Question: How do you convert HDRP to URP in Unity?


Converting from High Definition Render Pipeline (HDRP) to Universal Render Pipeline (URP) is a non-trivial process because these two pipelines are designed with different goals and use different rendering techniques. Here's how to approach this conversion:

  1. Backup Your Project: Before making any changes, it's crucial to backup your entire project.

  2. Install URP: Go to Window -> Package Manager, find the Universal RP package, and install it.

  3. Create a URP Asset: In the Project view, create a new Rendering -> Universal Render Pipeline -> Pipeline Asset (Forward Renderer) and optionally a 2D Renderer if your project requires it.

  4. Configure Project Settings:

    • Go to Edit -> Project Settings -> Graphics.
    • Assign the newly created URP asset to the Scriptable Render Pipeline Settings field.
  5. Migrate Materials:

    • The shaders used in HDRP are not compatible with URP. For each material, you will need to change the shader to one that is compatible with URP.
    • You can do this manually by selecting each material and choosing a suitable URP shader or use the Edit->Render Pipeline->Universal Render Pipeline->Upgrade Project Materials to UniversalRP Materials menu command for an automatic but less controlled conversion.
  6. Review Lighting Settings: Since lighting works differently between the two pipelines, you'll need to revisit your lighting settings and potentially re-bake lightmaps.

  7. Check and Update Custom Shaders: If you have custom HDRP shaders, they won't work in URP without modification. Converting these shaders involves rewriting them to comply with URP standards, which might require substantial effort depending on their complexity.

  8. Rebuild Post-Processing: URP uses its integrated post-processing stack, so you will need to set up post-processing effects again within the URP framework.

  9. Resolve Other Compatibility Issues:

    • Go through your project thoroughly to identify and resolve other issues that may arise due to the conversion.
    • This could include script changes for features that are handled differently between HDRP and URP.
  10. Testing: Finally, test your entire project extensively to ensure everything renders as expected.

Here's a pseudo code example to change materials' shaders to URP:

foreach (Material mat in Resources.FindObjectsOfTypeAll(typeof(Material))) { if ("HDRP")) { mat.shader = Shader.Find("HDRP", "UniversalRP")); } }

This code would attempt to switch each material using a HDRP shader to a similarly named URP shader. Note that shader naming conventions may differ, so this code may require customization.

Remember, converting between render pipelines should be done at an early stage of production where possible. If you're deeper into development, weigh the pros and cons carefully, as switching pipelines can significantly affect your project's visuals and performance.

Was this content helpful?

Start building today

Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement.