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
- [URP] Invalid update of shader stripping settings
- [HDRP] Errors on Shader stripper that do not stripp shaders.
- Usage of Adaptive Probe Volumes throws a lot of IndexOutOfRangeException and Assertion Failed errors
- Prefab overrides don't recover missing managed references
- Trail Renderer visual doesn't match the positions of vertices when they have been offset
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.