Ray Shader

Shader"Xray"{

Properties

{

_RimColor("RimColor", Color) = (0,0,1,1)

_RimIntensity("Intensity", Range(0,2)) =1}

SubShader

{

Tags {"Queue"="Transparent""RenderType"="Opaque"}

LOD200Pass

{//Blend SrcAlpha One//打开混合模式Blend SrcAlpha  One

ZWrite off

Lighting off

CGPROGRAM#pragma vertex vert#pragma fragment frag#include "UnityCG.cginc"struct appdata

{

float4 vertex : POSITION;

float3normal:Normal;

};

struct v2f

{

float4 pos : SV_POSITION;

fixed4color:COLOR;

};

fixed4 _RimColor;float_RimIntensity;

v2f vert (appdata v)

{

v2f o;

o.pos = UnityObjectToClipPos(v.vertex);

float3 viewDir =normalize(ObjSpaceViewDir(v.vertex));//计算出顶点到相机的向量floatval =1- saturate(dot(v.normal, viewDir));//计算点乘值o.color= _RimColor * val * (1+ _RimIntensity);//计算强度returno;

}

fixed4 frag (v2f i) : COLOR

{returni.color;

}

ENDCG

}

}

}

你可能感兴趣的:(Ray Shader)