mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Compare commits
2 Commits
0.1.4
...
feature-mu
Author | SHA1 | Date | |
---|---|---|---|
0281759d5f | |||
545f0d538b |
@ -22,7 +22,7 @@ Shader "ConformalDecals/Feature/Bumped"
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue" = "Geometry+100" "IgnoreProjector" = "true"}
|
||||
Tags { "Queue" = "Geometry+100" }
|
||||
Cull [_Cull]
|
||||
Ztest LEqual
|
||||
|
||||
|
@ -25,7 +25,7 @@ Shader "ConformalDecals/Paint/Diffuse"
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue" = "Geometry+100" "IgnoreProjector" = "true"}
|
||||
Tags { "Queue" = "Geometry+100" }
|
||||
Cull [_Cull]
|
||||
Ztest LEqual
|
||||
|
||||
|
@ -27,7 +27,7 @@ Shader "ConformalDecals/Paint/DiffuseSDF"
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue" = "Geometry+100" "IgnoreProjector" = "true"}
|
||||
Tags { "Queue" = "Geometry+100" }
|
||||
Cull [_Cull]
|
||||
Ztest LEqual
|
||||
|
||||
|
@ -30,7 +30,7 @@ Shader "ConformalDecals/Paint/Specular"
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue" = "Geometry+100" "IgnoreProjector" = "true"}
|
||||
Tags { "Queue" = "Geometry+100" }
|
||||
Cull [_Cull]
|
||||
Ztest LEqual
|
||||
|
||||
|
@ -32,7 +32,7 @@ Shader "ConformalDecals/Paint/SpecularSDF"
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue" = "Geometry+100" "IgnoreProjector" = "true"}
|
||||
Tags { "Queue" = "Geometry+100" }
|
||||
Cull [_Cull]
|
||||
Ztest LEqual
|
||||
|
||||
|
76
Assets/Shaders/SDF4test.shader
Normal file
76
Assets/Shaders/SDF4test.shader
Normal file
@ -0,0 +1,76 @@
|
||||
Shader "ConformalDecals/SDF4test"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex("_MainTex (RGB spec(A))", 2D) = "white" {}
|
||||
_Color1("Color 1", Color) = (0,0,0,0)
|
||||
_Color2("Color 2", Color) = (0,0,0,0)
|
||||
_Color3("Color 3", Color) = (0,0,0,0)
|
||||
_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
|
||||
_Smoothness ("SDF smoothness", Range(0,1)) = 0.15
|
||||
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue" = "Transparent" }
|
||||
Cull Back
|
||||
ZWrite On
|
||||
|
||||
Pass
|
||||
{
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
sampler2D _MainTex;
|
||||
float4 _Color1;
|
||||
float4 _Color2;
|
||||
float4 _Color3;
|
||||
float _Smoothness;
|
||||
float _Cutoff;
|
||||
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "Lighting.cginc"
|
||||
#include "AutoLight.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float3 worldPosition : TEXCOORD1;
|
||||
half3 worldNormal : TEXCOORD2;
|
||||
};
|
||||
|
||||
v2f vert(float4 vertex : POSITION, float2 uv : TEXCOORD0) {
|
||||
v2f o;
|
||||
o.pos = UnityObjectToClipPos(vertex);
|
||||
o.uv = uv;
|
||||
o.worldPosition = mul(unity_ObjectToWorld, vertex).xyz;
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target {
|
||||
fixed4 c = 0;
|
||||
float4 s = tex2D(_MainTex,(i.uv));
|
||||
|
||||
s.rgb = s.rbg;
|
||||
|
||||
c = lerp(c, _Color1, smoothstep(_Cutoff, saturate(_Smoothness+ _Cutoff), s.r + s.g + s.b));
|
||||
c = lerp(c, _Color2, smoothstep(_Cutoff, saturate(_Smoothness+ _Cutoff), s.g + s.b ));
|
||||
c = lerp(c, _Color3, smoothstep(_Cutoff, saturate(_Smoothness+ _Cutoff), s.b ));
|
||||
|
||||
// if (s.r + s.g + s.b > 0.5) {
|
||||
// if (s.r > s.g && s.r > s.b) c = _Color1;
|
||||
// if (s.g > s.r && s.g > s.b) c = _Color2;
|
||||
// if (s.b > s.g && s.b > s.r) c = _Color3;
|
||||
// }
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
@ -12,7 +12,7 @@ Shader "ConformalDecals/SelectionGlow"
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue" = "Transparent" "IgnoreProjector" = "true" }
|
||||
Tags { "Queue" = "Transparent" }
|
||||
Cull Back
|
||||
ZWrite Off
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -6,7 +6,7 @@
|
||||
{
|
||||
"MAJOR":0,
|
||||
"MINOR":1,
|
||||
"PATCH":4,
|
||||
"PATCH":3,
|
||||
"BUILD":0
|
||||
},
|
||||
"KSP_VERSION":
|
||||
@ -22,7 +22,7 @@
|
||||
},
|
||||
"KSP_VERSION_MAX":{
|
||||
"MAJOR":1,
|
||||
"MINOR":10,
|
||||
"MINOR":9,
|
||||
"PATCH":99
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
# Conformal Decals v0.1.4
|
||||
# Conformal Decals v0.1.3
|
||||
[](https://travis-ci.org/drewcassidy/KSP-Conformal-Decals) [](https://creativecommons.org/licenses/by-sa/4.0/) [](https://www.gnu.org/licenses/gpl-3.0)
|
||||
|
||||

|
||||
@ -8,7 +8,7 @@ Conformal Decals adds a set of decal stickers to KSP, as well as providing a fra
|
||||
## Dependencies
|
||||
|
||||
Required:
|
||||
- KSP (1.8.x to 1.10.x)
|
||||
- KSP (1.8.x to 1.9.x)
|
||||
- B9 Part Switch (2.16.0). Bundled with release.
|
||||
- ModuleManager (4.1.3). Bundled with release.
|
||||
- Shabby (0.1.2). Bundled with release.
|
||||
|
@ -237,23 +237,14 @@ namespace ConformalDecals {
|
||||
public override void OnStart(StartState state) {
|
||||
this.Log("Starting module");
|
||||
|
||||
|
||||
|
||||
materialProperties.RenderQueue = DecalQueue;
|
||||
|
||||
_boundsRenderer = decalProjectorTransform.GetComponent<MeshRenderer>();
|
||||
|
||||
UpdateMaterials();
|
||||
|
||||
// handle tweakables
|
||||
if (HighLogic.LoadedSceneIsEditor) {
|
||||
GameEvents.onEditorPartEvent.Add(OnEditorEvent);
|
||||
GameEvents.onVariantApplied.Add(OnVariantApplied);
|
||||
|
||||
UpdateTweakables();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnStartFinished(StartState state) {
|
||||
// handle game events
|
||||
if (HighLogic.LoadedSceneIsGame) {
|
||||
// set initial attachment state
|
||||
if (part.parent == null) {
|
||||
@ -263,20 +254,27 @@ namespace ConformalDecals {
|
||||
OnAttach();
|
||||
}
|
||||
}
|
||||
|
||||
// handle tweakables
|
||||
if (HighLogic.LoadedSceneIsEditor) {
|
||||
GameEvents.onEditorPartEvent.Add(OnEditorEvent);
|
||||
GameEvents.onVariantApplied.Add(OnVariantApplied);
|
||||
|
||||
UpdateTweakables();
|
||||
}
|
||||
|
||||
// handle flight events
|
||||
if (HighLogic.LoadedSceneIsFlight) {
|
||||
GameEvents.onPartWillDie.Add(OnPartWillDie);
|
||||
|
||||
if (part.parent == null) part.explode();
|
||||
|
||||
Part.layerMask |= 1 << DecalConfig.DecalLayer;
|
||||
decalColliderTransform.gameObject.layer = DecalConfig.DecalLayer;
|
||||
|
||||
if (!selectableInFlight || !DecalConfig.SelectableInFlight) {
|
||||
decalColliderTransform.GetComponent<Collider>().enabled = false;
|
||||
_boundsRenderer.enabled = false;
|
||||
}
|
||||
|
||||
if (part.parent == null) part.explode();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,3 @@
|
||||
v0.1.4
|
||||
------
|
||||
- Supported KSP versions: 1.8.x to 1.10.x
|
||||
- Fixes:
|
||||
- Fixed decals rendering onto disabled B9PS part variants
|
||||
- Decals will still not update whan their parent part's B9PS variant is changed, both in flight and in the editor. This is known and awaiting a change to B9PS to be fixed.
|
||||
- Fixed decal bounds rendering as dark cubes when shadowed by EVE clouds.
|
||||
- Fixed decals being shadowed by EVE clouds, causing the part underneath to appear overly dark.
|
||||
|
||||
v0.1.3
|
||||
------
|
||||
Fixes:
|
||||
@ -19,6 +10,8 @@ Changes:
|
||||
- Small refactor of node parsing code
|
||||
- Colors can now be specified in hex (#RGB, #RGBA, #RRGGBB, or #RRGGBBAA) or using the colors specified in the XKCDColors class
|
||||
|
||||
|
||||
|
||||
v0.1.2
|
||||
------
|
||||
Fixes:
|
||||
|
Reference in New Issue
Block a user