" 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"