Autodesk / Autodesk/maya-usd

Backface culling is reversed for instanceable objects with negative scale

Open
#3,168 0 comments 0 reactions 1 assignee Claimed by @santosg87 View on GitHub
bug vp2renderdelegate
Dominant language
Wolfram Language
Stars
905
Forks
223
Avg merge
2d 9h
Merged PRs (30d)
17

Description

**Describe the bug**
When a referenced model is marked instanceable, the referencing prim has a negative scale, and backface culling is enabled in the viewport options, the opposite faces are backface-culled. Toggling the instanceable flag on the prim toggles which faces are backface culled.

**Steps to reproduce**
Steps to reproduce the behavior:
1. In the attached zip file, open `scene.ma`
2. Make sure Shading > Backface Culling is enabled in the viewport
3. Go to `|scene|sceneShape,/world/poly_negscalex` -> this should have the "outside" of the box visible
4. Go to `|scene|sceneShape,/world/reversed_negscalex` -> this should have the "inside" of the box visible
5. Go to `|scene|sceneShape,/world/poly_negscalex_inst` -> this is just poly_negscalex with the instanceable flag set. Notice that the "inside" of the box is visible instead of the outside. The backface culling is flipped for this model
6. Go to `|scene|sceneShape,/world/reversed_negscalex_inst` -> this is just reversed_negscalex with the instanceable flag set. Notice that the "outside" of the box is visible instead of the inside. The backface culling is flipped for this model

**Expected behavior**
I would expect that setting the instanceable flag doesn't affect how backface culling works. In usdview, if I enable Display > Cull Backfaces (GL), setting the instanceable flag doesn't change the backface culling behavior.

**Attachments**
![maya_viewport](https://github.com/Autodesk/maya-usd/assets/1075619/db05792d-fd54-4c55-9b8c-721b7dc45993)
Both circled objects are the same reference, but the front object has instanceable=false and the back object has instanceable=true
![usdview](https://github.com/Autodesk/maya-usd/assets/1075619/b03911f2-4159-47b1-b529-9bc4de32eb99)
The same stage opened in usdview. Note that the circled objects are rendered identically with backface culling enabled.

**Specs (if applicable):**
- OS & version: Windows 10 21H2 (19044.2965)
- Maya version: Maya 2023.3 (also reproduces in 2024)
- Maya USD version: 0.23.0_202303171117-8b326f9

**Additional context**
Add any other context about the problem here.
[InstanceableNegativeScaleBackface.zip](https://github.com/Autodesk/maya-usd/files/11771855/InstanceableNegativeScaleBackface.zip)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.