1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

0027974: Visualization, ray tracing - Improve ray tracing engine

* Multiple importance sampling for path tracing
* Improved light sources sampling (better handling several light sources)
* Fixed issues in light source intersection (light distance is taken into account)
* Add new TCL sample - OCCT Ball model for demonstrating physically-based materials
* Fix potential issue on NVIDIA GPUs ("Error: Failed to upload light source buffer")
* Path tracing materials reviewed; directional light source was smoother by default
This commit is contained in:
dbp
2016-10-20 12:10:47 +03:00
committed by apn
parent 0d0481c787
commit 6e728f3b5c
19 changed files with 2186 additions and 747 deletions

View File

@@ -146,7 +146,9 @@ static const char Shaders_RaytraceBase_fs[] =
"#define AXIS_Y vec3 (0.0f, 1.0f, 0.0f)\n"
"#define AXIS_Z vec3 (0.0f, 0.0f, 1.0f)\n"
"\n"
"#define M_PI 3.14159265f\n"
"#define M_PI 3.141592653f\n"
"#define M_2_PI 6.283185307f\n"
"#define M_PI_2 1.570796327f\n"
"\n"
"#define LUMA vec3 (0.2126f, 0.7152f, 0.0722f)\n"
"\n"
@@ -838,8 +840,8 @@ static const char Shaders_RaytraceBase_fs[] =
"// =======================================================================\n"
"vec4 FetchEnvironment (in vec2 theTexCoord)\n"
"{\n"
" return mix (vec4 (0.0f, 0.0f, 0.0f, 1.0f),\n"
" textureLod (uEnvironmentMapTexture, theTexCoord, 0.0f), float (uSphereMapEnabled));\n"
" return uSphereMapEnabled == 0 ?\n"
" vec4 (0.f, 0.f, 0.f, 1.f) : textureLod (uEnvironmentMapTexture, theTexCoord, 0.f);\n"
"}\n"
"\n"
"// =======================================================================\n"
@@ -1023,8 +1025,8 @@ static const char Shaders_RaytraceBase_fs[] =
"\n"
" if (aVisibility > 0.0f)\n"
" {\n"
" vec3 aIntensity = vec3 (texelFetch (\n"
" uRaytraceLightSrcTexture, LIGHT_PWR (aLightIdx)));\n"
" vec3 aIntensity = min (UNIT, vec3 (texelFetch (\n"
" uRaytraceLightSrcTexture, LIGHT_PWR (aLightIdx))));\n"
"\n"
" float aRdotV = dot (reflect (aLight.xyz, aSidedNormal), theRay.Direct);\n"
"\n"