View Issue Details

IDProjectCategoryView StatusLast Update
0032198Open CASCADEOCCT:Visualizationpublic2021-04-03 12:49
Reporterkgv Assigned Tobugmaster  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version7.5.0 
Target Version7.6.0Fixed in Version7.6.0 
Summary0032198: Visualization, TKOpenGl - per-vertex lighting ignores back/front material colors
DescriptionCurrent implementation of per-vertex lighting replaces material colors with vertex colors.
This disallows applying effects like a color shift for distinguishing back/front colors.

It is proposed applying per-vertex lighting consistently to applying color texture map - e.g. modulating color with material definition.
User looking for previous behavior should just define a material with a white color.
Steps To Reproduce
pload MODELING VISUALIZATION
vclear
vinit View1
vviewparams -scale 10 -proj -0.3 -0.7 0.6 -up 0.013 0.65 0.75 -at 35.4 61.8 31.5
vdrawparray t1  triangles v 0 55 0 v 0 75 0 v 20 55 0 v 0 55 0 v 0 55 20 v 0 75 0 v 0 55 0 v 20 55 0 v 0 55 20 v 0 75 0 v 0 55 20 v 20 55 0
vdrawparray t1c triangles v 0 55 0 c 1 0 0  v 0 75 0 c 0 1 0  v 20 55 0 c 0 0 1  v 0 55 0 c 1 1 0  v 0 55 20 c 1 1 1  v 0 75 0 c 0 1 1  v 0 55 0 c 0.5 0 0  v 20 55 0 c 0 0 0.5 v 0 55 20 c 0 0.5 0 v 0 75 0 c 0.5 0.5 0  v 0 55 20  c 0 0.5 0.5  v 20 55 0 c 0.5 0 0.5
vdrawparray t2  triangles v 0 55 0 v 0 75 0 v 20 55 0 v 0 75 0 v 0 55 20 v 20 55 0
vdrawparray t2c triangles v 0 55 0 c 1 0 0  v 0 75 0 c 0 1 0  v 20 55 0 c 0 0 0.5  v 0 75 0 c 0.5 0.5 0  v 0 55 20  c 0 0.5 0.5  v 20 55 0 c 0.5 0 0.5
vlocation t1  -location  0 0  0
vlocation t2  -location 50 0  0
vlocation t1c -location  0 0 50
vlocation t2c -location 50 0 50
vfit
vaspects t1  -color GREEN -backfaceColor RED
vaspects t2  -color GREEN -backfaceColor RED
vaspects t1c -color GREEN -backfaceColor RED
vaspects t2c -color GREEN -backfaceColor RED
Additional information
and documentation updates
Nodal color vertex attribute is now modulated in the same way as a color texture - color is multiplied by material coefficients (diffuse/ambient/specular in case of a common material definition).
Existing code defining nodal colors should be updated to:
- Use *Graphic3d_TOSM_UNLIT* shading model when lighting is not needed.
- Adjust diffuse/ambient material coefficients, which have been previously ignored.
- Remove code multiplying nodal colors, intended to compensate over-brightness due to addition of specular color from material definition, as specular component is now also modulated by a vertex color.

Note that as specular material component is now always multiplied within Phong shading (this was already done for texture modulation), it is no more possible achieving exact visual result of previous approach (e.g. metal-alike reflections). Consider using PBR shading model if this effect is important.
TagsNo tags attached.
Test case numberv3d/glsl/vert_color

Activities

git

2021-03-05 17:26

administrator   ~0099443

Branch CR32198 has been created by kgv.

SHA-1: bbb08d63fa5018caf8aa2f5c711146b0d49ee9b0


Detailed log of new commits:

Author: kgv
Date: Fri Mar 5 17:26:47 2021 +0300

    0032198: Visualization, TKOpenGl - per-vertex lighting ignores back/front material colors
    
    Graphic3d_ShaderManager::stdComputeLighting() now multiplies vertex color by material color.

git

2021-03-05 22:21

administrator   ~0099451

Branch CR32198_1 has been created by kgv.

SHA-1: 5063266da2a8a10f6af16d3aca28065c14889a86


Detailed log of new commits:

Author: kgv
Date: Fri Mar 5 17:26:47 2021 +0300

    0032198: Visualization, TKOpenGl - per-vertex lighting ignores back/front material colors
    
    Graphic3d_ShaderManager::stdComputeLighting() now multiplies vertex color by material color.
    The implementation has been adjusted for better consistency between PBR / non-PBR.
    
    OpenGl_Material definition has been modified to join Front/Back pair into a single uniform variable.
    Common material definition now occupies 4x2 vec4 instead of 5x2 vec4.
    
    Getters of Common material properties within Declarations.glsl
    have been renamed to match PBR material syntax (e.g. take IsFront flag as function argument).
    Auxliary macros (like occTextureColor()) has been renamed (like occMaterialBaseColor())
    and adjusted to return material property directly instead of taking it as argument.

