Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

shader with lighting effect.

$
0
0
Hi, I want point light and spot light to affect this shader. Shader "Custom/Curved" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {} _QOffset ("Offset", Vector) = (0,0,0,0) _Dist ("Distance", Float) = 100.0 } SubShader { Tags { "RenderType"="Opaque" } Pass { CGPROGRAM // Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs. // Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs. #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" sampler2D _MainTex; float4 _QOffset; float _Dist; struct v2f { float4 pos : SV_POSITION; float4 uv : TEXCOORD0; }; v2f vert (appdata_base v) { v2f o; float4 vPos = mul (UNITY_MATRIX_MV, v.vertex); float zOff = vPos.z/_Dist; vPos += _QOffset*zOff*zOff; o.pos = mul (UNITY_MATRIX_P, vPos); o.uv = v.texcoord; return o; } half4 frag (v2f i) : COLOR { half4 col = tex2D(_MainTex, i.uv.xy); return col*0.45; } ENDCG } } FallBack "Diffuse" }

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>