mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0027256: Visualization, Path Tracing - add support of alpha-channel of texture
Regenerate resource files.
This commit is contained in:
@@ -759,10 +759,16 @@ vec4 PathTrace (in SRay theRay, in vec3 theInverse)
|
||||
aTexCoord.st = vec2 (dot (aTrsfRow1, aTexCoord),
|
||||
dot (aTrsfRow2, aTexCoord));
|
||||
|
||||
vec3 aTexColor = textureLod (
|
||||
sampler2D (uTextureSamplers[int (aMaterial.Kd.w)]), aTexCoord.st, 0.f).rgb;
|
||||
vec4 aTexColor = textureLod (
|
||||
sampler2D (uTextureSamplers[int (aMaterial.Kd.w)]), aTexCoord.st, 0.f);
|
||||
|
||||
aMaterial.Kd.rgb *= aTexColor * aTexColor; // de-gamma correction (for gamma = 2)
|
||||
aMaterial.Kd.rgb *= (aTexColor.rgb, aTexColor.rgb) * aTexColor.w; // de-gamma correction (for gamma = 2)
|
||||
|
||||
if (aTexColor.w != 1.0f)
|
||||
{
|
||||
// mix transparency BTDF with texture alpha-channel
|
||||
aMaterial.Kt = (UNIT - aTexColor.www) + aTexColor.w * aMaterial.Kt;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -969,11 +969,14 @@ vec4 Radiance (in SRay theRay, in vec3 theInverse)
|
||||
aTexCoord.st = vec2 (dot (aTrsfRow1, aTexCoord),
|
||||
dot (aTrsfRow2, aTexCoord));
|
||||
|
||||
vec3 aTexColor = textureLod (
|
||||
sampler2D (uTextureSamplers[int(aDiffuse.w)]), aTexCoord.st, 0.f).rgb;
|
||||
vec4 aTexColor = textureLod (
|
||||
sampler2D (uTextureSamplers[int(aDiffuse.w)]), aTexCoord.st, 0.f);
|
||||
|
||||
aDiffuse.rgb *= aTexColor;
|
||||
aAmbient.rgb *= aTexColor;
|
||||
aDiffuse.rgb *= aTexColor.rgb;
|
||||
aAmbient.rgb *= aTexColor.rgb;
|
||||
|
||||
// keep refractive index untouched (Z component)
|
||||
aOpacity.xy = vec2 (aTexColor.w * aOpacity.x, 1.0f - aTexColor.w * aOpacity.x);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -762,10 +762,16 @@ static const char Shaders_PathtraceBase_fs[] =
|
||||
" aTexCoord.st = vec2 (dot (aTrsfRow1, aTexCoord),\n"
|
||||
" dot (aTrsfRow2, aTexCoord));\n"
|
||||
"\n"
|
||||
" vec3 aTexColor = textureLod (\n"
|
||||
" sampler2D (uTextureSamplers[int (aMaterial.Kd.w)]), aTexCoord.st, 0.f).rgb;\n"
|
||||
" vec4 aTexColor = textureLod (\n"
|
||||
" sampler2D (uTextureSamplers[int (aMaterial.Kd.w)]), aTexCoord.st, 0.f);\n"
|
||||
"\n"
|
||||
" aMaterial.Kd.rgb *= aTexColor * aTexColor; // de-gamma correction (for gamma = 2)\n"
|
||||
" aMaterial.Kd.rgb *= (aTexColor.rgb, aTexColor.rgb) * aTexColor.w; // de-gamma correction (for gamma = 2)\n"
|
||||
"\n"
|
||||
" if (aTexColor.w != 1.0f)\n"
|
||||
" {\n"
|
||||
" // mix transparency BTDF with texture alpha-channel\n"
|
||||
" aMaterial.Kt = (UNIT - aTexColor.www) + aTexColor.w * aMaterial.Kt;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"#endif\n"
|
||||
"\n"
|
||||
|
@@ -972,11 +972,14 @@ static const char Shaders_RaytraceBase_fs[] =
|
||||
" aTexCoord.st = vec2 (dot (aTrsfRow1, aTexCoord),\n"
|
||||
" dot (aTrsfRow2, aTexCoord));\n"
|
||||
"\n"
|
||||
" vec3 aTexColor = textureLod (\n"
|
||||
" sampler2D (uTextureSamplers[int(aDiffuse.w)]), aTexCoord.st, 0.f).rgb;\n"
|
||||
" vec4 aTexColor = textureLod (\n"
|
||||
" sampler2D (uTextureSamplers[int(aDiffuse.w)]), aTexCoord.st, 0.f);\n"
|
||||
"\n"
|
||||
" aDiffuse.rgb *= aTexColor;\n"
|
||||
" aAmbient.rgb *= aTexColor;\n"
|
||||
" aDiffuse.rgb *= aTexColor.rgb;\n"
|
||||
" aAmbient.rgb *= aTexColor.rgb;\n"
|
||||
"\n"
|
||||
" // keep refractive index untouched (Z component)\n"
|
||||
" aOpacity.xy = vec2 (aTexColor.w * aOpacity.x, 1.0f - aTexColor.w * aOpacity.x);\n"
|
||||
" }\n"
|
||||
"#endif\n"
|
||||
"\n"
|
||||
|
Reference in New Issue
Block a user