Regenerate resource files.
Graphic3d_NOT_2D_MARBLE,
Graphic3d_NOT_2D_MOTTLED,
Graphic3d_NOT_2D_RAIN,
+Graphic3d_NOT_2D_CHESS,
Graphic3d_NOT_2D_UNKNOWN
};
"2d_maple.rgb",
"2d_marble.rgb",
"2d_mottled.rgb",
- "2d_rain.rgb"
+ "2d_rain.rgb",
+ "2d_chess.rgba"
};
// =======================================================================
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
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
" 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"
" 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"
icon:::2d_mottled.rgb
icon:::2d_rain.rgb
icon:::2d_rock.rgb
+icon:::2d_chess.rgba
icon:::env_clouds.rgb
icon:::env_cv.rgb
icon:::env_lines.rgb
--- /dev/null
+puts "============"
+puts "Visualization - Path Tracing, Ball sample"
+puts "============"
+puts ""
+
+source $env(CSF_OCCTSamplesPath)/tcl/pathtrace_ball.tcl
+
+vtexture ball 21 -scale 0.1 0.1
+vsetmaterial ball plaster
+vbsdf ball -fresnel Constant 0.0
+
+vfps 100
+vdump $imagedir/${casename}_zoom.png