Dear global illumination, please pay rent. (Devlog/Creations)

Dear global illumination, please pay rent.

incase you don’t get the joke (pretty dense if you don’t), The idea is I think about global illumination solutions so often it should ‘pay rent’ for living in my head.


(Fake Method) Iteration 1, 7/2/2021

Based on @testingacc333330’s fake GI system, In a nutshell I added a method for determining brightness and range based on object volume ((size.X,Y,Z)/3)

Credit to his original post

Comparison:
Testingacc’s method:


Note : The original source code has no Realtime features.

Iteration 1’s method:


https://i.gyazo.com/874ef16c3f76fa7d08045a93b865c709.mp4

In a nutshell, Iteration one added some important features to testingacc333330’s method, Mainly, Volume based Range + Brightness and an optimized refresh system


Commence many attempts at other ‘fake gi’ systems


(Basic RTGI) Iteration 2, 6/17/2022

(Roughly a month ago)
Got Content Deleted because I tested on a copy of the adopt me map (I got curious like an idiot and used a free model instead of an old roblox model)

with vs without :



*atmosphere is enabled in both screenshots

This system functioned by raycasting from a part (updated to match the suns position) down to a range around the player, the system did not support custom emitters and it had many issues with artifacting due to the ‘traci’ system (Placed points wherever the ray hits)


(Basic RTGI remake) iteration 2.5, 6/23/2022

Not important enough to showoff, it does almost the exact same thing that 2 does but rescripted and slightly changed to allow 3’s planned features


(Advanced RTGI) Iteration 3, 6/24/2022

(Shortly after Iteration 2)
Remake of Iteration 2, with many improvements including emitter probes and lifetime fade

Debug views (because they look cool)


With vs without:


This system was essentially a redesign of iteration 2, it included many new features like emitter ‘probes’, QuadBounce (rather than dualBounce), Traci Snapping (automatically snapping traci to a grid) and finally lifetime fade (fading brightness in and out over time). This system, while better than Iteration 2 still left me unsatisfied due to the continued artifacting, performance problems (when adressing the other issues with brute numbers) and brightness inconsistency

Actual quote on discord:
“I dont think it gets better than this, this is the prettiest dynamic lighting on roblox”

followed up by watching Elttobs amazing video and realizing, no, it can get better.


(ENVRTGI) (4) Iteration 4, after some intense thinking, 7/9/2022

A simpler method with more realism than 2 and 3 and but mainly stability advantages,


In a nutshell, rather than Raycasting from the sun (part representation) or emitters, we sample the scenes colors (3 dualbounce raycasts) and blend them together with the previous color of the probe, after that we determine the brightness of each probe based on emitters and the sun (checking distance and raycasting to see if the emitter is seen), This process is as trimmed and simple as possible to squeeze the most performance I can out of it to prevent lag, The entire scene is updated every 2-5 frames and the system is lightning fast. (Screenshots when complete)

Something I very much wanted to do is sample the ambient light color aswell but that seems very expensive using existing methods (MaximumADHD’s lightlib or the modified version I have of it)

Now that the system is done I can confirm the performance is not as good as my previous system however it is smoother than iteration’s 2 and 3 when it comes to artifacting and updates, The new system also runs much faster.

More in-depth technical update below


(EGI) iteration 5

Another new method, i5 now samples using region3, it also samples lightlevel rather than using a custom system. Most info from i4 applies to i5 so im not going indepth with this one. however the i5 system is under the hood very different so it gets its now iteration number.


To add some footnotes, There have been a few other systems mixed in between the iterations I list above (like 7 or 8 alternatives) but most of them were horrible performance hogs or ‘fake gi’ like the original (too important to not leave out), so I didn’t include them.


When will any of my suffering be available for you to experience? I might release a plugin/system that can do Realtime GI for your games, But that will come when I cant squeeze any more quality or performance out of this icky game engine (if you can even call it that), I hope my journey of fighting luau for performance pays off.

Finally, What have we learned from this little journey of Global illumination? I cant stop making these, please send help.


Details on some stuff
What does RTGI mean?

RTGI stands for raytraced global illumination, The method of RTGI I used isnt pixel accurate and instead randomly raycasts, samples + blends colors of objects it hits then returns the color and brightness determined to the simulated ‘traci’

What does ENVRTGI Mean?

