MantisBT - Open CASCADE
View Issue Details
0024250Open CASCADE[OCCT] OCCT:Visualizationpublic2013-10-10 19:422014-03-05 10:28
dbp 
bugmaster 
normalfeature 
closedfixed 
ALL
 
[OCCT] 6.7.0[OCCT] 6.7.0 
v3d glsl(013) phong_box, phong_couple, phong_fuse, phong_views
0024250: TKOpenGl - per-pixel lighting using GLSL program (Phong shading)
Implementing OpenGL/GLSL vertex and fragment shaders to enable per-pixel lighting (Phong shading).
Phong shading (or normal-interpolation shading) overcomes some of the disadvantages of Gouraud shading implemented in the fixed OpenGL rendering pipeline. This technique performs per-fragment light calculations within GLSL program. At each fragment the interpolated surface normal is used to evaluate light intensity. Interpolation of normal allows highlights smaller than a polygon (see attached picture).

The normal-interpolation shaders are implemented as part of OCCT visualization core (see Graphic3d_ShaderProgram::ShaderName enumeration). To enable per-fragment lighting computations the following DRAW command can be used:

vshaderprog [name] phong

To enable normal-interpolation shading in your application, see the source code of VShaderProg function (in TKViewerTest toolkit).

New command vdefaults provide the way to control automatic triangulation parameters (deflection value and absolute/relative mode).
No tags attached.
related to 0021753feedback abv Open CASCADE Visualization - improve shaded display of conical objects 
related to 0024309closed abv Open CASCADE TKOpenGl - Shader resources should be released with delay 
related to 0024310closed abv Open CASCADE TKOpenGl - GLSL compatibility issues 
related to 0024323closed apn Open CASCADE TKOpenGl - spot light sources are not handled in Phong GLSL program 
related to 0024345closed bugmaster Open CASCADE TKOpenGl - GLSL compatibility issues on NV40 (GeForce 6xxx/7xxx) 
related to 0024322closed bugmaster Open CASCADE TKOpenGl - light sources management inconsistency 
related to 0024687closed bugmaster Open CASCADE TKOpenGl shader programs - same view state for different v3d views 
png Comparison.png (115,670) 2013-10-11 11:26
https://tracker.dev.opencascade.org/
png cameras_2views.png (85,186) 2013-10-30 08:49
https://tracker.dev.opencascade.org/
Issue History
2013-10-10 19:42dbpNew Issue
2013-10-10 19:42dbpAssigned To => san
2013-10-11 08:32abvRelationship addedrelated to 0021753
2013-10-11 11:26dbpFile Added: Comparison.png
2013-10-11 11:30dbpNote Added: 0026042
2013-10-11 11:53abvNote Added: 0026043
2013-10-11 16:17sanAssigned Tosan => dbp
2013-10-11 16:17sanStatusnew => assigned
2013-10-28 15:43dbpNote Added: 0026304
2013-10-28 15:43dbpAssigned Todbp => kgv
2013-10-28 15:43dbpStatusassigned => resolved
2013-10-28 16:18dbpSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=6112#r6112
2013-10-28 16:18dbpAdditional Information Updatedbug_revision_view_page.php?rev_id=6114#r6114
2013-10-29 07:17kgvReproducibilityhave not tried => N/A
2013-10-29 07:17kgvSummaryImplementing vertex and fragment shaders to enable per-pixel lighting (Phong shading) => TKOpenGl - per-pixel lighting using GLSL program (Phong shading)
2013-10-29 07:17kgvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=6119#r6119
2013-10-30 08:49kgvFile Added: cameras_2views.png
2013-10-30 16:31dbpNote Added: 0026370
2013-10-30 16:31dbpAssigned Tokgv => bugmaster
2013-10-30 16:31dbpStatusresolved => reviewed
2013-10-30 21:33kgvAdditional Information Updatedbug_revision_view_page.php?rev_id=6136#r6136
2013-10-31 08:13mkvAssigned Tobugmaster => mkv
2013-10-31 11:25kgvNote Added: 0026388
2013-11-01 11:33mkvNote Added: 0026416
2013-11-01 11:34mkvTest case number => v3d glsl(013) phong_box, phong_couple, phong_fuse, phong_views
2013-11-01 11:34mkvAssigned Tomkv => dbp
2013-11-01 11:34mkvStatusreviewed => assigned
2013-11-01 11:47kgvNote Added: 0026417
2013-11-01 11:47kgvAssigned Todbp => bugmaster
2013-11-01 11:47kgvStatusassigned => feedback
2013-11-01 13:40mkvStatusfeedback => tested
2013-11-01 13:41kgvNote Added: 0026420
2013-11-01 21:28kgvRelationship addedrelated to 0024309
2013-11-02 16:38kgvRelationship addedrelated to 0024310
2013-11-06 11:07bugmasterChangeset attached => occt master 392ac980
2013-11-06 11:07bugmasterStatustested => verified
2013-11-06 11:07bugmasterResolutionopen => fixed
2013-11-06 11:20bugmasterTarget Version => 6.7.0
2013-11-06 17:18kgvRelationship addedrelated to 0024323
2013-11-11 17:41kgvRelationship addedrelated to 0024344
2013-11-11 20:37kgvRelationship addedrelated to 0024345
2013-11-12 15:15kgvRelationship addedrelated to 0024348
2013-11-12 18:02kgvRelationship addedrelated to 0024350
2013-11-13 15:22kgvRelationship addedrelated to 0024354
2013-11-13 20:35kgvRelationship addedrelated to 0024322
2013-12-19 13:51bugmasterStatusverified => closed
2013-12-19 13:59bugmasterFixed in Version => 6.7.0
2014-03-05 10:28aplRelationship addedrelated to 0024687

