i am trying to write a shader with Shader Forge that mimics an eye shader that constantly looks at a given Vector3. But I am overwhelmed by all the necessary space transformations.
I am no coder but here is my thinking process so far: All space transformations ignored, a plane has a material with two slider properties (X & Y) with a range of [-0.5,0.5]. X and Y get added to U and V, and some basic movement is possible. My problem is how to translate a Vector3 (object position) to those two [-0.5,0.5] values. My goal is a shader with a Vector3 property that I can assign an objects position via code, and can assign the material to multiple objects which all look at their specific X and Y position.
I hope that makes at least some sense, code talk makes my head dizzy and I have no clue of the lingo. I don't expect any code examples, but I would be very grateful for any ideas and clues on how to tackle that problem.
EDIT: For clarification, i got something similiar to this. Now I need the math to use it globally with a world position.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
137 People are following this question.
Standard Shader Emissive Warning?
2D image shader, 3D object UV mapping , Using good lightings,,, somebody help me!
Shader Transparency Issues
After changing a material's main texture, the main texture is null
What are the property names in the new Unity 5 standard shader