Download

What do procedural generated games do for lighting?

Hi,

I’ve been looking at procedural generation and begun to look at what these styles of games do for lighting. From what I understand, there is no out-of-box solution for any of the two majorly used engines.

What type of lighting solution do games like No Man Sky, Rust, Worlds Adrift, look toward to?

Would something like what Bossa games did with Unity be possible within Unreal? (presumably yes, their solution below.)

[SPOILER]The solution: What we do is create a probe set automatically for each island using an algorithm that uses the terrain and objects to determine where to position probes. Bake ‘only’ ambient lighting into the probes (which makes them something like a visibility spherical harmonic multiplied by our ambient tri-light, rather than full lighting information). Next, instead of baking traditional lightmaps we bake the indirect information interpolated from the probe set for every vertex of every asset into a custom texture. This creates some interesting looking textures that I would call visibility maps rather than lightmaps. Then at runtime we set the lightmap index and start position of each asset and use the Vertex_ID semantic inside shaders to determine the correct pixel of the lightmap per vertex. The majority of islands have 1 - 2 million vertices meaning the average islands lightmaps will be a few 1024x1024 textures at most. Really not much data at all. As for bake times, we are using a preview alpha build of Unities progressive light mapper for baking, and only baking probes with this version can bake 20,000 probes in under a minute. As you are flying through the sky the ‘nearest’ island to you is centered around the origin of the scene and the probe and visibility maps for that island are loaded. (This means further away islands will not have any GI data, but that isn’t too much of an issue due to the relative distances between them) Finally the spherical harmonics for the probes and a global shader variable that modulates the ambient intensity of the visibility maps are altered depending on the time of day every few seconds. This is probably quick enough to perform every frame but is unnecessary due to the speed of our in game time.
[/SPOILER]

Though, I presume this isn’t a solution to a truly procedural game as the lightmaps can’t be baked at runtime if I’m understanding this correctly. So the islands must be made prior to placing them in the world.

Well, with that being said, I’m just interested in knowing what type of solutions those style of games use :slight_smile:

Thanks!

In UE4 the solution is quite simple. Use cascaded shadowmaps for near near shadowing, distance field shadows for mid-far shadowing, and then the far shadow maps for very distant shadowing.

set the directional light and skylight to moveable, and set the skylight to “capture scene” then it will match the sky.

You can recapture the skylight while the game is running using blueprints to account for tod.