Global illumination is a widely spoken about topic on here - and you are probably tired of seeing so much of these “realtime” or “gi engines” or “raytracers”.
I know it may be hypocritical, but I am going to tell you why mine specifically should be of “More interest” (though thats up to you to decide).
I modeled it based off of Elttob’s post in 2022, as well as various references from posts here. Here are the features that separate it from every other shadowmap based engine/gi engine;
-Built around future; Because be real, why would you pursue a effect like this on arguably ROBLOX’s worst lighting technology? Future also automatically addresses the light splotching problem of shadowmap I noticed, and it also offers shadows (though I think shadowmap would be “Better” to simulate soft shadows of GI.)
- Inverse square law: A lot of engines do not account for the inverse square law - double your distance from the source and the light is 4x weaker. A lot of engines just blotch their lights onto the scene without accounting for sunlight, bounces, and how far the light is from a prominent light source. They treat it more like lighting the scene up.
- “Lip balming”: Sometimes, the rendering methods these engines use make it just seem like the light is forced in places where… it shouldn’t really be.? I try address this with the above point and falloff.
- Light escaping walls/being very visible: An issue with shadowmap based GI is that the lights on shadowmap aren’t pixel perfect and are on the voxel grid - meaning it is much easier to make out lights that are touching/near a surface or the border of the lights.
- Accounts for light: I tried to model it in a way that it followed where sunlight was, and then place lights based off that.
I decided to make this for fun. It is still HEAVY wip (some of the issues I need to address):
- smearing
- random spreading
- coloring
- intensity of light
- light glare (light too close to walls)
- not real time
- visible/easy to make out at times
Also, none of these other ones ever explain hat they do (except for Elttob), so here
My hybrid approach first maps out a voxel grid (I have a module that has a very easily editable “Data” holder in it, meaning customization is easy peasy) based off given bounds. FOr optimization reasons, I skip voxels over Y level 64 and under Y level 0 (again customizable with YMax and YMin). I then shoot 60 rays from each voxel, and get generic color information of the surfaces they hit, as well as checking whether the voxel that shot the ray is under direct sunlight.
I then calculate an average and assing the voxel that color.
For lighting calculations, I give the voxels in direct light a preset brightness, and then, based off that, iterate through voxels not illuminated by the sun, giving them a brightness calculation that checks for the nearest voxel that is under sunlight, gets the distance, and then applies a simple formula to calculate. (note: I modeled it based off inverse square law, but did not use the law itself since I am testing right now. still close by to it!).
I then illuminate the scene and done.
There is a lot to be addressed, but I have been programming for a year and I think it produces a nice effect for now. I am working on it actively, and any suggestions are very much welcome!!!
Results may be a little innacurate for now, but all the issues noted above will be addressed, as well as planned features like glass refraction and proximity checks to walls.
*If I do finish it I will release it as open source, with more features than above listed and also more optimizations. (right now, its simple memory optimizations like cleaning parts and multithreading everything, but not good for RT)