mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0029517: Visualization - introduce AlphaMode property defining alpha value handling options
This commit is contained in:
@@ -168,6 +168,7 @@ uniform float occPointSize; //!< point size
|
||||
//! Parameters of blended order-independent transparency rendering algorithm
|
||||
uniform int occOitOutput; //!< Enable bit for writing output color buffers for OIT (occFragColor, occFragCoverage)
|
||||
uniform float occOitDepthFactor; //!< Influence of the depth component to the coverage of the accumulated fragment
|
||||
uniform float occAlphaCutoff; //!< alpha test cutoff value
|
||||
|
||||
//! Parameters of clipping planes
|
||||
#if defined(THE_MAX_CLIP_PLANES) && (THE_MAX_CLIP_PLANES > 0)
|
||||
|
@@ -16,18 +16,20 @@
|
||||
// This file includes implementation of common functions and properties accessors
|
||||
|
||||
#if defined(FRAGMENT_SHADER)
|
||||
#if defined(OCC_WRITE_WEIGHT_OIT_COVERAGE)
|
||||
//! Output color and coverage for accumulation by OIT algorithm.
|
||||
//! Output color (and coverage for accumulation by OIT algorithm).
|
||||
void occSetFragColor (in vec4 theColor)
|
||||
{
|
||||
#if defined(OCC_ALPHA_TEST)
|
||||
if (theColor.a < occAlphaCutoff) discard;
|
||||
#endif
|
||||
#if defined(OCC_WRITE_WEIGHT_OIT_COVERAGE)
|
||||
float aWeight = theColor.a * clamp (1e+2 * pow (1.0 - gl_FragCoord.z * occOitDepthFactor, 3.0), 1e-2, 1e+2);
|
||||
occFragCoverage.r = theColor.a * aWeight;
|
||||
occFragColor = vec4 (theColor.rgb * theColor.a * aWeight, theColor.a);
|
||||
}
|
||||
#else
|
||||
//! Output color.
|
||||
void occSetFragColor (in vec4 theColor) { occFragColor = theColor; }
|
||||
occFragColor = theColor;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(THE_MAX_LIGHTS) && (THE_MAX_LIGHTS > 0)
|
||||
|
@@ -19,18 +19,20 @@ static const char Shaders_DeclarationsImpl_glsl[] =
|
||||
"// This file includes implementation of common functions and properties accessors\n"
|
||||
"\n"
|
||||
"#if defined(FRAGMENT_SHADER)\n"
|
||||
"#if defined(OCC_WRITE_WEIGHT_OIT_COVERAGE)\n"
|
||||
"//! Output color and coverage for accumulation by OIT algorithm.\n"
|
||||
"//! Output color (and coverage for accumulation by OIT algorithm).\n"
|
||||
"void occSetFragColor (in vec4 theColor)\n"
|
||||
"{\n"
|
||||
"#if defined(OCC_ALPHA_TEST)\n"
|
||||
" if (theColor.a < occAlphaCutoff) discard;\n"
|
||||
"#endif\n"
|
||||
"#if defined(OCC_WRITE_WEIGHT_OIT_COVERAGE)\n"
|
||||
" float aWeight = theColor.a * clamp (1e+2 * pow (1.0 - gl_FragCoord.z * occOitDepthFactor, 3.0), 1e-2, 1e+2);\n"
|
||||
" occFragCoverage.r = theColor.a * aWeight;\n"
|
||||
" occFragColor = vec4 (theColor.rgb * theColor.a * aWeight, theColor.a);\n"
|
||||
"}\n"
|
||||
"#else\n"
|
||||
"//! Output color.\n"
|
||||
"void occSetFragColor (in vec4 theColor) { occFragColor = theColor; }\n"
|
||||
" occFragColor = theColor;\n"
|
||||
"#endif\n"
|
||||
"}\n"
|
||||
"#endif\n"
|
||||
"\n"
|
||||
"#if defined(THE_MAX_LIGHTS) && (THE_MAX_LIGHTS > 0)\n"
|
||||
|
@@ -171,6 +171,7 @@ static const char Shaders_Declarations_glsl[] =
|
||||
"//! Parameters of blended order-independent transparency rendering algorithm\n"
|
||||
"uniform int occOitOutput; //!< Enable bit for writing output color buffers for OIT (occFragColor, occFragCoverage)\n"
|
||||
"uniform float occOitDepthFactor; //!< Influence of the depth component to the coverage of the accumulated fragment\n"
|
||||
"uniform float occAlphaCutoff; //!< alpha test cutoff value\n"
|
||||
"\n"
|
||||
"//! Parameters of clipping planes\n"
|
||||
"#if defined(THE_MAX_CLIP_PLANES) && (THE_MAX_CLIP_PLANES > 0)\n"
|
||||
|
Reference in New Issue
Block a user