View Issue Details

IDProjectCategoryView StatusLast Update
0024323Open CASCADEOCCT:Visualizationpublic2014-11-11 12:51
Reporterkgv Assigned Toapn  
PrioritylowSeverityminor 
Status closedResolutionfixed 
PlatformAOSL 
Product Version6.7.0 
Target Version6.8.0Fixed in Version6.8.0 
Summary0024323: TKOpenGl - spot light sources are not handled in Phong GLSL program
DescriptionCurrent implementation ignores Spot light sources which leads to incorrect presentation when such sources defined in 3D View.
else if (light.Type == occSpotLight)
{
  /* Not implemented */
}
TagsNo tags attached.
Test case numberNot needed

Relationships

related to 0024322 closedbugmaster TKOpenGl - light sources management inconsistency 
related to 0024250 closedbugmaster TKOpenGl - per-pixel lighting using GLSL program (Phong shading) 
related to 0024402 closedapn TKOpenGl - Implement clipping planes in Phong GLSL program 

Activities

duv

2013-11-25 17:58

developer   ~0026896

Dear kgv,

Please review current implementation of spot light sources with shaders.

kgv

2013-11-26 09:16

developer   ~0026901

Further complication of the shader program with optional paths might significantly affect performance on old hardware without real support of conditionals.

If we want to support such hardware, then additional mechanism should be implemented to disable rarely used parts (limit number of light sources, disable spot lights, no clipping planes) by linking the same GLSL program with special macros.

kgv

2013-11-26 15:15

developer   ~0026919

There are several options available for optimization (as result of discussion):
- Implement code generation for known shader programs to completely avoid unnecessary branching (replace for loop through light sources with "pointLight(0);directLight(1);directLight(2);spotLight(3);")
- Provide GLSL macros to disable arbitrary functionality known to be rarely used (spot lights, clipping planes, limit number of light sources with macros instead of uniform).
- Implement features list at Graphic3d level for shader program definition (shader supports or not clipping etc.).

To avoid GLSL program re-compilation, management of the same program compiled with different flags might be implemented.

Optimization task should be postponed until 0024402 clipping planes support implementation which affects this question more extensively.

kgv

2014-02-12 14:58

developer   ~0027857

As discussed with san, compatibility with old hardware (before '2006 for main GPU market) does not worth the time and extra complications.

Updated patch in CR24323_2 has been tested on RadeOn/GeForce/Intel GPUs and only Intel graphics has shown noticeable performance slow-down in stress test with 2 standard lights (GeForce has dropped performance in case of 8 lights):
FFP
FPS: 78.651699407278869
CPU: 0.15600100000000117 msec

Phong GLSL without spot light code
FPS: 8.9989368242780294
CPU: 0.46800300000000128 msec

Phong GLSL with (unused) spot light code
FPS: 6.193807223956898
CPU: 0.15600100000000117 msec


The following script might be used to simulate fragment-intensive computations (generates simple geometry which is drawn in contra optimal order):
pload MODELING VISUALIZATION
vinit View1 w=512 h=512
vclear
vtop
compound c
for {set i 0} {$i < 100} {incr i} { box b$i 0 0 $i 1 1 1; add b$i c }
vsetdispmode 1
vdisplay c
vfit
vfps
vshaderprog phong
vfps

mkv

2014-02-13 11:55

tester   ~0027878

Dear BugMaster,

Branch CR24323_2 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
SHA-1: b7caa4b3a6e82838820ac6a253121b0e66a4dcf3

Number of compiler warnings:

occt component :
Linux: 40 (40 on master)
Windows: 0 (0 on master)

products component :
Linux: 12 (12 on master)
Windows: 2 (2 on master)

Regressions/Differences:
No regressions/differences

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 380970524 / 381807740
Total CPU difference: 43669.28999999989 / 42213.479999999996

Testing on Windows:
Total MEMORY difference: 428563944 / 431123492
Total CPU difference: 34326.453125 / 34130.65625

There are not differences in images found by testdiff.

Related Changesets

occt: master 816d03ee

2014-02-12 10:42:27

duv


Committer: apn Details Diff
0024323: TKOpenGl - spot light sources are not handled in Phong GLSL program

Limit number of lights (breaks compatibility with old hardware).
Affected Issues
0024323
mod - src/Shaders/PhongShading.fs Diff File
mod - src/ViewerTest/ViewerTest_ViewerCommands.cxx Diff File

Issue History

Date Modified Username Field Change
2013-11-06 17:17 kgv New Issue
2013-11-06 17:17 kgv Assigned To => dbp
2013-11-06 17:18 kgv Relationship added related to 0024322
2013-11-06 17:18 kgv Relationship added related to 0024250
2013-11-06 17:18 kgv Assigned To dbp => kgv
2013-11-06 17:19 kgv Assigned To kgv => duv
2013-11-06 17:19 kgv Status new => assigned
2013-11-06 17:34 kgv Summary TKOpenGl - spot light sources are not handled in Pong GLSL program => TKOpenGl - spot light sources are not handled in Phong GLSL program
2013-11-15 10:08 kgv Product Version => 6.7.0
2013-11-15 10:08 kgv Target Version 6.7.0 => 6.7.1
2013-11-25 17:58 duv Note Added: 0026896
2013-11-25 17:58 duv Assigned To duv => kgv
2013-11-25 17:58 duv Status assigned => resolved
2013-11-26 09:16 kgv Note Added: 0026901
2013-11-26 09:17 kgv Assigned To kgv => san
2013-11-26 09:17 kgv Status resolved => feedback
2013-11-26 14:20 duv Relationship added related to 0024402
2013-11-26 15:15 kgv Note Added: 0026919
2013-11-29 18:43 san Assigned To san => duv
2013-11-29 18:43 san Status feedback => assigned
2014-02-12 14:47 kgv Assigned To duv => kgv
2014-02-12 14:47 kgv Status assigned => resolved
2014-02-12 14:58 kgv Note Added: 0027857
2014-02-12 14:58 kgv Assigned To kgv => bugmaster
2014-02-12 14:58 kgv Status resolved => reviewed
2014-02-12 15:53 mkv Assigned To bugmaster => mkv
2014-02-13 11:55 mkv Note Added: 0027878
2014-02-13 11:56 mkv Test case number => Not needed
2014-02-13 11:56 mkv Assigned To mkv => bugmaster
2014-02-13 11:56 mkv Status reviewed => tested
2014-02-14 12:00 apn Changeset attached => occt master 816d03ee
2014-02-14 12:00 apn Assigned To bugmaster => apn
2014-02-14 12:00 apn Status tested => verified
2014-02-14 12:00 apn Resolution open => fixed
2014-04-04 12:36 abv Target Version 6.7.1 => 6.8.0
2014-11-11 12:47 aiv Fixed in Version => 6.8.0
2014-11-11 12:51 aiv Status verified => closed