# Use UV in custom vertex shader

**URL:** <https://forums.unrealengine.com/t/use-uv-in-custom-vertex-shader/158234>\
**Category:** Rendering\
**Tags:** unreal-engine\
**Created:** [February 21, 2021, 7:33pm UTC](https://forums.unrealengine.com/t/use-uv-in-custom-vertex-shader/158234 "2021-02-21T19:33:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ylly](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ylly](https://forums.unrealengine.com/u/Ylly)\
**Post date:** [February 21, 2021, 7:33pm UTC](https://forums.unrealengine.com/t/use-uv-in-custom-vertex-shader/158234/1 "2021-02-21T19:33:32Z")

</div>

Im creating custom mesh component. I made vertex factory class and custom VertexFactory.ush. Also im writing custom data into UV channel (UV7) and trying to read this data inside VertexFactory.ush something like this

```auto

float4 CalcWorldPositionAnim(FVertexFactoryInput Input, float4x4 InstanceTransform, uint PrimitiveId, FVertexFactoryIntermediates Intermediates)
{
       FMaterialVertexParameters matParams = GetMaterialVertexParameters(Input,Intermediates,Input.Position,Intermediates.TangentToLocal);
       FVertexFactoryInterpolantsVSToPS params = VertexFactoryGetInterpolantsVSToPS(Input,Intermediates,matParams);
       FMaterialPixelParameters finaParams = GetMaterialPixelParameters(params,Input.Position);
      
       float4 textcoords = float4(0,0,0,0);
#if NUM_TEX_COORD_INTERPOLATORS
       textcoords =params.TexCoords(NUM_TEX_COORD_INTERPOLATORS+1)/2];
#endif

       return AnimDeformMesh(Input,PrimitiveId,InstanceTransform,textcoords); }

```

I tried to use VertexFactoryGetInterpolantsVSToPS or GetMaterialVertexParameters to get UVs. Also i can’t realy inderstand how NUM\_TEX\_COORD\_INTERPOLATORS is set and another defines belong to INTERPOLATORS.
