Quantcast
Channel: Questions in topic: "post processing"
Viewing all articles
Browse latest Browse all 713

URP Render Feature missing in final output

$
0
0
Hi! I'm fairly new to URP and Shaders in general, but I do have a general understanding of how it works.

Right now, I have a material that uses a CRT shader. Normally, with the built-in Unity Renderer, I could just use `Graphics.Blit` to apply the material affect to the camera, but as I've found out, this isn't the case for URP.

Consider the following view, before any post processing:

![Render before post-process view.](https://image.prntscr.com/image/BpwiMWlDR86GlIzAjlqiFg.png "Render before post-process view.")
Using the default Unity renderer, along with `Graphics.Blit`, I'm able to achieve this:

![Render after post-process, using the default Unity renderer.](https://image.prntscr.com/image/7aV3h_86Rzi8gotbPMAceA.png "Render after post-process, using the default Unity renderer.")
However, even after switching my code up to blit using `CommandBuffer` instead, the output still remains unchanged (it looks like the first picture, instead of the second.)

Upon analysis using Frame Debugger, the correct view is rendered, however it gets replaced by a "Final Blit Pass". Since I'm new to this, I have absolutely no idea how to either disable it (which I guess would be a bad idea), nor how to pass the correct render texture to that pass.

I wanted to know exactly what I got wrong, or what I missed, since searching for answers online hasn't helped that much.

I use the following class extending ScriptableRenderPass in order to blit the material and the camera's render texture. class MaterialBlitPass : ScriptableRenderPass { private bool enabled; private Material basisMaterial; private int screenCopyID; public MaterialBlitPass(Material basisMaterial, ref bool enabled) { this.basisMaterial = basisMaterial; this.enabled = enabled; } public override void Configure(CommandBuffer cmd, RenderTextureDescriptor cameraTextureDescriptor) { screenCopyID = Shader.PropertyToID("_AfterPostProcessTexture"); cmd.GetTemporaryRT(screenCopyID, cameraTextureDescriptor); } public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) { CommandBuffer cmd = CommandBufferPool.Get(); if (enabled && basisMaterial != null) { RenderTargetIdentifier dst = BuiltinRenderTextureType.CurrentActive; cmd.Blit(BuiltinRenderTextureType.CurrentActive, screenCopyID); cmd.Blit(screenCopyID, BuiltinRenderTextureType.RenderTexture, basisMaterial, 0); cmd.SetRenderTarget(BuiltinRenderTextureType.RenderTexture); } context.ExecuteCommandBuffer(cmd); CommandBufferPool.Release(cmd); } public override void FrameCleanup(CommandBuffer cmd) {} }
I still can't find out why the correctly-rendered version is not the one displayed. What am I missing or what might be the cause of the problem? Hopefully someone can point me towards the right direction.
Thanks!

Viewing all articles
Browse latest Browse all 713

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>