MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0032237Open CASCADE[OCCT] OCCT:Visualizationpublic2021-03-22 20:122021-04-03 12:50
Reporterkgv 
Assigned Tobugmaster 
PrioritynormalSeverityminor 
StatusverifiedResolutionfixed 
PlatformOSOS Version
Product Version[OCCT] 7.5.0 
Target Version[OCCT] 7.6.0*Fixed in Version 
Summary0032237: Visualization, TKOpenGl - fix Gouraud shading within perspective camera projection
DescriptionGouraud shading does not compute view direction properly for a perspective camera projection:
  vec3 aView = (occWorldViewMatrixInverse * vec4(0.0, 0.0, 1.0, 0.0)).xyz;


At the same time Phong shading handles perspective/orthographic projections independently:
  if (occProjectionMatrix[3][3] == 1.0)
  {
    View = vec3(0.0, 0.0, 1.0);
  }
  else
  {
    vec4 aPosition = occWorldViewMatrix * PositionWorld;
    View = -aPosition.xyz;
  }
  View = (occWorldViewMatrixInverse * vec4(View, 0.0)).xyz;

Proper calculations might look like this:
  vec3 aView;
  if (occProjectionMatrix[3][3] == 1.0)
  {
    aView = (occWorldViewMatrixInverse * vec4(0.0, 0.0, 1.0, 0.0)).xyz;
  }
  else
  {
    vec3 anEye = (occWorldViewMatrixInverse * vec4(0.0, 0.0, 0.0, 1.0)).xyz;
    aView = normalize (anEye - aPositionWorld.xyz);
  }


Note that existing behavior of Gouraud shader is more consistent to FFP lighting, so that patch would change this.
Steps To Reproducetest bugs vis bug30412 1
TagsNo tags attached.
Test case numberNot required
Attached Filespng file icon bug30412_cam_right_KO.png (7,689 bytes) 2021-03-22 21:57
png file icon bug30412_cam_right_OK.png (24,420 bytes) 2021-03-22 21:57

- Relationships

-  Notes
(0099662)
kgv (developer)
2021-03-22 22:05

Patch is ready for review
- OCCT: branch CR32237.

http://jenkins-test-12.nnov.opencascade.com:8080/view/CR32237-master-KGV/view/COMPARE/ [^]
(0099676)
osa (developer)
2021-03-23 15:47

The patch was reviewed without remarks
(0099691)
git (administrator)
2021-03-23 22:23

Branch CR32237 has been created by kgv.

SHA-1: 0f47d81a39b738f3d0307530806a88a7f9472b04


Detailed log of new commits:

Author: kgv
Date: Mon Mar 22 17:57:30 2021 +0300

    0032237: Visualization, TKOpenGl - fix Gouraud shading within perspective camera projection
(0099781)
bugmaster (administrator)
2021-03-27 14:09

Combination -
OCCT branch : WEEK-12
master SHA - 154b4635b8bd4c6c527738f59fd7d9d4f2cda509
a87b7ddc8cb44606b91e3f37113847c3f5f50fdc
Products branch : WEEK-12 SHA - 0779901f5e4c7f986db723d4a181df62079baf71
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: 17172.74000000034 / 17208.820000000378 [-0.21%]
Products
Total CPU difference: 11546.97000000013 / 11481.660000000102 [+0.57%]
Windows-64-VC14:
OCCT
Total CPU difference: 18612.140625 / 18668.765625 [-0.30%]
Products
Total CPU difference: 12857.140625 / 12879.75 [-0.18%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
(0100055)
git (administrator)
2021-04-03 12:50

Branch CR32237 has been deleted by inv.

SHA-1: 0f47d81a39b738f3d0307530806a88a7f9472b04

- Related Changesets
occt: master a0765350
Timestamp: 2021-03-22 14:57:30
Author: kgv
Committer: bugmaster
Details ] Diff ]
0032237: Visualization, TKOpenGl - fix Gouraud shading within perspective camera projection
mod - src/Graphic3d/Graphic3d_ShaderManager.cxx Diff ] File ]

- Issue History
Date Modified Username Field Change
2021-03-22 20:12 kgv New Issue
2021-03-22 20:12 kgv Assigned To => kgv
2021-03-22 21:57 kgv File Added: bug30412_cam_right_KO.png
2021-03-22 21:57 kgv File Added: bug30412_cam_right_OK.png
2021-03-22 21:57 kgv Steps to Reproduce Updated View Revisions
2021-03-22 22:05 kgv Note Added: 0099662
2021-03-22 22:05 kgv Assigned To kgv => osa
2021-03-22 22:05 kgv Status new => resolved
2021-03-22 22:19 kgv Description Updated View Revisions
2021-03-23 15:47 osa Note Added: 0099676
2021-03-23 15:47 osa Assigned To osa => bugmaster
2021-03-23 15:47 osa Status resolved => reviewed
2021-03-23 22:23 git Note Added: 0099691
2021-03-27 14:09 bugmaster Note Added: 0099781
2021-03-27 14:09 bugmaster Status reviewed => tested
2021-03-27 14:11 bugmaster Test case number => Not required
2021-03-27 14:19 bugmaster Changeset attached => occt master a0765350
2021-03-27 14:19 bugmaster Status tested => verified
2021-03-27 14:19 bugmaster Resolution open => fixed
2021-04-03 12:50 git Note Added: 0100055


Copyright © 2000 - 2021 MantisBT Team
Powered by Mantis Bugtracker