Skip to content

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

Merged
merged 13 commits into from
Feb 18, 2021
Merged

Conversation

lukaschod
Copy link
Contributor

@lukaschod lukaschod commented Jan 27, 2021

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):
image


Testing status

  • Checked if it works with depth prepass.
  • Checked if it works only with depth copy from opaque pass.
  • Checked if it works with offscreen target.
  • QA Pass to check if there is no regression with copy depth pass.

@lukaschod lukaschod requested a review from a team as a code owner January 27, 2021 08:23
// 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;
Copy link
Contributor Author

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

Copy link
Contributor

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.

Copy link
Contributor

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 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@github-actions
Copy link

It appears that you made a non-draft PR!
Please convert your PR to draft (button on the right side of the page)
and cancel any jobs that started on Yamato.
See the PR template for more information.
Thank you!

@lukaschod lukaschod requested a review from phi-lira January 27, 2021 08:23
// 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;
Copy link
Contributor

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.

@lukaschod
Copy link
Contributor Author

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
On demand schedular
https://jira.unity3d.com/browse/URP-704

[Yamato] Universal on Android_OpenGLES3_Standalone_cache_il2cpp_Linear on version trunk
[Yamato] Universal on Android_Vulkan_Standalone_cache_il2cpp_Linear on version trunk
[Yamato] Universal on iPhone_Metal_Standalone_cache_il2cpp_Linear on version trunk
Denoiser
https://jira.unity3d.com/browse/URP-705

@lukaschod lukaschod requested a review from a team January 28, 2021 14:05
@simon-engelbrecht-soerensen simon-engelbrecht-soerensen requested review from simon-engelbrecht-soerensen and removed request for a team February 3, 2021 07:56
Copy link

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.

@lukaschod
Copy link
Contributor Author

lukaschod commented Feb 18, 2021

https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/universal%252Ffix-game-view-gizmos/.yamato%252Funiversal_hybrid-win-dx11.yml%2523Universal_Hybrid_Win_DX11_playmode_mono_Linear_trunk/5377787/job
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/master/.yamato%252Funiversal_hybrid-win-dx11.yml%2523Universal_Hybrid_Win_DX11_playmode_mono_Linear_trunk/5383550/job
Overall status: FAIL
Reason(s): FAILURE REASON: One or more tests have failed.
Total tests: 37
Failed test count: 3
Successful tests count: 33
Not run tests count: 1

https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/universal%252Ffix-game-view-gizmos/.yamato%252Funiversal_hybrid-osx-metal.yml%2523Universal_Hybrid_OSX_Metal_playmode_mono_Linear_trunk/5377788/job
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/master/.yamato%252Funiversal_hybrid-osx-metal.yml%2523Universal_Hybrid_OSX_Metal_playmode_mono_Linear_trunk/5388072/job
Overall status: FAIL
Reason(s): FAILURE REASON: One or more tests have failed.
Total tests: 37
Failed test count: 3
Successful tests count: 33
Not run tests count: 1

https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/universal%252Ffix-game-view-gizmos/.yamato%252Furp_lighting-iphone-metal.yml%2523URP_Lighting_iPhone_Metal_Standalone_cache_il2cpp_Linear_trunk/5377741/job
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/master/.yamato%252Furp_lighting-iphone-metal.yml%2523URP_Lighting_iPhone_Metal_Standalone_cache_il2cpp_Linear_trunk/5388009/job
Overall status: FAIL
Reason(s): FAILURE REASON: One or more tests have failed.
Total tests: 37
Failed test count: 1
Successful tests count: 36
Not run tests count: 0

https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/universal%252Ffix-game-view-gizmos/.yamato%252Furp_foundation-linux-vulkan.yml%2523URP_Foundation_Linux_Vulkan_Standalone_cache_mono_Linear_trunk/5377716/job
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/master/.yamato%252Furp_foundation-linux-vulkan.yml%2523URP_Foundation_Linux_Vulkan_Standalone_cache_mono_Linear_trunk/5383537/job
Overall status: FAIL
Reason(s): FAILURE REASON: One or more tests have failed.
Total tests: 74
Failed test count: 2
Successful tests count: 71
Not run tests count: 1

https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/universal%252Ffix-game-view-gizmos/.yamato%252Furp_foundation-android-vulkan.yml%2523URP_Foundation_Android_Vulkan_Standalone_cache_il2cpp_Linear_trunk/5377720/job
Disrupted

https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/universal%252Ffix-game-view-gizmos/.yamato%252Fvfx_urp-win-dx11.yml%2523Build_VFX_URP_Win_DX11_Standalone_cache_mono_Linear_trunk/5377790/job
https://yamato.cds.internal.unity3d.com/jobs/902-Graphics/tree/master/.yamato%252Fvfx_urp-win-dx11.yml%2523Build_VFX_URP_Win_DX11_Standalone_cache_mono_Linear_trunk/5388750/job
Overall status: FAIL
Reason(s): FAILURE REASON: One or more non-test related errors or failures occurred.
Total tests: 0
Failed test count: 0
Successful tests count: 0
Not run tests count: 0

@lukaschod lukaschod merged commit 415113c into master Feb 18, 2021
@lukaschod lukaschod deleted the universal/fix-game-view-gizmos branch February 18, 2021 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants