Search Issue Tracker
Won't Fix
Votes
3
Found in
5.3.4f1
Issue ID
794020
Regression
No
Graphics.DrawMesh does not handle mirror (negative scale) transforms well, should flip backface culling properly
Steps to reproduce:
1. Open attached project
2. Open scene "Exmaple"
3. Select "Main Camera" and notice that Scale specified in Draw Mesh Scale component uses one negative value
4. Run scene and notice that normals of mesh are messed up
Reproduced with: 5.2.4f1, 5.3.4p6, 5.4.0.b18
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
MUGIK
Jan 25, 2021 18:27
I had overcome this issue by using this code:
Matrix4x4 matrix = ... object's localToWorlMatrix ...;
Vector3 s = matrix.lossyScale;
bool needToInvertCulling = Mathf.Sign(s.x * s.y * s.z) < 0;
CommandBuffer.SetInvertCulling( needToInvertCulling );
hedgehog90
Oct 14, 2016 16:24
Please add a feature that allows Graphics.DrawMesh to flip normals
z_blush
May 25, 2016 20:17
I am running into a similar issue with a skinned 2d character (polygon planes skinned to joints). Here is an example:
Often, the character is scaled to -1 on X to flip it. The scale happens on the root joint of the character which has no skin influence on the polygons. In this case, all meshes draw perfectly in positive and negative scale space. However, if a child joint which has influence on a mesh is scaled to -1 on X, the affected mesh is drawn in reverse space (the normals are pointing in the opposite direction of the other meshes) - essentially the same problem of backface culling not flipping.