Search Unity

Resolved Deploying for multiple RP

Discussion in 'SRP Dev Blitz Day 2022 - Q&A' started by Hazneliel, Sep 29, 2022.

Thread Status:
Not open for further replies.
  1. Hazneliel

    Hazneliel

    Joined:
    Nov 14, 2013
    Posts:
    305
    One interesting scenario would be when deploying for multiple platforms, we would like to take advantage of the different device's rendering power while maintaining it lightweight for not so powerful devices.

    For this reason we imagine a project to be deployable in URP and HDRP on demand.

    We are not sure what would be the best practices to maintain a project like this, and here are a couple of questions:

    1. Is this something that can only be solved by choosing the proper sub versioning/branching strategy?
    2. Does Unity offers any kind of tool to facilitate this?
    3. What are the pin points Dos and Don'ts of doing something like this
    4. Have you done something like this?
    5. Any advice and recommendation is highly appreciated
    Thank you
     
    sacb0y likes this.
  2. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    874
  3. arttu_p

    arttu_p

    Unity Technologies

    Joined:
    Jan 15, 2021
    Posts:
    22
    Hi! Let me start with at least a partial answer :) SRP Coexistence is indeed part of our roadmap, and a big focus for our team right now. Currently if you want to ship URP for some platforms and HDRP for others, it is not officially supported and may require managing multiple projects and/or branches. In the future, we want to make it possible for our users to target all the platforms they want, using the render pipeline that they want to use in a single project.

    So to answer 1 and 2 directly, we intend to make this an officially supported way to build Unity projects, meaning there won't be a need for complex branching strategies or custom tooling.

    Now all that said, to manage expectations I want to say that it's no small task, and even after meeting the Scriptable Render Pipeline Coexistence goal, we will likely not reach optimal workflows yet. Due to the differences of HDRP and URP there will still be parts of the workflow that feel clunky (stuff like perhaps some duplication of assets, separate subscenes etc.). But rest assured that we are exploring these problems internally and figuring out how we can support multi-SRP projects better in the future.
     
    Lionious, Hazneliel, AljoshaD and 2 others like this.
  4. Tomas-Kiniulis

    Tomas-Kiniulis

    Unity Technologies

    Joined:
    Apr 27, 2017
    Posts:
    55
    Hey,

    To answer 3-5 points, we have an internal test project that helps us discover workflow issues with pipeline coexistence. Here’s a few tips I could share:

    For shaders/vfx in the current state what is quite convenient if you use shadergraph is that you can target multiple pipelines. This way you can have a lit version of cross pipeline shader to populate most of the scene without worrying too much about the shading looking off on one pipeline. This is also the case for VFX graph. Although, you might run into issues where you want to use certain features on one pipeline which is not supported on the other one, but the final output goes to same input, for example emission, in this case you could add a Custom Function node with the following:
    #if defined(UNIVERSAL_PIPELINE_CORE_INCLUDED)
    OUT= URP;
    #elif defined(BUILTIN_PIPELINE_CORE_INCLUDED)
    OUT= BUILTIN;
    #elif defined(UNITY_HEADER_HD_INCLUDED)
    OUT= HDRP;
    #else
    OUT = OTHER;
    #endif

    This will help you ensure a certain part of the shader executes only on one pipeline.

    For Lighting, since HDRP uses real world light units and URP its own units I would recommend storing lights, reflection probes, pipeline specific volumes in separate scenes. Unity does not remember what intensity values are stored between pipelines and instead uses one shared intensity so if changes are in one pipeline the lighting in other pipeline will not look correct, separate scenes is an option to avoid this. This will also help to orient better if the project uses lightmaps to determine which lightmap needs to be used when switching.

    For volumes post processing settings, majority of post processing overrides exist in both pipelines, although some are implemented in different ways (Depth Of Field, Bloom, Motion Blur), the other post processing settings such as Color Curves or Shadows, Midtones, Highlights have identical settings on both pipelines so it should be easy to match, keep in mind though that currently the volume overrides that are added in one pipeline do not show up in the other pipeline and must be readded again that will store unique override values. This is something that is planned to be changed in the future where one override will control both pipeline for the overrides that share their settings. Note that you should make sure HDRP and URP setups are both using Linear color space, otherwise it will be very tricky if not impossible to get the desired look you are going for.

    The main issue you might face right now is the build times, this will be less of an issue with the 2023.1 release as the shaders that will contain a pipeline tag will be properly stripped, unfortunately compute shaders are still not stripped. The recommended approach before building is removing the render pipeline package that does not target the particular platform. This way you will make sure none of the unused pipeline code is affecting the performance of your player and you have decent build times, although do note that if you are using VFX graph multiple targets there is currently a known limitation that when render pipeline package is removed the target blocks of that pipeline are lost and do not reappear when package is readded.
     
    Last edited: Sep 29, 2022
  5. JoergHofmann74

    JoergHofmann74

    Joined:
    Oct 31, 2017
    Posts:
    17
    Hi,
    any news on the current state of the coexistens of the renderpiplines?
    Thans J
     
  6. tteneder

    tteneder

    Unity Technologies

    Joined:
    Feb 22, 2011
    Posts:
    175
    The define UNITY_HEADER_HD_INCLUDED does not seem to be set in HDRP anymore (2021 LTS and newer). Some friendly folks told me a workaround is to check for SHADEROPTIONS_PRE_EXPOSITION, which worked for me on Unity 2021 LTS through Unity 6 beta.
     
Thread Status:
Not open for further replies.