View Issue Details

IDProjectCategoryView StatusLast Update
0024250Open CASCADEOCCT:Visualizationpublic2014-03-05 10:28
ReporterdbpAssigned Tobugmaster  
PrioritynormalSeverityfeature 
Status closedResolutionfixed 
PlatformAOSL 
Target Version6.7.0Fixed in Version6.7.0 
Summary0024250: TKOpenGl - per-pixel lighting using GLSL program (Phong shading)
DescriptionImplementing OpenGL/GLSL vertex and fragment shaders to enable per-pixel lighting (Phong shading).
Additional information
and documentation updates
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).
TagsNo tags attached.
Test case numberv3d glsl(013) phong_box, phong_couple, phong_fuse, phong_views

Attached Files

  • Comparison.png (115,670 bytes)
  • cameras_2views.png (85,186 bytes)

Relationships

related to 0021753 resolvedmzernova Open CASCADE Visualization - improve shaded display of conical objects 
related to 0024309 closedabv Open CASCADE TKOpenGl - Shader resources should be released with delay 
related to 0024310 closedabv Open CASCADE TKOpenGl - GLSL compatibility issues 
related to 0024323 closedapn Open CASCADE TKOpenGl - spot light sources are not handled in Phong GLSL program 
related to 0024345 closedbugmaster Open CASCADE TKOpenGl - GLSL compatibility issues on NV40 (GeForce 6xxx/7xxx) 
related to 0024322 closedbugmaster Open CASCADE TKOpenGl - light sources management inconsistency 
related to 0024687 closedbugmaster Open CASCADE TKOpenGl shader programs - same view state for different v3d views 

Activities

dbp

2013-10-11 11:26

developer  

Comparison.png (115,670 bytes)

dbp

2013-10-11 11:30

developer   ~0026042

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.

abv

2013-10-11 11:53

manager   ~0026043

Please check case of incomplete cone (see issue 0021753)

dbp

2013-10-28 15:43

developer   ~0026304

Dear kgv,

the normal-interpolation shaders were implemented.

Please review the branch CR24250.

kgv

2013-10-30 08:49

developer  

cameras_2views.png (85,186 bytes)

dbp

2013-10-30 16:31

developer   ~0026370

Dear Bugmaster,

please test the patch (branch CR24250_1).

kgv

2013-10-31 11:25

developer   ~0026388

Dear Bugmaster,

please notice that new grid "glsl" has been added to "v3d" tests group.

mkv

2013-11-01 11:33

tester   ~0026416

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.

kgv

2013-11-01 11:47

developer   ~0026417

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.

kgv

2013-11-01 13:41

developer   ~0026420

Branch CR24250_2 is patch against current IR.

Related Changesets

occt: master 392ac980

2013-11-01 09:52:19

kgv


Committer: bugmaster Details Diff
0024250: TKOpenGl - per-pixel lighting using GLSL program (Phong shading) Affected Issues
0024250
mod - src/Graphic3d/Graphic3d_ShaderProgram.cxx Diff File
mod - src/Graphic3d/Graphic3d_ShaderProgram.hxx Diff File
mod - src/Graphic3d/Graphic3d_TextureRoot.cxx Diff File
mod - src/OpenGl/OpenGl_AspectFace.cxx Diff File
mod - src/OpenGl/OpenGl_AspectLine.cxx Diff File
mod - src/OpenGl/OpenGl_AspectMarker.cxx Diff File
mod - src/OpenGl/OpenGl_AspectText.cxx Diff File
mod - src/OpenGl/OpenGl_CappingAlgo.cxx Diff File
mod - src/OpenGl/OpenGl_Caps.cxx Diff File
mod - src/OpenGl/OpenGl_Caps.hxx Diff File
mod - src/OpenGl/OpenGl_Context.cxx Diff File
mod - src/OpenGl/OpenGl_GraphicDriver.hxx Diff File
mod - src/OpenGl/OpenGl_GraphicDriver_7.cxx Diff File
mod - src/OpenGl/OpenGl_ShaderManager.cxx Diff File
mod - src/OpenGl/OpenGl_ShaderManager.hxx Diff File
mod - src/OpenGl/OpenGl_ShaderProgram.cxx Diff File
mod - src/OpenGl/OpenGl_ShaderProgram.hxx Diff File
mod - src/OpenGl/OpenGl_View.cxx Diff File
mod - src/OpenGl/OpenGl_View.hxx Diff File
mod - src/OpenGl/OpenGl_View_2.cxx Diff File
mod - src/OpenGl/OpenGl_Workspace_5.cxx Diff File
add - src/Shaders/PhongShading.fs Diff File
add - src/Shaders/PhongShading.vs Diff File
mod - src/ViewerTest/ViewerTest.cxx Diff File
mod - src/ViewerTest/ViewerTest_OpenGlCommands.cxx Diff File
mod - src/ViewerTest/ViewerTest_ViewerCommands.cxx Diff File
mod - tests/v3d/begin Diff File
mod - tests/v3d/end Diff File
add - tests/v3d/glsl/phong_box Diff File
add - tests/v3d/glsl/phong_couple Diff File
add - tests/v3d/glsl/phong_fuse Diff File
add - tests/v3d/glsl/phong_views Diff File
mod - tests/v3d/grids.list Diff File

Issue History

Date Modified Username Field Change
2013-10-10 19:42 dbp New Issue
2013-10-10 19:42 dbp Assigned To => san
2013-10-11 08:32 abv Relationship added related to 0021753
2013-10-11 11:26 dbp File Added: Comparison.png
2013-10-11 11:30 dbp Note Added: 0026042
2013-10-11 11:53 abv Note Added: 0026043
2013-10-11 16:17 san Assigned To san => dbp
2013-10-11 16:17 san Status new => assigned
2013-10-28 15:43 dbp Note Added: 0026304
2013-10-28 15:43 dbp Assigned To dbp => kgv
2013-10-28 15:43 dbp Status assigned => resolved
2013-10-28 16:18 dbp Steps to Reproduce Updated
2013-10-28 16:18 dbp Additional Information Updated
2013-10-29 07:17 kgv Reproducibility have not tried => N/A
2013-10-29 07:17 kgv Summary Implementing vertex and fragment shaders to enable per-pixel lighting (Phong shading) => TKOpenGl - per-pixel lighting using GLSL program (Phong shading)
2013-10-29 07:17 kgv Steps to Reproduce Updated
2013-10-30 08:49 kgv File Added: cameras_2views.png
2013-10-30 16:31 dbp Note Added: 0026370
2013-10-30 16:31 dbp Assigned To kgv => bugmaster
2013-10-30 16:31 dbp Status resolved => reviewed
2013-10-30 21:33 kgv Additional Information Updated
2013-10-31 08:13 mkv Assigned To bugmaster => mkv
2013-10-31 11:25 kgv Note Added: 0026388
2013-11-01 11:33 mkv Note Added: 0026416
2013-11-01 11:34 mkv Test case number => v3d glsl(013) phong_box, phong_couple, phong_fuse, phong_views
2013-11-01 11:34 mkv Assigned To mkv => dbp
2013-11-01 11:34 mkv Status reviewed => assigned
2013-11-01 11:47 kgv Note Added: 0026417
2013-11-01 11:47 kgv Assigned To dbp => bugmaster
2013-11-01 11:47 kgv Status assigned => feedback
2013-11-01 13:40 mkv Status feedback => tested
2013-11-01 13:41 kgv Note Added: 0026420
2013-11-01 21:28 kgv Relationship added related to 0024309
2013-11-02 16:38 kgv Relationship added related to 0024310
2013-11-06 11:07 bugmaster Changeset attached => occt master 392ac980
2013-11-06 11:07 bugmaster Status tested => verified
2013-11-06 11:07 bugmaster Resolution open => fixed
2013-11-06 11:20 bugmaster Target Version => 6.7.0
2013-11-06 17:18 kgv Relationship added related to 0024323
2013-11-11 20:37 kgv Relationship added related to 0024345
2013-11-13 20:35 kgv Relationship added related to 0024322
2013-12-19 13:51 bugmaster Status verified => closed
2013-12-19 13:59 bugmaster Fixed in Version => 6.7.0
2014-03-05 10:28 apl Relationship added related to 0024687