DiscussionsIssue archiveOCCT:Visualization

Archived issue #0031225

Visualization, TKOpenGl - support cubemap for environment texture within Ray-Tracing

Open CASCADEOCCT:Visualizationclosed30 public notes

Search issues

Description

Currently environment Cubemaps are supported only by PBR renderer.
It is desired supporting Cubemaps within Ray-Tracing engine as well (for IBL and as background).

Steps to reproduce

v3d/raytrace/pbr_spheres

Public activity

30 archived notes

Participants are labeled by their role within this record.

01Commenter 2
Branch [archived branch] has been created by Commenter 3.

[revision removed]


Detailed log of new commits:

Author: Commenter 3
Date: Fri Dec 13 11:55:50 2019 +0300

    0031225: Visualization, TKOpenGl - support cubemap for environment texture within Ray-Tracing
    
    Added supporting environment Cubemaps within Ray-Tracing engine for IBL and as background
02Commenter 2
Branch [archived branch] has been created by Commenter 3.

[revision removed]


Detailed log of new commits:

Author: Commenter 3
Date: Fri Dec 13 11:55:50 2019 +0300

    0031225: Visualization, TKOpenGl - support cubemap for environment texture within Ray-Tracing
    
    Added supporting environment Cubemaps within Ray-Tracing engine for IBL and as background

Author: Commenter 3
Date: Fri Dec 13 13:30:36 2019 +0300

    remarks from kgv
03Commenter 2
Branch [archived branch] has been updated forcibly by Commenter 3.

[revision removed]
04Commenter 3
The patch CR31225 is ready to review
05Author
-    if (theDepth + uSphereMapForBack == 0) // view ray and map is hidden
+    if (bool(uCubemapForBack))
+    {
+      aTotalRadiance = textureCube (uRaytraceCubemapTexture, cubemapVectorTransform (theRay.Direct, uYCoeff, uZCoeff)).rgb;
+    }
+    else if (theDepth + uSphereMapForBack == 0) // view ray and map is hidden

It is expected that FetchEnvironment() function will be updated instead.

+//! Environment cubemap texture.
+uniform samplerCube uRaytraceCubemapTexture;
...
//! Environment map texture.
uniform sampler2D uEnvironmentMapTexture;

Please use #ifdef for switching between CubeMap and Spherical panorama images instead of defining both of them at once.
Please use the same variable name with different sampler type (samplerCube / sampler2D) basing on macros.

06Commenter 2
Branch [archived branch] has been updated forcibly by Commenter 3.

[revision removed]
07Commenter 2
Branch [archived branch] has been updated forcibly by Commenter 3.

[revision removed]
08Commenter 3
09Commenter 3
The patch CR31225 is ready to review
10Commenter 2
Branch [archived branch] has been created by Commenter 3.

[revision removed]


Detailed log of new commits:

Author: Commenter 3
Date: Fri Dec 13 11:55:50 2019 +0300

    0031225: Visualization, TKOpenGl - support cubemap for environment texture within Ray-Tracing
    
    Added supporting environment Cubemaps within Ray-Tracing engine for IBL and as background
11Author
Test case is missing for the new feature.
New test can be based on v3d/glsl/pbr_spheres using vrenderparams -gi mode for the same scene (to be put into v3d/raytrace/pbr_spheres).

+//! Enables/disables cubemap background.
+uniform int uCubemapForBack;

New variable just duplicates existing uSphereMapEnabled.
Please use single variable.

+  if (myBackgroundType == Graphic3d_TOB_CUBEMAP)
+  {
+    aPrefixString += TCollection_AsciiString("\n#define BACKGROUND_CUBEMAP");
+  }

As this parameter requires GLSL program re-compilation, it should be tracked within OpenGl_View::initRaytraceResources() to set aToRebuildShaders on change:
> if (myRenderParams.ToneMappingMethod != myRaytraceParameters.ToneMappingMethod)
> {
> myRaytraceParameters.ToneMappingMethod = myRenderParams.ToneMappingMethod;
> aToRebuildShaders = true;
> }
12Commenter 2
Branch [archived branch] has been updated forcibly by Commenter 3.

[revision removed]
13Commenter 2
Branch [archived branch] has been updated forcibly by Commenter 3.

[revision removed]
14Commenter 2
Branch [archived branch] has been updated forcibly by Commenter 3.

[revision removed]
15Commenter 3
The patch CR31225 is ready to review
16Commenter 2
Branch [archived branch] has been updated by Commenter 3.

[revision removed]


Detailed log of new commits:

Author: Commenter 3
Date: Tue Dec 24 15:39:55 2019 +0300

    replaced textureCube() with texture()

17Commenter 2
Branch [archived branch] has been updated forcibly by Commenter 3.

[revision removed]
18Commenter 2
Branch [archived branch] has been updated forcibly by Commenter 3.

[revision removed]
19Commenter 2
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: Commenter 3
Date: Fri Dec 13 11:55:50 2019 +0300

    0031225: Visualization, TKOpenGl - support cubemap for environment texture within Ray-Tracing
    
    Ray-Tracing now handles IBL and background cubemaps in similar way as PBR.
    Ambient light source is handled by Ray-Tracing in similar way as PBR,
    e.g. as coefficient for environment map (IBL) or as constant light source.
    
    Test script generating PBR spheres has been moved to Samples
    and now shared by PBR and Path-Tracing tests.
20Author
Remarks have been pushed to CR31225_3.
21Commenter 2
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
22Commenter 2
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
23Commenter 2
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
24Commenter 2
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
25Author
texture() from cubemap within FetchEnvironment() produced visual artifacts (visible boundaries of cube), so that it was replaced by textureLod(), which was already used for texture lookup from sphere.
26Author
27Commenter 2
Branch [archived branch] has been deleted by Participant.

[revision removed]
28Commenter 2
Branch [archived branch] has been deleted by Participant.

[revision removed]
29Commenter 2
Branch [archived branch] has been deleted by Participant.

[revision removed]
30Commenter 2
Branch [archived branch] has been deleted by Participant.

[revision removed]

Related records