Flat shading without the performance cost?

Hi,
Reading https://forum.babylonjs.com/t/new-smooth-flat-shading-processing/524

It appears Blender is able to export flat shaded meshes in GLB.
Tried everything in Blender 3.3 but no matter what I do, it always appear smooth shaded in BJS, which is ugly on the shapes I have, because they are not intended to be smooth.
thin instances + convertToFlatShadedMesh() implies a new buffer → not possible for me.
And on some meshes, it fails to allocate new memory.

I just want my meshes flat shaded.

Please note that I export the normals + uvs out of Blender in glb.

Tried a search on the forum, but missed the gem… :face_with_monocle:

1 Like

That was in reference to a .babylon process. Think you might need to do something with a modifier. It has been a while since I have had to to it that way, maybe an ‘edge split’

If you open the GLBs exported from Blender in other viewers, are they flat shaded? Blender might be doing the flat shading with a shader only which would mean the exported file geometry being the same as a regular mesh. Blender might have a solution to flat shade at geometry level, or you could write a shader in Babylon to get the flat shading too :slight_smile:

@carolhmj :hehehehe yesssssss
@JCPalmer : using this modifier didn’t change the outcome

hmmmmmm,

found out something: I visualized the mesh in other viewers and it was flat shaded.
asking babylon to recompute the normals via VertexData.ComputeNormals(vd.positions,vd.indices, vd.normals); leads to flat shaded meshes.

Comparing the result from Babylonjs which happens to be correct (yaaaayyyy) it looks like blender has wrong values.

I will investigate further to understand what is going on. It may be ->me<- messing around at some point.

I will report here my findings

And the problem was ->me<-

My importer messed up an inversion + indices: “all out”.

Problem solved. I beg for the right to oblivion :slight_smile:

Thanks anyway :+1:

1 Like