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
9a8a347cc7
commit
6e07433eed
@ -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;
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
version https://git-lfs.github.com/spec/v1
|
version https://git-lfs.github.com/spec/v1
|
||||||
oid sha256:c5c6eac6b56d72887c678fd14aa4f5596e2e3c1ba0da2dcf0e8d9c84789bb5f0
|
oid sha256:d1ffb743f95c6917c013dcd9cfd2205c769c2aa550191f17f43cb373b1bec195
|
||||||
size 98741
|
size 98979
|
||||||
|
Loading…
Reference in New Issue
Block a user