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

[URP] OutlinePass doesn't restore default render targets which break further rendering #54

Open
STARasGAMES opened this issue Feb 10, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@STARasGAMES
Copy link

To fix this I modified OutlinePass.cs at line ~106

cmd.SetRenderTarget(_renderer.cameraColorTarget, _renderer.cameraDepthTarget); // added line
context.ExecuteCommandBuffer(cmd);
CommandBufferPool.Release(cmd);

For such a small fix, I don't want to make a pull request, please forgive my laziness :)

P.S.
Most likely this line should be placed in a few more places to cover all setting combinations, but for my situation it solves the issue.

Thanks again for your excellent work on this project. It's a blessing to read well-structured code

@Arvtesh Arvtesh self-assigned this Feb 13, 2022
@Arvtesh Arvtesh added the bug Something isn't working label Feb 13, 2022
@Arvtesh
Copy link
Owner

Arvtesh commented Feb 13, 2022

Thanks for the report!

@Arvtesh
Copy link
Owner

Arvtesh commented Feb 15, 2022

Hm, I'm actually not sure if this is something worth doing. Standard URP render features don't seem to have any code that restores default render target. Instead, each render pass sets its own render target. @STARasGAMES could you share details of your use-case please?

@STARasGAMES
Copy link
Author

Hi @Arvtesh
Yes, sure.
So, I have Outline as a first feature, then goes URP's built-in Render Objects feature
image

This is how it looks without outline:
image

And that's how it looks with:
image

Notice broken gun rendering. This happens because there is no depth target currently active which leads to completely ignoring ZTest:
image
(at least frame debugger indicates that there is no depth target)

But if there is no outline pass before rendering the gun, then we can see the depth target and image renders correctly.
image

Adding the line, that reverts to default render targets fixes this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants