godot icon indicating copy to clipboard operation
godot copied to clipboard

Mesh with negative size and cull disabled displays incorrect normals GLES3

Open clayjohn opened this issue 6 years ago • 2 comments

This bug was found in both #26710 and #25696 But was mixed in with a few other bugs. This issue supercedes them both.

Godot version: Master

Issue description: When a mesh with culling disabled is given a negative size the normals appear backwards in GLES3.

https://user-images.githubusercontent.com/5222656/52463875-9e985800-2b46-11e9-9db0-136267400a36.png

Note: this issue doesn't appear when using cull_front or cull_back because Godot detects when the scale is negative and flips the culling operation.

https://github.com/godotengine/godot/blob/6895ad303b51aaf84a568c982e3622049a50ed37/servers/visual/visual_server_scene.cpp#L950

Steps to reproduce:

  1. Create a MeshInstance
  2. Set the cull property of the SpatialMaterial to "disabled"
  3. Set the scale of the MeshInstance to (-1, -1, -1)

Minimal reproduction project: https://github.com/godotengine/godot/files/2844079/tests_3.1.zip

clayjohn avatar May 30 '19 14:05 clayjohn

Seems still valid in ba51af790

KoBeWi avatar Dec 02 '20 00:12 KoBeWi

@KoBeWi I can reproduce this on v4.0.dev.custom_build [2a28df82d]

image

as you can see the left side (its a meshinstance inverted on scale)

thanks to @lyuma this can be workarounded via vertex shader: image

PS: Lines 25-26

nonunknown avatar Oct 10 '21 15:10 nonunknown