MantisBT - Open CASCADE
View Issue Details
0031099Open CASCADE[OCCT] OCCT:Visualizationpublic2019-10-23 12:302020-04-02 09:39
kgv 
bugmaster 
normalfeature 
verifiedfixed 
 
[OCCT] 7.5.0 
v3d/glsl/pbr_attenuation
0031099: Visualization, TKOpenGl - support Point light source with artistic full cut-off distance
Current 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.
v3d glsl pbr_attenuation
No tags attached.
child of 0030700verified apn Open CASCADE Visualization, TKOpenGl - support PBR Metallic-Roughness shading model 
png pbr_attenuation_angle_attenuation.png (44,215) 2020-01-10 14:02
https://tracker.dev.opencascade.org/
png pbr_attenuation_norange_high.png (34,359) 2020-01-10 14:02
https://tracker.dev.opencascade.org/
png pbr_attenuation_norange_low.png (37,124) 2020-01-10 14:02
https://tracker.dev.opencascade.org/
png pbr_attenuation_range0_6.png (7,223) 2020-01-10 14:03
https://tracker.dev.opencascade.org/
png pbr_attenuation_range1.png (20,485) 2020-01-10 14:03
https://tracker.dev.opencascade.org/
Issue History
2019-10-23 12:30kgvNew Issue
2019-10-23 12:30kgvAssigned To => iko
2019-10-23 12:30kgvRelationship addedchild of 0030700
2019-10-23 12:30kgvRelationship addedrelated to 0029298
2019-12-25 23:07kgvStatusnew => assigned
2019-12-27 17:46gitNote Added: 0089793
2020-01-09 16:08gitNote Added: 0089844
2020-01-09 18:01ikoNote Added: 0089847
2020-01-09 18:01ikoAssigned Toiko => kgv
2020-01-09 18:01ikoStatusassigned => resolved
2020-01-09 18:01ikoSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=22425#r22425
2020-01-09 20:50kgvNote Added: 0089849
2020-01-09 20:51kgvAssigned Tokgv => iko
2020-01-09 20:51kgvStatusresolved => assigned
2020-01-10 12:31gitNote Added: 0089850
2020-01-10 14:02ikoFile Added: pbr_attenuation_angle_attenuation.png
2020-01-10 14:02ikoFile Added: pbr_attenuation_norange_high.png
2020-01-10 14:02ikoFile Added: pbr_attenuation_norange_low.png
2020-01-10 14:03ikoFile Added: pbr_attenuation_range0_6.png
2020-01-10 14:03ikoFile Added: pbr_attenuation_range1.png
2020-01-10 14:07ikoNote Added: 0089852
2020-01-10 14:07ikoAssigned Toiko => kgv
2020-01-10 14:07ikoStatusassigned => resolved
2020-01-10 14:08ikoNote Added: 0089853
2020-01-10 14:16kgvAssigned Tokgv => bugmaster
2020-01-10 14:16kgvStatusresolved => reviewed
2020-01-13 16:06bugmasterTest case number => v3d/glsl/pbr_attenuation
2020-01-13 16:08bugmasterNote Added: 0089876
2020-01-13 16:11bugmasterStatusreviewed => tested
2020-01-18 12:27bugmasterChangeset attached => occt master 88b312d3
2020-01-18 12:27bugmasterStatustested => verified
2020-01-18 12:27bugmasterResolutionopen => fixed
2020-01-18 15:36gitNote Added: 0089948
2020-04-02 09:39kgvRelationship addedrelated to 0031482

Notes
(0089793)
git   
2019-12-27 17:46   
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
(0089844)
git   
2020-01-09 16:08   
Branch CR31099 has been updated forcibly by iko.

SHA-1: 63b058b8682b3f7f9a8ebd9007ebe705ba41e123
(0089847)
iko   
2020-01-09 18:01   
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/ [^]
(0089849)
kgv   
2020-01-09 20:50   
+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 }
(0089850)
git   
2020-01-10 12:31   
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
(0089852)
iko   
2020-01-10 14:07   
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/ [^]
(0089853)
iko   
2020-01-10 14:08   
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/ [^]
(0089876)
bugmaster   
2020-01-13 16:08   
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
(0089948)
git   
2020-01-18 15:36   
Branch CR31099 has been deleted by inv.

SHA-1: 6251c209e2544238b639b2780f36017434f53031