mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Fix ForwardAdd overlap in shader
This requires some code change to actually work (the material Queue also needs to be updated dynamically)
This commit is contained in:
parent
824e48620a
commit
cffc35d17a
@ -17,17 +17,16 @@ Shader "ConformalDecals/Feature/Bumped"
|
|||||||
}
|
}
|
||||||
SubShader
|
SubShader
|
||||||
{
|
{
|
||||||
Tags { "Queue" = "Geometry+400" }
|
Tags { "Queue" = "Geometry+100" }
|
||||||
ZWrite On
|
|
||||||
Cull Off
|
Cull Off
|
||||||
ZTest LEqual
|
|
||||||
Offset -1, -1
|
|
||||||
|
|
||||||
Pass
|
Pass
|
||||||
{
|
{
|
||||||
Name "FORWARD"
|
Name "FORWARD"
|
||||||
Tags { "LightMode" = "ForwardBase" }
|
Tags { "LightMode" = "ForwardBase" }
|
||||||
Blend SrcAlpha OneMinusSrcAlpha
|
Blend SrcAlpha OneMinusSrcAlpha
|
||||||
|
ZWrite Off
|
||||||
|
ZTest LEqual
|
||||||
|
|
||||||
CGPROGRAM
|
CGPROGRAM
|
||||||
#pragma vertex vert_forward
|
#pragma vertex vert_forward
|
||||||
@ -60,7 +59,7 @@ Shader "ConformalDecals/Feature/Bumped"
|
|||||||
float3 normal = UnpackNormal(tex2D(_BumpMap, IN.uv_bump));
|
float3 normal = UnpackNormal(tex2D(_BumpMap, IN.uv_bump));
|
||||||
|
|
||||||
// clip alpha
|
// clip alpha
|
||||||
clip(color.a - _Cutoff);
|
clip(color.a - saturate(_Cutoff + 0.01));
|
||||||
|
|
||||||
half rim = 1.0 - saturate(dot (normalize(IN.viewDir), normal));
|
half rim = 1.0 - saturate(dot (normalize(IN.viewDir), normal));
|
||||||
float3 emission = (_RimColor.rgb * pow(rim, _RimFalloff)) * _RimColor.a;
|
float3 emission = (_RimColor.rgb * pow(rim, _RimFalloff)) * _RimColor.a;
|
||||||
@ -79,6 +78,9 @@ Shader "ConformalDecals/Feature/Bumped"
|
|||||||
Name "FORWARD"
|
Name "FORWARD"
|
||||||
Tags { "LightMode" = "ForwardAdd" }
|
Tags { "LightMode" = "ForwardAdd" }
|
||||||
Blend One One
|
Blend One One
|
||||||
|
ZWrite On
|
||||||
|
ZTest Less
|
||||||
|
Offset -1, -1
|
||||||
|
|
||||||
CGPROGRAM
|
CGPROGRAM
|
||||||
#pragma vertex vert_forward
|
#pragma vertex vert_forward
|
||||||
@ -111,7 +113,7 @@ Shader "ConformalDecals/Feature/Bumped"
|
|||||||
float3 normal = UnpackNormal(tex2D(_BumpMap, IN.uv_bump));
|
float3 normal = UnpackNormal(tex2D(_BumpMap, IN.uv_bump));
|
||||||
|
|
||||||
// clip alpha
|
// clip alpha
|
||||||
clip(color.a - _Cutoff);
|
clip(color.a - saturate(_Cutoff + 0.01));
|
||||||
|
|
||||||
half rim = 1.0 - saturate(dot (normalize(IN.viewDir), normal));
|
half rim = 1.0 - saturate(dot (normalize(IN.viewDir), normal));
|
||||||
float3 emission = (_RimColor.rgb * pow(rim, _RimFalloff)) * _RimColor.a;
|
float3 emission = (_RimColor.rgb * pow(rim, _RimFalloff)) * _RimColor.a;
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user