r/TheMakingOfGames • u/Idoiocracy • Apr 29 '14
Unreal Engine 4 - Epic Games engine programmer Daniel Wright writes a post explaining the work that went into creating the realistic indoor scene demo, including correcting Lightmass (the precomputed indirect lighting solver), the process of photon mapping and Final Gather, and Irradiance Caching
/r/gaming/comments/248okb/no_this_is_not_real_lifeunreal_game_engine_4/ch4xblk
21
Upvotes
3
u/Idoiocracy Apr 29 '14
Epic Games engine programmer Daniel Wright, /u/NiceWalrus, wrote:
"For once a thread on reddit that I know something about!
I'm a graphics programmer at Epic, and I worked on quite a few of the lighting techniques being used to make this so realistic looking, along with the rest of the team. This is me:
https://answers.unrealengine.com/users/2393/danielw.html
Some interesting things about this room:
In the first version of this I saw, there was a ton of noise and splotchy artifacts all over the place. The precomputed indirect lighting solver (called Lightmass) was inconsistently finding the tiny bright spot of sun lighting on the ground, which needs to bounce to fill the room. Paul kept bugging me about it, joking about how bad it was. I didn't want to let him down (our artists here are gods) so I found time to look into it. That was about a year ago now.
Lightmass uses a bunch of techniques to get good quality in tough cases like these where all the indirect lighting is coming from a tiny spot (the sunlight on the ground). First there's photon mapping, where photons are traced from the light sources into the scene. Then we shade all the receiving points (texels in the lightmap), gathering lighting from the scene, this is called the Final Gather. Photons from the first pass are used to tell the Final Gather where to look for small bright sources of lighting. Without them it would require ~10x more rays and build times would be longer. The Final Gather sends out a bunch of rays in a grid to sample the scene's lighting, and then sends more rays anywhere that there were big brightness differences between neighbors - this is called adaptive sampling. We don't have to do the expensive Final Gather everywhere though, just in a few places and then interpolate the results. This is called Irradiance Caching, and the technique places more lighting samples (Final Gather points) in corners where the lighting changes rapidly, while sampling less often on flat areas. This is another 10x speedup over naive brute force operations. All of this is heavily multithreaded so it uses all the CPU cores in your machine to build as fast as possible.
Some images to help explain:
Some other cool stuff going on here:
Let me know if you guys have questions."