Is real-time performant Ray-Tracing possible?

Hey, I’ve seen some programmers post their work with Roblox “ray tracing” on twitter, or even here, but they haven’t made it open source, I’ve been wondering how it even works and how it would be possible in Roblox

I’d take a look at this Ray tracing how? - #7 by CoderHusk

Hey there.

As you know, real-time ray-tracing already makes a huge impact on performance when using a GPU to perform the math-operations.
I wouldn’t say it’s impossible but it sure is very much limited by the fact that ROBLOX has no API or framework for us developers to utilize the GPU, meaning everything is done on the CPU.
There is some advice I can give you as I have already some experience with creating my own ray-tracing engines in roblox.

  • Use threads (actors) to split up your work-load when rendering/ displaying the render to the user.
    Utilizing multiple threads greatly improves render-times for images with bigger resolution.

  • Use the “EditableImage”-Instance instead of many Frames or Label when displaying the final render.
    It is easier to work with and the :writePixels() method makes you draw all pixels at once rather than having to create each pixel using nested loops.

But to come back to your question.
Yes, it’s possible, but don’t expect to much. Trying to real-time render a scene in 1080p is not realistic here as we can only use the CPU for the math-operations. But if limited to a smaller viewport with a resolution of 80x80 pixels you surely can achieve real-time ray-tracing running at stable 20 to 25 fps.

Here are some of my results:

(real-time ray-tracing)

(bigger scene-renders)
These images take around 1 to 2 second to render.


If u have questions, please let me know.

  • DosenSupp2_0
3 Likes