#Writing a to a global, single channel alpha (A8) texture via URP renderer feature

1 messages · Page 1 of 1 (latest)

shell gorge
#

Hey all,

I'm looking for a way to create a mask based on the alpha output of a selection of renderers (no material override) in a scene.

I'm able to get that result but currently I'm writing a 4 channel texture only to use its alpha channel, and I'd like to only write a single channel. The only single channel color format available is R8.

Would appreciate help with this!

last storm
shell gorge
last storm
shell gorge
#

It's a pretty simple setup.
I'm using a renderer feature that renders a set of objects (using their original shaders) and outputs the result. I store the result in a global texture and then composite it in a separate pass.

I'm only using the alpha channel, so the RGB channels are better skipped. But if I store the texture in an R8 format, I get the red channel written there, not the alpha.

I'm not sure how to get the alpha channel to write into the R8 channel.

#

Or rather, I'm wondering if there's a way to do that within the renderer feature rather than modifying the shaders themselves.

last storm
#

It's just a channel that stores 8 bits of data. The texture doesn't care how you use that data.

#

So I don't really understand what the issue you're having is.

shell gorge
# last storm As I said earlier, there's no difference between red or alpha channels if you on...

My problem is not about the difference in data type, it's the ability to write the alpha channel into the red channel.

The behavior is that when I set the render target, then render, if I use the R8 format, I get the data from the source's red channel written to my render target (which is R8).

I want to somehow instruct the process to store the alpha channel from the source, to the red channel in the target.

So right now it's doing source.r->target.r, but I want it to do source.a->target.r.

last storm
#

Well, that's controlled by the pixel shader.

#

You'll need to make sure that your pixel shaders in the pass output to the render target r channel.

shell gorge
#

Right, so that was the question, is there a way to switch the channels up before I save the global texture, in the renderer feature.

last storm
#

No. Only the shader.