# Projecting Texture Onto Object ("Dynamic Mask")

**URL:** <https://forums.unrealengine.com/t/projecting-texture-onto-object-dynamic-mask/325839>\
**Category:** Rendering\
**Tags:** projection, projection-matrix, unreal-engine, question\
**Created:** [July 20, 2015, 1:18am UTC](https://forums.unrealengine.com/t/projecting-texture-onto-object-dynamic-mask/325839 "2015-07-20T01:18:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DamirH](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/damirh/32/906591_2.png) [@DamirH](https://forums.unrealengine.com/u/DamirH)\
**Post date:** [July 20, 2015, 1:18am UTC](https://forums.unrealengine.com/t/projecting-texture-onto-object-dynamic-mask/325839/1 "2015-07-20T01:18:56Z")

</div>

Heya,

I am trying to use materials to dynamically project a texture onto a mesh via material. Unfortunately, I am not having as much luck as I am hoping, even though my calculations appear correct (hint: they’re not). Any help on this subject would be greatly appreciated.

Basically, I take a point around my static mesh, make it face it constantly (This is my “projection plane”):

[http://i.imgur.com/CeJjxXO.png](http://i.imgur.com/CeJjxXO.png)

In my material, I take the information of that plane, its relative position, up, right and forward vectors, and project my static mesh points onto it (calculation for projection found [here][2]).

[http://i.imgur.com/vPEr50J.png](http://i.imgur.com/vPEr50J.png)

The last thing in the material function is me attempting to get the point’s “plane coordinates”, i.e. its 2D position in the projection plane’s local coordinate system. I then simply use those as the UVs for my mask texture.

[http://i.imgur.com/HWucQ3K.png](http://i.imgur.com/HWucQ3K.png)

[http://i.imgur.com/A09b3dN.png](http://i.imgur.com/A09b3dN.png)

This is my end result:

[http://i.imgur.com/d0GhxoS.png](http://i.imgur.com/d0GhxoS.png)

Obviously, this is not what I intended. Anyone got any ideas?

---

<div class="post-metadata">

**Author:** ![Kokuyouseki](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kokuyouseki](https://forums.unrealengine.com/u/Kokuyouseki)\
**Post date:** [January 14, 2018, 11:38am UTC](https://forums.unrealengine.com/t/projecting-texture-onto-object-dynamic-mask/325839/2 "2018-01-14T11:38:17Z")

</div>

Still no solution I guess?  
I’m doing a cartoon character eye/pupil that I want to project onto the eyeball (which is not a ball) in a similar fashion but unless I want to refrain from using any decals (blood, paint, damage etc.) on the character’s face/skin, I can’t use decals for this.

The eyeball deforms as the character is animated but I want the pupil to stay the same size/undeformed. So far I have been making extra uv maps for each position and lerping towards them similar to shapekeys/morphs and it actually works but it’s a pain if I want to move the pupil around as well.
