Texture sampler how to output rgb values

Hi creators !

Is it possible to output rgb values from texture sampler ?
I want to sample camera texture and check rgb values to know for example if it’s a range of green values.

Thanks for you answers.

All the best !

It’s not possible to output scalar values from a texture sampler. You can’t convert shader signals to another type, but you might be able to find a solution with shader logic. What are you trying to do?

Thanks Josh !
I want to sample the color of the screen (camera extraction) by screen tap and verify if rgb value is between a range and do something or if it’s outside doing another thing.
For example sample the green color of the grass in a garden and if it’s outside a range of green values trigger something.
I don’t know if I am very clear… :sweat_smile:
Thank you again for your reply.

Ah, yeah you would need to figure out how to do this with shaders somehow. It’s very specific to your particular setup, so maybe it won’t work. The idea is to take the distance to the target color and use that to control alpha. You can use step to make it act like a switch.

For animating the changes, you can use delay frames to slowly build up the texture so it acts like a fade effect.

Thank you Josh! I’ll look at the shaders. However, I’m not going to need to animate any colorimetric changes. I just want to sample the green color of the grass in the garden to determine if it is an acceptable “green” and trigger a message like you are a “good” or “bad” gardener :sweat_smile: