How to set flatShading or smooth to material (load object with GLTFLoader)?

Hello! I load an object with GLTFLoader
But some details ob this object are not smooth.

for example

in three js

image

It should be more smooth

image

in three js after loaded

image

but it should be

image

How can I fix it?

1 Like

Are you exporting your models from Blender?

i export model from cinema 4D in fbx format, then convert it in .glb with https://blackthread.io/loader/
I can’t to fix it with cinema 4D or blender, and find the way to fix it with three

In blender or cinema 4D I can’t see this effect

From my point of view this is a modeling issue. In Blender you can change between smooth and flat shading, see:

https://en.blender.org/index.php/Doc:2.6/Manual/Modeling/Meshes/Smoothing

Cinema 4D provides a similar option for sure.

1 Like

I can’t to fix it with three setting of material?
In blender or cinema 4D I can’t see this effect

three.js does smooth shading per default. You can only force flat shading by setting the flatShading material property to true. Besides, you can try to call BufferGeometry.computeVertexNormals() but the outcome depends on your geometry. Geometry.computeFlatVertexNormals() is another option.

In any event, it’s not ideal to fix this issue with the 3D engine. You should export your model in a way so you can directly render it without manual adjustments.

2 Likes

I tried with flatShading as

but didn’t see the result

gltf.scene.traverse((node) => {
if (node.isMesh) {
node.material.flatShading = true;
}
});

1 Like

I thought you want smooth shading?

I have No results with this code

 object.traverse((node) => {
            if (node.isMesh) {
                console.log('node', node)
                node.material.smoothShading = true;
            
            }
        });

No results too

 object.traverse((node) => {
            if (node.isMesh) {
                console.log('node', node)
                node.material.flatShading = true;
             

            }
        });
1 Like

I try to use computeFlatVertexNormals but haven’t any results
Can you help me in my codepen ? or maybe give me some examples

Material.smoothShading does not exist. Besides, your codepen does not seem to work.