Instead of simulating rays from emitters, we instead sample the scenery colors (Environment) with probes via raytracing, we then check the distance to emitters, followed up by checking if the emitter is blocked by a wall or object, this determines the brightness of the probes. This method works well for many reasons, mainly it reduces artifacting however in a ‘what is more realistic’ sense it does loose to my RTGI systems, however realtime raytracing isnt really possible on a cpu, ignoring the fact its not really possible on a single thread running inside roblox.

What specs are you running?

all above screenshots are captured on my second pc, it runs on an overclocked 9th gen core i5, an overlocked GTX1660 Super and 16 gigs of ram.

I have tested each system on my laptop aswell (Ryzen 3, Vega3 and 4 gigs of ram) though iteration 2 ran well, iteration 3 and iteration 1 both chugged around 30fps and made the laptop extremely hot, Im assuming its because iteration 3 addressed artifacting with animated fade and more traci per frame (at a lower emission)

Edit History

(7/9/22 : 3:20ish am) – Post created
(7/9/22 : 3:34am) – Added edit history, changed formatting and corrected timeline
(7/9/22 : 3:37am) – changed formatting (again), fixed some grammar
(7/9/22) : 3:37am) – remembered I’m sleep deprived and forgot to update the edit history
(7/9/22 : 3:40ish am) – added some indepth explainations and my specs
(7/10/22) : 4:13ish am) – updates and new reply to demo new iteration
(7/11/22) : 2:01 pm) – added i5 to iteration list

9 Likes

Iteration 4 : Extra Info + Update post


Iteration 4 Inspiration

The way iteration 4 works is heavily inspired by unreal engines Lumen GI system, Iteration 4 (ERTGI) creates a sample of the environment using raytracing (3 rays per frame), It then blends the colors it samples together alongside the last frames color (95% last frame and 5% new), After this I4 checks if the probe is in range of any emitters, In a perfect world it would already support emitters, however this is not a perfect world and I am extremely sleep deprived, i4 only supports the sun.

Iteration 4 Performance Drawbacks

I brushed on this subject briefly But I wanted to give more in-depth numbers for i4 in its current state,
The performance chugs above 250ish probes, However even around this number the memory use is a bit higher than I was hoping. My best guess is the amount of variables going in and out of memory, Keep in mind Ive never worked on a lua compiler and have zero idea how the garbage collection works. What I do know is, memory bad, gpu good, cpu bad, ping good, etc. The issue does seem to be a limitation of my scripting for now not the rendering engine so I should be able to squeeze more performance out of it via distance based update speeds or some other strategy I think up

Iteration 4 vs Previous

If you judge by screenshots and my statements alone you would probably belive iteration 4 is useless, however, Though it has dowsides i4 provides many useful features and benifits, area-based volumes and manual probe placement, Blazing fast calculation (roughly 10 frames to recalculate env data and a single frame to update emission data), Quick response times and mainly the stability of it (Visually), There are very few artifacts caused by the simulation and the few that do exist are usually updated out of the env data within 5 frames so they arent noticeable.

What about Iteration 4.5? or Iteration 5?

For the next major feature upgrade im giving iteration 4 the planned emitter system so it calculates more than sunlight, Im also going to implement many performance improvements.

What about i5?
Im thinking about combining both methods, Rather than calculating color and emission via env and distance to emitter, I want to calculate them with the older RTGI system due to it being more physically accurate, and atleast in my opinion better looking.

What else is coming in the future?

To celebrate the release of my nights in agony I plan to release a demo game that shows off different scenes with different GI systems enabled, i1, i3 and i4 will all be released open source alongside the games release. Iteration 5 will release open source alongside iteration 6 when I figure out what i6 will even look like.

What style of code are each systems written in?

all of the systems are written in the simplest most understandable way I physically can, packed with helpful info about how they work and how you can modify them.

You mentioned a plugin?

I did, I plan to release i7 (Hopefully the FINAL GI/light sim system) as a plugin for roblox studio, including its own editor and other tools to make quick pristine graphics running Realtime.

7 Likes

but how laggy is it, like what if I would want to use this? how badly will it rop the average computer’s performance?

Ill be making a new post documenting my progress since this post, Lets just say my new tracer library is to my knowledge the most efficient ever made on roblox. The system will be used in future Ulteam and venture interactive games. It will not be public anytime soon (though a plugin is still possible in the future) but as I did with this post I will break down some of the technical details behind the primary method for anyone who asks.

2 Likes