1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0030476: Visualization, Path Tracing - Adaptive Screen Sampling leads to unstable results

OpenGl_View::runPathtrace() has been extended with alternative multi-pass
Adaptive Screen Sampling mode, not relying on atomic floating point operations.
Although atomic operations on floats allows single-pass rendering,
such operations leads to instability in case of different calculation order.
Atomic float operations are also currently supported only by single GPU vendor.

Fixed GLSL compilation on Intel drivers (follow ARB_shader_image_load_store
specs rather than EXT_shader_image_load_store).

Graphic3d_RenderingParams::AdaptiveScreenSamplingAtomic option has been added
to activate 1-pass Adaptive Screen Sampling mode when supported by hardware.

vfps command has been extended with -duration argument allowing to limit command execution time.
vactivate command has been extended with -noUpdate argument.
This commit is contained in:
kgv
2019-02-11 18:00:35 +03:00
committed by apn
parent 66d1cdc65d
commit e084dbbc20
18 changed files with 488 additions and 147 deletions

View File

@@ -3,6 +3,8 @@
static const char Shaders_RaytraceBase_fs[] =
"#ifdef ADAPTIVE_SAMPLING\n"
" #extension GL_ARB_shader_image_load_store : require\n"
"#endif\n"
"#ifdef ADAPTIVE_SAMPLING_ATOMIC\n"
" #extension GL_NV_shader_atomic_float : require\n"
"#endif\n"
"\n"
@@ -100,10 +102,15 @@ static const char Shaders_RaytraceBase_fs[] =
"\n"
"#ifdef ADAPTIVE_SAMPLING\n"
" //! OpenGL image used for accumulating rendering result.\n"
" volatile restrict layout(size1x32) uniform image2D uRenderImage;\n"
" volatile restrict layout(r32f) uniform image2D uRenderImage;\n"
"\n"
"#ifdef ADAPTIVE_SAMPLING_ATOMIC\n"
" //! OpenGL image storing offsets of sampled pixels blocks.\n"
" coherent restrict layout(size2x32) uniform iimage2D uOffsetImage;\n"
" coherent restrict layout(rg32i) uniform iimage2D uOffsetImage;\n"
"#else\n"
" //! OpenGL image defining per-tile amount of samples.\n"
" volatile restrict layout(r32i) uniform iimage2D uTilesImage;\n"
"#endif\n"
"\n"
" //! Screen space tile size.\n"
" uniform ivec2 uTileSize;\n"
@@ -277,7 +284,7 @@ static const char Shaders_RaytraceBase_fs[] =
"//=======================================================================\n"
"vec4 BackgroundColor()\n"
"{\n"
"#ifdef ADAPTIVE_SAMPLING\n"
"#ifdef ADAPTIVE_SAMPLING_ATOMIC\n"
"\n"
" ivec2 aFragCoord = ivec2 (gl_FragCoord.xy);\n"
"\n"