-
Notifications
You must be signed in to change notification settings - Fork 841
[HDRP][Path Tracing] Added alpha channel to path traced results #3127
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
Perhaps it is worth backporting this to 10.x? The PR seems simple-enough/back-portable. |
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.
Agree for backporting to 10.x.
The PR miss a changelog
and we should update the doc about alpha to say that it also work with path tracer
Ok, adding both. |
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.
Tested with a camera outputting the path traced result to a render texture and then using the texture in a transparent and/or a opaque alpha clipped material. ✔️
Tested that it only worked with Sky setup to None ✔️
Don't know if "worth doc mentioning" but worth noting a few things even though they're expected :
- HDRP Color buffer needs to be setup with an alpha channel (R16B16G16A16) for this PR to have any effect
- Doesn't work with Unity Recorder (Recorder does not care about alpha)
- Doesn't work with CaptureScreenshot (Game view discards alpha)
Thanks to @pmavridis who helped me test this.
Addresses https://fogbugz.unity3d.com/f/cases/1304187/
The alpha channel of path-traced images was always set to 1.
Now, if there is no sky, it will use the alpha value of the clear color on camera ray misses (set to 0 by default), to match rasterization behaviour.
This change has been tested with and without presence of sky, and with a clear color with alpha going from 0 to 1:
Note that for now, volumetrics are ignored and won't affect the alpha.