Home > other >  [unity] shader has a problem
[unity] shader has a problem

Time:09-23

I want to do is a edge glow with version 5.1 of the code is found from the website that
Shader "Example/Rim" {
The Properties {
_MainTex (" Texture ", 2 d)="white" {}
_BumpMap (" Bumpmap ", 2 d)="bump" {}
_RimColor (" Rim Color ", Color)=(0.26, 0.19, 0.16, 0.0)
_RimPower (" Rim Power ", the Range (0.5, 8.0))=3.0
}
SubShader {
Tags {" RenderType "=" Opaque "}
CGPROGRAM
# pragma surface surf Lambert
Struct Input {
Float2 uv_MainTex;
Float2 uv_BumpMap;
Float3 viewDir;
};
Sampler2D _MainTex;
Sampler2D _BumpMap;
Float4 _RimColor;
Float _RimPower;
Void surf (Input IN and inout SurfaceOutput o {
O.A lbedo=tex2D (_MainTex, IN uv_MainTex). The RGB.
O.N ormal=UnpackNormal (tex2D (_BumpMap, IN uv_BumpMap));
Half rim=1.0 saturate (dot (the normalize (IN) viewDir), o.N ormal));
O.E mission=_RimColor. RGB * pow (rim, _RimPower);
}
ENDCG
}
Fallback "Diffuse"
}



And then run it according to the floating point about the divisor cannot be zero mean basic are checked the online later found this code inquire how to change?
  • Related