# Mat Function Float to Texture2D (?)

**URL:** <https://forums.unrealengine.com/t/mat-function-float-to-texture2d/6352>\
**Category:** Rendering\
**Tags:** unreal-engine\
**Created:** [June 20, 2014, 11:59am UTC](https://forums.unrealengine.com/t/mat-function-float-to-texture2d/6352 "2014-06-20T11:59:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chesire](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chesire](https://forums.unrealengine.com/u/Chesire)\
**Post date:** [June 20, 2014, 11:59am UTC](https://forums.unrealengine.com/t/mat-function-float-to-texture2d/6352/1 "2014-06-20T11:59:05Z")

</div>

I’m struggling with hooking up the output of a lerp to a texture sample node inside a material function.  
Any help would be greatly appreciated!

![4a998b31ee871ff15c9a7b9a5ea11db8e5e42557.jpeg](https://d1ap1mz92jnks1.cloudfront.net/images/transparent.png)

---

<div class="post-metadata">

**Author:** ![zeOrb](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@zeOrb](https://forums.unrealengine.com/u/zeOrb)\
**Post date:** [June 20, 2014, 12:21pm UTC](https://forums.unrealengine.com/t/mat-function-float-to-texture2d/6352/2 "2014-06-20T12:21:46Z")

</div>

There is TextureObject and TextureSample, they are different types of data.  
Treat TextureObject as a simple 2d picture, not a texture.  
And TextureSampler sorta “binds” data from your 2d picture to uv space and then you can manipulate data however you want.  
In your picture you are trying to pass already sampled data into TextureSampler

---

<div class="post-metadata">

**Author:** ![Chesire](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chesire](https://forums.unrealengine.com/u/Chesire)\
**Post date:** [June 20, 2014, 12:32pm UTC](https://forums.unrealengine.com/t/mat-function-float-to-texture2d/6352/3 "2014-06-20T12:32:19Z")

</div>

Thanks but that doesn’t get me anywhere closer to a solution since both yield the same incompatibility towards passing a blend onto a new chain inside a material function.  
Simply put: How the ??? do I blend 2 normals and pass the result onto a texture Sample for BumpOffsetting?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_89b5ed72](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_89b5ed72](https://forums.unrealengine.com/u/anonymous_user_89b5ed72)\
**Post date:** [June 20, 2014, 12:45pm UTC](https://forums.unrealengine.com/t/mat-function-float-to-texture2d/6352/4 "2014-06-20T12:45:36Z")

</div>

The Tex input pin is looking for a reference to a Texture asset. the Lerp is outputting a Float4. These are incompatible.

You seem to be going about what you want to do wrong. Sounds like you need a Bump Offset node and two heightmaps to Lerp between. Then plug the output of the Lerp into the Height input of the Bump Offset and the output of the Bump Offset into the UVs input of the Texture Sample.

---

<div class="post-metadata">

**Author:** ![Chesire](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chesire](https://forums.unrealengine.com/u/Chesire)\
**Post date:** [June 20, 2014, 1:07pm UTC](https://forums.unrealengine.com/t/mat-function-float-to-texture2d/6352/6 "2014-06-20T13:07:34Z")

</div>

Indeed a classic case of reversed logic (or no logic at all for that matter). I solved it by lerping both texturesamples, one for the alpha/height passed onto the bumpoffset and 1 for the normal chain. This gets me properly offsetted detail normals if that makes sense (?) Thanks to both of you for the great help!

---

<div class="post-metadata">

**Author:** ![Daluz](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/daluz/32/608973_2.png) [@Daluz](https://forums.unrealengine.com/u/Daluz)\
**Post date:** [October 28, 2023, 3:29pm UTC](https://forums.unrealengine.com/t/mat-function-float-to-texture2d/6352/7 "2023-10-28T15:29:31Z")

</div>

For those who want a simple way:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/2/9/3299bcd6f534dc9737d286b998cadb661c86e05a.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/c/0/2c0b27c2fc63ca505fdade40b450200d95b23eae.png)
