Custom Baked Lighting “Engine”

I’m going to add in some optimizations that were suggested. In the meantime, I suggest avoiding rendering parts that are too large and adding a wait to the renderMapPoint block in the Lightmap module.

Point lights are the only light types supported. Meaning all other lights will be treated as point lights.
Also, the max brightness you can have on a part is 5, and it takes a larger brightness value for the lights to be effective than Roblox’s regular lighting system.

I should’ve put this in the Things to know beforehand section, so I apologize for the confusion.

1 Like

Alrighty, I ended up modifying some things.

A yielding method and parallel lua has been added. Meaning the execution time for rendering is a bit faster. I also added some options for improving lag in the “Things You Should Know Beforehand” section.

Though I haven’t added spotlights yet, I changed the functionality of the lighting calculations to be more accurate to how Roblox calculates their lighting. This means that Brightness values for lights are properly calculated.

I also ended up replacing the demo place file and module on the post to include the updated versions.

2 Likes

Can I make the shadows very sharp? Roblox’s normal shadows are just pixelated.

there is no way to set this up, there is no instructions what do you want us to do other than download it :confused:

I figured that the “How Do I Use It” section covers how to use the system. The demo place file linked there is meant for those who don’t know how to set the system up themselves. In the place file, navigate to any script in workspace and read the rest of the “How Do I Use It” section to understand how it works.

You could increase sharpness by changing the texture id in the lightmap module and lowering the render scale. Setting the texture id to an a solid white image would remove any smoothness. Depending on the texture id though, you might need to also modify the extended render scale to compensate for the smoothing.

Can you leave a link to the source on GitHub if you can?

Here is the thing I navigated to any script in the workspace and I was stuck bc I didn’t know what I was told to put in them, I copied the line of code but I noticed most of that was in the script for me, so I put the line of code in the line where it had one parenthesis but I tried to where I didn’t understand what I was supposed to do

All I got from that was a bunch of red lines under my line of code as if it was written wrong.

Wow, this is really cool! Met you a while ago on Mustang’s Discord server and you got straight to Advanced lol. Never thought this was possible on Roblox

1 Like

ngl, this system + some optimizations and my own touches can make the ultimate lighting engine that can cover up some of the things the future lighting cant do.

My idea was to change the fps of the shadows or calculations of the shadows when it needs to.

Also unrender shadows depending on player range reducing calculations…

Also slap in some more lighting stuff into the engine with certain optimizations.

Move and change your wait. Try this:

task.wait(0.1)
end
task.wait(0)
end

I doubt he needs to because now the module yields itself.

1 Like

I remember you! I miss that server lol.

Also feel free to post anything that you add/change here! There’s a lot more that could be done for specific purposes.

2 Likes

Hello good sir, I do have a few ideas for this lighting system.

  1. Make it range based so that the shadows appear when player is within a certain range of a part. This is to solve issues of constantly calculating multiple raycasts across the whole map.

  2. Reduce Shadow FPS whenever its getting laggy. For an example, the shadow would normally run at 60 FPS. However, the fps would change/reduce when it needs to do so. So rather than causing more lag and reducing the player’s FPS, It reduces its own FPS to try and save performance.

I have another idea, but ill like to keep it private…to myself.

1 Like


u can change the texture of the shadows… pretty interesting result…

5 Likes

Woah! That looks like it’s straight out of a comic book.

1 Like

You should add a “SurfaceGui” mode for the shadows and calculate the position so that they dont go like this:
Image

I attempted doing so previously to not so great results :confused:

I feel stupid for asking this, but how do I make it work? I’m not sure if I’m doing it quite right.
There’s light leaking through, a dark haze around shaded areas, and sudden cutoff where shadows don’t work anymore.

How did you do the realtime shadows system?? Would love to know.

Edit: Im studying your code, looking at the function for shadowOnly. Won’t take long before im done.

Wait, How can i do real time shadows?!