- Home /
How to get color or value from material with shader?
I have a sphere with a shader that is using perlin noise with colors for specific heights and I want to get the height or color of the point the mouse is on when clicked. Is there a good way to get this information or the whole texture and find the value that way?
Comment
Answer by tanoshimi · May 05, 2016 at 06:08 AM
You can use http://docs.unity3d.com/ScriptReference/RaycastHit-textureCoord.html to get the UV of the texture at a clicked point and look up the corresponding value from the texture.