# Anyone got Dynamic Textures working well?

**URL:** <https://forums.unrealengine.com/t/anyone-got-dynamic-textures-working-well/20290>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [February 4, 2015, 10:29am UTC](https://forums.unrealengine.com/t/anyone-got-dynamic-textures-working-well/20290 "2015-02-04T10:29:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheSpaceMan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TheSpaceMan](https://forums.unrealengine.com/u/TheSpaceMan)\
**Post date:** [February 4, 2015, 10:29am UTC](https://forums.unrealengine.com/t/anyone-got-dynamic-textures-working-well/20290/1 "2015-02-04T10:29:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_3a8723ae](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3a8723ae](https://forums.unrealengine.com/u/anonymous_user_3a8723ae)\
**Post date:** [February 4, 2015, 10:46am UTC](https://forums.unrealengine.com/t/anyone-got-dynamic-textures-working-well/20290/2 "2015-02-04T10:46:51Z")

</div>

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 😉

sorry not having a visible example for you atm.

best regards

---

<div class="post-metadata">

**Author:** ![Rama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rama/32/882413_2.png) [@Rama](https://forums.unrealengine.com/u/Rama)\
**Post date:** [February 4, 2015, 1:48pm UTC](https://forums.unrealengine.com/t/anyone-got-dynamic-textures-working-well/20290/3 "2015-02-04T13:48:14Z")

</div>

\*\*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!

```auto

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

```

Enjoy!

Rama

PS: CanvasRenderTarget2D is the UE4 version of ScriptedTexture from UE3

---

<div class="post-metadata">

**Author:** ![TheSpaceMan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TheSpaceMan](https://forums.unrealengine.com/u/TheSpaceMan)\
**Post date:** [February 4, 2015, 3:23pm UTC](https://forums.unrealengine.com/t/anyone-got-dynamic-textures-working-well/20290/4 "2015-02-04T15:23:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Rama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rama/32/882413_2.png) [@Rama](https://forums.unrealengine.com/u/Rama)\
**Post date:** [February 5, 2015, 2:58am UTC](https://forums.unrealengine.com/t/anyone-got-dynamic-textures-working-well/20290/5 "2015-02-05T02:58:41Z")

</div>

> [@TheSpaceMan;216166](#):
>
> Well I feel calm now when Rama come and set things straight. Thanks Rama for saving the day. 🙂

Hee hee!

🙂

Rama
