Skip to content

Fix double-sided normals for negative scale meshes#24395

Open
issam3105 wants to merge 1 commit into
bevyengine:mainfrom
issam3105:Fix_double-sided_normals_for_negative-scale_meshes
Open

Fix double-sided normals for negative scale meshes#24395
issam3105 wants to merge 1 commit into
bevyengine:mainfrom
issam3105:Fix_double-sided_normals_for_negative-scale_meshes

Conversation

@issam3105
Copy link
Copy Markdown
Contributor

@issam3105 issam3105 commented May 22, 2026

Objective

Fix incorrect PBR lighting for double-sided meshes with negative-scale transforms.

#8859 fixed culling for single-sided glTF materials by detecting inverted scale in the loader. Double-sided materials still need a shader-side fix, because culling is disabled and raw front_facing is reversed by negative-scale winding.

Solution

Add a winding-corrected front-facing helper in the PBR shader path.

Testing

Tested with Khronos NegativeScaleTest

The bottom-right -1.0 column should match the expected lighting/reflection behavior for double-sided materials.

To validate non-regression for normal/tangent handling, reviewers can also test:

NormalTangentMirrorTest
NormalTangentTest

Showcase

Before
image

After
image

@issam3105 issam3105 force-pushed the Fix_double-sided_normals_for_negative-scale_meshes branch from d188e6f to d1c8ebf Compare May 22, 2026 15:31
@kfc35 kfc35 added A-Rendering Drawing game state to the screen S-Needs-Review Needs reviewer attention (from anyone!) to move forward D-Shaders This code uses GPU shader languages labels May 23, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Rendering May 23, 2026
@kfc35 kfc35 added the C-Bug An unexpected or incorrect behavior label May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior D-Shaders This code uses GPU shader languages S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

2 participants