clean project
This commit is contained in:
@@ -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:
|
||||
246
Assets/Oculus/Interaction/Runtime/Shaders/OculusHand.shader
Normal file
246
Assets/Oculus/Interaction/Runtime/Shaders/OculusHand.shader
Normal file
@@ -0,0 +1,246 @@
|
||||
/************************************************************************************
|
||||
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)
|
||||
_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)
|
||||
_OutlineWidth("Outline Width", Range( 0 , 0.005)) = 0.00134
|
||||
_OutlineOpacity("Outline Opacity", Range( 0 , 1)) = 0.4
|
||||
_OutlineIntensity("Outline Intensity", Range( 0 , 1)) = 1
|
||||
_OutlinePinchRange("Outline Pinch Range", Float) = 0.15
|
||||
_OutlineGlowIntensity("Outline Glow Intensity", Range( 0 , 1)) = 0
|
||||
_OutlineGlowColor("Outline Glow Color", Color) = (1,1,1,1)
|
||||
_OutlineSphereHardness("Outline Sphere Hardness", Range( 0 , 1)) = 0.3
|
||||
|
||||
[Header(Pinch)]
|
||||
_PinchPosition("Pinch Position", Vector) = (0,0,0,0)
|
||||
_PinchRange("Pinch Range", Float) = 0.03
|
||||
_PinchIntensity("Pinch Intensity", Range( 0 , 1)) = 0
|
||||
_PinchColor("Pinch Color", Color) = (0.95,0.95,0.95,1)
|
||||
|
||||
[Header(Wrist)]
|
||||
_WristLocalOffset("Wrist Local Offset", Vector) = (0,0,0,0)
|
||||
_WristRange("Wrist Range", Float) = 0.06
|
||||
_WristScale("Wrist Scale", Float) = 1.0
|
||||
|
||||
[Header(Finger Glow)]
|
||||
_FingerGlowMask("Finger Glow Mask", 2D) = "white" {}
|
||||
_FingerGlowColor("Finger Glow Color", Color) = (1,1,1,1)
|
||||
|
||||
[HideInInspector] _texcoord( "", 2D ) = "white" {}
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"Queue" = "Transparent" "RenderType" = "Transparent" "IgnoreProjector" = "True"
|
||||
}
|
||||
LOD 200
|
||||
|
||||
//==============================================================================
|
||||
// Depth Pass
|
||||
//==============================================================================
|
||||
|
||||
Pass
|
||||
{
|
||||
ZWrite On
|
||||
Cull Off
|
||||
ColorMask 0
|
||||
}
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// Outline Pass
|
||||
//==============================================================================
|
||||
|
||||
Tags
|
||||
{
|
||||
"RenderType" = "Transparent" "Queue" = "Transparent+0"
|
||||
}
|
||||
Cull Front
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
CGPROGRAM
|
||||
#pragma target 3.0
|
||||
#pragma surface outlineSurf Outline nofog keepalpha noshadow noambient novertexlights nolightmap nodynlightmap nodirlightmap nometa noforwardadd vertex:outlineVertexDataFunc
|
||||
|
||||
void outlineVertexDataFunc(inout appdata_full v, out Input o) {
|
||||
UNITY_INITIALIZE_OUTPUT(Input, o);
|
||||
v.vertex.xyz += v.normal * _OutlineWidth; // Outline
|
||||
}
|
||||
|
||||
inline half4 LightingOutline(SurfaceOutput s, half3 lightDir, half atten) {
|
||||
return half4(0, 0, 0, s.Alpha);
|
||||
}
|
||||
|
||||
void outlineSurf(Input i, inout SurfaceOutput o) {
|
||||
// Sphere mask
|
||||
float3 mask = ((i.worldPos - _PinchPosition) / _OutlinePinchRange);
|
||||
float dotValue = clamp(dot(mask, mask), 0.0, 1.0);
|
||||
float sphereMask = pow(dotValue, _OutlineSphereHardness);
|
||||
|
||||
// Compute outline color
|
||||
float3 outlineGlow = saturate(1.0 - sphereMask) * _OutlineGlowIntensity *
|
||||
_OutlineGlowColor.rgb;
|
||||
|
||||
// Wrist
|
||||
float3 wristPosition = mul(unity_ObjectToWorld, _WristLocalOffset).xyz;
|
||||
float wristSphere = length(wristPosition - i.worldPos);
|
||||
float wristRangeScaled = _WristRange * _WristScale;
|
||||
float wristSphereStep = smoothstep(wristRangeScaled * 0.333, wristRangeScaled, wristSphere);
|
||||
|
||||
// Output
|
||||
o.Emission = (_OutlineColor.rgb * _OutlineIntensity) + outlineGlow;
|
||||
o.Alpha = _OutlineOpacity * wristSphereStep;
|
||||
if (o.Alpha < 0.1)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
}
|
||||
ENDCG
|
||||
|
||||
//==============================================================================
|
||||
// Fesnel / Color / Alpha Pass
|
||||
//==============================================================================
|
||||
|
||||
Tags
|
||||
{
|
||||
"RenderType" = "MaskedOutline" "Queue" = "Transparent+0" "IgnoreProjector" = "True" "IsEmissive" = "true"
|
||||
}
|
||||
Cull Back
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
CGINCLUDE
|
||||
#include "UnityPBSLighting.cginc"
|
||||
#include "Lighting.cginc"
|
||||
#pragma target 3.0
|
||||
|
||||
struct Input {
|
||||
float3 worldPos;
|
||||
float3 worldNormal;
|
||||
float2 uv_FingerGlowMask;
|
||||
};
|
||||
|
||||
// General
|
||||
uniform float4 _ColorTop;
|
||||
uniform float4 _ColorBottom;
|
||||
uniform float _Opacity;
|
||||
uniform float _FresnelPower;
|
||||
|
||||
// Outline
|
||||
uniform float _OutlineWidth;
|
||||
uniform float _OutlineIntensity;
|
||||
uniform float4 _OutlineColor;
|
||||
uniform float _OutlinePinchRange;
|
||||
uniform float _OutlineSphereHardness;
|
||||
uniform float _OutlineGlowIntensity;
|
||||
uniform float4 _OutlineGlowColor;
|
||||
uniform float _OutlineOpacity;
|
||||
|
||||
// Pinch
|
||||
uniform float _PinchRange;
|
||||
uniform float3 _PinchPosition;
|
||||
uniform float _PinchIntensity;
|
||||
uniform float4 _PinchColor;
|
||||
|
||||
// Wrist
|
||||
uniform float4 _WristLocalOffset;
|
||||
uniform float _WristRange;
|
||||
uniform float _WristScale;
|
||||
|
||||
// Finger Glow
|
||||
uniform sampler2D _FingerGlowMask;
|
||||
uniform float4 _FingerGlowColor;
|
||||
uniform float _ThumbGlowValue;
|
||||
uniform float _IndexGlowValue;
|
||||
uniform float _MiddleGlowValue;
|
||||
uniform float _RingGlowValue;
|
||||
uniform float _PinkyGlowValue;
|
||||
|
||||
void vertexDataFunc(inout appdata_full v, out Input o) {
|
||||
UNITY_INITIALIZE_OUTPUT(Input, o);
|
||||
}
|
||||
|
||||
inline half4 LightingUnlit(SurfaceOutput s, half3 lightDir, half atten) {
|
||||
return half4(0, 0, 0, s.Alpha);
|
||||
}
|
||||
|
||||
void surf(Input i, inout SurfaceOutput o) {
|
||||
float3 wristPosition = mul(unity_ObjectToWorld, _WristLocalOffset).xyz;
|
||||
float3 worldViewDir = normalize(UnityWorldSpaceViewDir(i.worldPos));
|
||||
|
||||
// Fresnel + color
|
||||
float fresnelNdot = dot(i.worldNormal, worldViewDir);
|
||||
float fresnel = 1.0 * pow(1.0 - fresnelNdot, _FresnelPower);
|
||||
float4 color = lerp(_ColorTop, _ColorBottom, fresnel);
|
||||
|
||||
// Pinch sphere
|
||||
float pinchSphere = length(_PinchPosition - i.worldPos);
|
||||
float pinchSphereStep = smoothstep(_PinchRange - 0.01, _PinchRange, pinchSphere);
|
||||
float4 pinchColor = float4(
|
||||
saturate((1.0 - pinchSphereStep) * _PinchIntensity * _PinchColor.rgb),
|
||||
0.0);
|
||||
|
||||
// Wrist fade
|
||||
//
|
||||
// Visually this means that at approx 33% of the sphere range we want full transparency (map to 0)
|
||||
// to 100% of our sphere range to be opaque.
|
||||
float wristSphere = length(wristPosition - i.worldPos);
|
||||
float wristRangeScaled = _WristRange * _WristScale;
|
||||
float wristSphereStep = smoothstep(wristRangeScaled * 0.333, wristRangeScaled, wristSphere);
|
||||
|
||||
// Finger glows
|
||||
//
|
||||
// the value is packed into a texture where each pixel has two bytes (red and green channels):
|
||||
//
|
||||
// the red channel is used to mask each glow area, currently every finger,
|
||||
// with the thumb being the 1st bit and pinky the 5th bit (6-8 currently unused).
|
||||
//
|
||||
// the green channel is used to indicate the intensity of the glow. This works only because the glow maps
|
||||
// between fingers do not overlap.
|
||||
|
||||
float3 glowMaskPixelColor = tex2D(_FingerGlowMask, i.uv_FingerGlowMask);
|
||||
int glowMaskR = glowMaskPixelColor.r * 255;
|
||||
float glowIntensity = saturate(
|
||||
glowMaskPixelColor.g *
|
||||
((glowMaskR & 0x1) * _ThumbGlowValue +
|
||||
((glowMaskR >> 1) & 0x1) * _IndexGlowValue +
|
||||
((glowMaskR >> 2) & 0x1) * _MiddleGlowValue +
|
||||
((glowMaskR >> 3) & 0x1) * _RingGlowValue +
|
||||
((glowMaskR >> 4) & 0x1) * _PinkyGlowValue));
|
||||
|
||||
float4 glowColor = glowIntensity * _FingerGlowColor;
|
||||
|
||||
// Emission + Opacity
|
||||
o.Emission = saturate(color + pinchColor + glowColor).rgb;
|
||||
o.Alpha = _Opacity * wristSphereStep;
|
||||
}
|
||||
ENDCG
|
||||
|
||||
CGPROGRAM
|
||||
#pragma surface surf Unlit keepalpha vertex:vertexDataFunc
|
||||
ENDCG
|
||||
}
|
||||
Fallback "Diffuse"
|
||||
}
|
||||
@@ -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:
|
||||
103
Assets/Oculus/Interaction/Runtime/Shaders/RoundedBoxUnlit.shader
Normal file
103
Assets/Oculus/Interaction/Runtime/Shaders/RoundedBoxUnlit.shader
Normal file
@@ -0,0 +1,103 @@
|
||||
/************************************************************************************
|
||||
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)
|
||||
}
|
||||
|
||||
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"
|
||||
#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:
|
||||
Reference in New Issue
Block a user