forked from cgvr/DeltaVR
deltavr multiplayer 2.0
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
float3 orientCubePointToSegmentWithWidth(float3 localPt, float3 p0, float3 p1, float width0, float width1)
|
||||
{
|
||||
float3 localSpaceVert = localPt;
|
||||
|
||||
float len = length(p1 - p0);
|
||||
float3 up = float3(0.0f, 1.0f, 0.0f);
|
||||
float3 forward = normalize(p1 - p0);
|
||||
|
||||
if(len < 0.0001f) // near zero length line segment
|
||||
{
|
||||
forward = float3(1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
if(abs(forward.y) > 0.99999f) // vertical line segment
|
||||
{
|
||||
up = float3(1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
// Build lookAt matrix
|
||||
float3 zaxis = forward;
|
||||
float3 xaxis = normalize(cross(up, zaxis));
|
||||
float3 yaxis = cross(zaxis, xaxis);
|
||||
float4x4 lookAtMatrix = {
|
||||
xaxis.x, yaxis.x, zaxis.x, p0.x,
|
||||
xaxis.y, yaxis.y, zaxis.y, p0.y,
|
||||
xaxis.z, yaxis.z, zaxis.z, p0.z,
|
||||
0, 0, 0, 1
|
||||
};
|
||||
|
||||
// Apply widths
|
||||
if(localSpaceVert.z > 0.0f)
|
||||
{
|
||||
localSpaceVert.xy *= width0;
|
||||
localSpaceVert.z = len + width0/2.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
localSpaceVert.xy *= width1;
|
||||
localSpaceVert.z = -1.0f * width1/2.0f;
|
||||
}
|
||||
|
||||
// Apply lookAt matrix
|
||||
return mul(lookAtMatrix, float4(localSpaceVert, 1.0)).xyz;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d946b34836b79f41846424301cf06c8
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,89 @@
|
||||
/************************************************************************************
|
||||
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
|
||||
|
||||
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
|
||||
https://developer.oculus.com/licenses/oculussdk/
|
||||
|
||||
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
|
||||
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
ANY KIND, either express or implied. See the License for the specific language governing
|
||||
permissions and limitations under the License.
|
||||
************************************************************************************/
|
||||
|
||||
Shader "Interaction/DotGridUnlit"
|
||||
{
|
||||
Properties {
|
||||
_Color("Color", Color) = (0, 0, 0, 1)
|
||||
|
||||
// rows, columns, radius
|
||||
_Dimensions("Dimensions", Vector) = (1, 1, .1, 0)
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags {"Queue"="Transparent" "RenderType"="Transparent"}
|
||||
ZWrite Off
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
LOD 100
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_instancing
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
float4 vertex : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
UNITY_INSTANCING_BUFFER_START(Props)
|
||||
UNITY_DEFINE_INSTANCED_PROP(fixed4, _Color)
|
||||
UNITY_DEFINE_INSTANCED_PROP(fixed4, _Dimensions)
|
||||
UNITY_INSTANCING_BUFFER_END(Props)
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
||||
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.uv;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(i);
|
||||
|
||||
float4 color = UNITY_ACCESS_INSTANCED_PROP(Props, _Color);
|
||||
float4 dimensions = UNITY_ACCESS_INSTANCED_PROP(Props, _Dimensions);
|
||||
|
||||
float2 diameter = float2(1.0f/dimensions.x, 1.0f/dimensions.y);
|
||||
float2 uvOffset = i.uv + diameter / 2.0f;
|
||||
float2 index = floor(uvOffset / diameter);
|
||||
float2 xy = index * diameter;
|
||||
float dist = distance(i.uv, xy);
|
||||
|
||||
clip(dimensions.z - dist);
|
||||
|
||||
return color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 43bc449c40895214cac9066b6664fc67
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,66 @@
|
||||
/************************************************************************************
|
||||
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
|
||||
|
||||
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
|
||||
https://developer.oculus.com/licenses/oculussdk/
|
||||
|
||||
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
|
||||
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
ANY KIND, either express or implied. See the License for the specific language governing
|
||||
permissions and limitations under the License.
|
||||
************************************************************************************/
|
||||
|
||||
Shader "Interaction/OculusControllerRayShader"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_Color0 ("Color0", Color) = (1,1,1,1)
|
||||
_Color1 ("Color1", Color) = (1,1,1,0)
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"
|
||||
}
|
||||
LOD 100
|
||||
|
||||
ZWrite Off
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct appdata {
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f {
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
};
|
||||
|
||||
v2f vert(appdata v) {
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.vertex.zz * 2.0f;
|
||||
return o;
|
||||
}
|
||||
|
||||
uniform float4 _Color0;
|
||||
uniform float4 _Color1;
|
||||
|
||||
fixed4 frag(v2f i) : SV_Target {
|
||||
fixed4 col = lerp(_Color0, _Color1, clamp(i.uv.x, 0.0f, 1.0f) * 1.5f);
|
||||
return col;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1fd0c0add1014e349be27442ff000696
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
168
Assets/Oculus/Interaction/Runtime/Shaders/OculusHand.shader
Normal file
168
Assets/Oculus/Interaction/Runtime/Shaders/OculusHand.shader
Normal file
@@ -0,0 +1,168 @@
|
||||
/************************************************************************************
|
||||
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
|
||||
|
||||
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
|
||||
https://developer.oculus.com/licenses/oculussdk/
|
||||
|
||||
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
|
||||
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
ANY KIND, either express or implied. See the License for the specific language governing
|
||||
permissions and limitations under the License.
|
||||
************************************************************************************/
|
||||
|
||||
Shader "Interaction/OculusHand"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[Header(General)]
|
||||
_ColorTop("Color Top", Color) = (0.1960784, 0.2039215, 0.2117647, 1)
|
||||
_ColorBottom("Color Bottom", Color) = (0.1215686, 0.1254902, 0.1294117, 1)
|
||||
_FingerGlowColor("Finger Glow Color", Color) = (1,1,1,1)
|
||||
_Opacity("Opacity", Range(0 , 1)) = 0.8
|
||||
|
||||
[Header(Fresnel)]
|
||||
_FresnelPower("FresnelPower", Range(0 , 5)) = 0.16
|
||||
|
||||
[Header(Outline)]
|
||||
_OutlineColor("Outline Color", Color) = (0.5377358,0.5377358,0.5377358,1)
|
||||
_OutlineJointColor("Outline Joint Error Color", Color) = (1,0,0,1)
|
||||
_OutlineWidth("Outline Width", Range(0 , 0.005)) = 0.00134
|
||||
_OutlineOpacity("Outline Opacity", Range(0 , 1)) = 0.4
|
||||
|
||||
[Header(Wrist)]
|
||||
_WristFade("Wrist Fade", Range(0 , 1)) = 0.5
|
||||
|
||||
[Header(Finger Glow)]
|
||||
_FingerGlowMask("Finger Glow Mask", 2D) = "white" {}
|
||||
[Toggle(CONFIDENCE)] _EnableConfidence("Show Low Confidence", Float) = 0
|
||||
|
||||
[HideInInspector] _texcoord("", 2D) = "white" {}
|
||||
[HideInInspector] _ThumbGlowValue("", Float) = 0
|
||||
[HideInInspector] _IndexGlowValue("", Float) = 0
|
||||
[HideInInspector] _MiddleGlowValue("", Float) = 0
|
||||
[HideInInspector] _RingGlowValue("", Float) = 0
|
||||
[HideInInspector] _PinkyGlowValue("", Float) = 0
|
||||
}
|
||||
|
||||
CGINCLUDE
|
||||
#include "Lighting.cginc"
|
||||
|
||||
#pragma target 3.0
|
||||
|
||||
// CBUFFER named UnityPerMaterial, SRP can cache the material properties between frames and reduce significantly the cost of each drawcall.
|
||||
CBUFFER_START(UnityPerMaterial)
|
||||
// General
|
||||
uniform float4 _ColorTop;
|
||||
uniform float4 _ColorBottom;
|
||||
uniform float _Opacity;
|
||||
uniform float _FresnelPower;
|
||||
|
||||
// Outline
|
||||
uniform float4 _OutlineColor;
|
||||
uniform half4 _OutlineJointColor;
|
||||
uniform float _OutlineWidth;
|
||||
uniform float _OutlineOpacity;
|
||||
|
||||
// Wrist
|
||||
uniform half _WristFade;
|
||||
|
||||
// Finger Glow
|
||||
uniform sampler2D _FingerGlowMask;
|
||||
uniform float4 _FingerGlowColor;
|
||||
|
||||
uniform float _ThumbGlowValue;
|
||||
uniform float _IndexGlowValue;
|
||||
uniform float _MiddleGlowValue;
|
||||
uniform float _RingGlowValue;
|
||||
uniform float _PinkyGlowValue;
|
||||
|
||||
uniform half _JointsGlow[18];
|
||||
CBUFFER_END
|
||||
|
||||
ENDCG
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "IgnoreProjector" = "True" }
|
||||
|
||||
Cull Back
|
||||
AlphaToMask Off
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Depth"
|
||||
ZWrite On
|
||||
ColorMask 0
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
PackageRequirements { "com.unity.render-pipelines.universal": "[10.8.1,10.10.0]" }
|
||||
|
||||
Name "Outline-URP-2020"
|
||||
Tags { "LightMode" = "LightweightForward" "RenderType" = "Transparent" "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderPipeline" = "UniversalPipeline" }
|
||||
|
||||
Cull Front
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
CGPROGRAM
|
||||
#include "OculusHandOutlineCG.cginc"
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
PackageRequirements { "com.unity.render-pipelines.universal": "12.1.7" }
|
||||
|
||||
Name "Outline-URP-2021+"
|
||||
Tags { "LightMode" = "UniversalForwardOnly" "RenderType" = "Transparent" "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderPipeline" = "UniversalPipeline" }
|
||||
|
||||
Cull Front
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
CGPROGRAM
|
||||
#include "OculusHandOutlineCG.cginc"
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Outline-DRP"
|
||||
Tags { "RenderType" = "Transparent" "Queue" = "Transparent" "IgnoreProjector" = "True" }
|
||||
|
||||
Cull Front
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
CGPROGRAM
|
||||
#include "OculusHandOutlineCG.cginc"
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Interior-URP"
|
||||
Tags { "LightMode" = "UniversalForward" "RenderType" = "Transparent" "Queue" = "Transparent" "IgnoreProjector" = "True" "IsEmissive" = "true" }
|
||||
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
#include "OculusHandInteriorCG.cginc"
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Interior-DRP"
|
||||
Tags { "RenderType" = "MaskedOutline" "Queue" = "Transparent" "IgnoreProjector" = "True" "IsEmissive" = "true" }
|
||||
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
ZWrite Off
|
||||
|
||||
CGPROGRAM
|
||||
#include "OculusHandInteriorCG.cginc"
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b895d3431e75dc345a72e171f82bfbea
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,140 @@
|
||||
/************************************************************************************
|
||||
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
|
||||
|
||||
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
|
||||
https://developer.oculus.com/licenses/oculussdk/
|
||||
|
||||
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
|
||||
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
ANY KIND, either express or implied. See the License for the specific language governing
|
||||
permissions and limitations under the License.
|
||||
************************************************************************************/
|
||||
|
||||
Shader "Interaction/OculusHandCursor"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_OutlineWidth("OutlineWidth", Range( 0 , 0.4)) = 0.03
|
||||
_CenterSize("Center Size", Range( 0 , 0.5)) = 0.15
|
||||
_Color("Inner Color", Color) = (0,0,0,0)
|
||||
_OutlineColor("OutlineColor", Color) = (0,0.4410214,1,0)
|
||||
_Alpha("Alpha", Range( 0 , 1)) = 0
|
||||
_RadialGradientIntensity("RadialGradientIntensity", Range( 0 , 1)) = 0
|
||||
_RadialGradientScale("RadialGradientScale", Range( 0 , 1)) = 1
|
||||
_RadialGradientBackgroundOpacity("RadialGradientBackgroundOpacity", Range( 0 , 1)) = 0.1
|
||||
_RadialGradientOpacity("RadialGradientOpacity", Range( 0 , 1)) = 0.8550259
|
||||
[HideInInspector] _texcoord( "", 2D ) = "white" {}
|
||||
[HideInInspector] __dirty( "", Int ) = 1
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags{ "RenderType" = "Transparent" "Queue" = "Transparent+10" "IgnoreProjector" = "True" }
|
||||
Cull Off
|
||||
ZTest LEqual
|
||||
ZWrite Off
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
Offset -5, -5
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
uniform float _RadialGradientScale;
|
||||
uniform float _RadialGradientOpacity;
|
||||
uniform float _RadialGradientIntensity;
|
||||
uniform float _RadialGradientBackgroundOpacity;
|
||||
uniform float _OutlineWidth;
|
||||
uniform float4 _Color;
|
||||
uniform float4 _OutlineColor;
|
||||
uniform float _CenterSize;
|
||||
uniform float _Alpha;
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv_texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv_texcoord : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
v2f vert(appdata v)
|
||||
{
|
||||
v2f o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_OUTPUT(v2f, o);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv_texcoord = v.uv_texcoord;
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag(v2f i) : SV_Target
|
||||
{
|
||||
float RadialGradientScaleRaw149 = _RadialGradientScale;
|
||||
float RadialGradientScale94 = (0.16 + (_RadialGradientScale - 0.0) * (0.45 - 0.16) / (1.0 - 0.0));
|
||||
float temp_output_1_0_g49 = ( 1.0 - ( ( distance( i.uv_texcoord , float2( 0.5,0.5 ) ) * 1.0 ) / RadialGradientScale94 ) );
|
||||
float RadialGradientIntensity96 = (5.0 + (_RadialGradientIntensity - 0.0) * (1.5 - 5.0) / (1.0 - 0.0));
|
||||
float ifLocalVar12_g49 = 0;
|
||||
if( temp_output_1_0_g49 <= 0.0 )
|
||||
ifLocalVar12_g49 = 1.0;
|
||||
else
|
||||
ifLocalVar12_g49 = ( 1.0 / pow( 2.718282 , ( temp_output_1_0_g49 * RadialGradientIntensity96 ) ) );
|
||||
float temp_output_1_0_g47 = ( 1.0 - ( ( distance( i.uv_texcoord , float2( 0.5,0.5 ) ) * 1.0 ) / RadialGradientScale94 ) );
|
||||
float RadialDensity131 = 70.0;
|
||||
float ifLocalVar12_g47 = 0;
|
||||
if( temp_output_1_0_g47 <= 0.0 )
|
||||
ifLocalVar12_g47 = 1.0;
|
||||
else
|
||||
ifLocalVar12_g47 = ( 1.0 / pow( 2.718282 , ( temp_output_1_0_g47 * RadialDensity131 ) ) );
|
||||
float temp_output_75_0 = ( 1.0 - ifLocalVar12_g47 );
|
||||
float RadialGradient102 = saturate( ( ( _RadialGradientOpacity * ( ( 1.0 - ( 1.0 - ifLocalVar12_g49 ) ) - ( 1.0 - temp_output_75_0 ) ) ) + ( temp_output_75_0 * _RadialGradientBackgroundOpacity ) ) );
|
||||
float temp_output_1_0_g77 = ( 1.0 - ( ( distance( i.uv_texcoord , float2( 0.5,0.5 ) ) * 1.0 ) / ( RadialGradientScale94 + _OutlineWidth ) ) );
|
||||
float ifLocalVar12_g77 = 0;
|
||||
if( temp_output_1_0_g77 <= 0.0 )
|
||||
ifLocalVar12_g77 = 1.0;
|
||||
else
|
||||
ifLocalVar12_g77 = ( 1.0 / pow( 2.718282 , ( temp_output_1_0_g77 * 20.0 ) ) );
|
||||
float4 RadialGradientWithOutline147 = ( RadialGradient102 + ( ( ( 1.0 - ifLocalVar12_g77 ) - temp_output_75_0 ) * _OutlineColor ) );
|
||||
float temp_output_1_0_g81 = ( 1.0 - ( ( distance( i.uv_texcoord , float2( 0.5,0.5 ) ) * 1.0 ) / _CenterSize ) );
|
||||
float RadialDensityOutline189 = 20.0;
|
||||
float ifLocalVar12_g81 = 0;
|
||||
if( temp_output_1_0_g81 <= 0.0 )
|
||||
ifLocalVar12_g81 = 1.0;
|
||||
else
|
||||
ifLocalVar12_g81 = ( 1.0 / pow( 2.718282 , ( temp_output_1_0_g81 * RadialDensityOutline189 ) ) );
|
||||
float temp_output_1_0_g79 = ( 1.0 - ( ( distance( i.uv_texcoord , float2( 0.5,0.5 ) ) * 1.0 ) / ( _CenterSize + 0.06 ) ) );
|
||||
float ifLocalVar12_g79 = 0;
|
||||
if( temp_output_1_0_g79 <= 0.0 )
|
||||
ifLocalVar12_g79 = 1.0;
|
||||
else
|
||||
ifLocalVar12_g79 = ( 1.0 / pow( 2.718282 , ( temp_output_1_0_g79 * RadialDensityOutline189 ) ) );
|
||||
float4 OutlineColor183 = _OutlineColor;
|
||||
float4 CenterDot143 = ( ( 1.0 - ifLocalVar12_g81 ) + ( ( 1.0 - ifLocalVar12_g79 ) * OutlineColor183 ) );
|
||||
float4 ifLocalVar29 = 0;
|
||||
if( RadialGradientScaleRaw149 <= 0.1 )
|
||||
ifLocalVar29 = CenterDot143;
|
||||
else
|
||||
ifLocalVar29 = RadialGradientWithOutline147;
|
||||
float4 Emission151 = ifLocalVar29 * _Color;
|
||||
|
||||
float Opacity152 = ((ifLocalVar29).a * _Alpha);
|
||||
if (Opacity152 < 0.01)
|
||||
discard;
|
||||
return float4 (Emission151.rgb, Opacity152);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
Fallback "Diffuse"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 57c328e70d404164ab9b23ac6fc12df6
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,91 @@
|
||||
/************************************************************************************
|
||||
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
|
||||
|
||||
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
|
||||
https://developer.oculus.com/licenses/oculussdk/
|
||||
|
||||
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
|
||||
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
ANY KIND, either express or implied. See the License for the specific language governing
|
||||
permissions and limitations under the License.
|
||||
************************************************************************************/
|
||||
|
||||
#pragma vertex baseVertex
|
||||
#pragma fragment baseFragment
|
||||
#pragma multi_compile_fwdbase nolightmap nodirlightmap nodynlightmap novertexlight
|
||||
|
||||
#pragma prefer_hlslcc gles
|
||||
#pragma exclude_renderers d3d11_9x
|
||||
#pragma target 2.0
|
||||
|
||||
//
|
||||
|
||||
struct VertexInput
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
half3 normal : NORMAL;
|
||||
half4 vertexColor : COLOR;
|
||||
float4 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct VertexOutput
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
float3 worldPos : TEXCOORD1;
|
||||
float3 worldNormal : TEXCOORD2;
|
||||
half4 glowColor : COLOR;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
UNITY_INSTANCING_BUFFER_START(Props)
|
||||
UNITY_DEFINE_INSTANCED_PROP(half4, glowColor)
|
||||
UNITY_INSTANCING_BUFFER_END(Props)
|
||||
|
||||
VertexOutput baseVertex(VertexInput v)
|
||||
{
|
||||
VertexOutput o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_OUTPUT(VertexOutput, o);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
||||
|
||||
o.worldPos = mul(unity_ObjectToWorld, v.vertex);
|
||||
o.worldNormal = UnityObjectToWorldNormal(v.normal);
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
|
||||
half4 maskPixelColor = tex2Dlod(_FingerGlowMask, v.texcoord);
|
||||
int glowMaskR = maskPixelColor.r * 255;
|
||||
|
||||
int thumbMask = (glowMaskR >> 3) & 0x1;
|
||||
int indexMask = (glowMaskR >> 4) & 0x1;
|
||||
int middleMask = (glowMaskR >> 5) & 0x1;
|
||||
int ringMask = (glowMaskR >> 6) & 0x1;
|
||||
int pinkyMask = (glowMaskR >> 7) & 0x1;
|
||||
|
||||
half glowIntensity = saturate(
|
||||
maskPixelColor.g *
|
||||
(thumbMask * _ThumbGlowValue
|
||||
+ indexMask * _IndexGlowValue
|
||||
+ middleMask * _MiddleGlowValue
|
||||
+ ringMask * _RingGlowValue
|
||||
+ pinkyMask * _PinkyGlowValue));
|
||||
|
||||
half4 glow = glowIntensity * _FingerGlowColor;
|
||||
o.glowColor.rgb = glow.rgb;
|
||||
o.glowColor.a = saturate(maskPixelColor.a + _WristFade) * _Opacity;
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 baseFragment(VertexOutput i) : SV_Target
|
||||
{
|
||||
float3 worldViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos));
|
||||
|
||||
float fresnelNdot = dot(i.worldNormal, worldViewDir);
|
||||
float fresnel = 1.0 * pow(1.0 - fresnelNdot, _FresnelPower);
|
||||
float4 color = lerp(_ColorTop, _ColorBottom, fresnel);
|
||||
half3 glowColor = saturate(color + i.glowColor.rgb);
|
||||
|
||||
return half4(glowColor, i.glowColor.a);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2806b25272d987d409c259aeab719be4
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,109 @@
|
||||
/************************************************************************************
|
||||
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
|
||||
|
||||
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
|
||||
https://developer.oculus.com/licenses/oculussdk/
|
||||
|
||||
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
|
||||
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
ANY KIND, either express or implied. See the License for the specific language governing
|
||||
permissions and limitations under the License.
|
||||
************************************************************************************/
|
||||
|
||||
#pragma vertex outlineVertex
|
||||
#pragma fragment outlineFragment
|
||||
#pragma multi_compile_local __ CONFIDENCE
|
||||
#pragma multi_compile_instancing
|
||||
#pragma instancing_options
|
||||
|
||||
#pragma prefer_hlslcc gles
|
||||
#pragma exclude_renderers d3d11_9x
|
||||
#pragma target 3.0
|
||||
|
||||
//
|
||||
|
||||
struct OutlineVertexInput
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
float4 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct OutlineVertexOutput
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
half4 glowColor : TEXCOORD1;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
UNITY_INSTANCING_BUFFER_START(Props)
|
||||
UNITY_DEFINE_INSTANCED_PROP(half4, glowColor)
|
||||
UNITY_INSTANCING_BUFFER_END(Props)
|
||||
|
||||
|
||||
OutlineVertexOutput outlineVertex(OutlineVertexInput v)
|
||||
{
|
||||
OutlineVertexOutput o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_OUTPUT(OutlineVertexOutput, o)
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
||||
v.vertex.xyz += v.normal * _OutlineWidth;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
|
||||
half4 maskPixelColor = tex2Dlod(_FingerGlowMask, v.texcoord);
|
||||
|
||||
#if CONFIDENCE
|
||||
int glowMaskR = maskPixelColor.r * 255;
|
||||
int jointMaskB = maskPixelColor.b * 255;
|
||||
|
||||
int thumbMask = (glowMaskR >> 3) & 0x1;
|
||||
int indexMask = (glowMaskR >> 4) & 0x1;
|
||||
int middleMask = (glowMaskR >> 5) & 0x1;
|
||||
int ringMask = (glowMaskR >> 6) & 0x1;
|
||||
int pinkyMask = (glowMaskR >> 7) & 0x1;
|
||||
|
||||
int joint0 = (jointMaskB >> 4) & 0x1;
|
||||
int joint1 = (jointMaskB >> 5) & 0x1;
|
||||
int joint2 = (jointMaskB >> 6) & 0x1;
|
||||
int joint3 = (jointMaskB >> 7) & 0x1;
|
||||
|
||||
half jointIntensity = saturate(
|
||||
((1 - saturate(glowMaskR)) * _JointsGlow[0])
|
||||
+ thumbMask * (joint0 * _JointsGlow[1]
|
||||
+ joint1 * _JointsGlow[2]
|
||||
+ joint2 * _JointsGlow[3]
|
||||
+ joint3 * _JointsGlow[4])
|
||||
+ indexMask * (joint1 * _JointsGlow[5]
|
||||
+ joint2 * _JointsGlow[6]
|
||||
+ joint3 * _JointsGlow[7])
|
||||
+ middleMask * (joint1 * _JointsGlow[8]
|
||||
+ joint2 * _JointsGlow[9]
|
||||
+ joint3 * _JointsGlow[10])
|
||||
+ ringMask * (joint1 * _JointsGlow[11]
|
||||
+ joint2 * _JointsGlow[12]
|
||||
+ joint3 * _JointsGlow[13])
|
||||
+ pinkyMask * (joint0 * _JointsGlow[14]
|
||||
+ joint1 * _JointsGlow[15]
|
||||
+ joint2 * _JointsGlow[16]
|
||||
+ joint3 * _JointsGlow[17]));
|
||||
|
||||
half4 glow = lerp(_OutlineColor, _OutlineJointColor, jointIntensity);
|
||||
o.glowColor.rgb = glow.rgb;
|
||||
o.glowColor.a = saturate(maskPixelColor.a + _WristFade) * glow.a * _OutlineOpacity;
|
||||
#else
|
||||
o.glowColor.rgb = _OutlineColor;
|
||||
o.glowColor.a = saturate(maskPixelColor.a + _WristFade) * _OutlineColor.a * _OutlineOpacity;
|
||||
#endif
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 outlineFragment(OutlineVertexOutput i) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(i);
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
return i.glowColor;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ef476d3d3314714fbd78909394b2843
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
124
Assets/Oculus/Interaction/Runtime/Shaders/PolylineUnlit.shader
Normal file
124
Assets/Oculus/Interaction/Runtime/Shaders/PolylineUnlit.shader
Normal file
@@ -0,0 +1,124 @@
|
||||
/************************************************************************************
|
||||
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
|
||||
|
||||
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
|
||||
https://developer.oculus.com/licenses/oculussdk/
|
||||
|
||||
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
|
||||
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
ANY KIND, either express or implied. See the License for the specific language governing
|
||||
permissions and limitations under the License.
|
||||
************************************************************************************/
|
||||
|
||||
Shader "Custom/PolylineUnlit" {
|
||||
|
||||
Properties { }
|
||||
|
||||
SubShader
|
||||
{
|
||||
|
||||
Tags { "Queue"="Geometry" }
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_fwdbase nolightmap nodirlightmap nodynlightmap novertexlight
|
||||
#pragma target 5.0
|
||||
#include "UnityCG.cginc"
|
||||
#include "./CubePointToSegment.cginc"
|
||||
#include "../ThirdParty/Shaders/CapsuleRayIntersect.cginc"
|
||||
|
||||
#if SHADER_TARGET >= 45
|
||||
StructuredBuffer<float4> _PositionBuffer;
|
||||
StructuredBuffer<float4> _ColorBuffer;
|
||||
#endif
|
||||
|
||||
struct appdata_full_instance : appdata_full
|
||||
{
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct v2f {
|
||||
float4 pos : SV_POSITION;
|
||||
sample float3 worldPos : TEXCOORD0;
|
||||
float4 p0 : TEXCOORD1;
|
||||
float4 p1 : TEXCOORD2;
|
||||
float4 col0 : TEXCOORD3;
|
||||
float4 col1 : TEXCOORD4;
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
float _Scale;
|
||||
float4x4 _LocalToWorld;
|
||||
|
||||
v2f vert(appdata_full_instance v, uint instanceID : SV_InstanceID)
|
||||
{
|
||||
v2f o;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_OUTPUT(v2f, o);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
|
||||
#if SHADER_TARGET >= 45
|
||||
float4 p0 = _PositionBuffer[instanceID * 2];
|
||||
float4 p1 = _PositionBuffer[instanceID * 2 + 1];
|
||||
float4 col0 = _ColorBuffer[instanceID * 2];
|
||||
float4 col1 = _ColorBuffer[instanceID * 2 + 1];
|
||||
#else
|
||||
float4 p0 = 0;
|
||||
float4 p1 = 0;
|
||||
float4 col0 = 0;
|
||||
float4 col1 = 0;
|
||||
#endif
|
||||
|
||||
float3 localPos = orientCubePointToSegmentWithWidth(v.vertex.xyz, p0.xyz, p1.xyz, p0.w, p0.w);
|
||||
float3 worldPos = mul(_LocalToWorld, float4(localPos, 1.0)).xyz;
|
||||
|
||||
// Apply VP matrix to model
|
||||
o.pos = mul(UNITY_MATRIX_VP, float4(worldPos, 1.0));
|
||||
o.worldPos = worldPos;
|
||||
o.p0 = float4(mul(_LocalToWorld, float4(p0.xyz, 1.0)).xyz, p0.w);
|
||||
o.p1 = float4(mul(_LocalToWorld, float4(p1.xyz, 1.0)).xyz, p1.w);
|
||||
o.col0 = col0;
|
||||
o.col1 = col1;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i, out float out_depth : SV_Depth) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
float3 rayDir = normalize(i.worldPos - _WorldSpaceCameraPos.xyz);
|
||||
float dist = capIntersect(_WorldSpaceCameraPos.xyz, rayDir, i.p0, i.p1,
|
||||
i.p0.w/2.0f * _Scale); // hardcoded sphere at 0,0,0 radius .5
|
||||
clip(dist);
|
||||
|
||||
// calculate world space hit position
|
||||
float3 hitPos = _WorldSpaceCameraPos.xyz + rayDir * dist;
|
||||
|
||||
// set output depth
|
||||
float4 clipPos = UnityWorldToClipPos(hitPos);
|
||||
|
||||
out_depth = clipPos.z / clipPos.w;
|
||||
|
||||
#if !defined(UNITY_REVERSED_Z)
|
||||
out_depth = out_depth * 0.5 + 0.5;
|
||||
#endif
|
||||
|
||||
float3 vec = i.p1.xyz - i.p0.xyz;
|
||||
float dotvecvec = dot(vec, vec);
|
||||
float t = 0.0f;
|
||||
if(abs(dotvecvec) > 0.0f)
|
||||
{
|
||||
float3 toHit = hitPos - i.p0.xyz;
|
||||
t = dot(toHit, vec)/dotvecvec;
|
||||
}
|
||||
return float4(lerp(i.col0, i.col1, t).rgb, 1.0f);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8fd0b9a6fa1abd34393da45b7f791d6f
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
107
Assets/Oculus/Interaction/Runtime/Shaders/RoundedBoxUnlit.shader
Normal file
107
Assets/Oculus/Interaction/Runtime/Shaders/RoundedBoxUnlit.shader
Normal file
@@ -0,0 +1,107 @@
|
||||
/************************************************************************************
|
||||
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
|
||||
|
||||
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
|
||||
https://developer.oculus.com/licenses/oculussdk/
|
||||
|
||||
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
|
||||
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
ANY KIND, either express or implied. See the License for the specific language governing
|
||||
permissions and limitations under the License.
|
||||
************************************************************************************/
|
||||
|
||||
Shader "Interaction/RoundedBoxUnlit"
|
||||
{
|
||||
Properties {
|
||||
_Color("Color", Color) = (0, 0, 0, 1)
|
||||
|
||||
_BorderColor("BorderColor", Color) = (0, 0, 0, 1)
|
||||
|
||||
// width, height, border radius, unused
|
||||
_Dimensions("Dimensions", Vector) = (0, 0, 0, 0)
|
||||
|
||||
// radius corners
|
||||
_Radii("Radii", Vector) = (0, 0, 0, 0)
|
||||
|
||||
// defaults to LEqual
|
||||
[Enum(UnityEngine.Rendering.CompareFunction)] _ZTest("ZTest", Float) = 4
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags {"Queue"="Transparent" "RenderType"="Transparent"}
|
||||
ZWrite Off
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
ZTest [_ZTest]
|
||||
LOD 100
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_instancing
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "../ThirdParty/Box2DSignedDistance.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
float4 vertex : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
fixed4 color : COLOR;
|
||||
fixed4 borderColor : TEXCOORD1;
|
||||
fixed4 dimensions : TEXCOORD2;
|
||||
fixed4 radii : TEXCOORD3;
|
||||
};
|
||||
|
||||
UNITY_INSTANCING_BUFFER_START(Props)
|
||||
UNITY_DEFINE_INSTANCED_PROP(fixed4, _Color)
|
||||
UNITY_DEFINE_INSTANCED_PROP(fixed4, _BorderColor)
|
||||
UNITY_DEFINE_INSTANCED_PROP(fixed4, _Dimensions)
|
||||
UNITY_DEFINE_INSTANCED_PROP(fixed4, _Radii)
|
||||
UNITY_INSTANCING_BUFFER_END(Props)
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_OUTPUT(v2f, o);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
|
||||
o.radii = UNITY_ACCESS_INSTANCED_PROP(Props, _Radii);
|
||||
o.dimensions = UNITY_ACCESS_INSTANCED_PROP(Props, _Dimensions);
|
||||
o.borderColor = UNITY_ACCESS_INSTANCED_PROP(Props, _BorderColor);
|
||||
o.color = UNITY_ACCESS_INSTANCED_PROP(Props, _Color);
|
||||
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = (v.uv-float2(.5f,.5f))*2.0f*o.dimensions.xy;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
float sdResult = sdRoundBox(i.uv, i.dimensions.xy - i.dimensions.ww * 2.0f, i.radii);
|
||||
|
||||
clip(i.dimensions.w * 2.0f - sdResult);
|
||||
|
||||
if (-i.dimensions.z * 2.0f - sdResult < 0.0f)
|
||||
{
|
||||
return i.borderColor;
|
||||
}
|
||||
return i.color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f6ffd8c4413a1c4b8d833fc76c445ed
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
108
Assets/Oculus/Interaction/Runtime/Shaders/UIStyleShader.shader
Normal file
108
Assets/Oculus/Interaction/Runtime/Shaders/UIStyleShader.shader
Normal file
@@ -0,0 +1,108 @@
|
||||
/************************************************************************************
|
||||
Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
|
||||
|
||||
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at
|
||||
https://developer.oculus.com/licenses/oculussdk/
|
||||
|
||||
Unless required by applicable law or agreed to in writing, the Utilities SDK distributed
|
||||
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
ANY KIND, either express or implied. See the License for the specific language governing
|
||||
permissions and limitations under the License.
|
||||
************************************************************************************/
|
||||
|
||||
Shader "Oculus/Interaction/UIStyle"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_Color("Color", Color) = (1,1,1,1)
|
||||
|
||||
[HideInInspector] _texcoord("", 2D) = "white" {}
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags{ "RenderType" = "Transparent" "Queue" = "Transparent+0"}
|
||||
LOD 100
|
||||
|
||||
CGINCLUDE
|
||||
#pragma target 3.0
|
||||
ENDCG
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Base"
|
||||
CGPROGRAM
|
||||
|
||||
#ifndef UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX
|
||||
//only defining to not throw compilation error over Unity 5.5
|
||||
#define UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input)
|
||||
#endif
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma multi_compile_instancing
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityShaderVariables.cginc"
|
||||
|
||||
struct VertexInput
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
half4 vertexColor : COLOR;
|
||||
half3 normal : NORMAL;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct VertexOutput
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
float3 worldPos : TEXCOORD0;
|
||||
half3 normal : TEXCOORD2;
|
||||
half4 vertexColor : COLOR;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
uniform half4 _Color;
|
||||
|
||||
VertexOutput vert(VertexInput v)
|
||||
{
|
||||
VertexOutput o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
||||
o.normal = UnityObjectToWorldNormal(v.normal);
|
||||
half pulse = sin(_Time.z) * 0.5 + 0.5;
|
||||
float4 vertexPos = UnityObjectToClipPos(v.vertex);
|
||||
vertexPos.xyz = vertexPos + ((0.002 * pulse) * o.normal * v.vertexColor.a);
|
||||
o.vertex = vertexPos;
|
||||
o.vertexColor = v.vertexColor;
|
||||
o.worldPos = mul(unity_ObjectToWorld, v.vertex).xyz;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
half4 frag(VertexOutput i) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(i);
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
float3 worldViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos));
|
||||
half3 worldNormal = i.normal;
|
||||
half fresnel = saturate(dot(worldViewDir, worldNormal));
|
||||
fresnel = saturate(pow(fresnel + .1, 3) * 2);
|
||||
|
||||
half opacity = fresnel * i.vertexColor.a;
|
||||
|
||||
half4 debug = half4(i.vertexColor.a, i.vertexColor.a, i.vertexColor.a, 1.0);
|
||||
|
||||
half4 finalColor = _Color * i.vertexColor;
|
||||
return half4(finalColor.rgb, opacity);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 945300705d5265c40880df9dc394ebd5
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user