Search Unity

Resolved Compatibility cleanup plan

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

  1. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    So a plan is in action to provide an abstraction for hard written shaders between render pipelines- are their plans to clean up the rest of the C# API? For instance, setting a background camera color is completely different in HDRP and URP in one of the most confusing ways I've seen - in HDRP, the editor ads an additional camera component which stores the color value, then the normal camera component accesses this making it seem like the background color is on the camera component, but when you try to edit the one on the actual camera component via script, it does nothing, because that's not actually the one which is used.

    Things like this make it very confusing and hard to write cross SRP code, often wasting hours of time figuring out these differences.
     
  2. arttu_p

    arttu_p

    Unity Technologies

    Joined:
    Jan 15, 2021
    Posts:
    22
    Hi, thanks for the question! I certainly feel your pain on this one. On a general level, there is an ongoing effort to improve and unify the workflows between HDRP and URP, pursuant to the Render Pipeline Coexistence goal that we have. This includes both UX but also code. We want to share code between the pipelines as much as it makes sense and provide consistent C# APIs.

    With regard to the HDRP camera background color, this is one instance where we missed the mark a little bit. The confusion stems from the fact that SRPs needed a way to extend certain components used by built-in renderer (in this case, HDRP needs a HDR background color for the camera). This was achieved by the AdditionalData components that act as extra data storage for their target components (such as Camera or Light). Unfortunately this design turned out to have its own problems. There is ongoing work to resolve this and implement the additional data properties in a better way, but due to internal tech reasons this has taken longer than we'd like.

    So in this case HDRP uses HDAdditionalCameraData.backgroundColorHDR for camera clear, whereas URP and builtin use Camera.backgroundColor.
     
  3. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    Do u mean the future plan is to make SRPs agnostic API that u can just call the same API and it will just work for both URP and HDRP?
     
  4. arttu_p

    arttu_p

    Unity Technologies

    Joined:
    Jan 15, 2021
    Posts:
    22
    For parts where this makes sense and URP and HDRP work in the same way, yes. But of course this won't be possible in all cases, if the data required by the pipelines are totally different. HDRP and URP are very different by design, and some areas will be easier to unify than others.
     
    optimise likes this.
  5. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    I think one place that would have made the camera case much nicer is if the component that owns the data actually showed the data in the UI, and any non-applicable data would be hidden. The fact that it shows the data as the same data as the regular camera color and didn't show it on the additional data component is very confusing.
     
    Recon03 likes this.
  6. arttu_p

    arttu_p

    Unity Technologies

    Joined:
    Jan 15, 2021
    Posts:
    22
    Yeah, I agree. The current pattern of the AdditionalCameraData component owning the data but it actually being displayed in Camera component inspector can certainly be confusing. It is our intention to make this better in a way that still keeps render pipeline specific data separate. We are taking our time to get it right this time!