Skip to content

Instantly share code, notes, and snippets.

@LordNed
Created November 5, 2015 21:15
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 LordNed/bb979ba9a787cf8fd8a9 to your computer and use it in GitHub Desktop.
Save LordNed/bb979ba9a787cf8fd8a9 to your computer and use it in GitHub Desktop.
Shader "Custom/StandardPaint"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#include "UnityCG.cginc"
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard fullforwardshadows
#pragma debug
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
struct Input
{
float2 uv_MainTex;
};
half _Glossiness;
half _Metallic;
fixed4 _Color;
void surf (Input IN, inout SurfaceOutputStandard o)
{
// This lets us sample the unity_Lightmap texture properly, using the models main UVs.
//fixed4 c = UNITY_SAMPLE_TEX2D (unity_Lightmap, IN.uv_MainTex.xy) * _Color;
// This should create a per-pixel grayscale ramp that shows the interpolation of the X position in the Unity lightmap UVs.
float4 c = float4(unity_LightmapST.xxx, 1);
o.Albedo = c.rgb;
// Metallic and smoothness come from slider variables
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Standard"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment