-
Notifications
You must be signed in to change notification settings - Fork 855
[2021.2] Control Volume Framework updates #4242
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
/// <summary> | ||
/// Returns true if this camera should automatically replace NaN/Inf in shaders by a black pixel to avoid breaking some effects. | ||
/// </summary> |
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.
Extra documentation that bothered me when looking at the code.
/// <summary> | ||
/// Returns true if this camera applies 8-bit dithering to the final render to reduce color banding | ||
/// </summary> |
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.
Extra documentation that bothered me when looking at the code.
/// <summary> | ||
/// Returns the selected scene-layers affecting this camera. | ||
/// </summary> |
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.
Extra documentation that bothered me when looking at the code.
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.
Thank you.
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.
It's a bit vague IMO. In HDRP this field is documented like this:
Layer mask used to select which volumes will influence this camera.
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.
@oleks-k I like the suggestion here. What are your thoughts?
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.
I would suggest this description (does it return a list?):
Returns the list of Layers selected in the Layer property of this Camera.
Is it technically correct?
/// <summary> | ||
/// Returns the transform that will act as a trigger for volume blending. | ||
/// </summary> |
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.
Extra documentation that bothered me when looking at the code.
@Unity-Technologies/mobile-qa could you test if this PR does not regress anything on mobile side? |
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 is looking good :) Main question I have is how we expect users to update volumes via scripting - what is the API point for this. At first thought, I would expect a call on Camera or similar to update the volume for that camera that instant. Furthermore, another call to update all volumes stacks at once.
com.unity.render-pipelines.universal/Runtime/UniversalAdditionalCameraData.cs
Outdated
Show resolved
Hide resolved
com.unity.render-pipelines.universal/Runtime/UniversalAdditionalCameraData.cs
Outdated
Show resolved
Hide resolved
com.unity.render-pipelines.universal/Runtime/UniversalAdditionalCameraData.cs
Outdated
Show resolved
Hide resolved
/// Returns the current volume stack used by this camera | ||
/// </summary> | ||
VolumeStack m_VolumeStack = null; | ||
public VolumeStack volumeStack |
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.
At the moment this is the main location where we expect users to interact with when using ViaScripting
?
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.
(As you know but replying in case other reviewers are thinking the same)
We now have functions on the Camera to update the volume framework.
If users would like to change the stack used by this camera, then they have the possibility here to replace the volumeStack with their custom one.
com.unity.render-pipelines.universal/Runtime/UniversalRenderPipelineCore.cs
Outdated
Show resolved
Hide resolved
com.unity.render-pipelines.core/Runtime/Volume/VolumeManager.cs
Outdated
Show resolved
Hide resolved
com.unity.render-pipelines.universal/Runtime/UniversalAdditionalCameraData.cs
Outdated
Show resolved
Hide resolved
com.unity.render-pipelines.universal/Runtime/UniversalAdditionalCameraData.cs
Outdated
Show resolved
Hide resolved
com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs
Outdated
Show resolved
Hide resolved
com.unity.render-pipelines.universal/Runtime/UniversalRenderPipeline.cs
Outdated
Show resolved
Hide resolved
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.
LGTM
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.
Looks good!
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.
No issues found. Tested Scripting API and Settings in the inspector with one camera, multiple cameras, camera stacking.
Test doc: https://docs.google.com/document/d/1oMyqz56wyz0r2PZtnZnn1Zkp53GggA-nKg1kJon9FMI/edit#
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.
Looks good on mobile side and no issues found. Used Erika's provided project to test different scenarios. Regarding performance, as discussed with Elvar, this will be done later due to lack of time, but performance should only be improved due to given option for user to disable or control the volume frame work updates. Other than that, looks good.
# Conflicts: # com.unity.render-pipelines.universal/Editor/Camera/UniversalRenderPipelineCameraEditor.cs
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.
Please change the DrawPopUp
|
||
// Dropdown menu options | ||
public static string[] mainLightOptions = { "Disabled", "Per Pixel" }; | ||
public static string[] volumeFrameworkUpdateOptions = { "Every Frame", "Via Scripting" }; |
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.
You can use this approach: https://unity.slack.com/archives/C20E70CAC/p1615891650014300
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.
do in a next PR
Purpose of this PR
This PR is adding the option to disable volume framework updates in the Camera Inspector and to the URP Asset. It also adds public API on the Camera for users to update the volume or to change the setting.
Things done in this PR
Editor changes
Advanced
Scripting changes
Public
ResetMainStack()
function.GetVolumeFrameworkUpdateMode()
SetVolumeFrameworkUpdateMode(VolumeFrameworkUpdateMode mode)
UpdateVolumeStack()
UpdateVolumeStack(UniversalAdditionalCameraData cameraData)
requiresVolumeFrameworkUpdate
volumeStack
VolumeFrameworkUpdateMode
volumeFrameworkUpdateMode
Internal
GetVolumeLayerMaskAndTrigger(UniversalAdditionalCameraData cameraData, out LayerMask layerMask, out Transform trigger)
volumeFrameworkUpdateMode
Other changes
UI Changes
Camera Inspector
Before
After
URP Asset
Before
After
Testing
What has been tested
What needs testing
UpdateVolumeStack()
functions do not do anything when it's set to EveryFrameUpdateVolumeStack()
functions update the correct volume stack when it's set to Via Scripting (Test with multiple cameras with various mask settings)requiresVolumeFrameworkUpdate
returns correct resultsLater work
A follow-up PR will add the new test scene to our CI