I’m running into an issue I don’t know how to solve and Google searching hasn’t helped yet. I have a dynamic projectile I’m spawning at runtime with a point light attached. The light lights up any meshes in the scene but not my terrain. I’m using the forward rendering path, terrain is uing Built in legacy diffuse shader (tried standard, doesn’t work either.), and Cast Shadows is set on the terrain. In Window- > Lighting I have Precomputed realtime GI and Baked GI checked. If I go to Window → Lighting → Objects and uncheck Terrain Lightmap static I get the dynamic lights working on the terrain.
My fear is that this means the terrain won’t be baked which I fear may impact performance later on. Is it expected that runtime dynamic lights don’t light terrain that was statically baked? This would seem to indicate so ( Unity - Manual: Lightmapping In-Depth )
I would expect for Unity to keep a list of lights that shouldn’t move (don’t have rigid bodies on them) as static and everything else to be dynamic.
If you check this document, you’ll see that forward rendering path uses limited number of per-pixel lights per object. Basically, depending on quality settings, you’ll get main directional light, few brightest per-pixel lights, everything else is being stuffed into per-vertex lights/spherical harmonics.
So. The thing is, terrain is a HUGE object. If your terrain is a normal static mesh (and not some kind of special object specifically tailored to work as terrain with many dynamic lights), it’ll grab pretty much every light in the scene, select several brightest lights, and if your projectile is fairly dim, it won’t be one of them.
To solve the issue either
try marking projectile light as “important”
or
Try to split terrain into smaller chunks.
or
(Try to) switch to deferred lighting.
Please note that this is simply an educated guess regarding possible source of your problem, it might not be real cause of your issue.
So right now my scene has one static directional light and the ONLY dynamic light is what I’m spawning on the projectile. I’m well aware of forward rendering path lighting limitations. Switching to deferred is broken currently on android on unity 5 for Oculus rift, so its not an option.
Android? I cannot help you with that. (I would need test scene/debug it on android device, and frankly, I’m not very interested)
If I were you, however, I would:
Ensure that your single dynamic light is marked as important. (It is mobile device, after all, wouldn’t be surprised if it has 0 per-pixel lights in forward rendering path by default)
Ensure that default quality settings are high enough for android platform (I spent plenty of time recently trying to figure out why I don’t have shadows in webplayer)
It also occurs on Windows build… Like I said earlier the light renders fine against static meshes, even meshes placed on the terrain. Only the terrain, and only if the terrain has baked lighting on it is it broken…