Skip to content

Conversation

WestLangley
Copy link
Collaborator

@WestLangley WestLangley commented Apr 22, 2018

For both double-sided and back-sided materials, we want extrusions when viewed from the front side, to appear as indentations when viewed from the back side.

This PR should ensure that behavior for both normal maps and bump maps.

@WestLangley
Copy link
Collaborator Author

/ping @donmccurdy This code works in my tests, but I have not been able to test with your test cases.

@donmccurdy
Copy link
Collaborator

For both double-sided and back-sided materials, we want extrusions viewed from the front side, to appear as indentations when viewed from the back side.

I'm seeing this behavior correctly for NormalTangentTest, NormalTangentMirrorTest, and DamagedHelmet glTF models.


float fDet = dot( vSigmaX, R1 );

fDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );
Copy link
Owner

@mrdoob mrdoob Apr 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intentional? Should it just be...

float fDet = dot( vSigmaX, R1 ) * float( gl_FrontFacing );

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I have coded was intentional and works in my tests. It is equivalent to a sign flip if back-facing.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. This code multiplies fDet by 1.0 or -1.0. Looks good!

@mrdoob mrdoob added this to the r93 milestone Apr 23, 2018
@mrdoob mrdoob merged commit d3494aa into mrdoob:dev Apr 24, 2018
@mrdoob
Copy link
Owner

mrdoob commented Apr 24, 2018

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants