mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Templatize decal shader
This commit is contained in:
parent
321b2a49a4
commit
14640c1dca
3
.gitignore
vendored
3
.gitignore
vendored
@ -41,6 +41,9 @@ ExportedObj/
|
|||||||
*.opendb
|
*.opendb
|
||||||
*.VC.db
|
*.VC.db
|
||||||
|
|
||||||
|
# Autogenerated shaders
|
||||||
|
Assets/Shaders/Generated/*.shader
|
||||||
|
|
||||||
# Binaries and support files
|
# Binaries and support files
|
||||||
Source/ConformalDecals/dlls
|
Source/ConformalDecals/dlls
|
||||||
Source/ConformalDecals/bin
|
Source/ConformalDecals/bin
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "DecalsCommon.cginc"
|
#include "../DecalsCommon.cginc"
|
||||||
#include "SDF.cginc"
|
#include "../SDF.cginc"
|
||||||
|
|
||||||
void surf(DecalSurfaceInput IN, inout SurfaceOutput o) {
|
void surf(DecalSurfaceInput IN, inout SurfaceOutput o) {
|
||||||
float4 color = tex2D(_Decal, IN.uv_decal);
|
float4 color = tex2D(_Decal, IN.uv_decal);
|
@ -1,12 +1,13 @@
|
|||||||
Shader "ConformalDecals/Decal/Standard"
|
Shader "{% block shader_name %}ConformalDecals/Decal/Standard{% endblock %}"
|
||||||
{
|
{
|
||||||
Properties
|
Properties
|
||||||
{
|
{
|
||||||
|
// Shader-specific properties
|
||||||
|
//{% block properties %}
|
||||||
[Header(Decal)]
|
[Header(Decal)]
|
||||||
_Decal("Decal Texture", 2D) = "gray" {}
|
_Decal("Decal Texture", 2D) = "gray" {}
|
||||||
[Toggle(DECAL_SDF_ALPHA)] _Decal_SDF_Alpha ("SDF in Alpha", int) = 0
|
[Toggle(DECAL_SDF_ALPHA)] _Decal_SDF_Alpha ("SDF in Alpha", int) = 0
|
||||||
|
|
||||||
|
|
||||||
[Header(Normal)]
|
[Header(Normal)]
|
||||||
[Toggle(DECAL_BASE_NORMAL)] _BaseNormal ("Use Base Normal", int) = 0
|
[Toggle(DECAL_BASE_NORMAL)] _BaseNormal ("Use Base Normal", int) = 0
|
||||||
[Toggle(DECAL_BUMPMAP)] _Decal_BumpMap ("Has BumpMap", int) = 0
|
[Toggle(DECAL_BUMPMAP)] _Decal_BumpMap ("Has BumpMap", int) = 0
|
||||||
@ -24,7 +25,9 @@
|
|||||||
[Toggle(DECAL_EMISSIVE)] _Decal_Emissive ("Has Emissive", int) = 0
|
[Toggle(DECAL_EMISSIVE)] _Decal_Emissive ("Has Emissive", int) = 0
|
||||||
_Emissive("_Emissive", 2D) = "black" {}
|
_Emissive("_Emissive", 2D) = "black" {}
|
||||||
_EmissiveColor("_EmissiveColor", Color) = (0,0,0,1)
|
_EmissiveColor("_EmissiveColor", Color) = (0,0,0,1)
|
||||||
|
//{% endblock %}
|
||||||
|
|
||||||
|
// Common decal properties
|
||||||
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
|
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
|
||||||
_DecalOpacity("Opacity", Range(0,1) ) = 1
|
_DecalOpacity("Opacity", Range(0,1) ) = 1
|
||||||
_Background("Background Color", Color) = (0.9,0.9,0.9,0.7)
|
_Background("Background Color", Color) = (0.9,0.9,0.9,0.7)
|
||||||
@ -67,11 +70,16 @@
|
|||||||
#pragma multi_compile DIRECTIONAL
|
#pragma multi_compile DIRECTIONAL
|
||||||
#pragma multi_compile_local __ DECAL_PREVIEW
|
#pragma multi_compile_local __ DECAL_PREVIEW
|
||||||
#pragma multi_compile_local __ DECAL_BASE_NORMAL DECAL_BUMPMAP
|
#pragma multi_compile_local __ DECAL_BASE_NORMAL DECAL_BUMPMAP
|
||||||
|
//{% block pragmas %}
|
||||||
#pragma multi_compile_local __ DECAL_SPECMAP
|
#pragma multi_compile_local __ DECAL_SPECMAP
|
||||||
#pragma multi_compile_local __ DECAL_EMISSIVE
|
#pragma multi_compile_local __ DECAL_EMISSIVE
|
||||||
#pragma multi_compile_local __ DECAL_SDF_ALPHA
|
#pragma multi_compile_local __ DECAL_SDF_ALPHA
|
||||||
|
//{% endblock %}
|
||||||
|
|
||||||
|
//{% block body %}
|
||||||
#include "StandardDecal.cginc"
|
#include "StandardDecal.cginc"
|
||||||
|
//{% endblock %}
|
||||||
|
|
||||||
ENDCG
|
ENDCG
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,11 +102,9 @@
|
|||||||
#pragma multi_compile DIRECTIONAL SPOT POINT
|
#pragma multi_compile DIRECTIONAL SPOT POINT
|
||||||
#pragma multi_compile_local __ DECAL_PREVIEW
|
#pragma multi_compile_local __ DECAL_PREVIEW
|
||||||
#pragma multi_compile_local __ DECAL_BASE_NORMAL DECAL_BUMPMAP
|
#pragma multi_compile_local __ DECAL_BASE_NORMAL DECAL_BUMPMAP
|
||||||
#pragma multi_compile_local __ DECAL_SPECMAP
|
//{{ self.pragmas() }}
|
||||||
#pragma multi_compile_local __ DECAL_EMISSIVE
|
|
||||||
#pragma multi_compile_local __ DECAL_SDF_ALPHA
|
|
||||||
|
|
||||||
#include "StandardDecal.cginc"
|
//{{ self.body() }}
|
||||||
ENDCG
|
ENDCG
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,6 +120,13 @@
|
|||||||
Offset -1, -1
|
Offset -1, -1
|
||||||
Blend 1 Zero OneMinusSrcColor, Zero OneMinusSrcAlpha
|
Blend 1 Zero OneMinusSrcColor, Zero OneMinusSrcAlpha
|
||||||
|
|
||||||
|
Stencil
|
||||||
|
{
|
||||||
|
Ref 1
|
||||||
|
Comp Equal
|
||||||
|
Pass Keep
|
||||||
|
}
|
||||||
|
|
||||||
CGPROGRAM
|
CGPROGRAM
|
||||||
#pragma vertex vert
|
#pragma vertex vert
|
||||||
#pragma fragment frag_deferred_prepass
|
#pragma fragment frag_deferred_prepass
|
||||||
@ -121,11 +134,11 @@
|
|||||||
|
|
||||||
#pragma multi_compile_local __ DECAL_PREVIEW
|
#pragma multi_compile_local __ DECAL_PREVIEW
|
||||||
#pragma multi_compile_local __ DECAL_BASE_NORMAL
|
#pragma multi_compile_local __ DECAL_BASE_NORMAL
|
||||||
#pragma multi_compile_local __ DECAL_SDF_ALPHA
|
//{{ self.pragmas() }}
|
||||||
|
|
||||||
#define DECAL_PREPASS
|
#define DECAL_PREPASS
|
||||||
|
|
||||||
#include "StandardDecal.cginc"
|
//{{ self.body() }}
|
||||||
ENDCG
|
ENDCG
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,8 +160,8 @@
|
|||||||
Stencil
|
Stencil
|
||||||
{
|
{
|
||||||
Ref 1
|
Ref 1
|
||||||
Comp Always
|
Comp Equal
|
||||||
Pass Replace
|
Pass Keep
|
||||||
}
|
}
|
||||||
|
|
||||||
CGPROGRAM
|
CGPROGRAM
|
||||||
@ -159,11 +172,9 @@
|
|||||||
#pragma multi_compile __ UNITY_HDR_ON
|
#pragma multi_compile __ UNITY_HDR_ON
|
||||||
#pragma multi_compile_local __ DECAL_PREVIEW
|
#pragma multi_compile_local __ DECAL_PREVIEW
|
||||||
#pragma multi_compile_local __ DECAL_BASE_NORMAL DECAL_BUMPMAP
|
#pragma multi_compile_local __ DECAL_BASE_NORMAL DECAL_BUMPMAP
|
||||||
#pragma multi_compile_local __ DECAL_SPECMAP
|
//{{ self.pragmas() }}
|
||||||
#pragma multi_compile_local __ DECAL_EMISSIVE
|
|
||||||
#pragma multi_compile_local __ DECAL_SDF_ALPHA
|
|
||||||
|
|
||||||
#include "StandardDecal.cginc"
|
//{{ self.body() }}
|
||||||
ENDCG
|
ENDCG
|
||||||
}
|
}
|
||||||
}
|
}
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user