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

[Merged by Bors] - gltf-loader: disable backface culling if material is double-sided #4270

Conversation

jakobhellermann
Copy link
Contributor

@jakobhellermann jakobhellermann commented Mar 20, 2022

Objective

The glTF spec the doubleSided has the following to say about the doubleSided boolean:

When this value is false, back-face culling is enabled, i.e., only front-facing triangles are rendered.
When this value is true, back-face culling is disabled and double sided lighting is enabled. The back-face MUST have its normals reversed before the lighting equation is evaluated.

Solution

Disable backface culling when doubleSided: true.

@jakobhellermann jakobhellermann added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen A-Assets Load files from disk to use for things like images, models, and sounds labels Mar 20, 2022
@github-actions github-actions bot added the S-Needs-Triage This issue needs to be labelled label Mar 20, 2022
@alice-i-cecile alice-i-cecile removed the S-Needs-Triage This issue needs to be labelled label Mar 20, 2022
@alice-i-cecile
Copy link
Member

I think we don't yet reverse the normals on the other side, so this is a candidate for a future PR.

Can you please make and link and issue for this?

@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Mar 20, 2022
@jakobhellermann
Copy link
Contributor Author

I think we don't yet reverse the normals on the other side, so this is a candidate for a future PR.

Can you please make and link and issue for this?

Actually it looks like we do this already, so no need to do anything: https://github.com/bevyengine/bevy/blob/main/crates/bevy_pbr/src/render/pbr.wgsl#L505

@mockersf
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Mar 20, 2022
)

# Objective

The  [glTF spec](https://github.com/KhronosGroup/glTF/blob/8e798b02d254cea97659a333cfcb20875b62bdd4/specification/2.0/Specification.adoc#395-double-sided) the `doubleSided` has the following to say about the `doubleSided` boolean:

> When this value is false, back-face culling is enabled, i.e., only front-facing triangles are rendered.
> When this value is true, back-face culling is disabled and double sided lighting is enabled. The back-face MUST have its normals reversed before the lighting equation is evaluated.

## Solution
Disable backface culling when `doubleSided: true`.
@bors bors bot changed the title gltf-loader: disable backface culling if material is double-sided [Merged by Bors] - gltf-loader: disable backface culling if material is double-sided Mar 20, 2022
@bors bors bot closed this Mar 20, 2022
aevyrie pushed a commit to aevyrie/bevy that referenced this pull request Jun 7, 2022
…vyengine#4270)

# Objective

The  [glTF spec](https://github.com/KhronosGroup/glTF/blob/8e798b02d254cea97659a333cfcb20875b62bdd4/specification/2.0/Specification.adoc#395-double-sided) the `doubleSided` has the following to say about the `doubleSided` boolean:

> When this value is false, back-face culling is enabled, i.e., only front-facing triangles are rendered.
> When this value is true, back-face culling is disabled and double sided lighting is enabled. The back-face MUST have its normals reversed before the lighting equation is evaluated.

## Solution
Disable backface culling when `doubleSided: true`.
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
…vyengine#4270)

# Objective

The  [glTF spec](https://github.com/KhronosGroup/glTF/blob/8e798b02d254cea97659a333cfcb20875b62bdd4/specification/2.0/Specification.adoc#395-double-sided) the `doubleSided` has the following to say about the `doubleSided` boolean:

> When this value is false, back-face culling is enabled, i.e., only front-facing triangles are rendered.
> When this value is true, back-face culling is disabled and double sided lighting is enabled. The back-face MUST have its normals reversed before the lighting equation is evaluated.

## Solution
Disable backface culling when `doubleSided: true`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Assets Load files from disk to use for things like images, models, and sounds A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants