#HDRP custom pass inject before a specific object is rendered?
1 messages · Page 1 of 1 (latest)
So, rendertexture?
Yes, blit to a render texture before the object is rendered.
Sure, Shader graph has a node specifically for it too if you wanna do that
Actually may need to use LOD sample texture I believe
~~https://docs.unity3d.com/Packages/com.unity.shadergraph@6.9/manual/Sample-Texture-2D-LOD-Node.html~~
Ah, that's at the vertex level so maybe the non-LOD node suffices
Been a minute since I've done much with them
The shader I have is in HLSL code. Right now I am blitting to a render texture in a custom pass, however the injection point which is set to before post process is not ideal.
Ideally I'd like to keep the render order to be default and blit right before the pipeline renders it
I just don't know how to do that
It is a transparent shader, so I want to preserve how the pipeline calculates depth with other transparent objects and capture the color buffer before it renders so that it includes the transparent objects behind it.
Can you not set it to before transparents? I usually just use graphic buffers and blit using that and it seems to following the ordering of my objects without explicitly giving it an injection time.
No if I set to before transparents, the blitted color buffer won't include any transparent objects at all
So what's the difference from using a transparent/opaque color buffer and blitting this texture yourself
What do you mean?
You're capturing all previous transparents and modifying it with a shader, then using that information for the next transparent?
Kind of, it is only for one custom shader and one object. I want to capture the color buffer right before the shader is rendered so that I can apply blur to it.
It is not a fullscreen shader either
I want it to include transparents that are behind it in the color buffer so it appears in the blur
But anyway, usually if you can't do it with render objects, then you're doing some custom pipeline scripting.
Really though it seems like just passing in a transparent color buffer into your shader and modifying it there is all you need to do
Yeah I get that, just was wondering if it is possible to leave the render order up to the pipeline but capture the color buffer before a specific shader is rendered and feed it to it
Right and I have that working on the shader side, but I don't know how to capture it at the right step in the render pipeline
Before transparent is too early, Before post process is too late. I want it to render transparents behind the object, blit the color buffer after, and then pass it to the shader, then render other transparents in front of the custom shader
Yeah I see what you mean. I was thinking hey just save the current transparents and use them next frame but that probably doesnt fit the requirements
I guess I could do the depth calculations for transparents myself in the before transparents pass then render all transparents myself and before my object gets render capture the color buffer.
I think I would be double rendering all transparents in that case though
Because I don't think there is a way to manually render transparents and then have the pipeline skip them? Or is there a way to do that?
Yeah, I'm not entirely sure. I'd imagine you have to draw them all manually via scriptable render pass and* by structuring a bunch of command buffers and calling draw and blitting between each call... or well blit before drawing what you need