Skip to content

Instantly share code, notes, and snippets.

@shop-0761
Last active January 26, 2019 16:26
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 shop-0761/7452ca0da6a63205fe605aa838313abc to your computer and use it in GitHub Desktop.
Save shop-0761/7452ca0da6a63205fe605aa838313abc to your computer and use it in GitHub Desktop.
fragment Shader 内で Surface shader を展開する例
#include "UnityPBSLighting.cginc"
fixed4 frag(v2f i) : SV_Target
{
Input surfIN;
UNITY_INITIALIZE_OUTPUT(Input, surfIN);
SurfaceOutputStandard o;
UNITY_INITIALIZE_OUTPUT(SurfaceOutputStandard, o);
surf(surfIN, o);
return fixed4(o.Albedo,0);
}
void surf(Input IN, inout SurfaceOutputStandard o)
{
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment