The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

+1 vote

Hi all,

I created a simple scene with just a rigid body with the following children:

screenshot

  • mesh node (cube expected to be 8 vertex ?)
  • collision
  • other stuff (such as audio , non visible nodes...)

The debug monitor is showing 72 vertices drawn... is this expected or I am missing something trivial ?

Thx

in Engine by (892 points)
edited by

I don't know about 72 vertices, but a flat cube will have at least 4*6=24 vertices, since for every side of the cube the normals can't be shared, since they need to point straight into the direction of the side. If you wanna know what I mean, create a cube in Blender and switch it to smooth shading. That cube will have 8 vertices but won't look like the cube you see in Godot.

Hi @omggomb,

Thx for your feedback but i didn’t full understand it.
Also i tried the shading -> smooth / flat switch in blender, it only changed visually, but blender kept on saying it is 8 vertices...

Hope you can clarify / prove your answer better.

Thx again :-)

I am so confused, I added a plane mesh and counts 12, while cube has 72, seems like every vertices has another vertices for normals. idk

I also try creating mesh from code, and if my guess is true then my mesh made from code did not divide as couple of triangles but a whole square, but if my guess is false, well I do not know anymore XO

here is my script:

extends Spatial

var tmpMesh = Mesh.new()
var vertices = PoolVector3Array()
var UVs = PoolVector2Array()
var mat = SpatialMaterial.new()
var color = Color(1, 1, 1)

func _ready():

vertices.append(Vector3(-0.5, 0, -0.5))
vertices.append(Vector3(-0.5, 0, 0.5))
vertices.append(Vector3(0.5, 0, 0.5))
vertices.append(Vector3(0.5, 0, -0.5))
vertices.invert()

UVs.push_back(Vector2(0, 0))
UVs.push_back(Vector2(0, 1))
UVs.push_back(Vector2(1, 1))
UVs.push_back(Vector2(1, 0))

mat.albedo_color = color

var st = SurfaceTool.new()
st.begin(Mesh.PRIMITIVE_TRIANGLE_FAN)
st.set_material(mat)

for v in vertices.size():
    st.add_color(color)
    st.add_uv(UVs[v])
    st.add_vertex(vertices[v])

st.commit(tmpMesh)

$MeshInstance2.mesh = tmpMesh
pass

func process(delta):
$MeshInstance2.rotate_z(0.01)
pass

1 Answer

0 votes

I'm not sure about this, but possibly some sort of triangulation of the faces would create the 72 vertices.

by (91 points)

Hmm maybe like this:
1 face = 2 triangles = 6 Vertices. That makes 6 * 6 = 36 Vertices. Considering that I think that every vertex is need twice for the cube to appear sharp, that would make 72 vertices.

Can you clarify more why

every vertex is need twice for the cube to appear sharp

Also, more importantly, is this expected ? I just wanna make sure that 1 simple cube in Godot is made of X Vertices before adding more cubes to my scene. (whether X is 8 or 72 or smthg else).

Thx

I recorded a short video explaining why I think this is true. I admit I'm not sure but to me it sounds reasonable. I think the vertex count in Blender and Godot are counted at different stages. Blender counts only the vertices you created while Godot counts the vertices that are sent to the GPU for rendering

Here's the video

Edit:
To further test this, I exported a cube using smooth shading without an edgesplit modifier, and as expected it looks different that the cube you can create in Godot, however there are still 72 vertices drawn, so I'm actually no longer sure if I'm correct :).

Smooth shaded cube in Godot

Thx a lot @omggomb for taking the time to do the video !
It did clarify ur point better,
I think the vertex on top count as 3 since there is also the "normal" upward ?

Anw, hope the creators of Godot or someone from the top 3 users
@zylann @volzhs @Calinou @eons can confirm this count.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.