OpacityΒΆ
Using opacity
The opacity is returned by the shader using the Opacity Output. The predefined shaders (Surface, Surface2, Hair and Curves) have different attributes to control the opacity.
Both the Surface and Surface2 shaders provide a simple
Mask attribute. See the
Both the Hair and Curves shader can control the opacity of the curve,
the opacity in shadows and the curve tip opacity.
See the
Optimizations
Objects in Guerilla can be semi-transparent. Guerilla can render their exact opacity, at the cost of rendering time, though Guerilla 2.0 now prevents rendering time to degenerate completely when using exact opacity.
Guerilla Render provides different opacity modes to improve the render time depending on the situation. The result is similar with the exact mode but the render time is much lower, close to the render time of an opaque rendering.
This opacity mode is controlled by the
Opacity Mode: Exact
This is the default mode: the opacity is evaluated using the shader at each ray intersection. This mode is the slowest one.
Use cases:
- sprites with an opacity texture and an opacity varying with the particle age or the particle id.
- any complex opacity setup.
Opacity Mode: Opaque
The opacity is forced to opaque. This mode is the fastest, and is suitable for opaque objects. Note that, in most cases, opaque objects will automatically fallback to this mode if opacity controls in shaders are left to the default value.
Opacity Mode: Constant
This mode assumes the opacity is constant on the object. This mode is fast to render and uses no extra memory. Note that, in most cases, constant opacity objects will automatically fallback to this mode if opacity is detected as constant (no texture is used, or is not dependent on st coordinates, for instance.)
Use cases:
- a simple thin glass with a constant opacity.
- fur with a constant opacity.
Opacity Mode: Vertex
This mode assumes the opacity is constant on every object vertices. This mode is fast to render. The opactiy is stored at every object vertices in memory.
Use cases:
- transparent fur/hair where the strands opacity are different.
- transparent surfaces with a low frequency transparency.
- particles with an opacity varying with the particle age or the particle id.
Opacity Mode: UV
For curve meshes only. This mode assumes the opacity is varying on the curves u and v parameters (as per width and length.) This mode is fast to render and uses almost no memory. The number of steps used to subdivide the u and v parameter is given by the Opacity Bake Resolution attribute.
Use case:
- transparent fur/hair where the opacity along the strand is the same for every strand.
- transparent fur/hair where the opacity is mapped using the curves implicit uv coordinates.
Opacity Mode: ST
For triangle meshes only. This mode assumes the opacity is varying on the surface st parameters and the st parameters to be between [0,1]. This mode is fast to render. The number of steps used to subdivide the st parameters is given by the Opacity Bake Resolution attribute.
Use case:
- surfaces with a simple opacity texture, like tree leaves.
- sprites with an opacity texture (not using the particle age or the particle id).