# Why texture lookup count increases with material function?

**URL:** <https://forums.unrealengine.com/t/why-texture-lookup-count-increases-with-material-function/454519>\
**Category:** Rendering\
**Tags:** unreal-engine, Shaders, question\
**Created:** [August 28, 2019, 11:05am UTC](https://forums.unrealengine.com/t/why-texture-lookup-count-increases-with-material-function/454519 "2019-08-28T11:05:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Em4Russ0](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/em4russ0/32/710746_2.png) [@Em4Russ0](https://forums.unrealengine.com/u/Em4Russ0)\
**Post date:** [August 28, 2019, 11:05am UTC](https://forums.unrealengine.com/t/why-texture-lookup-count-increases-with-material-function/454519/1 "2019-08-28T11:05:29Z")

</div>

Hello,

When I use this material function

 ![286051-materialfunction.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/0/b/80b81085387e89b622b4d8c9a4a87f963cdb9c0f.jpeg)

in this material

 ![286052-material.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/6/d/06d810fe2584cf4bbbf6790361ddc07ffe0b1638.jpeg)

the texture lookup count is 2. If I just plug the same TextureSample in the material without the material function, it goes down to 1.

I read the HLSL and I read why this is so, and when the shader will be compiled it will count as 1 in the very end,  
and I understand that it’s an estimated count but:

- is it a bad practice outputting MaterialAttributes in material functions?
- is there a better way to keep the lookup estimate consistent ?

Thanks in advance
