-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce55f07
commit 9469752
Showing
20 changed files
with
182 additions
and
296 deletions.
There are no files selected for viewing
156 changes: 156 additions & 0 deletions
156
Assets/ConformalDecals/Shaders/Decal/DecalBase.shader.template
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
Shader "ConformalDecals/Decal/{% block shader_name %}UNKNOWN{% endblock %}" | ||
{ | ||
Properties | ||
{ | ||
|
||
// Shader-specific properties | ||
{% block properties %} | ||
{% endblock %} | ||
|
||
// Common decal properties | ||
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5 | ||
_DecalOpacity("Opacity", Range(0,1) ) = 1 | ||
_Background("Background Color", Color) = (0.9,0.9,0.9,0.7) | ||
|
||
[Enum(UnityEngine.Rendering.CullMode)] _Cull ("Cull", int) = 2 | ||
[Toggle] _ZWrite ("ZWrite", Float) = 1.0 | ||
|
||
[Toggle(DECAL_PREVIEW)] _Preview ("Preview", int) = 0 | ||
|
||
[Header(Effects)] | ||
[PerRendererData]_Opacity("_Opacity", Range(0,1) ) = 1 | ||
[PerRendererData]_Color("_Color", Color) = (1,1,1,1) | ||
[PerRendererData]_RimFalloff("_RimFalloff", Range(0.01,5) ) = 0.1 | ||
[PerRendererData]_RimColor("_RimColor", Color) = (0,0,0,0) | ||
[PerRendererData]_UnderwaterFogFactor ("Underwater Fog Factor", Range(0,1)) = 0 | ||
} | ||
SubShader | ||
{ | ||
Tags | ||
{ | ||
"Queue" = "Geometry+100" "IgnoreProjector" = "true" "DisableBatching" = "true" | ||
} | ||
Cull [_Cull] | ||
|
||
Pass | ||
{ | ||
Name "FORWARD" | ||
Tags | ||
{ | ||
"LightMode" = "ForwardBase" | ||
} | ||
ZWrite [_ZWrite] | ||
ZTest LEqual | ||
Blend SrcAlpha OneMinusSrcAlpha | ||
|
||
CGPROGRAM | ||
#pragma vertex vert | ||
#pragma fragment frag_forward | ||
|
||
#pragma multi_compile_fwdbase | ||
#pragma skip_variants LIGHTMAP_ON DIRLIGHTMAP_COMBINED DYNAMICLIGHTMAP_ON LIGHTMAP_SHADOW_MIXING | ||
#pragma multi_compile_local __ DECAL_PREVIEW | ||
|
||
{% block body %} | ||
#error No body provided | ||
{% endblock %} | ||
|
||
ENDCG | ||
} | ||
|
||
Pass | ||
{ | ||
Name "FORWARD" | ||
Tags | ||
{ | ||
"LightMode" = "ForwardAdd" | ||
} | ||
ZWrite Off | ||
ZTest LEqual | ||
Blend SrcAlpha One | ||
Offset -1, -1 | ||
|
||
CGPROGRAM | ||
#pragma vertex vert | ||
#pragma fragment frag_forward | ||
|
||
#pragma multi_compile DIRECTIONAL SPOT POINT | ||
#pragma multi_compile __ LIGHTPROBE_SH | ||
#pragma multi_compile_local __ DECAL_PREVIEW | ||
|
||
{{ self.body() }} | ||
|
||
ENDCG | ||
} | ||
|
||
Pass | ||
{ | ||
Name "DEFERRED_PREPASS" | ||
Tags | ||
{ | ||
"LightMode" = "Deferred" | ||
} | ||
ZWrite Off | ||
ZTest LEqual | ||
Offset -1, -1 | ||
Blend 1 Zero OneMinusSrcColor, Zero OneMinusSrcAlpha | ||
|
||
Stencil | ||
{ | ||
Ref 1 | ||
Comp Equal | ||
Pass Keep | ||
} | ||
|
||
CGPROGRAM | ||
#pragma vertex vert | ||
#pragma fragment frag_deferred_prepass | ||
#pragma target 3.0 | ||
|
||
#pragma multi_compile_local __ DECAL_PREVIEW | ||
|
||
{{ self.body() }} | ||
|
||
{% block pragmas_deferred_prepass %} | ||
{% endblock %} | ||
|
||
ENDCG | ||
} | ||
|
||
Pass | ||
{ | ||
Name "DEFERRED" | ||
Tags | ||
{ | ||
"LightMode" = "Deferred" | ||
} | ||
ZWrite Off | ||
ZTest LEqual | ||
Offset -1, -1 | ||
Blend 0 SrcAlpha OneMinusSrcAlpha, Zero One | ||
Blend 1 One One | ||
Blend 2 SrcAlpha OneMinusSrcAlpha, Zero One | ||
Blend 3 SrcAlpha OneMinusSrcAlpha, Zero One | ||
|
||
Stencil | ||
{ | ||
Ref 1 | ||
Comp Equal | ||
Pass Keep | ||
} | ||
|
||
CGPROGRAM | ||
#pragma vertex vert | ||
#pragma fragment frag_deferred | ||
#pragma target 3.0 | ||
|
||
#pragma multi_compile __ LIGHTPROBE_SH | ||
#pragma multi_compile __ UNITY_HDR_ON | ||
#pragma multi_compile_local __ DECAL_PREVIEW | ||
|
||
{{ self.body() }} | ||
|
||
ENDCG | ||
} | ||
} | ||
} |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#include "../DecalsCommon.cginc" | ||
#include "DecalsCommon.cginc" | ||
#include "../SDF.cginc" | ||
|
||
float4 _DecalColor; | ||
|
Oops, something went wrong.