void surf (Input IN, inout SurfaceOutput o) {
o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
o.Normal = UnpackNormal (tex2D (_BumpMap, IN.uv_BumpMap));
half rim = 1.0 - saturate(dot (normalize(IN.viewDir), o.Normal));
o.Emission = _RimColor.rgb * pow (rim, _RimPower);
}
what does it mean???..where can I find its and other built-in mathmatic operation in Unity mannul??
tomvds
2
Here you can find a list of CG standard library functions: http://http.developer.nvidia.com/Cg/index_stdlib.html
Saturate is a function that clamps it’s input between 0 and 1.
2 Likes
It clamps the value so that it is never larger than 1.0 and never smaller than 0.0.
It’s not a function Unity created, it’s part of the CG shader language.
3 Likes
That’s what i need.
Thank you!
anyone know how to average two values? i can’t find a function that does this!