Archived issue #0028069
Visualization, TKOpenGl - handle flat shading model within GLSL programs
Description
The following shading models are not supported by built-in GLSL programs (in contrast to deprecated FFP):
- V3d_COLOR
- V3d_FLAT
The first one is almost useless and can be safely removed (the same effect can be achieved by removing all non-ambient light sources).
The second one can be achieved by application by duplicating vertices for each triangle with unique normal, requires more memory and recomputation of presentation. Therefore, support from GLSL programs can be useful here.
Unfortunately, the behavior similar to V3d_FLAT is not trivial to achieve - it requires Geometry Shader (also fake flat model can be simulated by flat normal interpolation - which will give the single normal for entire triangle, but this normal will be taken from one of the vertices, not for triangle itself).
Anyway, current mechanism of global shading model should be also revised / completed with per-object options, since it is rarely desired to use only Flat or only Phong shading model for all objects in the scene. This, however, might be implemented in dedicated patch.
- V3d_COLOR
- V3d_FLAT
The first one is almost useless and can be safely removed (the same effect can be achieved by removing all non-ambient light sources).
The second one can be achieved by application by duplicating vertices for each triangle with unique normal, requires more memory and recomputation of presentation. Therefore, support from GLSL programs can be useful here.
Unfortunately, the behavior similar to V3d_FLAT is not trivial to achieve - it requires Geometry Shader (also fake flat model can be simulated by flat normal interpolation - which will give the single normal for entire triangle, but this normal will be taken from one of the vertices, not for triangle itself).
Anyway, current mechanism of global shading model should be also revised / completed with per-object options, since it is rarely desired to use only Flat or only Phong shading model for all objects in the scene. This, however, might be implemented in dedicated patch.
Steps to reproduce
pload MODELING VISUALIZATION psphere s 10 vclear vinit View1 vdisplay -dispMode 1 s vfit puts "Deprecated FFP" vcaps -ffp 1 # OK vrenderparams -shadingModel color # OK vrenderparams -shadingModel flat # OK (default) vrenderparams -shadingModel vert # KO (expected) vrenderparams -shadingModel phong puts "GLSL programs" vcaps -ffp 0 # KO (unsupported) vrenderparams -shadingModel color # KO (unsupported) vrenderparams -shadingModel flat # OK (default) vrenderparams -shadingModel vert # OK vrenderparams -shadingModel phong
Public activity
8 archived notes
Participants are labeled by their role within this record.
Branch [archived branch] has been created by Author.
[revision removed]
Detailed log of new commits:
Author: Author
Date: Sun Sep 10 17:06:19 2017 +0300
0028069: Visualization, TKOpenGl - handle flat shading model within GLSL programs
[revision removed]
Detailed log of new commits:
Author: Author
Date: Sun Sep 10 17:06:19 2017 +0300
0028069: Visualization, TKOpenGl - handle flat shading model within GLSL programs
Branch [archived branch] has been updated forcibly by Author.
[revision removed]
[revision removed]
Patch is ready for review.
Branch CR28069 reviewed without remarks, ready for testing.
it is suggested to test it after new master for OCCT and Products has been ready.
And fix has been rebased on latter
And fix has been rebased on latter
Branch [archived branch] has been updated forcibly by Participant.
[revision removed]
[revision removed]
Combination -
OCCT branch : [archived branch] [revision removed]
Products branch : [archived branch]
was compiled on Linux, MacOS and Windows platforms and tested on optimize mode.
http://jenkins-test-10.nnov.opencascade.com/view/CR28069-master-KGV/
Number of compiler warnings:
No new/fixed warnings
Regressions/Differences/Improvements:
No regressions/differences
CPU differences:
No differences that require special attention
Image differences :
No differences that require special attention
Memory differences :
No differences that require special attention
New test cases are OK
OCCT branch : [archived branch] [revision removed]
Products branch : [archived branch]
was compiled on Linux, MacOS and Windows platforms and tested on optimize mode.
http://jenkins-test-10.nnov.opencascade.com/view/CR28069-master-KGV/
Number of compiler warnings:
No new/fixed warnings
Regressions/Differences/Improvements:
No regressions/differences
CPU differences:
No differences that require special attention
Image differences :
No differences that require special attention
Memory differences :
No differences that require special attention
New test cases are OK
Branch [archived branch] has been deleted by Author.
[revision removed]
[revision removed]
Related records
- #0028062 · related to · closedSamples - Shading model functionality does not work in mfc Viewer3d
- #0027715 · related to · closedVisualization - turn off deprecated OpenGL fixed-function pipeline by default
- #0030102 · parent of · closedVisualization, TKOpenGl - Graphic3d_TOSM_FACET shading is incorrect in some cases
- #0030136 · parent of · closedVisualization, TKOpenGl - Graphic3d_TOSM_FACET does not work on mobile devices
- #0029074 · related to · closedVisualization, TKOpenGl - support Geometry Shader definition
- #0029097 · related to · closedVisualization - allow picking Graphic3d_TypeOfShadingModel per-object