Skip to content

Commit

Permalink
[HDRP][PathTracing] High resolution sky on camera ray misses (#3389)
Browse files Browse the repository at this point in the history
* Hd/fix 1299116 tesselation cull (#3057)

* Fixed Render Graph immediate mode. (#3033)

Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>

* Fix issue with shadow mask and area lights (#3019)

* Not checking NdotL since it's not really valid for area lights (We have multiple valid light directions, not one)

* Changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fix issue with capture callback (now includes post processing results) (#3035)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* [HDRP] Fix decal draw order for ShaderGraph decal materials (#3018)

* Fixed ShaderGraph decal draw order

* Updated changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fixed various Look Dev issues after exiting Playmode (#2956)

* Fixed access to invalid Contexts references after exiting playmode.

* Fixed comparison gizmo after playmode.

* Fixes from PR feedback

* StackLit: Fix SG surface option property block to only display energy conserving specular color option for the specular input parametrization (similar to case 1257050) (#3060)

* Fixed missing BeginCameraRendering call for custom render mode of a Camera (#3063)

* Implement custom drawer for layer mask parameters (#3066)

* Adding mixed light baking shadowmask test (#3052)

* adding a shadow mask test

* Update reference images

* Fixing hull constant shader's tesselation cull algorithm.
Before it was comparing edges being out of the frustum. This is wrong
because the camera could be inside a triangle, in which case the edges could
be out of at least 1 frustum plane.
Correct fix is to check all three vertices if they are out of at least 1 plane.
Result packed tightly into the functions w return component.

* Renamed to a new function so we keep backwards compatibility.
Restored the shadow shader pass path, accidentally changed it to bool4 and use near plane.

* Fixing type back to bool, instead of bool4

* Merging changelog information from rebase.

* Making sure scene declaration pass is a bool4

* Adding new test for tesselation culling, with a weird camera angle which fails previous setup.

* Fixing formatting of code, rearranging order of test in editor build settings.

* Adding reference images for test.

* Missing meta file for new tests

* Fix bad merge issue

* fix bad merge issue

* fix bad merge issue

Co-authored-by: JulienIgnace-Unity <julien@unity3d.com>
Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>
Co-authored-by: FrancescoC-unity <43168857+FrancescoC-unity@users.noreply.github.com>
Co-authored-by: Pavlos Mavridis <pavlos.mavridis@unity3d.com>
Co-authored-by: Antoine Lelievre <antoinel@unity3d.com>
Co-authored-by: slunity <37302815+slunity@users.noreply.github.com>
Co-authored-by: Adrien de Tocqueville <adrien.tocqueville@unity3d.com>
Co-authored-by: Rémi Chapelain <57442369+remi-chapelain@users.noreply.github.com>

* Change the source value for the ray tracing frame index iterator from m_FrameCount to the camera frame count (case 1301356). (#3032)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* [HDRP] Added a RenderGraph pass that resets the camera size after the dynamic res upscale (#3070)

* Added a RenderGraph pass that resets the camera size after the dynamic res upscale

* Updated changelog

# Conflicts:
#	com.unity.render-pipelines.high-definition/CHANGELOG.md

* fixed class name

* update class name

* PR fix

* Fixed RTHandle scale

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fix Light Intensity UI Prefab Override Application (1299563) (#3061)

* Fixed Render Graph immediate mode. (#3033)

Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>

* Fix issue with shadow mask and area lights (#3019)

* Not checking NdotL since it's not really valid for area lights (We have multiple valid light directions, not one)

* Changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fix issue with capture callback (now includes post processing results) (#3035)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* [HDRP] Fix decal draw order for ShaderGraph decal materials (#3018)

* Fixed ShaderGraph decal draw order

* Updated changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fixed various Look Dev issues after exiting Playmode (#2956)

* Fixed access to invalid Contexts references after exiting playmode.

* Fixed comparison gizmo after playmode.

* Fixes from PR feedback

* Apply the fix

* Changelog

* Mofified approach to the fix, this time also fixing override saving of light unit

* Use more precise rect line offset calculation

* Update CHANGELOG.md

Co-authored-by: JulienIgnace-Unity <julien@unity3d.com>
Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>
Co-authored-by: FrancescoC-unity <43168857+FrancescoC-unity@users.noreply.github.com>
Co-authored-by: Pavlos Mavridis <pavlos.mavridis@unity3d.com>
Co-authored-by: Antoine Lelievre <antoinel@unity3d.com>

* Fix Undo/Redo Stability for Light Temperature (1304176, 1301076) (#3079)

* Fixed Render Graph immediate mode. (#3033)

Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>

* Fix issue with shadow mask and area lights (#3019)

* Not checking NdotL since it's not really valid for area lights (We have multiple valid light directions, not one)

* Changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fix issue with capture callback (now includes post processing results) (#3035)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* [HDRP] Fix decal draw order for ShaderGraph decal materials (#3018)

* Fixed ShaderGraph decal draw order

* Updated changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fixed various Look Dev issues after exiting Playmode (#2956)

* Fixed access to invalid Contexts references after exiting playmode.

* Fixed comparison gizmo after playmode.

* Fixes from PR feedback

* StackLit: Fix SG surface option property block to only display energy conserving specular color option for the specular input parametrization (similar to case 1257050) (#3060)

* Fixed missing BeginCameraRendering call for custom render mode of a Camera (#3063)

* Implement custom drawer for layer mask parameters (#3066)

* Adding mixed light baking shadowmask test (#3052)

* adding a shadow mask test

* Update reference images

* Apply the fix

* Changelog

* Update CHANGELOG.md

* fix merge issue

Co-authored-by: JulienIgnace-Unity <julien@unity3d.com>
Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>
Co-authored-by: FrancescoC-unity <43168857+FrancescoC-unity@users.noreply.github.com>
Co-authored-by: Pavlos Mavridis <pavlos.mavridis@unity3d.com>
Co-authored-by: Antoine Lelievre <antoinel@unity3d.com>
Co-authored-by: slunity <37302815+slunity@users.noreply.github.com>
Co-authored-by: Adrien de Tocqueville <adrien.tocqueville@unity3d.com>
Co-authored-by: Rémi Chapelain <57442369+remi-chapelain@users.noreply.github.com>

* Fix labels style (#3046)

* Fixed Render Graph immediate mode. (#3033)

Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>

* Fix issue with shadow mask and area lights (#3019)

* Not checking NdotL since it's not really valid for area lights (We have multiple valid light directions, not one)

* Changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fix issue with capture callback (now includes post processing results) (#3035)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* [HDRP] Fix decal draw order for ShaderGraph decal materials (#3018)

* Fixed ShaderGraph decal draw order

* Updated changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fixed various Look Dev issues after exiting Playmode (#2956)

* Fixed access to invalid Contexts references after exiting playmode.

* Fixed comparison gizmo after playmode.

* Fixes from PR feedback

* Fix labels style

* Update CHANGELOG.md

Co-authored-by: JulienIgnace-Unity <julien@unity3d.com>
Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>
Co-authored-by: FrancescoC-unity <43168857+FrancescoC-unity@users.noreply.github.com>
Co-authored-by: Pavlos Mavridis <pavlos.mavridis@unity3d.com>
Co-authored-by: Antoine Lelievre <antoinel@unity3d.com>

* Fixed side effect on styles during compositor rendering. (#3081)

* Fixed Render Graph immediate mode. (#3033)

Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>

* Fix issue with shadow mask and area lights (#3019)

* Not checking NdotL since it's not really valid for area lights (We have multiple valid light directions, not one)

* Changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fix issue with capture callback (now includes post processing results) (#3035)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* [HDRP] Fix decal draw order for ShaderGraph decal materials (#3018)

* Fixed ShaderGraph decal draw order

* Updated changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fixed various Look Dev issues after exiting Playmode (#2956)

* Fixed access to invalid Contexts references after exiting playmode.

* Fixed comparison gizmo after playmode.

* Fixes from PR feedback

* StackLit: Fix SG surface option property block to only display energy conserving specular color option for the specular input parametrization (similar to case 1257050) (#3060)

* Fixed missing BeginCameraRendering call for custom render mode of a Camera (#3063)

* Implement custom drawer for layer mask parameters (#3066)

* Adding mixed light baking shadowmask test (#3052)

* adding a shadow mask test

* Update reference images

* Changed the clamping approach for RTR and RTGI (in both perf and quality) to improve visual quality. (#3020)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fixed the condition on temporal accumulation in the reflection denoiser (case 1303504). (#3027)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Changed the warning message for ray traced area shadows (case 1303410). (#3029)

* - Changed the warning message for ray traced area shadows (case 1303410).

* Adds approximation information about ray-traced area shadows

Co-authored-by: Lewis Jordan <lewis.jordan@hotmail.co.uk>
Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fixed side effect on styles during compositor rendering.

* Update CHANGELOG.md

* fix merge issue

Co-authored-by: JulienIgnace-Unity <julien@unity3d.com>
Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>
Co-authored-by: FrancescoC-unity <43168857+FrancescoC-unity@users.noreply.github.com>
Co-authored-by: Pavlos Mavridis <pavlos.mavridis@unity3d.com>
Co-authored-by: Antoine Lelievre <antoinel@unity3d.com>
Co-authored-by: slunity <37302815+slunity@users.noreply.github.com>
Co-authored-by: Rémi Chapelain <57442369+remi-chapelain@users.noreply.github.com>
Co-authored-by: anisunity <42026998+anisunity@users.noreply.github.com>
Co-authored-by: Lewis Jordan <lewis.jordan@hotmail.co.uk>

* [HDRP][Compositor] Fix size and spacing of compositor info boxes (#3101)

* Fixed Render Graph immediate mode. (#3033)

Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>

* Fix issue with shadow mask and area lights (#3019)

* Not checking NdotL since it's not really valid for area lights (We have multiple valid light directions, not one)

* Changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fix issue with capture callback (now includes post processing results) (#3035)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* [HDRP] Fix decal draw order for ShaderGraph decal materials (#3018)

* Fixed ShaderGraph decal draw order

* Updated changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fixed various Look Dev issues after exiting Playmode (#2956)

* Fixed access to invalid Contexts references after exiting playmode.

* Fixed comparison gizmo after playmode.

* Fixes from PR feedback

* StackLit: Fix SG surface option property block to only display energy conserving specular color option for the specular input parametrization (similar to case 1257050) (#3060)

* Fixed missing BeginCameraRendering call for custom render mode of a Camera (#3063)

* Implement custom drawer for layer mask parameters (#3066)

* Adding mixed light baking shadowmask test (#3052)

* adding a shadow mask test

* Update reference images

* Changed the clamping approach for RTR and RTGI (in both perf and quality) to improve visual quality. (#3020)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fixed the condition on temporal accumulation in the reflection denoiser (case 1303504). (#3027)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Changed the warning message for ray traced area shadows (case 1303410). (#3029)

* - Changed the warning message for ray traced area shadows (case 1303410).

* Adds approximation information about ray-traced area shadows

Co-authored-by: Lewis Jordan <lewis.jordan@hotmail.co.uk>
Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Disabled specular occlusion for what we consider medium and larger scale rtao > 1.25 with a 25cm falloff interval. (#3023)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Removed 2505_Area_Light_ShadowMask_Baking from baking queue (#3087)

* Lightmaps / Removed scene from baking queue + meta files

* update reference screenshots

Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>

* Fix size and spacing of compositor info boxes

* Fix typo in changelog

Co-authored-by: JulienIgnace-Unity <julien@unity3d.com>
Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>
Co-authored-by: FrancescoC-unity <43168857+FrancescoC-unity@users.noreply.github.com>
Co-authored-by: Antoine Lelievre <antoinel@unity3d.com>
Co-authored-by: slunity <37302815+slunity@users.noreply.github.com>
Co-authored-by: Adrien de Tocqueville <adrien.tocqueville@unity3d.com>
Co-authored-by: Rémi Chapelain <57442369+remi-chapelain@users.noreply.github.com>
Co-authored-by: anisunity <42026998+anisunity@users.noreply.github.com>
Co-authored-by: Lewis Jordan <lewis.jordan@hotmail.co.uk>

* [HDRP][Compositor] Fix color picker UI glitch in the Graphics Compositor (#3105)

* Fixed Render Graph immediate mode. (#3033)

Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>

* Fix issue with shadow mask and area lights (#3019)

* Not checking NdotL since it's not really valid for area lights (We have multiple valid light directions, not one)

* Changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fix issue with capture callback (now includes post processing results) (#3035)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* [HDRP] Fix decal draw order for ShaderGraph decal materials (#3018)

* Fixed ShaderGraph decal draw order

* Updated changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fixed various Look Dev issues after exiting Playmode (#2956)

* Fixed access to invalid Contexts references after exiting playmode.

* Fixed comparison gizmo after playmode.

* Fixes from PR feedback

* StackLit: Fix SG surface option property block to only display energy conserving specular color option for the specular input parametrization (similar to case 1257050) (#3060)

* Fixed missing BeginCameraRendering call for custom render mode of a Camera (#3063)

* Implement custom drawer for layer mask parameters (#3066)

* Adding mixed light baking shadowmask test (#3052)

* adding a shadow mask test

* Update reference images

* Changed the clamping approach for RTR and RTGI (in both perf and quality) to improve visual quality. (#3020)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fixed the condition on temporal accumulation in the reflection denoiser (case 1303504). (#3027)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Changed the warning message for ray traced area shadows (case 1303410). (#3029)

* - Changed the warning message for ray traced area shadows (case 1303410).

* Adds approximation information about ray-traced area shadows

Co-authored-by: Lewis Jordan <lewis.jordan@hotmail.co.uk>
Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Disabled specular occlusion for what we consider medium and larger scale rtao > 1.25 with a 25cm falloff interval. (#3023)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Removed 2505_Area_Light_ShadowMask_Baking from baking queue (#3087)

* Lightmaps / Removed scene from baking queue + meta files

* update reference screenshots

Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>

* Removed unused index parameter

* Fix box light attenuation (#3056)

* Fix box light attenuation

* Update screenshots

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Revert "Disabled specular occlusion for what we consider medium and larger scale rtao > 1.25 with a 25cm falloff interval. (#3023)"

This reverts commit 55bb6ff.

* Revert "Revert "Disabled specular occlusion for what we consider medium and larger scale rtao > 1.25 with a 25cm falloff interval. (#3023)""

This reverts commit 57ee23b.

* Fix default value of  _SpecularOcclusionBlend

* Fix color picker UI glitch in the Graphics Compositor

Co-authored-by: JulienIgnace-Unity <julien@unity3d.com>
Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>
Co-authored-by: FrancescoC-unity <43168857+FrancescoC-unity@users.noreply.github.com>
Co-authored-by: Antoine Lelievre <antoinel@unity3d.com>
Co-authored-by: slunity <37302815+slunity@users.noreply.github.com>
Co-authored-by: Adrien de Tocqueville <adrien.tocqueville@unity3d.com>
Co-authored-by: Rémi Chapelain <57442369+remi-chapelain@users.noreply.github.com>
Co-authored-by: anisunity <42026998+anisunity@users.noreply.github.com>
Co-authored-by: Lewis Jordan <lewis.jordan@hotmail.co.uk>

* Fix 1299233 ies resize bug (#3094)

* Fixed Render Graph immediate mode. (#3033)

Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>

* Fix issue with shadow mask and area lights (#3019)

* Not checking NdotL since it's not really valid for area lights (We have multiple valid light directions, not one)

* Changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fix issue with capture callback (now includes post processing results) (#3035)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* [HDRP] Fix decal draw order for ShaderGraph decal materials (#3018)

* Fixed ShaderGraph decal draw order

* Updated changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fixed various Look Dev issues after exiting Playmode (#2956)

* Fixed access to invalid Contexts references after exiting playmode.

* Fixed comparison gizmo after playmode.

* Fixes from PR feedback

* StackLit: Fix SG surface option property block to only display energy conserving specular color option for the specular input parametrization (similar to case 1257050) (#3060)

* Fixed missing BeginCameraRendering call for custom render mode of a Camera (#3063)

* Implement custom drawer for layer mask parameters (#3066)

* Adding mixed light baking shadowmask test (#3052)

* adding a shadow mask test

* Update reference images

* Changed the clamping approach for RTR and RTGI (in both perf and quality) to improve visual quality. (#3020)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fixed the condition on temporal accumulation in the reflection denoiser (case 1303504). (#3027)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Changed the warning message for ray traced area shadows (case 1303410). (#3029)

* - Changed the warning message for ray traced area shadows (case 1303410).

* Adds approximation information about ray-traced area shadows

Co-authored-by: Lewis Jordan <lewis.jordan@hotmail.co.uk>
Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Disabled specular occlusion for what we consider medium and larger scale rtao > 1.25 with a 25cm falloff interval. (#3023)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fix 1299233 ies resize bug

* change log

* Update CHANGELOG.md

* fix merge issue

Co-authored-by: JulienIgnace-Unity <julien@unity3d.com>
Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>
Co-authored-by: FrancescoC-unity <43168857+FrancescoC-unity@users.noreply.github.com>
Co-authored-by: Pavlos Mavridis <pavlos.mavridis@unity3d.com>
Co-authored-by: Antoine Lelievre <antoinel@unity3d.com>
Co-authored-by: slunity <37302815+slunity@users.noreply.github.com>
Co-authored-by: Adrien de Tocqueville <adrien.tocqueville@unity3d.com>
Co-authored-by: Rémi Chapelain <57442369+remi-chapelain@users.noreply.github.com>
Co-authored-by: anisunity <42026998+anisunity@users.noreply.github.com>
Co-authored-by: Lewis Jordan <lewis.jordan@hotmail.co.uk>

* filter for xbone addded (#3116)

* [Yamato] Enable cache server for standalone build jobs (#3106)

* create standalone_cache jobs

* use cache jobs for trunk verification

* fix commands so linux can recognise them

need to wrap each string around "extra-editor-arg"

* Fix undo redo on layered lit editor (#3059)

* Fixed Render Graph immediate mode. (#3033)

Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>

* Fix issue with shadow mask and area lights (#3019)

* Not checking NdotL since it's not really valid for area lights (We have multiple valid light directions, not one)

* Changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fix issue with capture callback (now includes post processing results) (#3035)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* [HDRP] Fix decal draw order for ShaderGraph decal materials (#3018)

* Fixed ShaderGraph decal draw order

* Updated changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fixed various Look Dev issues after exiting Playmode (#2956)

* Fixed access to invalid Contexts references after exiting playmode.

* Fixed comparison gizmo after playmode.

* Fixes from PR feedback

* Fix undo redo on layered lit editor

* Update CHANGELOG.md

Co-authored-by: JulienIgnace-Unity <julien@unity3d.com>
Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>
Co-authored-by: FrancescoC-unity <43168857+FrancescoC-unity@users.noreply.github.com>
Co-authored-by: Pavlos Mavridis <pavlos.mavridis@unity3d.com>
Co-authored-by: Antoine Lelievre <antoinel@unity3d.com>

* [HDRP] Added Vulkan install in system requirements (#3122)

* Added vulkan install in system requirements

* Reworded content

Co-authored-by: Lewis Jordan <lewis.jordan@hotmail.co.uk>

* [HDRP] Fix issue with compositor related custom passes (#3055)

* Fixed Render Graph immediate mode. (#3033)

Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>

* Fix issue with shadow mask and area lights (#3019)

* Not checking NdotL since it's not really valid for area lights (We have multiple valid light directions, not one)

* Changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fix issue with capture callback (now includes post processing results) (#3035)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* [HDRP] Fix decal draw order for ShaderGraph decal materials (#3018)

* Fixed ShaderGraph decal draw order

* Updated changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fixed various Look Dev issues after exiting Playmode (#2956)

* Fixed access to invalid Contexts references after exiting playmode.

* Fixed comparison gizmo after playmode.

* Fixes from PR feedback

* Fix issue with compositor related custom passes still active after disabling the compositor

Co-authored-by: JulienIgnace-Unity <julien@unity3d.com>
Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>
Co-authored-by: FrancescoC-unity <43168857+FrancescoC-unity@users.noreply.github.com>
Co-authored-by: Antoine Lelievre <antoinel@unity3d.com>

* Fixed some render texture leaks. (#3050)

* Fixed Render Graph immediate mode. (#3033)

Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>

* Fix issue with shadow mask and area lights (#3019)

* Not checking NdotL since it's not really valid for area lights (We have multiple valid light directions, not one)

* Changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fix issue with capture callback (now includes post processing results) (#3035)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* [HDRP] Fix decal draw order for ShaderGraph decal materials (#3018)

* Fixed ShaderGraph decal draw order

* Updated changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fixed various Look Dev issues after exiting Playmode (#2956)

* Fixed access to invalid Contexts references after exiting playmode.

* Fixed comparison gizmo after playmode.

* Fixes from PR feedback

* Fixed a few render texture memory leaks.

* Update changelog

* Added comment

* Update CHANGELOG.md

Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>
Co-authored-by: FrancescoC-unity <43168857+FrancescoC-unity@users.noreply.github.com>
Co-authored-by: Pavlos Mavridis <pavlos.mavridis@unity3d.com>
Co-authored-by: Antoine Lelievre <antoinel@unity3d.com>

* Hd/fix wizard runtime resources (#3123)

* Fix runtim resource wizard fix regression

* Update CHANGELOG.md

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* [HDRP] Fixed lookdev reload bug when viewing a scene object (#3108)

* Fixed lookdev reload bug when viewing a scene object

* Updated changelog

* Re-added lookdev fix

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* [HDRP] Fix error in Depth Of Field near radius blur calculation (#3131)

* Fix error in Depth Of Field near radius blur calculation

* Fix typo

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* [HDRP] Fix GC allocs (#3136)

* Fix gc alloc errors

* Avoid setting the name of an object during render (gc alloc)

* Avoid gc allocs (for real this time)

* Revert: Fix 1299233 ies resize bug (#3094)

* Hide light shadow near plane gizmo when shadows are disabled (#3114)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Hd/fix backplate globalcubemap2 (#3111)

* Removed backplate from rendering of lighting cubemap as it did not really work conceptually and caused artefacts.

* Update changelog

* Remove useless code

* Compilation fix.

* Update doc

* Update Override-HDRI-Sky.md

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* [HDRP][Path Tracing] Added alpha channel to path traced results (#3127)

* Added alpha support changes for path tracing in bugfix branch.

* Updated changelog and added doc.

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Doc update (#3160)

* Fix various shader warnings (#3158)

* Histogram and scalarization warnings.

* Fix warning in probe

* Changelog

* Update CHANGELOG.md

Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>

* Update Override-Screen-Space-GI.md

* Fixed shadow matte not working with ambient occlusion when MSAA is en… (#3157)

* Fixed shadow matte not working with ambient occlusion when MSAA is enabled

* Add MSAA test

* update refrence screenshots win dx11

* update DX12 and win vulkan screen

* update screenshots for mac

* update screen of linux vulkan

* Update HDLightUI.cs (#3203)

* [HDRP] fix nullref when chaging RP from HDRP to URP (#3191)

* Fixed volume atlas release

* Updated changelog

* fix case 1307653 (#3205)

* Fix LookDev env library assignment after leaving playmode. (#3214)

* Fixed LookDev environment library assignement after leaving playmode.

* Update changelog

* Update Hair Shader Preset Documentation (#3208)

* Correct the language for hair shader documentation.

* Update hair-shader.md

* Update hair-shader.md

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* [HDRP] Fix locale diffusion profile shader property value in ShaderGraph (#3213)

* Fixed diffusion profile shader property float values using the current culture instead of invariant

* Updated changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fix error in the RTHandle scale of Depth Of Field when TAA is enabled (#3182)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Reset to current quality settings after preprocess build in HDRP (#3218)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Have bilinear default (#3223)

Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>

* Merged changes for high res sky display in path tracing.

* Uncommented PS5 includes.

* Cosmetic.

* Update CHANGELOG.md

* Added missing character to the layered lit document (#3310)

* Fix needs of exposure for debug display "SSR Transparent" (#3308)

* Fix needs of exposure for debug display "SSR Transparent"

* Add Change Log

* [HDRP] Fix GUI exception in material UI (#3315)

* Fixed an exception when opening the color picker in a material UI

* Updated changelog

* [HDRP] Update decal angle fade tooltip (#3322)

* Added tooltip in decal fade angle prop

* Updated changelog

* Mention in TAA doc that a certain use case will lead to problems. (#3317)

* Doc update.

* Review feedback.

* Hide shadow resolution value (#3335)

* Bump timer of 2nd runtime test to make it work on all platforms.  (#3314)

* Bump wait

* Bump timer again

* Revert "Bump timer again"

This reverts commit 6bfc794.

* Fix light frustum planes (#3341)

* Project skybox without perspective for ortho cameras (#2955)

* [HDRP] Fix coat normal space (#2888)

* Fix coat normal space

* Update CHANGELOG.md

Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>

* Avoid issues causing faulty transitions in shadows (resulting in no shadows with unconventional aspect ratio)  (#2776)

* Fixed volume component tooltips using the same parameter name (#2754)

* Use the proper history info for Bicubic resampling in TAA (#2759)

* Use proper info for previous buffer info

* changelog

* Fixed lookdev movement (#2757)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* [HDRP] Fix issue with saving some quality settings in volume overrides (#2758)

* Fix issue with saving some quality settings volume overrides

* Fix typo in changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* [HDRP] Fixed NullReferenceException in HDRenderPipeline.UpgradeResourcesIfNeeded (case 1292524) (#2765)

* fix issue with confusing text (#2766)

* Fix

* Fix white dots

* Changelog

* Rename the sunrise icon to fix typo, causing issue with 2x resolution loading. (#2809)

* [HDRP] Rename HDRP to HD Render Pipeline in menu item (#2819)

* [HDRP] Update HDRP menu in shader graph

* Update CHANGELOG.md

* HDRP/Fix package version showing package after the last "verified" package (#2783)

* Fix typo

* Remove last version checker from wizard and add link to package manager instead

* Update CHANGELOG.md

* Update documentation

* Update Render-Pipeline-Wizard.md

Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>

* Revert bad changelog merge

* Update CHANGELOG.md

* Update CHANGELOG.md

Co-authored-by: Adrien de Tocqueville <adrien.tocqueville@unity3d.com>
Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
Co-authored-by: Pavlos Mavridis <pavlos.mavridis@unity3d.com>
Co-authored-by: John Parsaie <johnpa@unity3d.com>
Co-authored-by: Remi Slysz <40034005+RSlysz@users.noreply.github.com>

* Fixed invalid loop length for probe baking (case 1289680) (#2830)

* Fixed invalid loop length for probe baking (case 1289680)

# Conflicts:
#	com.unity.render-pipelines.high-definition/CHANGELOG.md

# Conflicts:
#	com.unity.render-pipelines.high-definition/CHANGELOG.md

* Update CHANGELOG.md

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fix volumetric fog with XR single-pass (#2823)

* fix volumetric fog with XR single-pass rendering

* update changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* [HDRP] Fix rendering issues for the first frame (#2836)

* Fix first frame exposure, depth pyramid / AO

* Update changelog

* Comment

* Typo

* Add missing RenderGraphBuilder.ReadTexture call

* Move ComputePackedMipChainInfo at the beginning of ExecuteWithRenderGraph

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Update 5001_Fog_FogFallback.png

* Revert "Update 5001_Fog_FogFallback.png"

This reverts commit 2653b9c.

* Update 5001_Fog_FogFallback.unity

* Fix AOV API for render graph (#2909)

* Fix AOV api in rendergraph

# Conflicts:
#	com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs

* Update changelog

* Fix a small discrepancy in the marker placement in light intensity sliders (#2924)

* Update CHANGELOG.md

* Fix issue with VT spewing errors when transparent and opaque are disabled (#2925)

* Fix

* Changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fixed a bug in the sphere-aabb light cluster (case 1294767). (#2920)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Move EndCameraRendering callback out of the profiling scope (#2917)

* Move EndCameraRendering callback out of the profiling scope

* added a comment

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fixed baked light being included into the ray tracing light cluster (case 1296203). (#2915)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Handle all enums the same way for UI (#2913)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Changed the message when the graphics device doesn't support ray tracing (case 1287355). (#2916)

* [HDRP] Fix default blocks for Hair and Eye shader graphs (#2919)

* Fixed default eye shader blocks

* Fix missing emission block in hair shader

* Updated changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Init scene camera debug framesettings (#2931)

* Fixed using the wrong method to define if a light should be included in the light cluster depending on its baking status. (#2932)

* - Fixed using the wrong method to define if a light should be included in the light cluster depending on its baking status.

* Update CHANGELOG.md

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* [HDRP] Change the behavior of custom passes when the volume is disabled (#2930)

* Changed the behavior of custom passes when the Custom Pass Volume component is disabled

* Updated changelog

* Fixed display of LOD Bias and maximum level in frame settings when using Quality Levels (#2921)

* Fixed display of LOD Bias and maximum level in frame settings when using Quality Levels

* Update changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fixed an issue when trying to open a look dev env library when Look Dev is not supported. (#2929)

* Fixed an issue when trying to open a look dev env library when Look Dev is not supported.

* Update changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Enable Reflector for Spotlight by default

* - Fixed shader graph not supporting indirectdxr multibounce (case 1294694). (#2933)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fixed the planar depth texture not being properly created and rendered to (case 1299617). (#2926)

* Fixed the planar depth texture not being properly created and rendered to (case 1299617).

* adding comment

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fixed C# 8 compilation issue with turning on nullable checks (case 1300167) (#2949)

* Fixed C# 8 compilation issue with turning on nullable checks - bis (#2951)

* Fixed C# 8 compilation issue with turning on nullable checks (case 1300167)

* Update MaterialDebug.cs

* Fix scripting light test with enableReflector true by default

* Project skybox without perspective for ortho cameras

* Explicit orthographic argument

Co-authored-by: Antoine Lelievre <antoinel@unity3d.com>
Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>
Co-authored-by: FrancescoC-unity <43168857+FrancescoC-unity@users.noreply.github.com>
Co-authored-by: Pavlos Mavridis <pavlos.mavridis@unity3d.com>
Co-authored-by: John Parsaie <johnpa@unity3d.com>
Co-authored-by: Remi Slysz <40034005+RSlysz@users.noreply.github.com>
Co-authored-by: Frédéric Vauchelles <55485372+fredericv-unity3d@users.noreply.github.com>
Co-authored-by: Fabien Houlmann <44069206+fabien-unity@users.noreply.github.com>
Co-authored-by: anisunity <42026998+anisunity@users.noreply.github.com>
Co-authored-by: JulienIgnace-Unity <julien@unity3d.com>

* Fix non temporal SSAO issues with the rendergraph pass  (#3351)

* Fix

* changelog

* Reset ambient probe upon switching to very different skies (#3340)

* Set ambient probe to black when there is a big difference

* Changelog

* Fix a couple of things

* Change name

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fix white flash on camera cuts with volumetric  (#3354)

* Have two frames with reprojection off on cut (due to exposure)

* changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Fix issues with light layers issues when editing multiple lights (#3323)

* Avoid syncing light layers when we have multiple values.

* Changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Maximum of reflection distance must be bound by the min of all dimensions, (#3329)

not the maximum.

* Fixed debug panel reseting when going through enum items (#3370)

* tentative fix for enum navigation in the runtime debug UI

* Update changelog

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Made the code more rendergraph compliant and cleaner.

* Fix keywords with fbx importer (#3350)

Co-authored-by: sebastienlagarde <sebastien@unity3d.com>

* Higt res env on camera misses, render sky only on first accum frame.

* Updated changelog.

* Support for camera motion blur when recording.

* Fixed typo.

* Update CHANGELOG.md

* Formatting

* Update 5005 PT screenshots

* Fixed dirtiness issue with multiple cameras setup.

Co-authored-by: Kleber Garcia <kleber.garcia@unity3d.com>
Co-authored-by: JulienIgnace-Unity <julien@unity3d.com>
Co-authored-by: Sebastien Lagarde <sebastien@unity3d.com>
Co-authored-by: FrancescoC-unity <43168857+FrancescoC-unity@users.noreply.github.com>
Co-authored-by: Pavlos Mavridis <pavlos.mavridis@unity3d.com>
Co-authored-by: Antoine Lelievre <antoinel@unity3d.com>
Co-authored-by: slunity <37302815+slunity@users.noreply.github.com>
Co-authored-by: Adrien de Tocqueville <adrien.tocqueville@unity3d.com>
Co-authored-by: Rémi Chapelain <57442369+remi-chapelain@users.noreply.github.com>
Co-authored-by: anisunity <42026998+anisunity@users.noreply.github.com>
Co-authored-by: John Parsaie <johnpa@unity3d.com>
Co-authored-by: Lewis Jordan <lewis.jordan@hotmail.co.uk>
Co-authored-by: skhiat <55133890+skhiat@users.noreply.github.com>
Co-authored-by: Martin Thorzen <35328557+martint-unity@users.noreply.github.com>
Co-authored-by: Sophia <16596228+sophiaaar@users.noreply.github.com>
Co-authored-by: Remi Slysz <40034005+RSlysz@users.noreply.github.com>
Co-authored-by: jenniferd-unity <71718938+jenniferd-unity@users.noreply.github.com>
Co-authored-by: Frédéric Vauchelles <55485372+fredericv-unity3d@users.noreply.github.com>
Co-authored-by: Fabien Houlmann <44069206+fabien-unity@users.noreply.github.com>
  • Loading branch information
20 people committed Feb 25, 2021
1 parent 30768c9 commit 24a1479
Show file tree
Hide file tree
Showing 10 changed files with 123 additions and 53 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Expand Up @@ -89,6 +89,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Improved shadow cascade GUI drawing with pixel perfect, hover and focus functionalities.
- Improving the screen space global illumination.
- Moving MaterialHeaderScopes to Core
- Changed resolution (to match the render buffer) of the sky used for camera misses in Path Tracing. (case 1304114).

## [11.0.0] - 2020-10-21

Expand Down
Expand Up @@ -4,11 +4,11 @@

#pragma kernel KMain

#pragma multi_compile _ INPUT_FROM_RADIANCE_TEXTURE
#pragma multi_compile _ INPUT_FROM_FRAME_TEXTURE

// Inputs
#ifdef INPUT_FROM_RADIANCE_TEXTURE
TEXTURE2D_X(_RadianceTexture);
#ifdef INPUT_FROM_FRAME_TEXTURE
TEXTURE2D_X(_FrameTexture);
#endif

float4 _AccumulationWeights;
Expand Down Expand Up @@ -63,8 +63,8 @@ void KMain(uint3 dispatchThreadId : SV_DispatchThreadID)
}
else
{
#ifdef INPUT_FROM_RADIANCE_TEXTURE
float4 color = _RadianceTexture[COORD_TEXTURE2D_X(dispatchThreadId.xy)];
#ifdef INPUT_FROM_FRAME_TEXTURE
float4 color = _FrameTexture[COORD_TEXTURE2D_X(dispatchThreadId.xy)];
#else
float4 color = _CameraColorTextureRW[COORD_TEXTURE2D_X(dispatchThreadId.xy)];
#endif
Expand Down
Expand Up @@ -286,7 +286,7 @@ RenderAccumulationParameters PrepareRenderAccumulationParameters(HDCamera hdCame
parameters.accumulationCS.shaderKeywords = null;
if (inputFromRadianceTexture)
{
parameters.accumulationCS.EnableKeyword("INPUT_FROM_RADIANCE_TEXTURE");
parameters.accumulationCS.EnableKeyword("INPUT_FROM_FRAME_TEXTURE");
}
return parameters;
}
Expand All @@ -311,7 +311,7 @@ static void RenderAccumulation(in RenderAccumulationParameters parameters, RTHan
cmd.SetComputeTextureParam(accumulationShader, parameters.accumulationKernel, HDShaderIDs._CameraColorTextureRW, outputTexture);
if (!inputTexture.Equals(outputTexture))
{
cmd.SetComputeTextureParam(accumulationShader, parameters.accumulationKernel, HDShaderIDs._RadianceTexture, inputTexture);
cmd.SetComputeTextureParam(accumulationShader, parameters.accumulationKernel, HDShaderIDs._FrameTexture, inputTexture);
}
cmd.SetComputeVectorParam(accumulationShader, HDShaderIDs._AccumulationWeights, frameWeights);
cmd.SetComputeIntParam(accumulationShader, HDShaderIDs._AccumulationNeedsExposure, parameters.needExposure ? 1 : 0);
Expand Down
Expand Up @@ -122,7 +122,7 @@ class TempPassData {};

if (hdCamera.viewCount == 1)
{
colorBuffer = RenderPathTracing(m_RenderGraph, hdCamera);
colorBuffer = RenderPathTracing(m_RenderGraph, hdCamera, colorBuffer);
}
else
{
Expand Down
Expand Up @@ -473,7 +473,7 @@ public HDRenderPipeline(HDRenderPipelineAsset asset, HDRenderPipelineAsset defau
InitRayTracedIndirectDiffuse();
InitRaytracingDeferred();
InitRecursiveRenderer();
InitPathTracing();
InitPathTracing(m_RenderGraph);
InitRayTracingAmbientOcclusion();
}

Expand Down
Expand Up @@ -721,12 +721,13 @@ static class HDShaderIDs
public static readonly int _SubSurfaceLightingBuffer = Shader.PropertyToID("_SubSurfaceLightingBuffer");
public static readonly int _IndirectDiffuseLightingBuffer = Shader.PropertyToID("_IndirectDiffuseLightingBuffer");

// Accumulation
// Accumulation and path tracing
public static readonly int _AccumulationFrameIndex = Shader.PropertyToID("_AccumulationFrameIndex");
public static readonly int _AccumulationNumSamples = Shader.PropertyToID("_AccumulationNumSamples");
public static readonly int _AccumulationWeights = Shader.PropertyToID("_AccumulationWeights");
public static readonly int _AccumulationNeedsExposure = Shader.PropertyToID("_AccumulationNeedsExposure");
public static readonly int _RadianceTexture = Shader.PropertyToID("_RadianceTexture");
public static readonly int _FrameTexture = Shader.PropertyToID("_FrameTexture");
public static readonly int _SkyCameraTexture = Shader.PropertyToID("_SkyCameraTexture");

// Preintegrated texture name
public static readonly int _PreIntegratedFGD_GGXDisneyDiffuse = Shader.PropertyToID("_PreIntegratedFGD_GGXDisneyDiffuse");
Expand Down
Expand Up @@ -69,20 +69,32 @@ public partial class HDRenderPipeline
#endif // UNITY_EDITOR
ulong m_CacheAccelSize = 0;
uint m_CacheLightCount = 0;
int m_CameraID = 0;
bool m_RenderSky = true;

RTHandle m_RadianceTexture; // stores the per-pixel results of path tracing for this frame
TextureHandle m_FrameTexture; // stores the per-pixel results of path tracing for one frame
TextureHandle m_SkyTexture; // stores the sky background

void InitPathTracing()
void InitPathTracing(RenderGraph renderGraph)
{
#if UNITY_EDITOR
Undo.postprocessModifications += OnUndoRecorded;
Undo.undoRedoPerformed += OnSceneEdit;
SceneView.duringSceneGui += OnSceneGui;
#endif // UNITY_EDITOR

m_RadianceTexture = RTHandles.Alloc(Vector2.one, TextureXR.slices, colorFormat: GraphicsFormat.R32G32B32A32_SFloat, dimension: TextureXR.dimension,
enableRandomWrite: true, useMipMap: false, autoGenerateMips: false,
name: "PathTracingFrameBuffer");
TextureDesc td = new TextureDesc(Vector2.one, true, true);
td.colorFormat = GraphicsFormat.R32G32B32A32_SFloat;
td.useMipMap = false;
td.autoGenerateMips = false;

td.name = "PathTracingFrameBuffer";
td.enableRandomWrite = true;
m_FrameTexture = renderGraph.CreateSharedTexture(td);

td.name = "PathTracingSkyBuffer";
td.enableRandomWrite = false;
m_SkyTexture = renderGraph.CreateSharedTexture(td);
}

void ReleasePathTracing()
Expand All @@ -92,15 +104,21 @@ void ReleasePathTracing()
Undo.undoRedoPerformed -= OnSceneEdit;
SceneView.duringSceneGui -= OnSceneGui;
#endif // UNITY_EDITOR

RTHandles.Release(m_RadianceTexture);
}

internal void ResetPathTracing()
{
m_RenderSky = true;
m_SubFrameManager.Reset();
}

internal void ResetPathTracing(int camID, CameraData camData)
{
m_RenderSky = true;
camData.ResetIteration();
m_SubFrameManager.SetCameraData(camID, camData);
}

private Vector4 ComputeDoFConstants(HDCamera hdCamera, PathTracing settings)
{
var dofSettings = hdCamera.volumeStack.GetComponent<DepthOfField>();
Expand All @@ -119,6 +137,7 @@ private void OnSceneEdit()
// If we just change the sample count, we don't necessarily want to reset iteration
if (m_PathTracingSettings && m_CacheMaxIteration != m_PathTracingSettings.maximumSamples.value)
{
m_RenderSky = true;
m_CacheMaxIteration = (uint)m_PathTracingSettings.maximumSamples.value;
m_SubFrameManager.SelectiveReset(m_CacheMaxIteration);
}
Expand Down Expand Up @@ -157,8 +176,7 @@ private void CheckDirtiness(HDCamera hdCamera)
{
camData.width = (uint)hdCamera.actualWidth;
camData.height = (uint)hdCamera.actualHeight;
camData.ResetIteration();
m_SubFrameManager.SetCameraData(camID, camData);
ResetPathTracing(camID, camData);
return;
}

Expand All @@ -167,8 +185,7 @@ private void CheckDirtiness(HDCamera hdCamera)
if (enabled != camData.skyEnabled)
{
camData.skyEnabled = enabled;
camData.ResetIteration();
m_SubFrameManager.SetCameraData(camID, camData);
ResetPathTracing(camID, camData);
return;
}

Expand All @@ -177,16 +194,14 @@ private void CheckDirtiness(HDCamera hdCamera)
if (enabled != camData.fogEnabled)
{
camData.fogEnabled = enabled;
camData.ResetIteration();
m_SubFrameManager.SetCameraData(camID, camData);
ResetPathTracing(camID, camData);
return;
}

// Check camera matrix dirtiness
if (hdCamera.mainViewConstants.nonJitteredViewProjMatrix != (hdCamera.mainViewConstants.prevViewProjMatrix))
{
camData.ResetIteration();
m_SubFrameManager.SetCameraData(camID, camData);
ResetPathTracing(camID, camData);
return;
}

Expand All @@ -203,6 +218,7 @@ private void CheckDirtiness(HDCamera hdCamera)
{
m_TransformDirty = false;
ResetPathTracing();
return;
}

// Check lights dirtiness
Expand All @@ -220,6 +236,13 @@ private void CheckDirtiness(HDCamera hdCamera)
m_CacheAccelSize = accelSize;
ResetPathTracing();
}

// If the camera has changed, re-render the sky texture
if (camID != m_CameraID)
{
m_RenderSky = true;
m_CameraID = camID;
}
}

static RTHandle PathTracingHistoryBufferAllocatorFunction(string viewName, int frameIndex, RTHandleSystem rtHandleSystem)
Expand Down Expand Up @@ -270,7 +293,7 @@ PathTracingParameters PreparePathTracingParameters(HDCamera hdCamera)
return parameters;
}

static void RenderPathTracing(in PathTracingParameters parameters, RTHandle radianceTexture, CommandBuffer cmd)
static void RenderPathTracing(in PathTracingParameters parameters, RTHandle frameTexture, RTHandle skyTexture, CommandBuffer cmd)
{
// Define the shader pass to use for the path tracing pass
cmd.SetRayTracingShaderPass(parameters.pathTracingShader, "PathTracingDXR");
Expand All @@ -291,10 +314,11 @@ static void RenderPathTracing(in PathTracingParameters parameters, RTHandle radi
// Set the data for the ray miss
cmd.SetRayTracingIntParam(parameters.pathTracingShader, HDShaderIDs._RaytracingCameraSkyEnabled, parameters.cameraData.skyEnabled ? 1 : 0);
cmd.SetRayTracingVectorParam(parameters.pathTracingShader, HDShaderIDs._RaytracingCameraClearColor, parameters.backgroundColor);
cmd.SetRayTracingTextureParam(parameters.pathTracingShader, HDShaderIDs._SkyCameraTexture, skyTexture);
cmd.SetRayTracingTextureParam(parameters.pathTracingShader, HDShaderIDs._SkyTexture, parameters.skyReflection);

// Additional data for path tracing
cmd.SetRayTracingTextureParam(parameters.pathTracingShader, HDShaderIDs._RadianceTexture, radianceTexture);
cmd.SetRayTracingTextureParam(parameters.pathTracingShader, HDShaderIDs._FrameTexture, frameTexture);
cmd.SetRayTracingMatrixParam(parameters.pathTracingShader, HDShaderIDs._PixelCoordToViewDirWS, parameters.pixelCoordToViewDirWS);
cmd.SetRayTracingVectorParam(parameters.pathTracingShader, HDShaderIDs._PathTracedDoFConstants, parameters.dofParameters);

Expand All @@ -306,26 +330,52 @@ class RenderPathTracingData
{
public PathTracingParameters parameters;
public TextureHandle output;
public TextureHandle sky;
}

TextureHandle RenderPathTracing(RenderGraph renderGraph, in PathTracingParameters parameters, TextureHandle pathTracingBuffer)
TextureHandle RenderPathTracing(RenderGraph renderGraph, in PathTracingParameters parameters, TextureHandle pathTracingBuffer, TextureHandle skyBuffer)
{
using (var builder = renderGraph.AddRenderPass<RenderPathTracingData>("Render PathTracing", out var passData))
{
passData.parameters = parameters;
passData.output = builder.WriteTexture(pathTracingBuffer);
passData.sky = builder.ReadTexture(skyBuffer);

builder.SetRenderFunc(
(RenderPathTracingData data, RenderGraphContext ctx) =>
{
RenderPathTracing(data.parameters, data.output, ctx.cmd);
RenderPathTracing(data.parameters, data.output, data.sky, ctx.cmd);
});

return passData.output;
}
}

TextureHandle RenderPathTracing(RenderGraph renderGraph, HDCamera hdCamera)
// Simpler variant used by path tracing, without depth buffer or volumetric computations
void RenderSky(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle skyBuffer)
{
if (m_CurrentDebugDisplaySettings.DebugHideSky(hdCamera))
return;

using (var builder = renderGraph.AddRenderPass<RenderSkyPassData>("Render Sky for Path Tracing", out var passData))
{
passData.visualEnvironment = hdCamera.volumeStack.GetComponent<VisualEnvironment>();
passData.sunLight = GetCurrentSunLight();
passData.hdCamera = hdCamera;
passData.colorBuffer = builder.WriteTexture(skyBuffer);
passData.depthTexture = builder.WriteTexture(CreateDepthBuffer(renderGraph, true, false));
passData.debugDisplaySettings = m_CurrentDebugDisplaySettings;
passData.skyManager = m_SkyManager;

builder.SetRenderFunc(
(RenderSkyPassData data, RenderGraphContext context) =>
{
data.skyManager.RenderSky(data.hdCamera, data.sunLight, data.colorBuffer, data.depthTexture, data.debugDisplaySettings, context.cmd);
});
}
}

TextureHandle RenderPathTracing(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle colorBuffer)
{
RayTracingShader pathTracingShader = m_Asset.renderPipelineRayTracingResources.pathTracing;
m_PathTracingSettings = hdCamera.volumeStack.GetComponent<PathTracing>();
Expand All @@ -336,34 +386,33 @@ TextureHandle RenderPathTracing(RenderGraph renderGraph, HDCamera hdCamera)

CheckDirtiness(hdCamera);

var parameters = PreparePathTracingParameters(hdCamera);
TextureHandle outputTexture = CreateColorBuffer(renderGraph, hdCamera, false);
// TODO RENDERGRAPH: This texture needs to be persistent
// (apparently it only matters for some tests, loading a regular scene with pathtracing works even if this one is not persistent)
// So we need to import a regular RTHandle. This is not good because it means the texture will always be allocate even if not used...
// Refactor that when we formalize how to handle persistent textures better (with automatic lifetime and such).
var radianceTexture = renderGraph.ImportTexture(m_RadianceTexture);

if (!m_SubFrameManager.isRecording)
{
// If we are recording, the max iteration is set/overridden by the subframe manager, otherwise we read it from the path tracing volume
m_SubFrameManager.subFrameCount = (uint)m_PathTracingSettings.maximumSamples.value;
}


#if UNITY_HDRP_DXR_TESTS_DEFINE
if (Application.isPlaying)
m_SubFrameManager.subFrameCount = 1;
#endif

var parameters = PreparePathTracingParameters(hdCamera);
if (parameters.cameraData.currentIteration < m_SubFrameManager.subFrameCount)
{
RenderPathTracing(m_RenderGraph, parameters, radianceTexture);
// Keep a sky texture around, that we compute only once per accumulation (except when recording, with potential camera motion blur)
if (m_RenderSky || m_SubFrameManager.isRecording)
{
RenderSky(m_RenderGraph, hdCamera, m_SkyTexture);
m_RenderSky = false;
}

RenderPathTracing(m_RenderGraph, parameters, m_FrameTexture, m_SkyTexture);
}

RenderAccumulation(m_RenderGraph, hdCamera, radianceTexture, outputTexture, true);
RenderAccumulation(m_RenderGraph, hdCamera, m_FrameTexture, colorBuffer, true);

return outputTexture;
return colorBuffer;
}
}
}
Expand Up @@ -26,21 +26,23 @@
float4x4 _PixelCoordToViewDirWS;
int _RaytracingCameraSkyEnabled;
float4 _RaytracingCameraClearColor;

// DoF related parameters
float4 _PathTracedDoFConstants; // x: aperture radius, y: focus distance, zw: unused
TEXTURE2D_X(_SkyCameraTexture);

// Output(s)
RWTexture2D<float4> _RadianceTexture;
RW_TEXTURE2D_X(float4, _FrameTexture);

// DoF related parameters
float4 _PathTracedDoFConstants; // x: aperture radius, y: focus distance, zw: unused

[shader("miss")]
void MissCamera(inout PathIntersection pathIntersection : SV_RayPayload)
{
bool skyEnabled = _EnvLightSkyEnabled && _RaytracingCameraSkyEnabled;
pathIntersection.value = skyEnabled ? SampleSkyTexture(WorldRayDirection(), 0.0, 0).xyz : _RaytracingCameraClearColor.xyz * GetInverseCurrentExposureMultiplier();
pathIntersection.alpha = skyEnabled ? 1.0 : _RaytracingCameraClearColor.w;
float4 missColor = skyEnabled ? _SkyCameraTexture[COORD_TEXTURE2D_X(pathIntersection.pixelCoord)] : _RaytracingCameraClearColor;
pathIntersection.value = missColor.xyz * GetInverseCurrentExposureMultiplier();
pathIntersection.alpha = missColor.w;

ApplyFogAttenuation(WorldRayOrigin(), WorldRayDirection(), pathIntersection.value);
ApplyFogAttenuation(WorldRayOrigin(), WorldRayDirection(), pathIntersection.value, pathIntersection.alpha);

if (_EnableVolumetricFog && _RaytracingMinRecursion <= 1)
{
Expand Down Expand Up @@ -149,7 +151,7 @@ void RayGen()
// Evaluate the ray intersection
TraceRay(_RaytracingAccelerationStructure, RAY_FLAG_CULL_BACK_FACING_TRIANGLES, RAYTRACINGRENDERERFLAG_PATH_TRACING, 0, 1, 0, rayDescriptor, pathIntersection);

_RadianceTexture[currentPixelCoord] = float4(pathIntersection.value, pathIntersection.alpha);
_FrameTexture[COORD_TEXTURE2D_X(currentPixelCoord)] = float4(pathIntersection.value, pathIntersection.alpha);
}

// This should never be called, return magenta just in case
Expand Down

0 comments on commit 24a1479

Please sign in to comment.