Created
February 23, 2021 11:52
-
-
Save skibitsky/eb84474b2c05d166d4a3b2c897ce3663 to your computer and use it in GitHub Desktop.
Simple diffuse surface shader with mip map bias support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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