Repair shader

This commit is contained in:
haitem 2021-01-30 19:02:37 +01:00
parent 77456cec41
commit d2bd761e2f
5 changed files with 70 additions and 209 deletions

View File

@ -66,7 +66,7 @@ Material:
- _Metallic: 0 - _Metallic: 0
- _Mode: 0 - _Mode: 0
- _OcclusionStrength: 1 - _OcclusionStrength: 1
- _Outline: 0.25 - _Outline: 0.1
- _Parallax: 0.02 - _Parallax: 0.02
- _SmoothnessTextureChannel: 0 - _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1 - _SpecularHighlights: 1

8
Assets/Scenes/Filip.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 89e3b8217119e5342a8150f4a2b3cc44
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -283,87 +283,6 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 597897b562955934fae65d62e0a8e3cd, type: 3} 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 --- !u!1 &964739489
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -604,72 +523,3 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 0d7691d0b9091aa4dba16f262d8daf1b, type: 3} 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}

View File

@ -71,7 +71,7 @@ public class ObjectManager : MonoBehaviour
playerManager = collision.gameObject.GetComponent<PlayerManager>(); playerManager = collision.gameObject.GetComponent<PlayerManager>();
if (playerManager.activeAbility.Count > 0 && playerManager.activeAbility[0] == 2) if (playerManager.activeAbility.Count > 0 && playerManager.activeAbility[0] == 2)
{ {
meshRenderer.materials[1].SetFloat("_Outline", 0.25f); meshRenderer.materials[1].SetFloat("_Outline", 0.1f);
} }
else else
{ {

View File

@ -1,82 +1,85 @@
Shader "Outlined/Silhouette Only" // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
{
Properties{
_OutlineColor("Outline Color", Color) = (0,0,0,1)
_Outline("Outline width", Range(0.0, 1.0)) = .005
}
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" #include "UnityCG.cginc"
struct appdata { struct appdata {
float4 vertex : POSITION; float4 vertex : POSITION;
float3 normal : NORMAL; float3 normal : NORMAL;
}; };
struct v2f { struct v2f {
float4 pos : POSITION; float4 pos : POSITION;
float4 color : COLOR; float4 color : COLOR;
}; };
uniform float _Outline; uniform float _Outline;
uniform float4 _OutlineColor; uniform float4 _OutlineColor;
v2f vert(appdata v) { v2f vert(appdata v) {
// just make a copy of incoming vertex data but scaled according to normal direction // just make a copy of incoming vertex data but scaled according to normal direction
v2f o; v2f o;
o.pos = UnityObjectToClipPos(v.vertex); o.pos = UnityObjectToClipPos(v.vertex);
float3 norm = mul((float3x3)UNITY_MATRIX_IT_MV, v.normal); float3 norm = mul((float3x3)UNITY_MATRIX_IT_MV, v.normal);
float2 offset = TransformViewToProjection(norm.xy); float2 offset = TransformViewToProjection(norm.xy);
o.pos.xy += offset * o.pos.z * _Outline; o.pos.xy += offset * o.pos.z * _Outline;
o.color = _OutlineColor; o.color = _OutlineColor;
return o; return o;
} }
ENDCG ENDCG
SubShader{ SubShader{
Tags { "Queue" = "Transparent" } Tags { "Queue" = "Transparent" }
Pass { Pass {
Name "BASE" Name "BASE"
Cull Back Cull Back
Blend Zero One Blend Zero One
// uncomment this to hide inner details: // uncomment this to hide inner details:
//Offset -8, -8 //Offset -8, -8
SetTexture[_OutlineColor] { SetTexture[_OutlineColor] {
ConstantColor(0,0,0,0) ConstantColor(0,0,0,0)
Combine constant Combine constant
} }
} }
// note that a vertex shader is specified here but it's using the one above // note that a vertex shader is specified here but its using the one above
Pass { Pass {
Name "OUTLINE" Name "OUTLINE"
Tags { "LightMode" = "Always" } Tags { "LightMode" = "Always" }
Cull Front Cull Off
Offset 4,4
// you can choose what kind of blending mode you want for the outline
//Blend SrcAlpha OneMinusSrcAlpha // Normal // you can choose what kind of blending mode you want for the outline
//Blend One One // Additive //Blend SrcAlpha OneMinusSrcAlpha // Normal
Blend One OneMinusDstColor // Soft Additive //Blend One One // Additive
//Blend DstColor Zero // Multiplicative Blend One OneMinusDstColor // Soft Additive
//Blend DstColor SrcColor // 2x Multiplicative //Blend DstColor Zero // Multiplicative
//Blend DstColor SrcColor // 2x Multiplicative
CGPROGRAM CGPROGRAM
#pragma vertex vert #pragma vertex vert
#pragma fragment frag #pragma fragment frag
half4 frag(v2f i) :COLOR { half4 frag(v2f i) :COLOR {
return i.color; return i.color;
} }
ENDCG ENDCG
} }
} }
Fallback "Diffuse" Fallback "Diffuse"
} }