Is there a way to get the color underneath the current pixel in a fragment program?

Hullo again! It’s been a while.

So, pretty new to the whole shaders thing I was wondering how I go about getting the color of the pixel underneath the current pixel I’m processing in a fragment program. If I can’t, is there any other similar solutions where I can basically write my own blend modes?

Thanks.

1 Like

You can render the scene once to the off-screen buffer, so called “render target”, and then use it as a texture for other shaders - therefore, what’s rendered next - can get a pixel “underneath” - so from a render target of what’s already drawn on the scene.

This is a basic approach for semi-transparency, color grading, post process effects, so you can learn basics, e.g. here:

This even uses the same approach (render the scene first to a render target, then use it to draw the final scene result (here drawing even two - scene + a separate light map) - and I think this video (which is mine :sweat_smile: ) explains it well: