- Home /
Question by
kalledk21 · Jan 24, 2019 at 08:17 PM ·
shadertransparencyworldtoscreenpoint
Transparency in front of player
So I'm trying to create a shader that takes in a vector and and creates a transparent circle in front of this vector. Here is the significant code regarding it.
Vert
o.pos = UnityObjectToClipPos(v.vertex);
o.screenPos = ComputeScreenPos(o.pos);
o.transScreenPos =ComputeScreenPos( UnityObjectToClipPos(mul(unity_WorldToObject, _TransparentPosition)));
Frag
i.screenPos.xyz /= i.screenPos.w;
i.transScreenPos.xyz /= i.transScreenPos.w;
if (length(i.screenPos.xy - i.transScreenPos.xy)<_TransparencySize)
In the game, however there are unique circles for each object using the shader and it isn't centered on the vector. Thanks for your time.
Comment
Your answer

Follow this Question
Related Questions
How to use the Unity 5 Transparent Shader? 1 Answer
Transparency / depth problem 0 Answers
Problem with transparent shader 0 Answers
Objects visible through terrain 2 Answers
Changing material color´s alpha in self iluminated shader 1 Answer