Experimenting with rendering to textures and blend modes

Hello there! For a little project I’m working on I need to be able to draw materials on render targets using blend modes, such as ‘Max’ (the pixel value is either the old one or the material’s, whichever is higher)

Looks like there is no ‘out of the box’ way to do this, so I figured I could do it in the material by getting a reference to that same texture and using a ‘Max’ node. However, it doesn’t work. I think it is because of using the same texture you’re rendering to.

Can anyone confirm this, or offer any solutions? Thanks in advance :smiley:

You need to use two render targets and cycle between them. You can just store an int of the pass index and every tick use mod2 and select the rts using 0 and 1. Set the rt you draw to to be the opposite one the MID reads.

That works flawlessly! In addition, I can use the opposite rt as a parameter of the drawing material, which allows me to blend two textures in any way :slight_smile: (altough there has to be a third texture, but whatever)