whats the point of a custom mesh having "normals" when a normal texture would do that?

Hi,

ive got a custom mesh i created by using assetmanager.createasset. im trying to bake my lights and use lightmapping. its not working so far, but i will come back to that in a second.

i notice on the mesh c# object, there is a variable called normals. I would have thought the shader uses the normal texture attached to it? i havnt quite understood why normals is needed on the mesh object when it is clearly specified as a texture on most shaders.

which brings me to why im asking this. im trying to get my lightmaps working for my custom mesh. ive set my objects to static and ticked the static tickbox. In my mesh generation im using unwrapping.generateseco daryuvs () after i set my triangles. im however not setting the normals variable - im only calling recalculatenormals. do i need to set mesh.normals for lightmapping to work on my custom mesh?

Normals are for lighting, not textures. Without normals, real-time lighting doesn’t work.

–Eric

Normal maps provide detailed lighting information to shaders, and this is correct. In the mesh’s case though, you need normals to figure out which way things render and so on.

So you still always need normals for lighting and rendering, otherwise verts have no directionality and you will have a flat or invisible object.

Lighting only, not which way things render; winding order determines that. (Face normals in a modeling app are actually winding order.)

–Eric

Oh yeah, that’ll teach me to do 15 hour work days. I’ve muddled. They have another purpose though, I remember using them in shaders for effect directionality.

And the part that the others didn’t explain is that the normal map texture is used to modify the existing mesh normals. The normal map textures don’t work with out the mesh normals, but you don’t need normal maps. Baked lighting usually ignores the normal map texture and just uses the mesh normals.

1 Like