Agentlien / agentlien.github.io

0 stars 0 forks source link

Could you please share your method for getting Aura 2 working with URP? #1

Open CompilingShaders opened 1 day ago

CompilingShaders commented 1 day ago

Hey there,

I came across your post after spending days if not weeks looking into the best solutions for URP Fog. The built in solution for fog in Unity looks terrible, and I would love to use Aura 2, but I need it to work with URP. Any help would be greatly appreciated, as I have a deadline looming and good looking fog would really help me out. Thanks so much.

Ben

Agentlien commented 12 hours ago

Whether using Aura 2 is a good choice depends deeply on your project limitations and the expertise of your team. What kind of team do you have? What's their graphics programming experience? You also mention a deadline - how tight is it? You might not want to overhaul vital chunks of your rendering on a tight schedule.

The built in solution for fog in Unity looks terrible

Have you spent sufficient time setting them up and understanding the models? If you enable the volumetric fog in HDRP the underlying model is all but identical to the one used by Aura 2. If you necessarily need to use URP then Aura 2 is possibly a valuable choice, but it does depend on why you are limited to URP. If you need to ship on mobile or Switch, then know ahead of time that Aura 2 is simply too taxing for such platforms. I would heartily recommend Aura 2 if, like with Lost in Random, you need to ship on a broad variety of platforms and intend to use Aura 2 on the non-mobile platforms.

As for how to get Aura 2 working, there's a few tricks and a few caveats to how we did it in LiR. Most details are covered by this quote from the article:

In order to convert Aura 2 to URP we created a new ScriptableRendererFeature which calls the Aura code and blits the results to the frame buffer. The Camera.onPreCull and Camera.onPreRender callbacks were simply converted to RenderPipelineManager.beginCameraRendering callbacks. We also had to make some modifications to our shaders to make transparent objects play nice with our fog, since they don't write to the depth buffer.

The mentioned modifications for transparent materials boil down to calling a function which calculates the depth of fog in front of the transparent materials and mixing the right amount of missing fog back into the colour.

The one thing we did not solve in general was volumetric light sources. Instead, we created some special handling of sunlight. I can't share exact details, but with a bit of graphics programming experience it shouldn't be hard to replicate.