- Home /
Strange point light on generated mesh
I'm generating three meshes via a script and have a pre-made point light that varies in intensity, meant to be part of a torch. When I move it around randomly, it flickers on the meshes. If it's static and in the right place, it still appears weird:
Some parts of of the meshes aren't being lit. The floor has a stripe of darkness on it, the roof (part of the same mesh as the floor) isn't lit at all and the wall (separate mesh) has striped or spotty shadows dotted around it.
I've looked far and wide for a solution, but only found things that affect but do not solve it. Changing the bias only tweaks it, with it still being present in some situations. Changing camera clipping planes, rendering modes and changing shadow quality settings do not help.
This is currently one of only two point lights in the scene - the issue happens in both Editor and Game views. The material for all the meshes is set to Standard Opaque with no emission set. The light has Render Mode set to Auto, culling mask set to Everything and is using Hard Shadows. Another thing to note is that the other point light in the scene (parented to the player, which is just a cube right now) has no issues with this, despite having roughly the same settings.
Do you recalculate the normals when you generate the mesh?
Answer by LukeZaz · Jan 12, 2019 at 01:41 AM
Turns out I was missing a call to RecalculateNormals. I posted this question originally thinking I already had, but apparently I'd missed it somewhere in the code. Posting this late to help anyone who may come across this later - I would've posted it sooner, but at the time I found the problem Unity Answers was bugged and I couldn't log in.