Shader "Unlit/shader" { Properties { _MainTex ("Texture", 2D) = "white" {} } SubShader { Tags { "RenderType" = "Background" } LOD 100 Pass { Blend One One CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" struct appdata { float4 vertex : POSITION; float2 uv : TEXCOORD0; float3 normal : NORMAL; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; float3 worldNormal : TEXCOORD1; }; sampler2D _MainTex; float4 _MainTex_ST; v2f vert (appdata v) { v2f o; o.worldNormal = UnityObjectToWorldNormal(v.normal); o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); return o; } fixed4 frag(v2f i) : SV_Target { float3 camVec = float3(1, 0, 0); float cosa = dot(-camVec, normalize(i.worldNormal)); float depth = (1 - cosa) * abs(sin(i.uv.y * 100)); fixed4 col = float4(0, depth, depth * 0.25, 0); return col; } ENDCG } } } i have 3 questions 1. how do i get worldpos/vertex positions in world 2. how do i get camera position 3. how to fix transparency please help please help
If you're asking questions with code, format your code properly. You're also asking in a wrong forum. Unity has a good set of tutorials on surface shaders, available here, read/work through them: https://docs.unity3d.com/Manual/SL-SurfaceShaderExamples.html List of builtin variables is available here: https://docs.unity3d.com/Manual/SL-SurfaceShaderExamples.html This is certainly incorrect, regardless of what you're trying to do: