(hopefully not generic) global illumination

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)

8 Likes

That looks good, I’ll keep an eye on this.

2 Likes

Interesting, why would you call it the worst one?

2 Likes

ShadowMap is the worst simply for performance reasons and visual reasons. It is the middle child of Future is Bright.

  1. Shadowmap does not support localized normalmapping. That’s right. voxel supports local normalmaps, but shadowmap doesn’t. ShadowMap only has normals for objects under sunlight.
  2. Horrible performance. Out of future and voxel, shadowmap can arguably perform the worst (the same as future in some cases, when future offers pixel perfect local lights, all due to;
  3. Ambient Occlusion. AO is a great effect, but shadowmap puts emphasis on it… by attaching it everywhere like a plague. The performance is especially unbearable, since it is on every intersecting/touching surface or corner. (hence why places with many buildings or rooms, or places with corners, will see somehow similar performance on ShadowMap as on Future). Also, the future AO is far better, since it goes off secondary light and shadowmap falsely occludes objects that… simply are not meant to be occldued. (eg; something under direct light)
3 Likes

Oh I thought you meant future lighting :sob:

2 Likes

Looks great, should be better than other global illumination models.

1 Like

example images with voxel lighting and shadowmap? i really want to see the difference but nowdays most of the games use shadowmap or future

1 Like

Thanks! I’m gonna build it into an engine with other gimmicks like lens flare and exposure, motion blur… etc.

I like ALARE 2.0, and that’s my inspiration. I won’t release unless I can get it to run on semi playable on my Integrated graphics card, with maybe real time.

I will also have other things built in and stuff.

2 Likes

Here is voxel;

Here is shadowmap;

1 Like

Looks good! Keep working on it!

2 Likes

is this intentional or what? like shadowmap is an extension to voxel. anyways which performs better

I have no idea. My first assumption is that it’s an oversight from ROBLOX; I don’t have a reasonable explanation.

Voxel obviously performs better, and I noticed voxel produces AO too in some cases.

1 Like

That specular highlight is the only difference between those two images, it’s most likely just some light leaking as voxel shadows are janky.

They are both identical in ao behaviour.

1 Like

I didn’t take the picture so I wouldn’t know, but point is shadowmap is buns.

That i can agree on its litteraly just slightly nicer sun/moon shadows.

2 Likes

Exactly. I was shocked to see that ROBLOX were making future lighting the default studio lighting on new places sometime in 2025 on the roadmap. Like, this has not been in place?

2 Likes

Though it does support more lights than future does(some pitiful number between 100 and 150) shadowmap and voxel support a lot more but with horrendous quality.

1 Like

Making this specific GI, I was testing on shadowmap, and I noticed that with like under 4000 lights, the lights began to display red green and blue splotches, have incredible randomness, and sometimes just outright not display correct colors…

Yeah that is an issue but with my GI solution that also runs on future its impossible to get nice resolution before roblox starts removing distant lights, id rather the blotchy light artifacts than no lights.

I’m working on proximitychecks right now to address the issue of light disappearing.