Downgrading from HDRP?

Hi, wondering if it’s possible to make a game in HDRP and then downgrade it to LDRP for cross-platform someday? My best guess is there will be some script like the Unity updator to help you change the whole project, but leave tons of pink materials to be fixed yourself, and of crouse, some feature will be lost.

I do not think there is any provision made for this scenario because Unity not support this use-case as far as I know. They don’t give support for people swapping SRP’s, only very minimal support for built in to HDRP via standard shader to lit conversion, and this only works on the basic standard shader.

So to downgrade you will do it all by yourself. You will remove HDRP via package manager. You then go and replace all your materials and fix all your reflection probes. You adjust all the lighting etc. And so on. You’ll also be having to change textures where necessary.

If you just sit down and do the work, it really doesn’t take more than a week for any project, writing the occasional script where required to automate things.

1 Like

Not checked it myself, but on THIS unity blog post they use a sample project, they mention:

“On the Readme inspector, you’ll find buttons to switch between Lightweight and High Definition Render Pipelines. This is mainly to allow you to author assets and test compatibility between pipelines — for production, we recommend using only one render pipeline.”

So check it out.

1 Like

Also you might learn more about the process and pitfalls by looking at how upgrading from builtin to HDRP is done with this recent doc: https://github.com/Unity-Technologies/ScriptableRenderPipeline/wiki/Upgrading-to-HDRP

Ultimately, people should test with a copy of their project or sample scenes to get the hang of the process.

1 Like

Thank you guys, it seems feasible as long as we keep substance source files. Also, as @hippocoder suggested, perhaps a few more automated scripts and some short-term hard work :wink:

Just want to say after reading this forum I didn’t feel I had a week and almost didn’t do it but went ahead anyways. My project is small in size, around 5gb’s. I have to say it was extremely easy and took less then 5 minutes. Only pain in the butt was changing the materials back but rather easy since I have them sorted together in my projects folder. All I did was go to package manger, removed hdsrp. Fixed materials. Good to go. What a relief, I was running into brick walls left and right in the HD pipeline. It’s still way to early in my opinion to be used by a mid level user.

5 Likes

Would you be willing to share a bit more on your specific brick walls? Maybe even on its own topic. I’m considering migrating to SRP but I’m on the fence and leaning to not migrating at all.

I’ve used HDRP for a few months, here’ are some experiences.

  1. Regarding HDRP/LWRP migration, pipeline differences cannot be ignored. Say if you’re using HDRP, probably you are targeting top-notch graphics, which LWRP might not support. AFAICS, HDRP is not designed for the multi-platform purpose.

  2. Packages like PostProcessing has been integrated into HDRP in Unity2019, some implementation of effects has been changed a lot and I’ve to re-authoring all PostProcessing effects in Volume, vice versa. It could be a trend, only Unity Tech can explain this.

3 Likes

I created this script to fix the material, if someone is interested:

[MenuItem("Tools/Fix materials")]
    static void Do()
    {
        var standardShader = Shader.Find("Standard");
        var materialsGuids = AssetDatabase.FindAssets($"t:{nameof(Material)}");
        EditorUtility.DisplayProgressBar("Fixing materials", "", 0);
        var counter = 0;
        foreach (var materialGuid in materialsGuids)
        {
            var materialPath = AssetDatabase.GUIDToAssetPath(materialGuid);
            var material = AssetDatabase.LoadAssetAtPath<Material>(materialPath);
            EditorUtility.DisplayProgressBar("Fixing materials", material.name, counter++ / (float)materialsGuids.Length);
            try
            {
                var shader = material.shader;
                if (shader.name == "Hidden/InternalErrorShader")
                {
                    Debug.Log(material.name, material);
                    material.shader = standardShader;
                    EditorUtility.SetDirty(material);
                    AssetDatabase.SaveAssetIfDirty(material);
                }
            }
            catch (Exception e)
            {
                Debug.LogError(e.ToString(), material);
                break;
            }
            finally
            {
                EditorUtility.DisplayProgressBar("Fixing materials", "", counter / (float)materialsGuids.Length);
            }
        }
        EditorUtility.ClearProgressBar();
    }
