True Surface Reflections in Roblox! (Real-Time Raytracing)

Over the past year, I have been obsessed with creating intense visuals in roblox to push it’s limits to see what can really be achieved on the engine. At first, I thought it would be impossible to create a custom real-time raytracer in roblox. But boy was I wrong. I would like to introduce custom raytraced surfaces in roblox that runs in real time!

This was purely made within roblox and doesn’t use any third party tools, viewport frames, or even beta features. This consists of nothing but surfaces guis and raycasting, which means this could have probably been made back in 2013 (but i guess no one thought about it back then)

In the video shown above, I was rendering about 10 surfaces with a resolution of 15p on high graphic settings. I was also able to maintain 60 FPS when rendering 1 to 2 reflective objects. But when you go beyond that, performance starts to drop. But not an issue!;

PERFORMANCE vs QUALITY:

In the video above, I was rendering only a few reflective objects that are shown on screen on the default settings which are pretty intensive. (about 1 to 3 reflective objects on screen being rendered at once running at a range of about 30 - 60 FPS)

In this scene below, there are 4 reflective surfaces being rendered at once running at 10 FPS on high quality mode: (Which is like running 4 separate mini raytracers at once)

And in this scene, I reduced the resolution to 10p and disabled things like shadows, reflections in reflections, and vsync, and manged to run this scene at about 40 to 45 FPS:

Not even much has visually changed and performance has improved greatly!


I would also like to point out that this isn’t even using parallel lua and still runs better than you’d expect. If I could optimize code and implement parallel lua, this thing would run as smooth as butter without losing visual quality! So stay tuned to that!

Let me know what you guys think about this renderer!

Feedback and opinions greatly appreciated!

90 Likes

Holy crap
That’s super realistic my computer would cry if I run this!

Keep up the good work👍

9 Likes

Hopefully that wont be the case soon once i properly optimise this. My goal rn is to try and get at least two high quality reflective objects shown on screen to run at 60 FPS on a typical home computer

5 Likes

This is awesome, I’d like to see this in a game some day

5 Likes

I dont know what kind of magic is going on to make that work, but holy heck, good job dude.

3 Likes

The bast part of this is that it’s reflecting the player model, which I don’t think Roblox is doing with there reflections.

2 Likes

Roblox reflections is in the works, It will likely come out in 2022.

Was this done using the beta feature? Or was it coded

This looks great, I assume that the game sends an HTTPS request to a website that screenshots the players screen in realtime from a different perspective and uploads the textures and those textures and converted into the “mirror” which gives the look of reflections.

That’s sick would be cool if this was actually a feature

1 Like

nah
if that was the case there would be a delay on the reflections

1 Like

It could be using that new reflections thing

Truly magnificent I hope it can run on low end pc’s

1 Like

Nope. This doesnt use any third party tools or any beta features or anything. This was made with nothing but constant raycasts and surface guis for the pixels. This was purely made within roblox. this could have even been made back in 2013 when surfaces guis were released!

1 Like

Roblox doesn’t even have true reflections as far as i know. Thats why realmirrors dont really work. The closest thing they have rn is cube map reflections which aren’t even proper reflections really. Its pretty much just like skybox reflections

You can probably look at 1 or 2 mirrors on low quality mode to be able to sustain a decent framerate on a low end PC :sweat_smile:

I would like to point out that this actually runs relatively fast on my small Iphone8! All though the lag really kicks in when im looking at 3 or more mirrors.

But not to worry. I plan to optimise the crap out of this before i can get a test place up and running to the public!

1 Like

Jeeze that must be really laggy

I managed to make the raytracer faster by only casting one ray instead of two per pixel. This manages to add on an extra 8 to 10 FPS when rendering multiple mirrors. I can even run around 57 FPS when rendering 4 mirrors on performant mode! Big jump in performance and much more optimisation to come in the future!
(Might even make a new video of the new version of the raytracer)

2 Likes

Is this a client side render? This is pretty cool. I have been considering something like this with viewport frames and a WorldModel , but surfaceappearance isn’t fully implemented yet so it would still look awful

1 Like

Really nice stuff man. :+1:

Too bad that ray casts are handled by the CPU and not the GPU.

2 Likes