View Issue Details

IDProjectCategoryView StatusLast Update
0031099Open CASCADEOCCT:Visualizationpublic2020-12-02 17:12
Reporterkgv Assigned Tobugmaster  
PrioritynormalSeverityfeature 
Status closedResolutionfixed 
Target Version7.5.0Fixed in Version7.5.0 
Summary0031099: Visualization, TKOpenGl - support Point light source with artistic full cut-off distance
DescriptionCurrent implementation of Metallic-Roughness shading model considers infinite cut-off distance for Point light sources. While this is physically correct behavior, it disallows limiting light source distance for artistic or optimization purposes. Managing large number of light sources requires mechanisms filtering distance lights for performance reasons.
Steps To Reproducev3d glsl pbr_attenuation
TagsNo tags attached.
Test case numberv3d/glsl/pbr_attenuation

Attached Files

  • pbr_attenuation_angle_attenuation.png (44,215 bytes)
  • pbr_attenuation_norange_high.png (34,359 bytes)
  • pbr_attenuation_norange_low.png (37,124 bytes)
  • pbr_attenuation_range0_6.png (7,223 bytes)
  • pbr_attenuation_range1.png (20,485 bytes)

Relationships

child of 0030700 closedapn Open CASCADE Visualization, TKOpenGl - support PBR Metallic-Roughness shading model 

Activities

git

2019-12-27 17:46

administrator   ~0089793

Branch CR31099 has been created by iko.

SHA-1: 57adb8b2dfbf24b25adf12ef8ac300988c18aa38


Detailed log of new commits:

Author: iko
Date: Tue Dec 24 16:05:00 2019 +0300

    # work in progress

git

2020-01-09 16:08

administrator   ~0089844

Branch CR31099 has been updated forcibly by iko.

SHA-1: 63b058b8682b3f7f9a8ebd9007ebe705ba41e123

iko

2020-01-09 18:01

developer   ~0089847

Please review the implementation.

http://vm-jenkins-test-12.nnov.opencascade.com:8080/job/CR31099-master-IKO-OCCT-Windows-64-VC14-opt-test-compare/1/

http://vm-jenkins-test-12.nnov.opencascade.com:8080/job/CR31099-master-IKO-OCCT-Debian80-64-opt-test-compare/1/

kgv

2020-01-09 20:50

developer   ~0089849

