Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Simple diffuse surface shader with mip map bias support
Shader "Futuclass/BiasDiffuse"
{
Properties
{
_MainTex ("Base (RGB)", 2D) = "white" {}
_MainTexBias ("Mip Bias", float) = -0.5
}
SubShader
{
Tags
{
"RenderType"="Opaque"
}
LOD 150
CGPROGRAM
#pragma surface surf Lambert noforwardadd
sampler2D _MainTex;
half _MainTexBias;
struct Input
{
float2 uv_MainTex;
};
void surf(Input IN, inout SurfaceOutput o)
{
const fixed4 c = tex2Dbias(_MainTex, half4(IN.uv_MainTex.x, IN.uv_MainTex.y, 0.0, _MainTexBias));
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
Fallback "Mobile/Diffuse"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment