Last active
September 3, 2021 12:48
-
-
Save fotfla/2fc2adb5c080b4b147c1e5ae2416394b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 "Unlit/EmissonTestShader" | |
{ | |
Properties | |
{ | |
[HDR] | |
_EmissionColor("Emission Color",Color) = (0,0,0,0) | |
} | |
SubShader | |
{ | |
Tags { "RenderType"="Opaque" } | |
LOD 100 | |
Pass{ | |
Name "Meta" | |
Tags{"LightMode"="Meta"} | |
Cull Off | |
CGPROGRAM | |
#include "UnityStandardMeta.cginc" | |
float4 frag_meta2(v2f_meta i) : SV_Target | |
{ | |
FragmentCommonData data =UNITY_SETUP_BRDF_INPUT(i.uv); | |
UnityMetaInput o; | |
UNITY_INITIALIZE_OUTPUT(UnityMetaInput,o); | |
fixed4 c = 0; | |
o.Albedo = c.rgb; | |
o.Emission = _EmissionColor; | |
return UnityMetaFragment(o); | |
} | |
#pragma vertex vert_meta | |
#pragma fragment frag_meta2 | |
ENDCG | |
} | |
Pass | |
{ | |
CGPROGRAM | |
#pragma vertex vert | |
#pragma fragment frag | |
// make fog work | |
#pragma multi_compile_fog | |
#include "UnityCG.cginc" | |
struct appdata | |
{ | |
float4 vertex : POSITION; | |
float2 uv : TEXCOORD0; | |
}; | |
struct v2f | |
{ | |
float2 uv : TEXCOORD0; | |
UNITY_FOG_COORDS(1) | |
float4 vertex : SV_POSITION; | |
float3 localPos : TEXCOORD2; | |
}; | |
float3 _EmissionColor; | |
v2f vert (appdata v) | |
{ | |
v2f o; | |
o.vertex = UnityObjectToClipPos(v.vertex); | |
o.uv = v.uv; | |
o.localPos = v.vertex; | |
UNITY_TRANSFER_FOG(o,o.vertex); | |
return o; | |
} | |
fixed4 frag (v2f i) : SV_Target | |
{ | |
fixed4 col = float4(_EmissionColor,1); | |
// apply fog | |
UNITY_APPLY_FOG(i.fogCoord, col); | |
return col; | |
} | |
ENDCG | |
} | |
} | |
CustomEditor "RealtimeEmissiveGammaGUI" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment