NME preview sphere’s normals seem broken

Heya, I wonder if the builtin sphere mesh used in the NME preview has changed recently (particularly its normals)? Or maybe the Lights block has? Because for example here’s a simple material using the Lights block which IIRC would have worked not so long ago.

And for comparison here’s the same material with a sphere mesh that was created and exported from Babylon and the lighting seems smooth as expected.

Yup this is reallllllly strange @carolhmj @Deltakosh anything changed here ?

The normals of the sphere in the linked PG are completely unnormalized wondering if a but in the mat or the mesh ???

So probably coming from this change Use glb meshes for sphere and plane in NME preview window by deltakosh · Pull Request #12866 · BabylonJS/Babylon.js · GitHub

This fixes it https://nme.babylonjs.com/#7D09DX#1 (normals need to be normalized before lighting)

@PatrickRyan do you remember where the models come from

1 Like

@sebavan the models were all glbs exported from Maya as I remember. This was so we could do things like bevel the cube and have control over the UV mapping and resolution of the meshes. I can look for the sphere and take a look, but it would have been exported the same as all of the others.

And the change for the sphere and plane PR was caused by the need for the preview meshes to have tangents in the file. Originally they were Meshbuilder meshes which didn’t have any tangent data on them. I will look at the original file and see if I can replicate with that glb.

@sebavan, I opened a PR Normalized surface normals by PatrickRyanMS · Pull Request #68 · BabylonJS/Assets (github.com) for sphere, plane, and cube. Each of those meshes seemed to have broken normals but I tested the new exports on the above shader and they seem to render correctly now.

1 Like