Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | jujumumu |
For a large mesh is it more performant to render a mesh that shares vertices with indices or does it not matter?
Not Sharing verticies:
var arr = []
arr.resize(Mesh.ARRAY_MAX)
var verts = PoolVector3Array([Vector3(0,0,0),Vector3(1,0,0),Vector3(0,0,1),Vector3(1,0,1),Vector3(0,0,1),Vector3(1,0,0)])
var normals = PoolVector3Array([Vector3(0,1,0),Vector3(0,1,0),Vector3(0,1,0),Vector3(0,1,0),Vector3(0,1,0),Vector3(0,1,0)])
arr[Mesh.ARRAY_VERTEX] = verts
arr[Mesh.ARRAY_NORMAL] = normals
#arr[Mesh.ARRAY_INDEX] = indices
var mesh = ArrayMesh.new()
mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arr)
Sharing verticies:
var arr = []
arr.resize(Mesh.ARRAY_MAX)
var verts = PoolVector3Array([Vector3(0,0,0),Vector3(1,0,0),Vector3(0,0,1),Vector3(1,0,1)])
var normals = PoolVector3Array([Vector3(0,1,0),Vector3(0,1,0),Vector3(0,1,0),Vector3(0,1,0)])
var indices = PoolIntArray([0,1,2,3,2,1])
arr[Mesh.ARRAY_VERTEX] = verts
arr[Mesh.ARRAY_NORMAL] = normals
arr[Mesh.ARRAY_INDEX] = indices
var mesh = ArrayMesh.new()
mesh.add_surface_from_arrays(Mesh.PRIMITIVE_TRIANGLES, arr)
I ask this since I want to have flat shading which cannot share any verticies. Is there a performance difference in Godot for much larger meshes? The only thing I can think of is if there were any vertex shaders.