r/GraphicsProgramming 4d ago

Question Is Ray Tracing Ahead of Rasterization?

I've spent the last 15 months building and optimizing a game engine with a Vertex / Fragment shader. It's pretty well optimized, hard to quantify but I've hit 90fps on standalone Quest 3 with it, so it's not a complete cow.

I wanted to do some ray traced audio stuff so I looked into ray tracing through Vulkan. As a stress test I was like "I wonder if I shoot a ray through every pixel what types of times I'd get."

I expected my Vertex/Fragment shader to win by 10x. It didn't. It won, but by more like 2x. And as I've added optimizations the past 48 hours it's closer to 1:1 in terms of cost (and I expect ray tracing to pull ahead with foveated rendering for my VR work & after I optimize further). Granted this is on my desktop 4090 and laptop 3070 but...

What are your takes on this? I feel like I failed to do my homework here as I really didn't expect this.

39 Upvotes

20 comments sorted by

51

u/crimson1206 4d ago

Shooting a single ray per pixel and stopping on the first hit isn’t too expensive. Actually doing full blown ray tracing with multiple bounces and more spp is what’s very expensive.

7

u/Keyframe 3d ago

that's the answer. Note well though that even with 1spp and let's say 2 bounces and then ray reconstruction it's damn isable and clean these days. Nvidia's DLSS-RR is magical. I haven't checked out AMDs FSR 4 yet because they said fuck you to Linux still.

1

u/R4ND0M1Z3R_reddit 1d ago

What are you on about? FSR4 is on Linux for almost half a year at this point, and even with non-RDNA4 support. Read up here: https://themaister.net/blog/2025/05/09/conquering-fidelityfx-fsr4-enabling-the-pretty-pixels-on-linux-through-maniacal-persistence/

To get ahead of you: FSR is not an umbrella term like DLSS - denoiser is separate. 

50

u/waramped 4d ago

If all you are doing is shooting a single ray per pixel from the camera (say to populate a Vis buffer or something), then RT is faster. It's been faster than raster for that since the 2080s came out. But that's a trivial case. RT hits alot of bottlenecks once your BVHs get complex and deep, once you have to start managing a lot of dynamic objects and scheduling refits. And once you start shooting MORE rays around for shadows, bounces, etc. Then it slows down. That's changing though. It won't be long until raster will be used for special cases and RT will be the norm. But not quite yet.

4

u/PictureNew661 3d ago

But thats just how traversal works isnt it?

RT cores are fixed function by design, carrying upto 8 32B registers as a payload. RT doesnt really care what the scene is. Its only work was to make ray triangle intersection blazing fast

4

u/Array2D 3d ago

The rt cores are quick at traversing bounding volume hierarchies and performing ray-triangle tests, yes, but something still has to generate those bounding volume hierarchies and update them each frame.

Additionally, there’s only so much you can do in a cache-efficient manner, especially with things like bounce lighting and reflections, where one ray only slightly different from another in direction and origin will end up at wildly different parts of the scene N bounces down.

Modern ray tracing hardware did speed up some parts of ray tracing, but only by a constant factor compared to compute shaders. You still get exponential blowup in workload when you need multiple bounces, especially for materials that aren’t perfectly reflective, which require multiple child bounces to resolve with reasonable accuracy.

16

u/TheWidrolo 4d ago

The thing is, most people don’t have cards that can do RT well. Even an average AMD card today will never ahead of rasterized graphics, the RT cores in AMD cards are not very good.

Having said that, we will still need more research and tech around it to get a full path traced renderer that can render graphics without rasterizing (except for ui and post processing).

I would also really like to see that 1:1 you mentioned. Is there a GitHub link to it?

-7

u/icpooreman 4d ago

There is not. Private work. It's a little trust me bro', but it is real.

It's a pretty easy experiment to do though once you have the acceleration structure set up. Just fire like a billion rays and measure the times.

1

u/icpooreman 4d ago

Also it's a tough measurement to do apples to apples.

