Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Is HDRP Creating a custom sky documentation up to date?

Discussion in 'High Definition Render Pipeline' started by Olmi, Nov 8, 2019.

  1. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,553
    Is this documentation fresh?

    https://docs.unity3d.com/Packages/c...inition@7.1/manual/Creating-a-Custom-Sky.html

    Looks like to me that there's lots of things that aren't up to date, I get many errors. Or I wonder if did something wrong?

    Documentation is for HDRP 7.1.2 and I'm using HDRP 7.1.2 on Unity 2019.3.0b8.

    I did add some of the required namespaces like:
    UnityEngine.Rendering;
    UnityEngine.Rendering.HighDefinition;

    But I get errors for a few of those overrides like SetRenderTargets and also HDUtils.SetRenderTarget calls.
    Looks like HDShaderIDs also gives errors.

    Could someone shed some light on this? I'd rather not spend hours hacking on this... And I don't honestly have any idea how to change some things.
     
  2. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    880
  3. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,553
    I had time to hack this for 2 hours and I think I got my own sky there in the menus and at least something is rendering. But this required me to hard code many of the variables and change a few things here and there...

    Maybe someone from Unity could clarify how this is supposed to be done correctly? Or is this currently not officially supported?
     
  4. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    I just reworked my custom skybox yesterday to be compatible with HDRP 7.1.2. It seems like they either forgot or don't know that the documentation is out of date.

    I found the files under the following folders very useful to see the latest implementation:
    Packages/High Definition RP/Runtime/Sky/GradientSky/
    Packages/High Definition RP/Runtime/Sky/HDRISky/

    Sounds like you got stuff working already, but for anyone else who needs examples:
    For how to derive your class from SkySettings, see GradientSky and HDRISky scripts.
    For deriving from SkyRenderer, see the GradientSkyRenderer and HDRISkyRenderer scripts.
    For how to do your shader, see GradientSky and HDRISky shaders.

    The shader code is especially different from the documentation page.

    Edit: for getting the string names because we can't access HDShaderIDs anymore, see:
    https://github.com/Unity-Technologi...n/Runtime/RenderPipeline/HDStringConstants.cs
     
    Olmi likes this.
  5. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,553
    Hi @Korindian,
    Thanks for writing out some of that hard to find information for future visitors. Those two files were the ones that I checked too after going through the source files for too many hours. It should have been obvious to try find a Sky folder... Same goes for that thread @iamarugin linked. It's not really easy to find.

    One thing I that's perplexing me is that we need to inherit from SkySettings when a custom sky is created? So, that brings all the stuff that's in there (skyIntensityMode, upperHemisphereLuxValue etc.) and I really wouldn't want those visible in the Inspector UI. I was just trying to get them somehow hidden/override them but no luck yet.

    EDIT: Custom editor is the solution.
     
    Last edited: Nov 13, 2019
    Korindian likes this.
  6. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,553
    Some updates:
    For my editor script I cannibalized majority of editor stuff from SkySettingsEditor.cs.
    Added using UnityEditor to access the required editor things.
    I inherited the class from VolumeComponentEditor instead of SkySettingsEditor to remove a few errors.
    And I added access to my custom variables in OnEnable using that Unpack and added PropertyFields etc. to the OnInspectorGUI.

    So now my values show up in Inspector, unneeded things are hidden and everything updates ok in the shader, but It's hard to verify if that Update Mode is actually functioning but I don't care at the moment as the custom sky looks ok, it's enough for this learning experience.

    But I'd like to have clear guidelines for this, it's not good to hack some stuff that might or might not work ok.
     
    Korindian likes this.
  7. Korindian

    Korindian

    Joined:
    Jun 25, 2013
    Posts:
    584
    With HDRP 7.1.5, some of the skybox classes and methods have changed. Again, we'll need to see the built-in HDRP scripts from post #4 above and compare to see what's different. It took about 5 min. to get it compatible again, so nothing major.
     
    Olmi likes this.
  8. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,553
    @Korindian hey thanks for the heads up, I just upgraded to 2019.3.0b12 yesterday and fixed this sky issue a moment ago. How those custom parameters are passed to the SkyRenderer looks a bit weird to my eye... But I guess I should just look more into the code etc.
     
    Korindian likes this.
  9. SebLagarde

    SebLagarde

    Unity Technologies

    Joined:
    Dec 30, 2015
    Posts:
    934
    Hi, we have updated the sky documentation in future package 7.1.6. thanks for the feedback.
     
    rz_0lento, Korindian and Olmi like this.
  10. Lhiowynh

    Lhiowynh

    Joined:
    Jan 24, 2019
    Posts:
    5
    @SebLagarde
    Hey, I was just looking at that, that's great, it's a bit cleaner and makes a bit more sense, but I can't find any good documentation about the parameters. I've been trying to add an Object Parameter (ObjectParameter<T>), and none of the configurations I've tried have worked. Can I get some elaboration on that one?

    I've made a post on Answers here: https://answers.unity.com/questions/1685415/objectparameter-usage-in-a-custom-skybox.html

    That should give a good summary of my confusion and what I'm trying to achieve.