-
Notifications
You must be signed in to change notification settings - Fork 860
Mixed cached shadows for directional lights #6030
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
|
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 SRP Core 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. |
|
It appears that you made a non-draft PR! |
sebastienlagarde
left a comment
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.
This PR fixes also an issue we had with area light and mixed cached shadows.
can you make a separte backport PR for 21.2 for this fix? thanks
Done! #6121 |
# Conflicts: # com.unity.render-pipelines.high-definition/CHANGELOG.md # com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl
|
ping me when QA & yamato are good. We should be able to merge it. |
kecho
left a comment
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.
Very cool! Any chance you could add a test?
|
I can try, cannot be fully tested as it will require precise camera movements to test all aspects, but will try to add something |
|
Added and run tests, but got some seemingly unrelated fails. Re-running |
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.
Fantastic. Thank you so much. Checked the tests, looks rock solid. Waiting on QA now and this should be ready to merge in.
|
@Unity-Technologies/gfx-qa-hdrp Got easy on the merge button, we had automated testing work, but still worth looking a bit and lemme know if something got bad. |
|
Tested again the feature from scratch to made sure I understand. Only thing I'd like changed is the typo on the tooltip on the HDRP Asset. Here's the proposed version: |
|
Hi, this is a feature we definitely need in our game to hit our performance target. I have tried back-porting it to 2021.2.0f1 and it works but only in the scene edit view. Do you have an idea about where the problem could be? |
The video captured in this PR is in playmode and I tested again locally playmode and all is fine. When it comes to cached shadows and directional lights is really important to know that the shadows are view dependent. For the cached component this is really important as when switching the view a lot the cached component is invalidated. I assume you have scene and game view together at the same time? (This will confuse one of the two as the view) Generally the cached component needs to be updated every time you have significant change on the main view. If you have only one view and no other change in view, it might be that your backport was not successful. One thing that is fundamental to get things working properly is this https://github.com/Unity-Technologies/Graphics/pull/6030/files#diff-f649de66adbf0e482453589d1bb42e446bdb7df4af577f41355a71dc72caca50R333 in case you missed this step. |
|
More info: In the build it works but only up to a certain world position, then the shadows get "noodlified" as i move and stop working as i move further, if i go back it "de-noodlifies" and works again. In the editor in playmode it is not right no matter what i do. I did check the changes you linked to (even before posting here as it was what i thought too). Could it be that im on an older version of HDRP (2021.2 + 12.1)? This was tested on 2022 alpha right? |
This change fixes an issue where the shadow atlas could end up with an invalid texture handle after the render pipeline asset is modified and reloaded. The previous code was invalidating the output texture handle in some particular cases, but a new handle was recently added to the atlas code without updating the invalidation logic. This change simply adds the new handle to the existing invalidation logic. The new handle was added as part of #6030 and merged into master as: c83cb31 This fix may need to be backported to other branches.
This PR implements mixed cached shadows (allow always draw dynamic) for directional lights too. Turned out to be less trivial than I originally thought :D It was a bit tricky to get the 2 set of rendered data to agree with the fact that they are drawn with different view positions. To solve this we warp the dynamic ones to be rendered in the camera space of the cached shadows.
In this Pic, the shadows are set to OnDemand, the dancing avatar and a spinning cube are dynamic so the shadow is updated. The other spinning cube is marked as static and so it doesn't update/render.
MixedDirCachedShadows.mp4
This PR fixes also an issue we had with area light and mixed cached shadows.
Also, given that it comes with an extra memory cost, it is an option in the HDRP asset.
For QA: Please give a spin with other light types for the OnDemand/OnEnable with/without Always Draw Dynamic option. Also a bit of playing with normal shadows in directional wouldn't hurt.