Is HDRP Creating a custom sky documentation up to date?

Is this documentation fresh?

https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@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.

Related to this topic: HDRP 7.0 HDShaderIDs is inaccessible due to its protection level

1 Like

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?

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-Technologies/ScriptableRenderPipeline/blob/master/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs

1 Like

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.

1 Like

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.

1 Like

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.

1 Like

@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.

1 Like

Hi, we have updated the sky documentation in future package 7.1.6. thanks for the feedback.

3 Likes

@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), 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.