ROBLOX Ray Tracing Plugin

So I have been working on a Ray-Tracer plugin for ROBLOX Studio for the last couple of days.
There have been some quiet interesting results.

I just felt like charing my results with you guys. Maybe I get some feedback to current problems.

What can the plugin offer so far?

  • The plugin offers (Soft) Shadows
  • Reflections with custom depth
  • anti-aliasing
  • sampling

How does the Plugin work?

  • The Plugin lets you select an area on the Viewport you want to render.
    After selecting the area and clicking on “Render” it starts to Render the image pixel by pixel.
    That means the resolution of each Render is 1:1! The image is drawn with Frames. Each frame with a size of 1x1 pixel. Roblox has a limit to how many UI-Objects you can have on your screen at once. The plugin has a build in compression algorithm that reduces the Frame-count by up to 68%!

Problems with the Plugin:

  • It has a huge, and with huge I mean enormous, memory leak. When rendering a big scene you might need to reload the game before doing another render the same size. The memory usage stays high even if you remove all frames. Thats why you have to reload the game. I am not sure why that happens as each frame is removed using :Destroy(). There are no references to the frames either. It might be a problem on ROBLOX’s end but I am trying to fix it non the less.
  • Another thing are the “Soft” shadwos. They look kinda blocky still. (Images below) I have tried shooting multiple rays at different locations on the light to calculate the strength of the shadow and I have tried to average all samples but the blocky-shadow effect does not want to let me alone. If you have any idea on how to fix that, please let me know.

Here are some Renders:

Scene-Size: 1112x501 (557112 Pixels)
Reflection-Depth: 4
Anti-aliasing: true
Time to render: ~20seconds
Threads: 1
(yes, 20 seconds on one thread, I was curious, that’s why)
Frame-Count (compressed): 5291
Light-Parts: 1
C__Users_Niklas_Documents_ROBLOX_Stuff_RenderPlugin.rbxl - Roblox Studio 8_6_2022 5_37_32 PM

Scene-Size: 1112x501 (557112 Pixels)
Reflection-Depth: 4
Anti-aliasing: true
Time to render: ~4min
Threads: 2
Frame-Count (compressed): 9736
Light-Parts: 2

Note: It has not the best quality but that’s roblox’s fault. A ray detects a mesh even if that part is not rendered (doublesided off), even with such limitations it turned out good in my opinion. (Windows have no reflection modefier, I forgot to add them)

Another Note:

  • As of now I am not planing to release the plugin anytime soon as it’s still in alpha.

Feedback and suggestions are appreciated!

20 Likes

Wow, this is amazing!
This may be the future of roblox studio building!

2 Likes

I dont think it’s the future of building, but with some polishing it would be a nice thing for icons.

1 Like

I agree with you. As I said in the post, there is a lot to improve on. Some stuff is on Roblox’s end and other stuff is where I got to work on. I wish Roblox would give us the ability to utilize the GPU. It would speed up the Ray Tracing so much that we could add RealTime Ray Tracing. But even without Real Time Ray Tracing it performs well enough.

Cool thing, but… how u even place so much gui, it gonna crash ur studio, not?

It does not crash because I have implemented an algorithm that merges similar looking frames into a single frame. For example, the red and yellow tiles are consisting of one large Frame and a few smaller frames each.
The frames stay at around 6k to 18k depending on the render. However it uses more RAM than Chrome.

u apply this algorithm while rendering it?

Not really. When I render the image, the render method returns a table with data for each pixel.
That data gets compressed and the result get send to the draw method which then draws the image ro sceen at the end.

1 Like