Upgraded original RothenburgAR to Unity version 2017.4.5f1 (and upgrading from standalone vuforia to the version integrated in unity)
This commit is contained in:
86
Assets/Vuforia/Shaders/OutlineOpaque.shader
Normal file
86
Assets/Vuforia/Shaders/OutlineOpaque.shader
Normal file
@@ -0,0 +1,86 @@
|
||||
//===============================================================================
|
||||
//Copyright (c) 2017 PTC Inc. All Rights Reserved.
|
||||
//
|
||||
//Confidential and Proprietary - Protected under copyright and other laws.
|
||||
//Vuforia is a trademark of PTC Inc., registered in the United States and other
|
||||
//countries.
|
||||
//===============================================================================
|
||||
//==============================================================================
|
||||
//Copyright (c) 2013-2014 Qualcomm Connected Experiences, Inc.
|
||||
//All Rights Reserved.
|
||||
//==============================================================================
|
||||
|
||||
Shader "Custom/OutlineOpaque"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_SilhouetteSize ("Size", Float) = 0.0
|
||||
_SilhouetteColor ("Color", Color) = (1,1,1,1)
|
||||
}
|
||||
|
||||
CGINCLUDE
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 position : POSITION;
|
||||
float4 color : COLOR;
|
||||
};
|
||||
|
||||
struct vertIn
|
||||
{
|
||||
float4 position : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
};
|
||||
|
||||
uniform float _SilhouetteSize;
|
||||
uniform float4 _SilhouetteColor;
|
||||
|
||||
ENDCG
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "Queue" = "Geometry" }
|
||||
|
||||
Pass
|
||||
{
|
||||
Cull Back
|
||||
Blend Zero One
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Cull Front
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
v2f vert(vertIn input)
|
||||
{
|
||||
v2f output;
|
||||
// unmodified projected position of the vertex
|
||||
output.position = UnityObjectToClipPos(input.position);
|
||||
output.color = _SilhouetteColor;
|
||||
|
||||
// calculate silhouette in image space
|
||||
float2 silhouette = TransformViewToProjection(mul((float3x3)UNITY_MATRIX_IT_MV, input.normal).xy) * _SilhouetteSize;
|
||||
|
||||
// add silhouette offset
|
||||
output.position.xy += output.position.z * silhouette;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
half4 frag(v2f input) :COLOR
|
||||
{
|
||||
return input.color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Fallback "Diffuse"
|
||||
}
|
||||
Reference in New Issue
Block a user