Compositor Techniques

From Multiverse

Jump to: navigation, search

Contents

Overview

A compositor technique is much like a material technique in that it describes one approach to achieving the effect you're looking for. A compositor definition can have more than one technique if you wish to provide some fallback should the hardware not support the technique you'd prefer to use.

Hardware support

Techniques are evaluated for hardware support based on two things:

  • Material support: All passes that render a fullscreen quad use a material; for the technique to be supported, all of the materials referenced must have at least one supported material technique. If they don't, the compositor technique is marked as unsupported and won't be used.
  • Texture format support: This one is slightly more complicated. When you request a texture in your technique, you request a pixel format. Not all formats are natively supported by hardware, especially the floating point formats. However, in this case the hardware will typically downgrade the texture format requested to one that the hardware does support - with compositor effects though, you might want to use a different approach if this is the case. So, when evaluating techniques, the compositor will first look for native support for the exact pixel format you've asked for, and will skip onto the next technique if it is not supported, thus allowing you to define other techniques with simpler pixel formats which use a different approach. If it doesn't find any techniques which are natively supported, it tries again, this time allowing the hardware to downgrade the texture format and thus should find at least some support for what you've asked for.

Syntax

As with material techniques, compositor techniques are evaluated in the order you define them in the script, so techniques declared first are preferred over those declared later.

Format:

technique { }

Techniques can have the following nested elements:

  • texture
  • target
  • target_output

texture

This declares a render texture for use in subsequent target passes.

Format:

texture Name Width Height Pixel Format

The following table describes the parameters:

Parameter Description
Name Name to give the render texture, which must be unique within this compositor. This name is used to reference the texture in target passes, when the texture is rendered to, and in passes, when the texture is used as input to a material rendering a fullscreen quad.
Width, Height Dimensions of the render texture. You can either specify a fixed width and height, or you can request that the texture matches the physical dimensions of the viewport to which the compositor is attached (specify target_width and target_height instead of numerical dimensions).
Pixel Format Pixel format of the render texture. This affects how much memory it will take, what colour channels will be available, and what precision you will have within those channels. Valid formats are:
  • PF_A8R8G8B8
  • PF_R8G8B8A8
  • PF_R8G8B8
  • PF_FLOAT16_RGBA
  • PF_FLOAT16_RGB
  • PF_FLOAT16_R
  • PF_FLOAT32_RGBA
  • PF_FLOAT32_RGB
  • PF_FLOAT32_R.

Examples:

texture rt0 512 512 PF_R8G8B8A8
texture rt1 target_width target_height PF_FLOAT32_RGB

This document is based on the OGRE Manual and is licensed under the Creative Commons Attribution-ShareAlike 2.5 License.

Personal tools