Threejs renderer.info.triangle is incorrect?

Hi,
I have a gltf model , the model in glTF-Validator has 61941 triangles.
But when i put in three.js, i console log the renderer.info.triangle, it has 115867 triangles.
I put the model in blender. Blender shows it has 52166 triangles.
The model link

When import the asset into the three.js editor I see this:

image

Wo.
I put it in https://gltf-viewer.donmccurdy.com/ , when i open the chrome control, i console.log(renderer.info.render.triangles), it show 115871.

@donmccurdy Do you know why gltf-viewer shows a different triangle count than the editor?

If model castShadows, then trinagles renders twice. and when material.side:THREE.doubleSide

2 Likes

You can find a more detailed view of the contents of the model at https://gltf.report, where “GL_PRIMITIVES” are triangles in this case —

Beyond that it’s important to know that the final triangle count depends on the runtime representation required by a particular software. Blender often shows a lower count than what it exports, because it (internally) represents multiple normals and vertex colors per vertex. Realtime engines like three.js need 1 normal per vertex, which sometimes require more vertices. Finally the number of triangles in the glTF file is close to, but not exactly, what three.js will use. I don’t know how glTF Validator would count vertices in a geometry that is rendered more than once, for example.

gltf-viewer shows the number reported by glTF Validator, “61941 triangles” if you open the info tab (bottom left).

I’m not sure why printing renderer.info.render.triangles would show a larger number, but the app’s renderer does include other things in its GL context, not just the given model. For example a THREE.RoomEnvironment is used to generate the IBL, and I’m not aware of any way to dispose of those resources afterward.

4 Likes

Thank you very much for your explanation. I have a deeper understanding of the basic principle of 3D.