I’m a Unity3D User In Rendering , Light and Shader And I Used UDK and Unreal Engine 4.
In Unity we have nice tools for lighting but one thing makes a problem .
In UDK and Unreal Engine I saw Dynamic Shadows And Static Shadows blend together perfectly !
I can’t understand what is unreal method .
- It just bake Skylight and GI with lightmass and direct light are dynamic ?
- It makes a mask from shadows and multiply it with Real time shadows and next mask it on lights ?
- I could make it in unity just for direct light and I feel my way is wrong .
- How UDK blend Lightmaps shader with Dynamic Shaders ? Make A ID for every light ?
This is really big challenge for us , Please some one explain it for me .
It’s explained here: https://docs.unrealengine.com/latest/INT/Engine/Rendering/LightingAndShadows/LightMobility/StationaryLights/index.html
The stationary lights are actually real-time lights with pre-baked shadows. Since you cannot have more than four overlapping stationary lights, I assume UE4 renders the baked shadow masks into a RGBA buffer (one light per channel) that is used to mask the real-time lights during deferred rendering. Per-object shadows are probably draw into the same buffer (each shadow being drawn into the channel corresponding to the light that’s casting it).
The first time I saw this technique was in the first Bioshock, which wasn’t even UE3, but a UE “2.5” with custom lighting.
Thanks pedro_clericuzzi ,
It was quite clear !
Just one thing … is this limit on Unreal Engine 4 ?
Yes, the documentation states you can’t have more than four overlapping stationary lights. There’s even a visualization in the editor that shows light overlap. Of course, you can have as many stationary lights on a level as you want, just be careful about not letting them overlap.
You can actually have more than 4 overlapping shadow casting stationary lights, it’s just a severe performance cost because they are forced to use whole scene dynamic shadows at that point. That makes them cost like a Movable light.
Pedro is right about the implementation, Stationary lights store their direct shadowing separate from all the other lights, which allows them to be masked correctly with dynamic object shadows. This was also done in UE3 with Dominant lights, but Stationary lights have fewer restrictions. Distance field shadow maps are used to store the precomputed shadows, which give a much higher quality result than storing the shadow factor directly.
There are a bunch of other benefits to storing the direct shadowing separately for Stationary lights - it allows us to evaluate their direct lighting dynamically. That means things like light intensity, color, and light function can change dynamically at runtime. And we can do analytic (accurate) specular from that light instead of having to jam it in a cubemap.
One more thing - note that dynamic objects receive accurate shadows from the static environment - it’s not full on or off like in many games. If there’s a detailed grate above your character, the detailed grate shadow will cast across the character.