+void Graphic3d_CLight::SetRange (Standard_ShortReal theValue)
+{
+  Standard_ProgramError_Raise_if (myType == Graphic3d_TOLS_AMBIENT || myType == Graphic3d_TOLS_DIRECTIONAL,

This check looks awkward - better reversing with a test for Graphic3d_TOLS_POSITIONAL/Graphic3d_TOLS_SPOT.

+  //! Returns maximum distance on which point light source affects to objects and is considered during illumination calculations.

Returns distance from which point light source (Graphic3d_TOLS_POSITIONAL/Graphic3d_TOLS_SPOT) has no effect

+  //! 0.0 means disabling range considering at all without any distance limits.

Default value is 0.0, which means no (infinite) range limit and corresponds to light behavior in real life.

+  //! Has sense only for point light sources (positional and spot).  

Just remove this sentence.

+  //! Returns direction of directional/spot light and range for positional/spot light in alpha channel.

Returns XYZ direction of directional/spot light and range for positional/spot light in W component.

+    theAttenuation = occPointLightAttenuation (theDistance, theRange);
+       return true;

Broken indentation.

@@ -153,10 +154,10 @@ const char THE_FUNC_PBR_pointLight[] =
   EOL"  aLight -= thePoint;"

Please implement also for pointLight().
When range is non-zero - linear and constant attenuation parameters can be ignored and quadratic attenuation can be used instead.

+#define occGetPointLightAttenuation(theDistance, theRange) float anAtten = 0.0; if (!occPointLightAttenuation(anAtten, theDistance, theRange)) return

The macros looks confusing - I would rather remove it at all.

+float occPointLightAttenuation(in float theDistance, in float theRange)

This method looks redundant - better moving code to second co-named method which is actually called.

+bool occPointLightAttenuation(out float theAttenuation, in float theDistance, in float theRange)

Returning -1.0 instead of FALSE would allow avoiding "out" argument.
> float anAtten = occPointLightAttenuation (aDist, aRange);
> if (anAtten < 0.0) { return; }

+for {set i 0} {$i < 5} {incr i} {
+    for {set j 0} {$j < 5} {incr j} {

Please use 2-spaces indentation for Tcl scripts (same as for C++).

\ No newline at end of file

It is better putting newline at the end of files.

+puts "Test of point light's (positional and spot) attenuation and range in PBR"

Please put also this bug Id into script description.

+pload XDE

pload XDE OCAF VISUALIZATION MODELING
catch { Close D }

git

2020-01-10 12:31

administrator   ~0089850

Branch CR31099 has been updated by iko.

SHA-1: 6251c209e2544238b639b2780f36017434f53031


Detailed log of new commits:

Author: iko
Date: Fri Jan 10 12:27:58 2020 +0300

    # fix remarks

iko

2020-01-10 14:02

developer  

pbr_attenuation_angle_attenuation.png (44,215 bytes)

iko

2020-01-10 14:02

developer  

pbr_attenuation_norange_high.png (34,359 bytes)

iko

2020-01-10 14:02

developer  

pbr_attenuation_norange_low.png (37,124 bytes)

iko

2020-01-10 14:03

developer  

pbr_attenuation_range0_6.png (7,223 bytes)

iko

2020-01-10 14:03

developer  

pbr_attenuation_range1.png (20,485 bytes)

iko

2020-01-10 14:07

developer   ~0089852

Please review the fixes.

http://vm-jenkins-test-12.nnov.opencascade.com:8080/job/CR31099-master-IKO-OCCT-Debian80-64-opt-test-compare/2/

http://vm-jenkins-test-12.nnov.opencascade.com:8080/job/CR31099-master-IKO-Products-Windows-64-VC14-opt-test-compare/2/

iko

2020-01-10 14:08

developer   ~0089853

http://vm-jenkins-test-12.nnov.opencascade.com:8080/job/CR31099-master-IKO-OCCT-Windows-64-VC14-opt-test-compare/2/

http://vm-jenkins-test-12.nnov.opencascade.com:8080/job/CR31099-master-IKO-Products-Debian80-64-opt-test-compare/2/

bugmaster

2020-01-13 16:08

administrator   ~0089876

Combination -
OCCT branch : CR31099
master SHA - 6251c209e2544238b639b2780f36017434f53031
fe4497f3246e6bc1ced97ac331c148f0809ded15
Products branch : master SHA - c0486f53f3cff19deed9ff7054f97a6871a50496
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 16998.05000000013 / 16989.810000000103 [+0.05%]
Products
Total CPU difference: 10732.720000000067 / 10741.020000000053 [-0.08%]
Windows-64-VC14:
OCCT
Total CPU difference: 18459.546875 / 18447.0625 [+0.07%]
Products
Total CPU difference: 12694.5625 / 12436.203125 [+2.08%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

git

2020-01-18 15:36

administrator   ~0089948

Branch CR31099 has been deleted by inv.

SHA-1: 6251c209e2544238b639b2780f36017434f53031

Related Changesets

occt: master 88b312d3

2019-12-24 13:05:00

iko


Committer: bugmaster Details Diff
0031099: Visualization, TKOpenGl - support Point light source with artistic full cut-off distance

"Range" parameter of point light sources (positional and spot) concidering in PBR has been added.
Angular attenuation parameter of spot light in PBR has been reimplemented based on existing "concentration" parameter.
Affected Issues
0031099
mod - src/Graphic3d/Graphic3d_CLight.cxx Diff File
mod - src/Graphic3d/Graphic3d_CLight.hxx Diff File
mod - src/OpenGl/OpenGl_ShaderManager.cxx Diff File
mod - src/OpenGl/OpenGl_ShaderManager.hxx Diff File
mod - src/OpenGl/OpenGl_View_Raytrace.cxx Diff File
mod - src/Shaders/Declarations.glsl Diff File
mod - src/Shaders/FILES Diff File
add - src/Shaders/PointLightAttenuation.glsl Diff File
mod - src/Shaders/Shaders_Declarations_glsl.pxx Diff File
add - src/Shaders/Shaders_PointLightAttenuation_glsl.pxx Diff File
mod - src/ViewerTest/ViewerTest_ViewerCommands.cxx Diff File
add - tests/v3d/glsl/pbr_attenuation Diff File

Issue History

Date Modified Username Field Change
2019-10-23 12:30 kgv New Issue
2019-10-23 12:30 kgv Assigned To => iko
2019-10-23 12:30 kgv Relationship added child of 0030700
2019-12-25 23:07 kgv Status new => assigned
2019-12-27 17:46 git Note Added: 0089793
2020-01-09 16:08 git Note Added: 0089844
2020-01-09 18:01 iko Note Added: 0089847
2020-01-09 18:01 iko Assigned To iko => kgv
2020-01-09 18:01 iko Status assigned => resolved
2020-01-09 18:01 iko Steps to Reproduce Updated
2020-01-09 20:50 kgv Note Added: 0089849
2020-01-09 20:51 kgv Assigned To kgv => iko
2020-01-09 20:51 kgv Status resolved => assigned
2020-01-10 12:31 git Note Added: 0089850
2020-01-10 14:02 iko File Added: pbr_attenuation_angle_attenuation.png
2020-01-10 14:02 iko File Added: pbr_attenuation_norange_high.png
2020-01-10 14:02 iko File Added: pbr_attenuation_norange_low.png
2020-01-10 14:03 iko File Added: pbr_attenuation_range0_6.png
2020-01-10 14:03 iko File Added: pbr_attenuation_range1.png
2020-01-10 14:07 iko Note Added: 0089852
2020-01-10 14:07 iko Assigned To iko => kgv
2020-01-10 14:07 iko Status assigned => resolved
2020-01-10 14:08 iko Note Added: 0089853
2020-01-10 14:16 kgv Assigned To kgv => bugmaster
2020-01-10 14:16 kgv Status resolved => reviewed
2020-01-13 16:06 bugmaster Test case number => v3d/glsl/pbr_attenuation
2020-01-13 16:08 bugmaster Note Added: 0089876
2020-01-13 16:11 bugmaster Status reviewed => tested
2020-01-18 12:27 bugmaster Changeset attached => occt master 88b312d3
2020-01-18 12:27 bugmaster Status tested => verified
2020-01-18 12:27 bugmaster Resolution open => fixed
2020-01-18 15:36 git Note Added: 0089948
2020-12-02 16:40 emo Fixed in Version => 7.5.0
2020-12-02 17:12 emo Status verified => closed