Skip to content
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

Universal/runtime render pass #2719

Closed
wants to merge 20 commits into from
Closed

Conversation

Nzollner
Copy link
Contributor

@Nzollner Nzollner commented Nov 23, 2020

Status

This is a Draft and is currently still missing documentation.

Purpose of this PR

This PR fixes the render passes not being able to be enqueued at runtime.
Which is requested by this bug case: https://fogbugz.unity3d.com/f/cases/1211195/
And to show the feature working is a sample implemented which also helps the user.

Testing status

I tested this PR locally on Windows 10 using DX11 on UniversalGraphicsTest.
I have also tested the feature manually when creating the sample using the fix.

Comments to reviewers

Please check the sample and come with feedback making the sample better for the user.

@ellioman
Copy link
Contributor

I removed the needs-backport-8.x tag as we won't backport more PR's to that version.
Add the tag for 7.x if you think we should backport this fix for LTS.

Copy link
Contributor

@phi-lira phi-lira left a comment

Choose a reason for hiding this comment

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

Also missing changelog.

// make fog work
#pragma multi_compile_fog

#include "UnityCG.cginc"
Copy link
Contributor

Choose a reason for hiding this comment

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

Needs to be written in SRP shader library / URP. This is using old built-in shader library.

Copy link
Contributor

Choose a reason for hiding this comment

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

Shader also needs to be stereo aware. @thomas-zeng

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The updated shader should now use the universal shader library and is now using HLSL instead of cginc.

for (var i = 1; i < settings.blurPasses - 1; i++)
{
cmd.SetGlobalFloat("_offset", 0.5f + i);
cmd.Blit(tmpRT1, tmpRT2, settings.blurMaterial);
Copy link
Contributor

Choose a reason for hiding this comment

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

This won't work on XR. @thomas-zeng can you help?

Copy link
Contributor

@thomas-zeng thomas-zeng Dec 2, 2020

Choose a reason for hiding this comment

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

XR prefers to use DrawMesh will fullscreen quad to do blit.
cmd.Blit in some cases will use built-in blit shader which doesn't work well with URP.
With DrawMesh, we can explicit set the blit shader. And DrawMesh has better yflip control.
See how URP SSAO handles blit here:

cmd.DrawMesh(RenderingUtils.fullscreenMesh, Matrix4x4.identity, material, 0, (int)pass);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The result is used in Shader Graph is it possible to use XR textures in shader graph?

Copy link
Contributor

@Jonasmortensen Jonasmortensen left a comment

Choose a reason for hiding this comment

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

As more package samples are added to URP there needs to be a common template that makes it easy for users to investigate and navigate the samples. With this being the first sample landing in URP this is not an issue at the moment but it might need to be revisited in the near future.

@Nzollner
Copy link
Contributor Author

XR for MockHMD: Single pass instanced is not working but if instanced is turned off the Kawase blur will the correct result return on the left lens.

@phi-lira
Copy link
Contributor

Closing PR. Can be reopened if necessary.

@phi-lira phi-lira closed this Aug 25, 2021
@sebastienlagarde sebastienlagarde deleted the universal/runtimeRenderPass branch September 1, 2021 10:19
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.

5 participants