Canvas Render Target 2D draw without remove old texture

I got a problem with the Canvas Render Target 2D I need paint in the ground but adding all the time to the texture, the problem when I add and update the old texture is gone and I need keep the old changes and the new ones, someone knows how to do this ?

https://dl.dropboxusercontent.com/u/28070491/UE/Forums/2016-03-07_16-02-49.png

I call the bottom function to draw a texture (to add)

Create multiple CanvasRenderTarget2Ds, use one to update the other. I’m working on something that requires this. I’ll show you my setup so far.

I created a CanvasRenderTarget2D blueprint called MatRT that will draw either a static material, or a material instance dynamic.

If the CanvasRenderTarget2D is given a material instance dynamic, it updates any texture, vector or scalar parameters with this function.

Instances of MatRT are created in another blueprint that I’m using to test. This function creates an instance with a static material.

This function creates an instance with a dynamic material.

This function updates an instance with a dynamic material.

Here’s the main blueprint.

To walk you through the spaghetti, a dynamic instances of the material RMLayers is created.
Two instances of MatRT are created to draw LatLongMat and DistGrid.
A new instance of MatRT is created to draw the dynamic instance of RMlayers, with the MatRTs that draw LatLongMat and DistGrid passed as texture parameters.
An instance of MatRT is created to draw NextStep.
A dynamic instance of the material LayerCombiner is created. The MatRTs that draw RMLayers and Nextstep are set as texture parameters.
The MatRT that draws RMLayers is updated every few ticks with a dummy camera position.

1 Like

Thanks you for the reply and help, I will try this, but this looks too heavy no ?

What I’m using it for is a bit heavy, but a lot lighter than the alternative. It can be used to ray march, without having to update the rayfield at all distances at the same time, and distant rayfields can be rendered at lower resolutions. I haven’t added the asynchronous rendering yet, cause I still have some texture seam glitches to work out, but this only adds 2-4ms to my frame. Most of that is due to the instruction count on my materials, not the render targets.

You could use a setup more like this.

It renders at 120 fps for me, no difference from the base project.

1 Like

Hey,

Would it be possible to use this approach and render to a texture instead of a new dynamic material, so that it can be used in a previously made material? I’m trying to figure out how to grab multiple actor locations in a scene, and update and add to a mask similarly to what is being done here.

Any help would be great!

[MENTION=474005]Austin P.[/MENTION] 4.13 has DrawMaterialToRenderTarget which draws to a render target asset. This can be used like a texture in a non-dynamic material.