Like my Vertex/Fragment shader has all sorts of crazy tricks I'm doing for real-time lighting calculations etc.

Meanwhile my ray trace version can largely bypass those algorithms completely.

But admittedly maybe I'm not direct comparing pure rasterization write to a gbuffer and die vs. the exact same thing for ray tracing. If I did that it may not be 1:1 I think it'd be more like 1:2 again. But that's also not the real-world. Point is for me in the real world with what I really need to calculate the literal best I could do in 15 months is close to 1:1 with me playing with ray tracing for 48 hours.

16

u/Array2D 4d ago

Generally no.

Ray tracing today leans heavily on denoising filters and neural frame generation because it’s still not possible to shoot enough rays per second to compose an accurate, good-looking frame on the same level of quality as a rasterized one with “fake” GI.

Whether you find the quality of a denoised, frame-generation assisted motion visual acceptable (much less better) compared to a well done rasterized one is ultimately a matter of opinion, but there’s no getting around the fact that it introduces ugly artifacts and increases latency to do so.

Personally, I think RT is still at the gimmick phase for game graphics, and it’s going to be a long time before we have true real-time ray traced visuals.

4

u/le-throw-away-acct 4d ago

Yep, and even the games using it are mostly using it for calculating lighting, shadows, and glossy reflections, otherwise it’s still rasterization. A full path-traced game is still rare or usually very simple because it’s just too expensive.

We’re a couple orders of magnitude of speed away from being able to do fully path traced real time AAA titles without a lot of AI to guess how to fill in the gaps.

1

u/thimmythimble 2d ago

sorry this is wrong. If you don't include the BVH build times (this sentence is doing a lot of work), you can ray trace your visibility faster than you can rasterise it for complex scenes on modern GPUs. After BVH build times, you can render identical frames faster using ray tracing than rasterisation. You can also render every single frame identically without any rasterisation and just ray tracing, except conservative rasterisation (which isn't really used). This guy isn't talking about ray traced GI.

1

u/Array2D 2d ago

Sure, if you’re not doing any bounces, and rendering a static scene with a pre-built BVH, then ray tracing may be comparable or even faster than rasterization.

That’s quite the edge case though, as far as the applications of this technology go. The numbers don’t lie when you actually start doing complex real time visuals.

0

u/thimmythimble 2d ago

this is apples to oranges - multiple bounce effects enabled by ray tracing simply aren't an option when only using raster graphics. However, every effect used with raster graphics is applicable to a ln RT pipeline.

If we're comparing raster to RT performance I don't see how it's relevant if multi bounce path tracing is slow - we simply cannot do that without RT, and all alternatives are compatible when we are using RT.

6

u/PictureNew661 4d ago

In terms of HW RT performance, yes things are kinda getting tighter in the difference.

I wud like to see that 1:1 with concrete numbers because very few modern cards (including 4090) are capable of absurd RT performance.

In terms of what the current research has, rasterization will still be faster all because it's full hardware acceleration and the passes are coherent in memory.

ReSTIR PT Enhanced (2026) was a good example of real time path tracing, but not rasterization speeds that wud make it immediately viable for everything.

But I wudnt say the RT has outdone raster in performance.

Even raster hybrids like Lumen struggle, on HW RT

2

u/cybereality 4d ago

You may wish to try Steam Audio, as this includes some fairly advanced 3D audio (including occlusion based on scene geometry, HRTF, and more). The license is pretty open and essentially free. https://valvesoftware.github.io/steam-audio/

Even if you wish to code this DIY, might be a good idea to see what they did, it was used on Half-Life: Alyx.

2

u/Ok-Sherbert-6569 3d ago

Also RT can be a lot faster if you’re just doing a first pass because it automatically does occlusion culling if you have a lot of instances along your depth that are occluded

0

u/[deleted] 4d ago edited 4d ago

[deleted]

-1

u/Adventurous_Chef2225 3d ago

first of all vsh and fsh passes r not really optimised for RT ... either use the VKRT API to accelerate it using rt cores or make compute rt for non rt gpus , requiring vulkan compute