Skip to content

Commit d49a300

Browse files
committed
Replace KSP/Alpha/Cutoff shader, stops the stock version from adding emission
1 parent 8b0f9ab commit d49a300

4 files changed

Lines changed: 55 additions & 1 deletion

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Shader "KSP/Alpha/Cutoff"
2+
{
3+
Properties
4+
{
5+
_MainTex("Color Map", 2D) = "gray" {}
6+
_BumpMap("Normal Map", 2D) = "bump" {}
7+
_Shininess ("Shininess", Range (0.0, 1.0)) = 0.5
8+
_Color ("Part Color", Color) = (1.0, 1.0, 1.0, 1.0)
9+
_Cutoff("Alpha cutoff", Range(0,1)) = 0.5
10+
_SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 1.0)
11+
_EmissiveColor("Emissive Color", Color) = (0.0, 0.0, 0.0, 1.0)
12+
[PerRendererData]_RimFalloff("Rim Falloff", Range(0.0, 10.0) ) = 0.1
13+
[PerRendererData]_RimColor("Rim Color", Color) = (0.0, 0.0, 0.0, 0.0)
14+
[PerRendererData]_TemperatureColor("Temperature Color", Color) = (0.0, 0.0, 0.0, 0.0)
15+
[PerRendererData]_BurnColor ("Burn Color", Color) = (1.0, 1.0, 1.0, 1.0)
16+
[PerRendererData]_Opacity("_Opacity", Range(0.0,1.0)) = 1.0
17+
}
18+
19+
SubShader
20+
{
21+
Tags { "Queue" = "AlphaTest" "RenderType" = "TransparentCutout" }
22+
23+
Stencil
24+
{
25+
Ref 1
26+
Comp Always
27+
Pass Replace
28+
}
29+
30+
CGPROGRAM
31+
32+
#define IGNORE_VERTEX_COLOR_ON
33+
#define CUTOUT_ON
34+
35+
#include "../ReplacementShader.cginc" //exclude_path:forward
36+
#pragma surface DeferredSpecularReplacementShader StandardSpecular
37+
#pragma target 3.0
38+
39+
ENDCG
40+
}
41+
Fallback "Standard"
42+
}

shaders/DeferredKSPShaders/Assets/Shaders/Replaced shaders/Part shaders/AlphaCutoff.shader.meta

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

shaders/DeferredKSPShaders/Assets/Shaders/Replaced shaders/Part shaders/SpecularCutoff.shader

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
Shader "KSP/Specular (Cutoff)"
22
{
3-
43
Properties
54
{
65
_MainTex("Color Map", 2D) = "gray" {}

shaders/DeferredKSPShaders/Assets/Shaders/Replaced shaders/ReplacementShader.cginc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ void DeferredSpecularReplacementShader(Input i, inout SurfaceOutputStandardSpecu
6565

6666
float4 color = _Color * vertexColor * _BurnColor * tex2D(_MainTex, (i.uv_MainTex));
6767

68+
#if defined(CUTOUT_ON)
69+
clip(color.a - _Cutoff);
70+
#endif
71+
6872
#if defined (NORMALMAP_ON)
6973
float3 normal = UnpackNormalDXT5nm(tex2D(_BumpMap, i.uv_BumpMap));
7074
#else

0 commit comments

Comments
 (0)