Texture parameter not updating for material drawing on the same texture

Hello everyone!

I have a question regarding texture parameters in UE4. I’m trying to make a brush material to paint on a texture render target using Blueprints. I want the brush to do a max value on every pixel between the previous and the next color, meaning painting twice or thrice at the same location will not have any effect. I hope I made myself clear.
It is crucial that the new color is a maximum between old and brush, and not just painted over or added using the opacity of the brush.

The flow of the rendering should look something like this:


The red cross in the picture indicates that which I can’t seem to get to work. Circles indicating Materials, Square indicating texture render target.

Before I go into explaining what I have done so far, I ask if this behavior is even possible to achieve in the first place?

Since this did not work for me, I went ahead and extended the flow map to the point it actually works. This is what I got to work:


Since I thought that the feeding of the same render target to the drawing of that texture target was the problem, I went full out to avoid it. This requires triple amount texture render targets and double amount of dynamic materials for every mesh I want to use this on.

A great flaw with my current method (the one with 3 render targets), is the fact that the problem at hand arises anyways if I want to draw twice on locations where the brushes would overlap during the same tick. To overcome this I would have to use a separate texture render target for each of the locations I want to draw the brush, and then combine them one at a time. To clarify, I want to be able to draw twice within reach, so this is not an acceptable solution for me.

This is the part of the brush which doesn’t seem to work:

This is the result I want to achieve (and already have, but in an undesired way):

This is the result of the not working flow:

This is the result of the not working flow if I don’t pass the render target to the dynamic brush material when I create it:

The difference between the last two pictures is crucial, the gray squares are the red channel of the engine default texture sample for texture parameters, which means that the first (of the two bad results) receives the texture target as a parameter and uses it, but the parameter is then never updated. The same texture target is used in the material that displays it onto the mesh on the screen - which means that the render target itself is updating, but only one of the 2 parameters is updating correctly.

I tried both on 4.17 and 4.19 but the results were the same.

Thanks for any help!

Carl