Why the number of vertices of the exported obj model is three will become more

When I tried to export a plane obj model in blender, I found it in three JS, the number of vertices has increased,

obj model

renderer:

use ShaderMaterial to renderer

    const rawMaterial = new ShaderMaterial({
      uniforms: {
        uColor: {
          value: new Color(0x3581fc),
        },
        uOpacity: {
          value: 0.6,
        },
      },
      fragmentShader: `
        uniform vec3 uColor;
        uniform float uOpacity;
        void main() {
          gl_FragColor = vec4(uColor, uOpacity);
        }
      `,
      vertexShader: `
        varying vec3 uColor;
        void main() {
          vec4 viewPostion = viewMatrix * modelMatrix * vec4(position, 1);
          gl_Position = projectionMatrix * viewPostion;
        }
      `,
      transparent: true,
      depthWrite: false,
    })

this obj model data

# Blender v3.1.2 OBJ File: ''
# www.blender.org
o 平面_平面.002
v 9.251820 0.000000 9.251820
v -9.251820 0.000000 -9.251820
v 9.251820 0.000000 -9.251820
v -9.251820 0.000000 -2.399833
v -0.011656 0.000000 9.251820
v -0.012841 0.000000 0.211577
v -5.425591 0.000000 0.209980
v -5.425742 0.000000 -2.402929
s off
f 4 8 7 6 5 1 3 2

Maybe he break poligons to triangles. Square 4 vertices break to triangles will 6 vertices.

Your screenshot shows that your object is not rendered correctly because of overlapping faces. I suggest you triangulate the object in Blender first, make sure there are not overlapping parts and then export to glTF.

glTF is the recommended 3D format of three.js and should be your first choice. Try to avoid OBJ whenever possible. More information about this topic here: three.js docs

I remember that cant good exporte from blender to obj format - triangles overlaped. 3ds max exportint to obj without overlaping. Maybe in blender need break polygons to triangles before exporting.

1 Like

It is also very common that a mesh containing UVs, normals, or vertex colors will have more vertices after export from Blender. This is a simple difference in how editing software represents the mesh vs. how WebGL and other graphics APIs represent the mesh. If you don’t need those vertex attributes you can remove them and often reduce the vertex count, otherwise it’s not a big deal.

1 Like