1 Like

what does this script does. ?

How do i make this script work? I’m not great at scripting, so where do i place the script, what should I copy in the Csharp?

Here’s a little script i made, it’s from HDRP/Lit —>Standard shader but you can easily modify it to fit your needs.

using UnityEngine;
using UnityEditor;
using System.Collections.Generic;

public class DowngradeMaterials : EditorWindow
{
    [MenuItem("Tools/HDRP to Built-in/Lit --> Standard")]
    static void DowngradeLitMaterials()
    {
        Undo.RegisterCompleteObjectUndo(Selection.objects, "UndoDowngrade");

        Object[] selectedObjects = Selection.objects;

        List<Material> hdMaterials = new List<Material>();

        for (int i = 0; i < selectedObjects.Length; i++)
        {
            if (selectedObjects[i] is Material)
            {
                hdMaterials.Add(selectedObjects[i] as Material);
            }
        }

        for (int i = 0; i < hdMaterials.Count; i++)
        {
            //Get render type Opaque = 0, Transparent = 1
            float surfaceType = hdMaterials[i].GetFloat("_SurfaceType");

            //Get Normal map
            Texture normalMap = hdMaterials[i].GetTexture("_NormalMap");

            //Get Mask Map - Metallic(R) - Ambient Occlusion(G) - Detail Mask(B) - Smoothness(A)
            Texture maskMap = hdMaterials[i].GetTexture("_MaskMap");

            //Get Emission Map
            Texture emissionMap = hdMaterials[i].GetTexture("_EmissiveColorMap");

            //Get Detail Map
            Texture detailMap = hdMaterials[i].GetTexture("_DetailMap");

            //Get main texture tiling and offset
            Vector2 first_UV_Tiling = hdMaterials[i].GetTextureScale("_BaseColorMap");
            Vector2 first_UV_OffSet = hdMaterials[i].GetTextureOffset("_BaseColorMap");

            //Get detail texture tiling and offset
            Vector2 second_UV_Tiling = hdMaterials[i].GetTextureScale("_DetailMap");
            Vector2 second_UV_OffSet = hdMaterials[i].GetTextureOffset("_DetailMap");


            hdMaterials[i].shader = Shader.Find("Standard");


            //Set render type
            if (surfaceType == 1)
            {
                //Opaque = 0, Cutout = 1, Fade = 2, Transparent = 3
                hdMaterials[i].SetFloat("_Mode", 3.0f);
            }

            //Set Normal map
            hdMaterials[i].SetTexture("_BumpMap", normalMap);

            //Set Metallic map
            hdMaterials[i].SetTexture("_MetallicGlossMap", maskMap);

            //Set Occlusion map
            hdMaterials[i].SetTexture("_OcclusionMap", maskMap);

            if (emissionMap != null)
            {
                //Set Occlusion map
                hdMaterials[i].SetTexture("_EmissionMap", emissionMap);

                hdMaterials[i].globalIlluminationFlags = MaterialGlobalIlluminationFlags.BakedEmissive;

                hdMaterials[i].EnableKeyword("_EMISSION");
            }


            //Set Detail Map
            hdMaterials[i].SetTexture("_DetailAlbedoMap", detailMap);

            //Set main texture tiling and offset
            hdMaterials[i].SetTextureScale("_MainTex", first_UV_Tiling);
            hdMaterials[i].SetTextureOffset("_MainTex", first_UV_OffSet);

            //Set detail texture tiling and offset
            hdMaterials[i].SetTextureScale("_DetailAlbedoMap", second_UV_Tiling);
            hdMaterials[i].SetTextureOffset("_DetailAlbedoMap", second_UV_OffSet);
        }
    }
}
11 Likes

Can you please provide an upgraded link? The one you have hear is 404!