-
Notifications
You must be signed in to change notification settings - Fork 839
Fixed gizmos drawing in game view #3272
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
…s depth buffer when gizmos enabled.
// In game view final target acts as back buffer were target is not flipped | ||
bool isGameViewFinalTarget = (cameraData.cameraType == CameraType.Game && destination == RenderTargetHandle.CameraTarget); | ||
bool yflip = (renderingToTexture && !isGameViewFinalTarget) && SystemInfo.graphicsUVStartsAtTop; | ||
float flipSign = yflip ? -1.0f : 1.0f; |
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 am not super happy about this, open for suggestions
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'm worried as well a little bit about this one. It would be better if we would fix the cameraData.IsCameraProjectionMatrixFlipped() instead.
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 have bool yflip = (renderingToTexture && !isGameViewFinalTarget) && SystemInfo.graphicsUVStartsAtTop;
which is same as (renderingToTexture && SystemInfo.graphicsUVStartsAtTop) && !isGameViewFinalTarget
and renderingToTexture && SystemInfo.GraphicsUVStartsAtTop
is same as IsCameraProjectMatrixFlipped
so it could be rewritten as bool yflip = cameraData.IsCameraProjectionMatrixFlipped() && !isGameViewRenderTarget
?
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.
Fixed
It appears that you made a non-draft PR! |
com.unity.render-pipelines.universal/Runtime/ForwardRenderer.cs
Outdated
Show resolved
Hide resolved
// In game view final target acts as back buffer were target is not flipped | ||
bool isGameViewFinalTarget = (cameraData.cameraType == CameraType.Game && destination == RenderTargetHandle.CameraTarget); | ||
bool yflip = (renderingToTexture && !isGameViewFinalTarget) && SystemInfo.graphicsUVStartsAtTop; | ||
float flipSign = yflip ? -1.0f : 1.0f; |
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'm worried as well a little bit about this one. It would be better if we would fix the cameraData.IsCameraProjectionMatrixFlipped() instead.
Failing tests are known issues that are not related to this PR: [Yamato] Build VFX_URP on Win_DX11_mono_Linear_Standalone_cache_build_Player on version trun [Yamato] Universal on Android_OpenGLES3_Standalone_cache_il2cpp_Linear on version trunk |
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.
Looking good after fixes! No regressions found.
…universal/fix-game-view-gizmos
…universal/fix-game-view-gizmos
…universal/fix-game-view-gizmos
Purpose of this PR
Fix gizmos drawing in game view, by enabling copy depth pass in game view when gizmos are on. This way filled depth buffer is passed to gizmos pass.
With gizmos game view (Now it also contained in sampler):

Testing status