HDRP Raytracing completely production unusable on 2021.LTS

We are on 2021 LTS
Since DX12 is now supposedly fixed we wanted to try the Raytracing features.

Turning on Raytracing, the FPS instantly dropped by half. We tried through all the settings and effects, the results actually do look nice.

After some digging and turning off everything, it turns out that the effects themselves actually don’t cause the FPS drop, but that there is an insane fixed cost.

We looked into the code and terrible terrible practice “FindObjectsOfType” completely eat the entire game performance without any single effect being turned on. No shadows, no AO, no Light, no Reflections.

10+ MS for Find Object of Type

As an artist and complete junior programmer I even know how to avoid extremely slow things like find object of type. Yesterday I optimized a list to avoid 5 find-objects for some tweens in the UI.

Looping through tens of thousands of mesh renderers every frame with find object of type is on level beyond imagination

Really not sure what to say

The next stable version of Unity that will have this fixed is end 2023 (when 2022 LTS is ± stable)
So no raytracing for this entire project cycle and maybe the next, that is really great and we are thrilled

2 Likes

Wow that is pretty embarassing.

2 Likes

DX12 is out of experimental since 2022.2.0a17.

The code you’re seeing is very old and does not exist in a modern version of Unity/HDRP. It was removed in October 2021 and required an editor API change that was first seen in 2022.a13. New features/API changes do not land on LTS, only backported bug fixes do.

1 Like

i was thinking the same, there is no DX12 on LTS version yet (not that i know)

The marketing push from Unity around raytracing was 2020 - 2021, not 2022. We are long before a stable 2022 version. DirectX 12 came out almost 8 years ago. Thats like having Windows 10 support on experimental.

2022-2023 we are now in times where raytracing is no longer cutting edge. Epic already deprecated DX raytracing.

Also the 2022 version still does find object of type lookups. It’s much better but still not correct, and the lists even already exist but are funnily not used.

In a test of the 2022 It took us around an hour or so to fix the mistakes and then all the overhead is gone however, but its still there. Anyone not looking inside the code and forking the HDRP will lose a good chunk of CPU performance for no reason.

2 Likes