-
Notifications
You must be signed in to change notification settings - Fork 855
HDR Cubemap Encoding support #5967
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… non-encoded textures, the overhead will essentially be a no-op).
Hi! This comment will help you figure out which jobs to run before merging your PR. The suggestions are dynamic based on what files you have changed. HDRP Depending on the scope of your PR, you may need to run more jobs than what has been suggested. Please speak to your lead or a Graphics SDET (#devs-graphics-automation) if you are unsure. |
@RSlysz I added you just for awareness. Pema have added control on reflection probe quality like what is done for lightmap. But for HDRP we always want to use high quality, exactly like for lightmap, so we will need to plan to add to HDRP wizard a check that reflection probe quality is indeed high quality (like we do for lightmap) once this PR lands, thanks |
com.unity.render-pipelines.high-definition/Runtime/Lighting/Reflection/ReflectionProbeCache.cs
Show resolved
Hide resolved
com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader
Show resolved
Hide resolved
com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.shader
Outdated
Show resolved
Hide resolved
...unity.render-pipelines.high-definition/Runtime/Core/CoreResources/BlitCubeTextureFace.shader
Outdated
Show resolved
Hide resolved
@sebastienlagarde If you want more elaboration on the whole |
When is this setting applied? During importing of textures? |
@JulienIgnace-Unity indeed, this setting is applied in the importer, just as with Lightmap Encoding. If you never import the texture, the setting won't affect you. So if the realtime reflection cubemaps only exist in memory at runtime, they shouldn't be affected, as you have pointed out. For affected textures, when a texture has no manual encoding (RGBM, dLDR), the decoding code in the shaders will essentially be a no-op - the |
To be completely clear, the setting only affects textures which are:
|
@pema99 ok, the PR looks fine but I still don't understand who setup the _InputTex_HDR in the case of cache cubemap. The ConvertTexture is a SRP is implemented like this:
|
oh sorry I missed your comment: "The _HDR uniforms are set automatically for any corresponding texture uniform. This is core Unity functionality. These are based only the 'texture usage' (which for lightmap can only be None, dLDR or RGBM, where None means either native HDR or not an HDR texture). Basically synonymous with the Lightmap Encoding and HDR Cubemap Encoding settings. In cases where the the texture is native HDR or not HDR (None), the uniform will be set such that the HDR decode code does nothing to the value read.". |
triggered a nightly build on Yamato with the custom revision of C++ PR: https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/lighting%252Fhdr-cubemap-encoding/.yamato%252Fall-hdrp.yml%2523Nightly_HDRP_CUSTOM-REVISION/9448040/job/pipeline |
Yamato catch an error in 5009_HDRI_Sky_Flow: Unhandled log message: '[Error] Shader error in 'Hidden/HDRP/Sky/HDRISky': 'DecodeHDREnvironment': cannot implicitly convert from 'float3' to 'float4' at line 210 (on d3d11) (note: other error Speedtree (1205) and the skin (9601/9602) have issue due to cache server and aren't related to your PR |
Wow, really strange that the shader compiler didn't error for me locally. I see the issue, will fix. About the other failures, not sure what I can do here. Should I merge Graphics master again? The branch was based on a fairly recent commit. |
yep, can you merge master and retrigger yamato with custom revision. I think the PR is good to go now just wait for C++ Pr to land and for a QA pass. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked on HDRP side. Things tested:
- migrating a template project
- rebaking lightmaps
- Importing heavy .hdr and .exr
- HDRI ambient light both in static and dynamic modes
- LookDev
No issues or regressions found ✔👍
I'd only emphasize that it's important to give a warning message for users if they switch to Medium or Low settings on HDRP.
Trunk PR landed. Will try to kick off tests with newest revision tomorrow, I've been having a lot of issues with random unrelated failures. |
Purpose of this PR
This trunk PR: https://ono.unity3d.com/unity/unity/pull-request/133667/_/lighting/reflection-probe-encoding3 adds a new setting (re)named "HDR Cubemap Encoding" which controls the (manual) encoding of HDR cubemaps. Since HDRP currently expects no manual encoding (native HDR format), I had to add support for these encoded cubemap to the relevant shaders, and make sure that HDR cubemaps are decoded before putting in the probe cache. Most of the time, that decoding will essentially be a no-op since a majority will be using the default of native HDR.
The 3 shaders I touched are:
Here is a video showing the setting working correctly in an HDRP project: https://i.imgur.com/zX4Up3h.mp4
In the same shot we see an HDRI sky, reflection probe gizmo and renderer with reflective material using an encoded HDR cubemap.
Testing status
Automated testing has been added in the trunk PR. QA will verify HDRP functionality once that PR lands. I don't think automated testing for the HDRP-specific part of this would be very straight forward or warranted, since a project setting is involved, and the changes are fairly small. Let me know if you think otherwise while reviewing. The common code path should be sufficiently covered by existing tests.
Comments to reviewers
A few things are worth noting here:
<texturename>_HDR
uniforms are already exposed to shaders, no extra code was needed. This is core unity functionality. The decoding function is also very similar to the one used in BiRP.Also, I'm not very familiar with the HDRP codebase, so please feel free to point out if something is off here. I spoke to @sebastienlagarde who told me that it should be fine, if I provided a minimal working changeset.