Projecting Texture Onto Object ("Dynamic Mask")

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

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

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/A09b3dN.png

This is my end result:

http://i.imgur.com/d0GhxoS.png

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

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.