- Home /
Curve shader with lights
Hi, i dont speak english, but, i try.
In this moment i develp curve game, and i fond the curve shader.
But this shader is not affect for lights in game.
need some help.
thanx to all.
Shader "Custom/Curved" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_QOffset ("Offset", Vector) = (0,0,0,0)
_Dist ("Distance", Float) = 100.0
_Color ("Color", Color) = (1,1,1,1)
}
SubShader {
Tags { "RenderType"="Opaque" }
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _MainTex;
float4 _QOffset;
float _Dist;
fixed4 _Color;
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 = mul( UNITY_MATRIX_TEXTURE0, v.texcoord );
return o;
}
half4 frag (v2f i) : COLOR
{
half4 col = tex2D(_MainTex, i.uv.xy) * _Color;
return col;
}
ENDCG
}
}
FallBack "Diffuse"
}
Comment
Your answer
Follow this Question
Related Questions
A Cg shader semantic problem 2 Answers
Shader - What is float3.xy? 1 Answer
Why does this shader show up black on iOS? 1 Answer
How do I keep an object lit when a light moves past it? 0 Answers