Last active
May 13, 2020 17:22
-
-
Save wonkee-kim/5ed4f047989044cb658682726442d149 to your computer and use it in GitHub Desktop.
ConfigurableShaders
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
// -------------------------------------------------------------------------------------------------------------------- | |
// <copyright file="ConfigurableStandard.shader" company="Supyrb"> | |
// https://github.com/supyrb/ConfigurableShaders/blob/master/Shaders/ConfigurableStandard.shader?fbclid=IwAR1lolNLIXdN5clTZaRpCSCxxxXtB8VzWnBWfrWkFlAgdkPcy2mp1xXwZ7g | |
// Copyright (c) 2019 Supyrb. All rights reserved. | |
// </copyright> | |
// <repository> | |
// https://github.com/supyrb/ConfigurableShaders | |
// </repository> | |
// <author> | |
// Johannes Deml | |
// public@deml.io | |
// </author> | |
// <documentation> | |
// https://github.com/supyrb/ConfigurableShaders/wiki | |
// </documentation> | |
// -------------------------------------------------------------------------------------------------------------------- | |
Shader "Configurable/Standard" | |
{ | |
Properties | |
{ | |
[HDR] _Color("Color", Color) = (1,1,1,1) | |
_MainTex ("Base (RGB)", 2D) = "white" {} | |
[Gamma] _Metallic("Metallic", Range(0.0, 1.0)) = 0 | |
_Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5 | |
[SimpleToggle] _UseVertexColor("Vertex color", Float) = 1.0 | |
[HeaderHelpURL(Rendering, https, github.com supyrb ConfigurableShaders wiki Rendering)] | |
[Tooltip(Changes the depth value. Negative values are closer to the camera)] _Offset("Offset", Float) = 0.0 | |
[Enum(UnityEngine.Rendering.CullMode)] _Culling ("Cull Mode", Int) = 2 | |
[Enum(Off,0,On,1)] _ZWrite("ZWrite", Int) = 1 | |
[Enum(UnityEngine.Rendering.CompareFunction)] _ZTest ("ZTest", Int) = 4 | |
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 14 | |
[HeaderHelpURL(Stencil, https, github.com supyrb ConfigurableShaders wiki Stencil)] | |
[EightBit] _Stencil ("Stencil ID", Int) = 0 | |
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Int) = 0 | |
[Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Int) = 0 | |
[Enum(UnityEngine.Rendering.StencilOp)] _StencilFail ("Stencil Fail", Int) = 0 | |
[Enum(UnityEngine.Rendering.StencilOp)] _StencilZFail ("Stencil ZFail", Int) = 0 | |
[EightBit] _ReadMask ("ReadMask", Int) = 255 | |
[EightBit] _WriteMask ("WriteMask", Int) = 255 | |
[HeaderHelpURL(Blending, https, github.com supyrb ConfigurableShaders wiki Blending)] | |
[Enum(UnityEngine.Rendering.BlendMode)] _BlendSrc ("Blend mode Source", Int) = 5 //SrcAlpha | |
[Enum(UnityEngine.Rendering.BlendMode)] _BlendDst ("Blend mode Destination", Int) = 10 // OneMinusSrcAlpha | |
//https://docs.unity3d.com/ScriptReference/Rendering.BlendMode.html | |
} | |
CGINCLUDE | |
sampler2D _MainTex; | |
half4 _Color; | |
half _UseVertexColor; | |
half _Glossiness; | |
half _Metallic; | |
struct Input | |
{ | |
float2 uv_MainTex; | |
float4 color : COLOR; | |
}; | |
void surf (Input IN, inout SurfaceOutputStandard o) | |
{ | |
half4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color; | |
c = lerp(c, c * IN.color, _UseVertexColor); | |
o.Albedo = c.rgb; | |
o.Alpha = c.a; | |
o.Metallic = _Metallic; | |
o.Smoothness = _Glossiness; | |
} | |
ENDCG | |
SubShader | |
{ | |
Tags { "RenderType"="Opaque" "Queue" = "Geometry" } | |
LOD 300 | |
Cull [_Culling] | |
Offset [_Offset], [_Offset] | |
ZWrite [_ZWrite] | |
ZTest [_ZTest] | |
ColorMask [_ColorMask] | |
Blend [_BlendSrc] [_BlendDst] | |
Stencil | |
{ | |
Ref [_Stencil] | |
ReadMask [_ReadMask] | |
WriteMask [_WriteMask] | |
Comp [_StencilComp] | |
Pass [_StencilOp] | |
Fail [_StencilFail] | |
ZFail [_StencilZFail] | |
} | |
CGPROGRAM | |
#pragma surface surf Standard fullforwardshadows addshadow keepalpha | |
#pragma target 3.0 | |
ENDCG | |
} | |
FallBack "Diffuse" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment