Search Unity

Cross pipeline workflow. Project for mobile, console and PC.

Discussion in 'High Definition Render Pipeline' started by Camarent, Jul 1, 2020.

?

Choose approach

  1. Trying to make hdrp for mobile

    10.0%
  2. Complexing workflow with Hdrp (Pc, console) + Urp (Ios, android)

    70.0%
  3. Custom SRP

    5.0%
  4. Upgraded URP for PC and console

    15.0%
  1. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    Hi!
    I have a question on which i would love to hear your opinion.
    So if you plan to create something crossplatform like for pc, console, ios and android with high-end graphics then what approach you choose. One more for this question, keep in mind that you would release it not right now but 1-2 years from now.

    I mentioned high end graphics so you know that mobile devices should be from middle+ segment or i think it is called pre-top. I know that it makes target audience less but still.

    if you better approach or some ideas that you want to share i would glad to hear it.

    The main reason to ask it because hdrp did not plan for mobile devices and supporting urp + hdrp complicates workflow.
     
  2. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Shader Graph stack change in 9.x and 10.x does help on URP + HDRP setup as you can now author same shader graph that has both URP and HDRP shader passes in same file.

    HDRP isn't really an realistic option for mobile so your alternatives are rather:
    - URP for all
    - URP on weaker platforms + HDRP on rest
     
    Camarent and newguy123 like this.
  3. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    Yes, I also thought that to make hdrp works on mobile i would have to cut it to urp at some point:)

    Thank you for insight about shadergraph! It will be very useful to work with to passes. I will definitely try it. What I am also thinking about is texture setup. I would have to import same texture through custom importer and convert it to hdrp + urp or ask artists to prepare two set of textures. I also need to manage materials in special way so it will automatically fill parameters and textures.
     
  4. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    I don't really get why you'd need another set of textures.
     
  5. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    As I can see HDRP/Lit shader and URP/Lit shader use different textures.
    In image below you can see that hdrp use one texture for metallic-occlusion-smoothness and URP shader ask occlusion to be separate texture.
    upload_2020-7-3_10-30-24.png

    I would also need to convert all light sources because as I see hdrp use diffirent intensity units unlike urp.

    HDRP Directional light
    upload_2020-7-3_10-43-2.png

    URP Directional light
    upload_2020-7-3_10-43-42.png
     
  6. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    934
    For a 1 to 2 years schedule I will recommend URP.

    We aim at having URP as the main pipeline when doing a cross platform game/project (Missing feature are work in progress).

    HDRP isn't cross platform on purpose and constraint flexibility in the favor of optimization for specific recent hardware. It is also more challenging to understand / manipulate.

    Note that quality of graphic is driven by artists :)
     
    viknesh2020 and DGordon like this.
  7. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    As so you refer to default texture mapping on default shaders. This wasn't what I was talking about. I referred to new shader graph update (SRP 9.x and newer) that lets you author shaders for multiple targets (so both HDRP and URP) on single shader file. Basically you'd author your custom shaders with SG that take the same texture input. The immediate gains from this are:

    - Same texture mapping for your assets regardless of the pipeline
    - Same materials regardless of the pipeline (you don't have to swap shaders from materials if you author release for HDRP or URP)

    Of course there other considerations, this isn't just SRP asset swap but you can minimize the work needed by putting platform specific values into separate additively loaded scenes so you don't have to reauthor full scenes with assets per pipeline. Currently these things differ a lot between these two pipelines:

    - Lighting and exposure (where you can use realistic values on HDRP but not on URP)
    - HDRP and URP both have additional data components on each light source and camera
    - URP just got volume framework but it works with different effects for some part, so you'd have to author URP and HDRP (postprocessing) separately
    - Both have a different way to handle sky

    Of course, you'd really want to just stick with URP if you can do it, just putting this info out there if someone really wants to use different SRPs for the same project.
     
  8. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    This sounds awesome and sounds like things are going into the right direction. @rz_0lento Can you give an example, even if it is just a screengrab, of any SG example where something is setup for both HDRP and URP please?
     
  9. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    Yes I understand that quality can be achieved by artists but not always or it will cause a lot of custom shaders, post effects and workarounds. Stylization is always a way and we all know it. I just do not want to compromise on graphics on some platform like PS5 and PC. Maybe not right now when I have time to try different approaches.
     
  10. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    Oh, I did not think in this way. Yes it may work! Thank you! I still would have to make sure that additional textures from HDRP will not go to URP build but I know how it can be done on building step.

    I think I will try to calculate how much time we need to support this hybrid workflow approximately and this help us to choose.
     
  11. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    You need to enable preview packages in Project Settings -> Package Manager, download latest hdrp and urp 9.x with shader graph and you can see new system.
    upload_2020-7-3_15-10-39.png
     
    newguy123 likes this.
  12. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Sure, this is from 9.0.0-preview.33 with both URP and HDRP packages in the project:

    Note that you first pick the targets you want the SG to apply for and then it lets you pick the material variant from the list per SRP. Like, I could have put HD StackLit and URP Unlit here and it could expose the master nodes accordingly on the list. If you wire input to a node that's only supported by one target then the other will just ignore that wire.
     
    newguy123 likes this.
  13. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Ah you beat me to it :D
     
  14. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    I'd like to note that while Unity doesn't support runtime SRP swapping (it's strongly adviced against), I do have a prototype where I can runtime swap between URP and HDRP. It requires a lot of thought and main issue I faced on that was with the exposure control as HDRP's exposure always bled into URP side despite me resetting exposure manually from HDRP before SRP swap. I'm hoping something like this will eventually be supported workflow with less friction.

    My prototype worked fine as long as I used low intensity values on HDRP side and exposure at 0 for everything but you'd really want the full lighting range for HDRP to get most of it. I had separate scene for both URP and HDRP that had lighting, camera and volumes. I still used same SG stack materials for both so actual models and materials in scene could stay intact on other "base" scene.

    Basically what I did on the script then was that upon swap, I first unloaded extra SRP scene, then swapped the SRP Asset between URP and HDRP and then loaded new additive scene for that newly loaded SRP variant. All this could be also automated in the editor so one could have editing time toggle to swap between these two.
     
  15. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    I just read this: <https://forum.unity.com/threads/wha...nity-with-scriptable-render-pipelines.924218/>

    Apparently Unity is on this already:
    This is EXACTLY what I did earlier on my proto :)
     
    DGordon and Camarent like this.
  16. perholmes

    perholmes

    Joined:
    Dec 29, 2017
    Posts:
    296
    This is EXACTLY the right answer for us. URP for now, and in the future be able to target HDRP on desktop and URP on mobile from the same shader graph, with some features missing on mobile. Absolutely bullseye.

    We had actually migrated to Unreal for a number of months just to be able to target broadly, but are coming back to Unity because Unreal is a rogue operation and everything is nicer and more professional with Unity. That brought back the headache of looking great on desktop and OK on mobile. Targeting both pipelines from the same project is EXACTLY what we need. I think that anyone who's cross-platform is in the same boat.
     
  17. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Do note that while shader graphs can now target both URP and HDRP, there's still a lot of friction on smoothly authoring actual game content (levels, lighting, cameras etc) for both of these today. Apparently 2021 is the cycle where they'll make it simpler but we haven't really seen any concrete plans/roadmap for this beyond the shader graph change. I've welcome some estimate on which components Unity will streamline next (I've seen sky volume setup for URP on github so that could be one).
     
    newguy123 likes this.
  18. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    Can you give a link for volume setups in URP?

    Right now, I think for most of the staff it will be different scenes or prefabs but it is kinda tricky.
    @rz_0lento Do you know Is there any difference in lightmaps when bake for HDRP or URP if enviroment is the same?
     
  19. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@7.4/manual/Volumes.html

    Additionally, this is the sky volume rework that I was referring to earlier:
    https://github.com/Unity-Technologies/Graphics/tree/universal/SkyVolumes

    Considering you need different light data components per SRP, I very much doubt you could reuse baked light data today across the different SRPs either. I haven't done any testing with this though so that's just me guessing.
     
  20. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    13,363
    The core shader of HDRP is vastly unoptimized at this point, so would kill mobile performance imo. It even kills my desktop for simple things, because is just very heavy.

    If you plan to go all out with custom shaders of your own creation though, could run on mobile, but will be much harder journey and defeat the purpose of using HDRP slightly.

    Also image effects are generally heavy and even heavier on HDRP, again wont help with mobile that is best to use some tricks for similar effects than go with full volumes.
     
    Camarent likes this.
  21. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    Yes, I came to the same conclusion. Right now, I am in a process to go deeper in SRP. Thanks to this tutorial: https://catlikecoding.com/unity/tutorials/custom-srp/
    It is kinda new area for me so it takes some time.

    I am planning to keep this thread a live and rename it. I will write here if i find out a way to do it that I like.
     
    nasos_333 likes this.
  22. BattleAngelAlita

    BattleAngelAlita

    Joined:
    Nov 20, 2016
    Posts:
    400
    100% custom pipe. Because HDRP and URP is unmodifiable and unextendable.
     
  23. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168
    I think it is great way either for someone with a lot of experience and time or for big team.

    The main reason I personally do not like this approach that you will have to recreate existing and future features. Not all of it but a lot.

    The biggest advantage is full control i would like to say but because we do not have access to low level it is not completely true.
    You definitely can forget about Unity rendering pipeline and create custom buffer that will reproduce whole rendering pipeline and it may work for mobile but highend graphics will be super expensive to develop.

    Maybe i will change my opinion later when I finish deeper research:)
     
  24. Camarent

    Camarent

    Joined:
    Feb 19, 2014
    Posts:
    168