Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShaderChunk: Workaround for Adreno GPUs gl_FrontFacing bug. #21202

Merged
merged 9 commits into from Feb 4, 2021
Merged

Conversation

mrdoob
Copy link
Owner

@mrdoob mrdoob commented Feb 4, 2021

Related issue: #10331 #15850 #17158 #17586 #17958 #20997

Description

Adreno drivers do not handle gl_FrontFacing properly so we need a workaround.

I've made sure that the models in #17804 look correct.

Screen Shot 2021-02-04 at 1 17 01 PM

@mrdoob mrdoob added this to the r126 milestone Feb 4, 2021
@mrdoob
Copy link
Owner Author

mrdoob commented Feb 4, 2021

The test model in #11438 also looks correct:

Screen Shot 2021-02-04 at 1 14 32 PM

@mrdoob
Copy link
Owner Author

mrdoob commented Feb 4, 2021

Instead of:

isFrontFacing = dot( normal, normalize( cross( fdx, fdy ) ) ) > 0.0;
normal = normal * ( float( isFrontFacing ) * 2.0 - 1.0 );

I think we can just do:

faceDirection = sign( dot( normal, normalize( cross( fdx, fdy ) ) ) );
normal = normal * faceDirection;

I'll leave it for another PR.

@mrdoob
Copy link
Owner Author

mrdoob commented Feb 4, 2021

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.

None yet

1 participant