outline on hover
This commit is contained in:
10
Assets/QuickOutline/Resources/Materials.meta
Normal file
10
Assets/QuickOutline/Resources/Materials.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 80ac8e52d3c31a94babd161e86bc6b97
|
||||
folderAsset: yes
|
||||
timeCreated: 1522559139
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
25
Assets/QuickOutline/Resources/Materials/OutlineFill.mat
Normal file
25
Assets/QuickOutline/Resources/Materials/OutlineFill.mat
Normal file
@@ -0,0 +1,25 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: OutlineFill
|
||||
m_Shader: {fileID: 4800000, guid: 4e76d4023d7e0411297c670f878973e2, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs: []
|
||||
m_Floats:
|
||||
- _OutlineWidth: 2
|
||||
- _ZTest: 8
|
||||
m_Colors:
|
||||
- _OutlineColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
10
Assets/QuickOutline/Resources/Materials/OutlineFill.mat.meta
Normal file
10
Assets/QuickOutline/Resources/Materials/OutlineFill.mat.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 311313efa011949e98b6761d652ad13c
|
||||
timeCreated: 1520576285
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
23
Assets/QuickOutline/Resources/Materials/OutlineMask.mat
Normal file
23
Assets/QuickOutline/Resources/Materials/OutlineMask.mat
Normal file
@@ -0,0 +1,23 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: OutlineMask
|
||||
m_Shader: {fileID: 4800000, guid: 341b058cd7dee4f5cba5cc59a513619e, type: 3}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs: []
|
||||
m_Floats:
|
||||
- _ZTest: 8
|
||||
m_Colors: []
|
||||
10
Assets/QuickOutline/Resources/Materials/OutlineMask.mat.meta
Normal file
10
Assets/QuickOutline/Resources/Materials/OutlineMask.mat.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 106f3ff43a17d4967a2b64c7a92e49ec
|
||||
timeCreated: 1520576276
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
10
Assets/QuickOutline/Resources/Shaders.meta
Normal file
10
Assets/QuickOutline/Resources/Shaders.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6a63caa2b0e993043a42c11f35ff2d1a
|
||||
folderAsset: yes
|
||||
timeCreated: 1522559134
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
81
Assets/QuickOutline/Resources/Shaders/OutlineFill.shader
Normal file
81
Assets/QuickOutline/Resources/Shaders/OutlineFill.shader
Normal file
@@ -0,0 +1,81 @@
|
||||
//
|
||||
// OutlineFill.shader
|
||||
// QuickOutline
|
||||
//
|
||||
// Created by Chris Nolet on 2/21/18.
|
||||
// Copyright © 2018 Chris Nolet. All rights reserved.
|
||||
//
|
||||
|
||||
Shader "Custom/Outline Fill" {
|
||||
Properties {
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _ZTest("ZTest", Float) = 0
|
||||
|
||||
_OutlineColor("Outline Color", Color) = (1, 1, 1, 1)
|
||||
_OutlineWidth("Outline Width", Range(0, 10)) = 2
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags {
|
||||
"Queue" = "Transparent+110"
|
||||
"RenderType" = "Transparent"
|
||||
"DisableBatching" = "True"
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Fill"
|
||||
Cull Off
|
||||
ZTest [_ZTest]
|
||||
ZWrite Off
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
ColorMask RGB
|
||||
|
||||
Stencil {
|
||||
Ref 1
|
||||
Comp NotEqual
|
||||
}
|
||||
|
||||
CGPROGRAM
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
struct appdata {
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
float3 smoothNormal : TEXCOORD3;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f {
|
||||
float4 position : SV_POSITION;
|
||||
fixed4 color : COLOR;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
uniform fixed4 _OutlineColor;
|
||||
uniform float _OutlineWidth;
|
||||
|
||||
v2f vert(appdata input) {
|
||||
v2f output;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(input);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
float3 normal = any(input.smoothNormal) ? input.smoothNormal : input.normal;
|
||||
float3 viewPosition = UnityObjectToViewPos(input.vertex);
|
||||
float3 viewNormal = normalize(mul((float3x3)UNITY_MATRIX_IT_MV, normal));
|
||||
|
||||
output.position = UnityViewToClipPos(viewPosition + viewNormal * -viewPosition.z * _OutlineWidth / 1000.0);
|
||||
output.color = _OutlineColor;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
fixed4 frag(v2f input) : SV_Target {
|
||||
return input.color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e76d4023d7e0411297c670f878973e2
|
||||
timeCreated: 1520575782
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
33
Assets/QuickOutline/Resources/Shaders/OutlineMask.shader
Normal file
33
Assets/QuickOutline/Resources/Shaders/OutlineMask.shader
Normal file
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// OutlineMask.shader
|
||||
// QuickOutline
|
||||
//
|
||||
// Created by Chris Nolet on 2/21/18.
|
||||
// Copyright © 2018 Chris Nolet. All rights reserved.
|
||||
//
|
||||
|
||||
Shader "Custom/Outline Mask" {
|
||||
Properties {
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _ZTest("ZTest", Float) = 0
|
||||
}
|
||||
|
||||
SubShader {
|
||||
Tags {
|
||||
"Queue" = "Transparent+100"
|
||||
"RenderType" = "Transparent"
|
||||
}
|
||||
|
||||
Pass {
|
||||
Name "Mask"
|
||||
Cull Off
|
||||
ZTest [_ZTest]
|
||||
ZWrite Off
|
||||
ColorMask 0
|
||||
|
||||
Stencil {
|
||||
Ref 1
|
||||
Pass Replace
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 341b058cd7dee4f5cba5cc59a513619e
|
||||
timeCreated: 1520575773
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user