Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
Transparency Shader API

To properly handle transparency, your fragment shader should contains the following function calls: More...

Functions

bool OivDepthPeel (vec3 fragmentCoords)
 This method peels the current fragment.
 
void OivDepthPeelingOutputColor (vec4 color)
 When depth peeling is enabled, OivDepthPeelingOutputColor must be called instead of setting 'gl_FragColor' since some depth peeling techniques use MRTs (multiple render targets) or premultiply the color by the alpha value (on-the-fly blending for example).
 
void OivDepthPeelingOutputColor (vec4 color, vec3 coords)
 By default the depth generated by the rasterizer (gl_FragCoord.z) is used, but some algorithms may modify the depth in the fragment shader.
 

Detailed Description

To properly handle transparency, your fragment shader should contains the following function calls:

These methods are accessible by including the <Inventor/oivDepthPeeling_frag.h> header in your shader: Ex:

void main()
{
if ( OivDepthPeel(gl_FragCoord.xyz) )
{
Vec4 color = vec4(1, 0, 0, 0.5);
}
}
bool OivDepthPeel(vec3 fragmentCoords)
This method peels the current fragment.
void OivDepthPeelingOutputColor(vec4 color)
When depth peeling is enabled, OivDepthPeelingOutputColor must be called instead of setting 'gl_FragC...

Function Documentation

◆ OivDepthPeel()

bool OivDepthPeel ( vec3  fragmentCoords)

This method peels the current fragment.

If the fragment must be ignored, this method does the discard. The fragment coords must be in screen space (gl_FragCoord.xyz should always be used)

Returns true if the fragment should be shaded.

◆ OivDepthPeelingOutputColor() [1/2]

void OivDepthPeelingOutputColor ( vec4  color)

When depth peeling is enabled, OivDepthPeelingOutputColor must be called instead of setting 'gl_FragColor' since some depth peeling techniques use MRTs (multiple render targets) or premultiply the color by the alpha value (on-the-fly blending for example).

◆ OivDepthPeelingOutputColor() [2/2]

void OivDepthPeelingOutputColor ( vec4  color,
vec3  coords 
)

By default the depth generated by the rasterizer (gl_FragCoord.z) is used, but some algorithms may modify the depth in the fragment shader.

In these cases gl_FragCoord.z is not valid and the user-defined depth coordinate must be explicitly specified in the 'coords' parameter.