You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On a freshly created OpenGL Context, the default front face is GL_CCW.
I tested a project that I'll link below, but I wrote some code to do the winding order as follows:
var st = SurfaceTool.new()
st.begin(Mesh.PRIMITIVE_TRIANGLES)
st.add_vertex(Vector3(0, 2, 0))
st.add_vertex(Vector3(2, 2, 2))
st.add_vertex(Vector3(0, 2, 2))
var mesh = st.commit()
I think you can agree this is a clockwise winding order, and assuming godot is a right-handed coordinate system, you'd expect the normal face to point "down"(-Y axis in 3D godot).
However, I created a simple project, and that's simply not the case; you can see the triangle from "above" but not below, which implies that the triangle normal is actually facing "up"(+Y). See the yellow triangle below:
Maybe I'm misunderstanding something here, so please double check me if I've got this right. I'll attach the sample project with the above code to the issue.
If the docs are wrong, I'm happy to submit a pull request to update the docs.
The text was updated successfully, but these errors were encountered:
Your camera is facing toward Y-. The viewport axes are X+ to the right and Z+ down.
Hence, seen from the camera toward the triangle, the face is drawn clockwise (x,z: 0,0 > 2,2 > 0,2), and therefore the front face is towards the camera.
This means Godot face winding order is clockwise, because the clockwise ordered vertices of the triangle are facing toward the viewer.
Your Godot version:
v4.4.beta4.official.93d270693
Issue description:
In the documentation for SurfaceTool, ArrayMesh, and MeshDataTool it states:
I've been banging my head against this problem for quite a few hours, googled all around, and I think this is just incorrect in the documentation.
I believe Godot uses counterclockwise winding order when dealing with primitive triangles.
And indeed, in the documentation that the godot docs link to on https://learnopengl.com/ it says
And on the official openGL documentation it states:
I tested a project that I'll link below, but I wrote some code to do the winding order as follows:
I think you can agree this is a clockwise winding order, and assuming godot is a right-handed coordinate system, you'd expect the normal face to point "down"(-Y axis in 3D godot).
However, I created a simple project, and that's simply not the case; you can see the triangle from "above" but not below, which implies that the triangle normal is actually facing "up"(+Y). See the yellow triangle below:
Looking "down"(-Y):
Here's the project with the above code:
winding_direction_test.zip
URL to the documentation page:
https://docs.godotengine.org/en/stable/classes/class_surfacetool.html#description
https://docs.godotengine.org/en/stable/classes/class_arraymesh.html
https://docs.godotengine.org/en/stable/classes/class_meshdatatool.html
Maybe I'm misunderstanding something here, so please double check me if I've got this right. I'll attach the sample project with the above code to the issue.
If the docs are wrong, I'm happy to submit a pull request to update the docs.
The text was updated successfully, but these errors were encountered: