LightUp! The perfect plugin to fix your lighting

I actually done it incorrectly here.
The correct formula is R/(square root of 3)

If you use a 3d ver of the Pythagorean theorem you get D^2 = A^2+B^2+C^2
But in this case, A, B, C is S or one side of the cube in the grid so it can be simplified as:
D^2=3S^2 or D= (3S^2)^.5. or D=S(3^.5)
R being the radius you are checking
D is the longest length from corner to corner in a cube so D=R or R = S(3^.5).
Since we have the radius (R) but want S we just divide both sides by (3^.5) to get R/(3^.5)=S

1 Like

After consulting a friend (chatGPT o1 (gosh my future in CS is over))…
The entire cleanup code needs to be rewritten with a KD-Tree. If you are wondering what it is. Look it up.

1 Like

I added a warning for baking that might crash Roblox Studio.

Edit:
My code is a mess, im just going to revise how the calculations work fully.

Edit 2:
I’ve wasted enough time… (send help)

I think I’m just going to remake the plugin, ground up.

Edit 3:

I don’t know why I’ve done this, but I made a better version of the inverse square law.
image

n is the constant: 7.9372212227315
(found with some python code)
image

And a is the range of the light.

When the brightness is 1
And the range is 20.

This sure is fun…

(Oh and if you are wondering, what if you changed brightness? well here’s the code for that!)
image

Edit 4:

A companion of mine (GPT-4o) has outdone me with a binary search algorithm.

Edit 5:

All implemented.
Before:

After:

Edit 6:
Light tinting.

Edit 7:
That wasn’t fun.

Edit 8:
Bug fixes (too boring to get into, fixed edge cases with lighting).

Edit 9:
By using smooth light technology (insert trademark here)
Before:


After baking without smooth light:

Baked with smooth light:

We can use fewer points, and get less visible points, but it sacrifices some accuracy (to an acceptable level).

How it works is that instead of distancing one stud from the wall, it distances points from one stud from the walls, it will distance them by 1/3 of their light radius or half the distance the ray traveled (depending on which is smaller)
image

Edit 10 (spot and surface)
Full support for spotlights and surface lights.
(blue for spotlight, red for surface lights)

2 Likes

This looks extremely awesome man, do you plan on releasing this? And if so, when?

That’s gotta be a maybe, but I could send ya the files
something something developer stuff.rbxmx (187.6 KB)

It has a few things not exactly shown, like how if you place NumberValue named “BakeryRange” and set it to a positive number, it will override the light’s current range (it also allows for way more than 60 studs range)

Oh and I recommend just turning off Default Casting and just tweak around with R1

(Don’t know why I just didn’t make it automatically tweak R1 by default)

Almost forgot, if you are doing like high-precision bakes, I hope you have a crap ton of ram. I’ve seen it use 21 gigs of ram before (while pushing this plugin to its limits) you prob won’t get to this level tho with normal usage.

1 Like

Yo! Thanks for the response, I appreciate you giving me the file as I really did not expect you to respond lol.

I downloaded it, imported it and tested it for a bit and I gotta say it’s pretty cool tho I think it could use some work to make it even better than how it is as of now

Here is a list of suggestions I have in mind:

  • The UI honestly could use some work
  • Make it so you can bake lights that you pick/choose instead of baking all lights (unless I’m an idiot and I probably missed that :sweat_smile: )
  • I would add descriptions explaining specific stuff such as “Random 1”, "Random 2 ", “Base”, “Brightness Multiplier” and etc.

that’s it pretty much but as of now I think it’s pretty awesome! Good stuff!!

1 Like

It’s kinda a little developerie thing, so only I really understand all of it. At some point, I would make it more intuitive and have more features. (I did think of making the area baking thingie where you can select specific lights, but I need to make some special points so the lights that are in that area can account for other lights that are already baked (in summary, it will take a long time))

Oh and my Discord is alex_ispig#0 if you need a faster way to contact me.

E1:
Now that I’m thinking of it… No I will not be planning on implementing baking specific lights, not ever. I have put into account for the technical aspect of it.

To do this: you must keep into account of every place points, this could be thousands, millions, or even billions. Most computers tend to have limited RAM, keeping the entire set loaded will likely cause some heavy usage of RAM.

And if I didn’t do this, the baking quality will not be up to standard.

Another solution is to bake everything but only add the specific points… Just bake everything at that point.

As much as I’m a sucker for realistic lighting, this just isn’t practical for production-level games, nor is it the way to go. The number of light instances used to light up a room with a single light source when just two (Source and Bounce) could be used (while still looking realistic) is just obscene. The way I see it, developers would be better off putting their time, effort and money into learning how light actually propagates and instead using that knowledge to more efficiently use light instances.

Take this free model I found and touched up on the toolbox for example.
No Bounce - 25 Spotlights, 0 pointlights

Bounce using plugin - 25 Spotlights, 77 Pointlights


(This did not work well. Not sure if it’s the geometry or the fact that I’m using spotlights.)

Bounce using manual placement - 50 Spotlights, 0 Pointlights

All lights have shadows enabled, meaning the plugin baked one both looks AND performs worse.

2 Likes