Notes
(0026042)
dbp   
2013-10-11 11:30   
The comparison of Gouraud shading (supported in fixed-fucntion pipeline) and Phong shading is provided in attached image (Comparison.png). In general, the difference is more noticeable for surfaces with rought tesselatiion and/or high-glossy materials.
(0026043)
abv   
2013-10-11 11:53   
Please check case of incomplete cone (see issue 0021753)
(0026304)
dbp   
2013-10-28 15:43   
Dear kgv,

the normal-interpolation shaders were implemented.

Please review the branch CR24250.
(0026370)
dbp   
2013-10-30 16:31   
Dear Bugmaster,

please test the patch (branch CR24250_1).
(0026388)
kgv   
2013-10-31 11:25   
Dear Bugmaster,

please notice that new grid "glsl" has been added to "v3d" tests group.
(0026416)
mkv   
2013-11-01 11:33   
Dear BugMaster,

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

Number of compiler warnings:

occt component :
Linux: 321 (323 on master)
Windows: 0 (0 on master)

products component :
Linux: 189 (189 on master)
Windows: 287 (287 on master)

Regressions/Differences:
No regressions/differences

Testing cases:
(Bad images)

http://occt-tests/CR24250-1-master-occt/Debian60-64/v3d/glsl/phong_box.html [^]
http://occt-tests/CR24250-1-master-occt/Windows-32-VC9/v3d/glsl/phong_box.html [^]
v3d glsl(013) phong_box: OK

http://occt-tests/CR24250-1-master-occt/Debian60-64/v3d/glsl/phong_couple.html [^]
http://occt-tests/CR24250-1-master-occt/Windows-32-VC9/v3d/glsl/phong_couple.html [^]
v3d glsl(013) phong_couple: OK

http://occt-tests/CR24250-1-master-occt/Debian60-64/v3d/glsl/phong_fuse.html [^]
http://occt-tests/CR24250-1-master-occt/Windows-32-VC9/v3d/glsl/phong_fuse.html [^]
v3d glsl(013) phong_fuse: OK

http://occt-tests/CR24250-1-master-occt/Debian60-64/v3d/glsl/phong_views.html [^]
http://occt-tests/CR24250-1-master-occt/Windows-32-VC9/v3d/glsl/phong_views.html [^]
v3d glsl(013) phong_views: OK

Testing on Linux:
Total MEMORY difference: 355832428 / 356251104
Total CPU difference: 42672.17000000131 / 40566.35000000072

Testing on Windows:
Total MEMORY difference: 372223836 / 371127780
Total CPU difference: 24825.34375 / 28920.3125

There are not differences in images found by testdiff.
(0026417)
kgv   
2013-11-01 11:47   
Dear Bugmaster,

these bad images are most likely issues of currently used version of OpenGL Mesa on Windows. Please mark these as TODO for Windows workstation and integrate.
(0026420)
kgv   
2013-11-01 13:41   
Branch CR24250_2 is patch against current IR.