Skip to content

Instantly share code, notes, and snippets.

@skibitsky
Created February 23, 2021 11:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skibitsky/eb84474b2c05d166d4a3b2c897ce3663 to your computer and use it in GitHub Desktop.
Save skibitsky/eb84474b2c05d166d4a3b2c897ce3663 to your computer and use it in GitHub Desktop.
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