Can we disable normals and/or uv's?

Continuing the discussion from Why WebGPU backend is slower?:

@Evgeni_Popov you mention that “In WebGPU you have a call to set the index buffer and one or more calls to setup the vertex buffers (on average 3 calls if you have position, normals and uvs).”

is there a way to prevent 2 of these calls by not shipping normals and/or uv’s? My scene uses only ambient light, but I’m not sure if normals are still mandatory.

It wont get called if your meshes do not have them.

2 Likes

As @sebavan said, if your meshes don’t have normals / uvs, the vertex buffers won’t be created and you will save the setVertexBuffer calls. Normals are required for lighting, but if you don’t provide them they will be computed in the shader.

1 Like

are they also computed by the shader if there is only ambient light? if so, it will mean a performance hit as well.

No, the normal should be computed only if it is needed afterwards.

In any case, the driver should remove any unused code at compilation time.