From d2bd761e2f6fbb983d36b86f0a42f1b9c086d2d6 Mon Sep 17 00:00:00 2001 From: haitem Date: Sat, 30 Jan 2021 19:02:37 +0100 Subject: [PATCH] Repair shader --- Assets/Materials/PushPull.mat | 2 +- Assets/Scenes/Filip.meta | 8 ++ Assets/Scenes/Filip.unity | 150 -------------------------------- Assets/Scripts/ObjectManager.cs | 2 +- Assets/Shaders/Border.shader | 117 +++++++++++++------------ 5 files changed, 70 insertions(+), 209 deletions(-) create mode 100644 Assets/Scenes/Filip.meta diff --git a/Assets/Materials/PushPull.mat b/Assets/Materials/PushPull.mat index 698133c..b80e141 100644 --- a/Assets/Materials/PushPull.mat +++ b/Assets/Materials/PushPull.mat @@ -66,7 +66,7 @@ Material: - _Metallic: 0 - _Mode: 0 - _OcclusionStrength: 1 - - _Outline: 0.25 + - _Outline: 0.1 - _Parallax: 0.02 - _SmoothnessTextureChannel: 0 - _SpecularHighlights: 1 diff --git a/Assets/Scenes/Filip.meta b/Assets/Scenes/Filip.meta new file mode 100644 index 0000000..41cc1a9 --- /dev/null +++ b/Assets/Scenes/Filip.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 89e3b8217119e5342a8150f4a2b3cc44 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Filip.unity b/Assets/Scenes/Filip.unity index a277e00..0ee655a 100644 --- a/Assets/Scenes/Filip.unity +++ b/Assets/Scenes/Filip.unity @@ -283,87 +283,6 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 597897b562955934fae65d62e0a8e3cd, type: 3} ---- !u!1001 &791294013 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 1737216246128126191, guid: 08d7423eab725344da0bad3b29f907dd, - type: 3} - propertyPath: m_Icon - value: - objectReference: {fileID: 4162164826716764455, guid: 0000000000000000d000000000000000, - type: 0} - - target: {fileID: 4715133416468503816, guid: 08d7423eab725344da0bad3b29f907dd, - type: 3} - propertyPath: m_Icon - value: - objectReference: {fileID: 4162164826716764455, guid: 0000000000000000d000000000000000, - type: 0} - - target: {fileID: 8224448297729827164, guid: 08d7423eab725344da0bad3b29f907dd, - type: 3} - propertyPath: m_RootOrder - value: 6 - objectReference: {fileID: 0} - - target: {fileID: 8224448297729827164, guid: 08d7423eab725344da0bad3b29f907dd, - type: 3} - propertyPath: m_LocalPosition.x - value: -7.06 - objectReference: {fileID: 0} - - target: {fileID: 8224448297729827164, guid: 08d7423eab725344da0bad3b29f907dd, - type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8224448297729827164, guid: 08d7423eab725344da0bad3b29f907dd, - type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8224448297729827164, guid: 08d7423eab725344da0bad3b29f907dd, - type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 8224448297729827164, guid: 08d7423eab725344da0bad3b29f907dd, - type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8224448297729827164, guid: 08d7423eab725344da0bad3b29f907dd, - type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8224448297729827164, guid: 08d7423eab725344da0bad3b29f907dd, - type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8224448297729827164, guid: 08d7423eab725344da0bad3b29f907dd, - type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8224448297729827164, guid: 08d7423eab725344da0bad3b29f907dd, - type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8224448297729827164, guid: 08d7423eab725344da0bad3b29f907dd, - type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8224448297729827165, guid: 08d7423eab725344da0bad3b29f907dd, - type: 3} - propertyPath: m_Name - value: SawRiding - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 08d7423eab725344da0bad3b29f907dd, type: 3} --- !u!1 &964739489 GameObject: m_ObjectHideFlags: 0 @@ -604,72 +523,3 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 0d7691d0b9091aa4dba16f262d8daf1b, type: 3} ---- !u!1001 &8810309420367969849 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 8810309419999466072, guid: 75a5dff38607d264bbf318173d359a5e, - type: 3} - propertyPath: m_RootOrder - value: 5 - objectReference: {fileID: 0} - - target: {fileID: 8810309419999466072, guid: 75a5dff38607d264bbf318173d359a5e, - type: 3} - propertyPath: m_LocalPosition.x - value: 2.64 - objectReference: {fileID: 0} - - target: {fileID: 8810309419999466072, guid: 75a5dff38607d264bbf318173d359a5e, - type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8810309419999466072, guid: 75a5dff38607d264bbf318173d359a5e, - type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8810309419999466072, guid: 75a5dff38607d264bbf318173d359a5e, - type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 8810309419999466072, guid: 75a5dff38607d264bbf318173d359a5e, - type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8810309419999466072, guid: 75a5dff38607d264bbf318173d359a5e, - type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8810309419999466072, guid: 75a5dff38607d264bbf318173d359a5e, - type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8810309419999466072, guid: 75a5dff38607d264bbf318173d359a5e, - type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8810309419999466072, guid: 75a5dff38607d264bbf318173d359a5e, - type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8810309419999466072, guid: 75a5dff38607d264bbf318173d359a5e, - type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8810309419999466073, guid: 75a5dff38607d264bbf318173d359a5e, - type: 3} - propertyPath: m_Name - value: Saw - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 75a5dff38607d264bbf318173d359a5e, type: 3} diff --git a/Assets/Scripts/ObjectManager.cs b/Assets/Scripts/ObjectManager.cs index ef12999..e6975ab 100644 --- a/Assets/Scripts/ObjectManager.cs +++ b/Assets/Scripts/ObjectManager.cs @@ -71,7 +71,7 @@ public class ObjectManager : MonoBehaviour playerManager = collision.gameObject.GetComponent(); if (playerManager.activeAbility.Count > 0 && playerManager.activeAbility[0] == 2) { - meshRenderer.materials[1].SetFloat("_Outline", 0.25f); + meshRenderer.materials[1].SetFloat("_Outline", 0.1f); } else { diff --git a/Assets/Shaders/Border.shader b/Assets/Shaders/Border.shader index 8d92074..1513043 100644 --- a/Assets/Shaders/Border.shader +++ b/Assets/Shaders/Border.shader @@ -1,82 +1,85 @@ -Shader "Outlined/Silhouette Only" -{ - Properties{ - _OutlineColor("Outline Color", Color) = (0,0,0,1) - _Outline("Outline width", Range(0.0, 1.0)) = .005 - } +// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' - CGINCLUDE +Shader "Outlined/Silhouette Only" { + Properties{ + _OutlineColor("Outline Color", Color) = (0,0,0,1) + _Outline("Outline width", Range(0.0, 1)) = .005 + } + + CGINCLUDE #include "UnityCG.cginc" - struct appdata { - float4 vertex : POSITION; - float3 normal : NORMAL; - }; + struct appdata { + float4 vertex : POSITION; + float3 normal : NORMAL; + }; - struct v2f { - float4 pos : POSITION; - float4 color : COLOR; - }; + struct v2f { + float4 pos : POSITION; + float4 color : COLOR; + }; - uniform float _Outline; - uniform float4 _OutlineColor; + uniform float _Outline; + uniform float4 _OutlineColor; - v2f vert(appdata v) { - // just make a copy of incoming vertex data but scaled according to normal direction - v2f o; - o.pos = UnityObjectToClipPos(v.vertex); + v2f vert(appdata v) { + // just make a copy of incoming vertex data but scaled according to normal direction + v2f o; + o.pos = UnityObjectToClipPos(v.vertex); - float3 norm = mul((float3x3)UNITY_MATRIX_IT_MV, v.normal); - float2 offset = TransformViewToProjection(norm.xy); + float3 norm = mul((float3x3)UNITY_MATRIX_IT_MV, v.normal); + float2 offset = TransformViewToProjection(norm.xy); - o.pos.xy += offset * o.pos.z * _Outline; - o.color = _OutlineColor; - return o; - } - ENDCG + o.pos.xy += offset * o.pos.z * _Outline; + o.color = _OutlineColor; + return o; + } + ENDCG - SubShader{ - Tags { "Queue" = "Transparent" } + SubShader{ + Tags { "Queue" = "Transparent" } - Pass { - Name "BASE" - Cull Back - Blend Zero One + Pass { + Name "BASE" + Cull Back + Blend Zero One - // uncomment this to hide inner details: - //Offset -8, -8 + // uncomment this to hide inner details: + //Offset -8, -8 - SetTexture[_OutlineColor] { - ConstantColor(0,0,0,0) - Combine constant - } - } + SetTexture[_OutlineColor] { + ConstantColor(0,0,0,0) + Combine constant + } + } - // note that a vertex shader is specified here but it's using the one above - Pass { - Name "OUTLINE" - Tags { "LightMode" = "Always" } - Cull Front + // note that a vertex shader is specified here but its using the one above + Pass { + Name "OUTLINE" + Tags { "LightMode" = "Always" } + Cull Off + Offset 4,4 - // you can choose what kind of blending mode you want for the outline - //Blend SrcAlpha OneMinusSrcAlpha // Normal - //Blend One One // Additive - Blend One OneMinusDstColor // Soft Additive - //Blend DstColor Zero // Multiplicative - //Blend DstColor SrcColor // 2x Multiplicative + + // you can choose what kind of blending mode you want for the outline + //Blend SrcAlpha OneMinusSrcAlpha // Normal + //Blend One One // Additive + Blend One OneMinusDstColor // Soft Additive + //Blend DstColor Zero // Multiplicative + //Blend DstColor SrcColor // 2x Multiplicative CGPROGRAM #pragma vertex vert #pragma fragment frag half4 frag(v2f i) :COLOR { - return i.color; + return i.color; } ENDCG - } + } - } + } - Fallback "Diffuse" -} + Fallback "Diffuse" +} \ No newline at end of file