Ray tracing in URP? or only HDRP?

I thought HDRP is not meant for making games, and it is only used for making movies with Unity.
Can you use ray tracing in URP?
All online material show ray tracing is only for HDRP.
Once I tried to run the HDRP demo, it made my PC crawl just to be in the editor.

So where is there material on using ray tracing in URP?

AFAIK, Unity won’t make ray tracing effects in URP because it overlaps with HDRP features.

However, you can make them yourself. There’s an asset (by Wandering Corgi) related to the topic and I remember that the creator also wrote an article about the implementation details somewhere.

The tools to do it yourself in a custom render feature for URP (or even built-in) are all there. You’d need to create and maintain a RayTracingAccelerationStructure, write your own RT shaders, and then dispatch them with like CommandBuffer.DisptachRays.

For shadows, it’s fairly straightforward (just a lot of work!). I did it for an experimental custom RP to get perfect hard-edged shadows with hundreds of point lights, which is something you’d never be able to do with rasterized shadow maps. However, once you need to be able to sample actual surfaces (eg ray traced reflections or GI), it gets ugly fast unless you have a very constrained set of shaders. HDRP shader graphs can output the surface functions for RT, and the builtin shaders all just work with RT. But that’s not the case for URP/builtin, meaning you’re going to be going down a rabbit hole.

You can see this in the docs for that corgi asset – every shader needs to have raytracing support added. Which may or may not be feasible for a large project.

A few games have been shipped with HDRP. You can experiment with it to see if the performance meets your needs.

An older and/or weaker computer will do that with HDRP, and it’s even worse if you have a high resolution monitor (1440p/4K). My last work project was based around HDRP and had solid performance on our target hardware but our lead developer wasn’t able to run it at all on their older Apple computer that they prefer to develop on.

I think a Ryzen 7 2700X with RTX 2080 isn’t super old?
What are the minimum requirements fort HDRP?

Our game is built with HDRP and runs on all platforms except the Switch (we are porting to URP for it). I’d say it’s quite scalable if targeting 30 FPS on lower end hardware is viable for your game.

Raytracing, on the other hand, IMO is not ready for production at all. It doesn’t support Decals, VFX, terrains, volumetric fog, tessellation only to name a few. It also requires DX12, which only came out of preview in 2022.2, and often runs at lower frame rate than DX11. I’m not convinced if we’ll ever be able to update our game in its lifetime to support raytraced effects even for PC with a RTX 4080+ onboard.

You should be fine with that. I started working with HDRP using a Ryzen 5 1600X and a GTX 1080.

Would the hard edged shadows that you wrote work for URP? I’m just making cartoons over here and using URP for the stylized look, but the shadows aren’t great. If there’s a way to have ray traced shadows here that would be amazing. I’m on a high-end alienware PC and just making renders, so couldnt care less about performance, and dont need reflections or GI.

@DGordon I made this simple demo using inline ray tracing where I generate the shadow for a directional light in a compute shader, so you don’t need to change all shaders in your project. It’s not using URP but you can get some inspiration from the project GitHub - INedelcu/InlineRayTracingShadows: Sample scene that uses ray traced shadows generated by a compute shader using ray queries.

1 Like