Anyone got Dynamic Textures working well?

I followed some of the references people added.
Create a material, add a material instance to your actor.
In the material add a texture as a variable.
Apply the material instance to the correct mesh.
Create a texture trough code, modify the pixel values based on colorformat. //here i get a R16 G16 even if i try to make it a R8G8B8A
Trough the material Instance fetch the texture variable and set the texture value to your created texture.

I managed to get it working with random color for a while.
But trying to make the material white, made it end up with Green and black lines.
Sometimes the random texture would have a black square in the middle.

Code samples would help a lot or modern references.

Do you have any Scalars inside your Material?

since your tex is inside your material it is good to set inner scalars(variables) to change the tex behaviour as you like.

From the outside you would get the Dynamic Materials reference and Call Set Scalar Param with a new Scalar Value.

F.e. it seems you want to alter the texture´s coloring. So having four Scalars for Red,Green,Blue,Alpha which are applied to your texture should work out fine :wink:

sorry not having a visible example for you atm.

best regards

**Entire Class Just For You, for Dynamic Textures:

CanvasRenderTarget2D**

Dear SpaceMan,

Community member James Tan / Solid Snake submitted an entire class to Epic just for you!

It’s called UCanvasRenderTarget2D

With this class you create a texture render target 2D (super class of CanvasRenderTarget2D that allows you to draw onto it using all the very useful UE4 UCanvas functions!

So you can draw lines, draw text, and anything else you can do with UCanvas!

You can even draw materials and textures onto this Canvas which then becomes the final texture that gets rendered via CanvasRenderTarget2D!

Check it out in the code base!



Runtime/Engine/Classes/Engine/CanvasRenderTarget2D.h
Runtime/Engine/Private/CanvasRenderTarget2D.cpp


Enjoy!

Rama

PS: CanvasRenderTarget2D is the UE4 version of ScriptedTexture from UE3

Well I feel calm now when Rama come and set things straight. Thanks Rama for saving the day. :slight_smile:

Hee hee!

:slight_smile:

Rama