git

2021-03-06 01:53

administrator   ~0099455

Branch CR32198_1 has been updated forcibly by kgv.

SHA-1: 6c680be09b8eea192ebcbf2fe1c8bd350abf75ec

git

2021-03-06 03:23

administrator   ~0099459

Branch CR32198_2 has been created by kgv.

SHA-1: 35786fe837720de94f249007df253e01b522e41b


No new revisions were added by this update.

kgv

2021-03-06 03:28

developer   ~0099460

Patch is ready for review
- OCCT: branch CR32198_2.

http://jenkins-test-12.nnov.opencascade.com:8080/view/CR32198_1-master-KGV/

kgv

2021-03-06 03:29

developer   ~0099461

git

2021-03-06 14:34

administrator   ~0099509

Branch CR32198_2 has been updated forcibly by kgv.

SHA-1: 418eb886044b450545ecbf29601644d4df82415b

osa

2021-03-17 14:03

developer   ~0099549

The patch was reviewed

bugmaster

2021-03-20 12:50

administrator   ~0099614

Combination -
OCCT branch : IR-2021-03-19
master SHA - d209b3176e21010e096833052698f1c0da5b04d5
a87b7ddc8cb44606b91e3f37113847c3f5f50fdc
Products branch : IR-2021-03-19 SHA - 6baf3a921c29525981c0ad7881214c9b20ffe3c1
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: 17753.85000000016 / 17750.250000000156 [+0.02%]
Products
Total CPU difference: 11481.660000000102 / 11540.5800000001 [-0.51%]
Windows-64-VC14:
OCCT
Total CPU difference: 19361.09375 / 19341.28125 [+0.10%]
Products
Total CPU difference: 12879.75 / 12869.921875 [+0.08%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

git

2021-04-03 12:49

administrator   ~0100040

Branch CR32198 has been deleted by inv.

SHA-1: bbb08d63fa5018caf8aa2f5c711146b0d49ee9b0

git

2021-04-03 12:49

administrator   ~0100041

Branch CR32198_1 has been deleted by inv.

SHA-1: 6c680be09b8eea192ebcbf2fe1c8bd350abf75ec

git

2021-04-03 12:49

administrator   ~0100042

Branch CR32198_2 has been deleted by inv.

SHA-1: 418eb886044b450545ecbf29601644d4df82415b

Related Changesets

occt: master 61a05a36

2021-03-06 00:22:05

kgv


Committer: bugmaster Details Diff
0032198: Visualization, TKOpenGl - per-vertex lighting ignores back/front material colors

Graphic3d_ShaderManager::stdComputeLighting() now multiplies vertex color by material color.
Affected Issues
0032198
mod - dox/upgrade/upgrade.md Diff File
mod - src/AIS/AIS_Triangulation.cxx Diff File
mod - src/Graphic3d/Graphic3d_ShaderManager.cxx Diff File
mod - src/MeshVS/MeshVS_NodalColorPrsBuilder.cxx Diff File
mod - src/ViewerTest/ViewerTest_ObjectCommands.cxx Diff File
mod - tests/bugs/vis/bug30076 Diff File
add - tests/v3d/glsl/vert_color Diff File

Issue History

Date Modified Username Field Change
2021-03-05 16:39 kgv New Issue
2021-03-05 16:39 kgv Assigned To => kgv
2021-03-05 17:04 kgv Steps to Reproduce Updated
2021-03-05 17:07 kgv Steps to Reproduce Updated
2021-03-05 17:26 git Note Added: 0099443
2021-03-05 22:21 git Note Added: 0099451
2021-03-06 01:53 git Note Added: 0099455
2021-03-06 03:23 git Note Added: 0099459
2021-03-06 03:28 kgv Note Added: 0099460
2021-03-06 03:28 kgv Assigned To kgv => osa
2021-03-06 03:28 kgv Status new => resolved
2021-03-06 03:29 kgv Note Added: 0099461
2021-03-06 14:34 git Note Added: 0099509
2021-03-06 14:40 kgv Additional Information Updated
2021-03-17 14:03 osa Note Added: 0099549
2021-03-17 14:03 osa Assigned To osa => bugmaster
2021-03-17 14:03 osa Status resolved => reviewed
2021-03-20 12:50 bugmaster Note Added: 0099614
2021-03-20 12:50 bugmaster Status reviewed => tested
2021-03-20 12:58 bugmaster Test case number => v3d/glsl/vert_color
2021-03-23 21:46 bugmaster Changeset attached => occt master 61a05a36
2021-03-23 21:46 bugmaster Status tested => verified
2021-03-23 21:46 bugmaster Resolution open => fixed
2021-04-03 12:49 git Note Added: 0100040
2021-04-03 12:49 git Note Added: 0100041
2021-04-03 12:49 git Note Added: 0100042