clean project
This commit is contained in:
108
Assets/Oculus/Interaction/Samples/Shaders/MRDeskShadow.shader
Normal file
108
Assets/Oculus/Interaction/Samples/Shaders/MRDeskShadow.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/deskShadow"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex("MainTex", 2D) = "white" {}
|
||||
_Color("Shadow Color", Color) = (0, 0, 0, 0)
|
||||
|
||||
[HideInInspector] _texcoord("", 2D) = "white" {}
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags{ "RenderType" = "Transparent" "Queue" = "Transparent+0" }
|
||||
LOD 100
|
||||
|
||||
CGINCLUDE
|
||||
#pragma target 3.0
|
||||
ENDCG
|
||||
//Blend SrcAlpha OneMinusSrcAlpha
|
||||
Blend DstColor Zero
|
||||
AlphaToMask Off
|
||||
Cull Back
|
||||
ColorMask RGBA
|
||||
ZWrite Off
|
||||
ZTest LEqual
|
||||
Offset 0 , 0
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Base"
|
||||
Tags { "LightMode" = "ForwardBase" }
|
||||
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;
|
||||
half2 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct vertexOutput
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
half2 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform half4 _MainTex_ST;
|
||||
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.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.texcoord = v.texcoord;
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
|
||||
fixed4 frag(vertexOutput i) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(i);
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
half4 mainTexture = tex2D(_MainTex, i.texcoord.xy);
|
||||
half4 finalColor = lerp (_Color, half4(1, 1, 1, 1), mainTexture.r) ;
|
||||
return finalColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f78749865658de149abef9e52614f8fe
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
131
Assets/Oculus/Interaction/Samples/Shaders/StencilSky.shader
Normal file
131
Assets/Oculus/Interaction/Samples/Shaders/StencilSky.shader
Normal file
@@ -0,0 +1,131 @@
|
||||
/************************************************************************************
|
||||
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/Stencil Sky"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex("MainTex", 2D) = "white" {}
|
||||
_ColorLight("Light Color", Color) = (0,0,0,0)
|
||||
_ColorDark("Dark Color", Color) = (0, 0, 0, 0)
|
||||
_DitherStrength("Dither Strength", int) = 16
|
||||
[IntRange] _StencilRef("Stencil Reference Value", Range(0, 255)) = 0
|
||||
|
||||
[HideInInspector] _texcoord("", 2D) = "white" {}
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
|
||||
|
||||
Stencil{
|
||||
Ref[_StencilRef]
|
||||
Comp Equal
|
||||
}
|
||||
|
||||
// Tags{"Queue" = "Geometry+502"}
|
||||
// has to be this high because the stencil buffer writer needs to be 2501 in order to
|
||||
// sort back to front
|
||||
|
||||
Tags{ "RenderType" = "Opaque" "Queue" = "Geometry+502" }
|
||||
LOD 100
|
||||
|
||||
CGINCLUDE
|
||||
#pragma target 3.0
|
||||
ENDCG
|
||||
Blend Off
|
||||
AlphaToMask Off
|
||||
Cull Back
|
||||
ColorMask RGBA
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
Offset 0 , 0
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Base"
|
||||
Tags { "LightMode" = "ForwardBase" }
|
||||
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;
|
||||
half2 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct vertexOutput
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
half2 texcoord : TEXCOORD1;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform half4 _MainTex_ST;
|
||||
uniform half4 _ColorLight;
|
||||
uniform half4 _ColorDark;
|
||||
half _DitherStrength;
|
||||
|
||||
|
||||
|
||||
|
||||
vertexOutput vert(vertexInput v)
|
||||
{
|
||||
vertexOutput o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
||||
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.texcoord = v.texcoord;
|
||||
return o;
|
||||
}
|
||||
|
||||
inline half DitherAnimatedNoise(half2 screenPos) {
|
||||
half noise = frac(
|
||||
dot(uint3(screenPos, floor(fmod(_Time.y * 10, 4))), uint3(2, 7, 23) / 17.0f));
|
||||
noise -= 0.5; // remap from [0..1[ to [-0.5..0.5[
|
||||
half noiseScaled = (noise / _DitherStrength);
|
||||
return noiseScaled;
|
||||
}
|
||||
|
||||
fixed4 frag(vertexOutput i) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(i);
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
half ditherNoise = DitherAnimatedNoise(i.vertex.xy);
|
||||
half4 mainTexture = tex2D(_MainTex, i.texcoord.xy);
|
||||
half4 finalColor = lerp(_ColorDark, _ColorLight, mainTexture.r + ditherNoise);
|
||||
return finalColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2402243f452b96b408e8405082fd5ce6
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,68 @@
|
||||
/************************************************************************************
|
||||
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/StencilWriter"{
|
||||
Properties{
|
||||
[IntRange] _StencilRef("Stencil Reference Value", Range(0,255)) = 0
|
||||
}
|
||||
|
||||
SubShader{
|
||||
|
||||
Tags { "Queue" = "Geometry+501"} // stuck way up here so that it sorts with transparent objects
|
||||
|
||||
ZWrite Off
|
||||
|
||||
ColorMask 0 // Don't write to any colour channels
|
||||
//Blend Zero One
|
||||
Stencil{
|
||||
Ref[_StencilRef]
|
||||
Comp Always
|
||||
Pass Replace
|
||||
}
|
||||
|
||||
|
||||
|
||||
Pass {
|
||||
|
||||
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
// pragmas
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
// base input structs
|
||||
struct vertexInput {
|
||||
half4 vertex : POSITION;
|
||||
};
|
||||
struct vertexOutput {
|
||||
half4 pos : SV_POSITION;
|
||||
};
|
||||
|
||||
// vertex function
|
||||
vertexOutput vert(vertexInput v) {
|
||||
vertexOutput o;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
// fragment function
|
||||
fixed4 frag(vertexOutput i) : COLOR
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4afa4535914e1924cb7bef9318c2018c
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
122
Assets/Oculus/Interaction/Samples/Shaders/UIStyleShader.shader
Normal file
122
Assets/Oculus/Interaction/Samples/Shaders/UIStyleShader.shader
Normal file
@@ -0,0 +1,122 @@
|
||||
/************************************************************************************
|
||||
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
|
||||
AlphaToMask Off
|
||||
Cull Back
|
||||
ColorMask RGBA
|
||||
ZWrite Off
|
||||
ZTest LEqual
|
||||
Offset 0 , 0
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Base"
|
||||
Tags { "LightMode" = "ForwardBase" }
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
fixed4 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,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 945300705d5265c40880df9dc394ebd5
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
128
Assets/Oculus/Interaction/Samples/Shaders/floor.shader
Normal file
128
Assets/Oculus/Interaction/Samples/Shaders/floor.shader
Normal file
@@ -0,0 +1,128 @@
|
||||
/************************************************************************************
|
||||
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/floor"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex("MainTex", 2D) = "white" {}
|
||||
_ColorLight("Light Color", Color) = (0,0,0,0)
|
||||
_ColorDark("Dark Color", Color) = (0, 0, 0, 0)_DetailTex("Detail Texture", 2D) = "white" {}
|
||||
_DetailTexIntensity("Detail Texture Intensity", Range(0, 1)) = 1
|
||||
_DitherStrength("Dither Strength", int) = 16
|
||||
|
||||
[HideInInspector] _texcoord("", 2D) = "white" {}
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags{ "RenderType" = "Transparent" "Queue" = "Transparent+0" }
|
||||
LOD 100
|
||||
|
||||
CGINCLUDE
|
||||
#pragma target 3.0
|
||||
ENDCG
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
AlphaToMask Off
|
||||
Cull Back
|
||||
ColorMask RGBA
|
||||
ZWrite Off
|
||||
ZTest LEqual
|
||||
Offset 0 , 0
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Base"
|
||||
Tags { "LightMode" = "ForwardBase" }
|
||||
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;
|
||||
half2 texcoord : TEXCOORD0;
|
||||
half4 vertexColor : COLOR;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct vertexOutput
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
half2 texcoord : TEXCOORD1;
|
||||
half4 vertexColor : COLOR;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform half4 _MainTex_ST;
|
||||
uniform half4 _ColorLight;
|
||||
uniform half4 _ColorDark;
|
||||
uniform sampler2D _DetailTex;
|
||||
uniform half _DetailTexIntensity;
|
||||
uniform half4 _DetailTex_ST;
|
||||
uniform half _DitherStrength;
|
||||
|
||||
|
||||
|
||||
vertexOutput vert(vertexInput v)
|
||||
{
|
||||
vertexOutput o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
||||
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.texcoord = v.texcoord;
|
||||
o.vertexColor = v.vertexColor;
|
||||
return o;
|
||||
}
|
||||
|
||||
inline half DitherAnimatedNoise(half2 screenPos) {
|
||||
half noise = frac(
|
||||
dot(uint3(screenPos, floor(fmod(_Time.y * 10, 4))), uint3(2, 7, 23) / 17.0f));
|
||||
noise -= 0.5; // remap from [0..1[ to [-0.5..0.5[
|
||||
half noiseScaled = (noise / _DitherStrength);
|
||||
return noiseScaled;
|
||||
}
|
||||
|
||||
fixed4 frag(vertexOutput i) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(i);
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
half ditherNoise = DitherAnimatedNoise(i.vertex.xy);
|
||||
half4 detailTexture =
|
||||
tex2D(_DetailTex, (i.texcoord.xy * _DetailTex_ST.xy) + _DetailTex_ST.zw);
|
||||
detailTexture = saturate(detailTexture + (1 - _DetailTexIntensity));
|
||||
half4 mainTexture = tex2D(_MainTex, i.texcoord.xy);
|
||||
half4 finalColor = lerp(_ColorDark, _ColorLight, (mainTexture.r * detailTexture.r) + ditherNoise);
|
||||
return half4(finalColor.rgb, i.vertexColor.r + ditherNoise);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
10
Assets/Oculus/Interaction/Samples/Shaders/floor.shader.meta
Normal file
10
Assets/Oculus/Interaction/Samples/Shaders/floor.shader.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c1b3671e5e09b745962f635c3f2a747
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
129
Assets/Oculus/Interaction/Samples/Shaders/room.shader
Normal file
129
Assets/Oculus/Interaction/Samples/Shaders/room.shader
Normal file
@@ -0,0 +1,129 @@
|
||||
/************************************************************************************
|
||||
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/Room"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex("MainTex", 2D) = "white" {}
|
||||
_DetailTex("Detail Texture", 2D) = "white" {}
|
||||
_DetailTexIntensity("Detail Texture Intensity", Range(0, 1)) = 1
|
||||
|
||||
_ColorLight("Light Color", Color) = (0,0,0,0)
|
||||
_ColorDark("Dark Color", Color) = (0, 0, 0, 0)
|
||||
_DitherStrength("Dither Strength", int) = 16
|
||||
|
||||
[HideInInspector] _texcoord("", 2D) = "white" {}
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags{ "RenderType" = "Opaque" "Queue" = "Geometry+0" }
|
||||
LOD 100
|
||||
|
||||
CGINCLUDE
|
||||
#pragma target 3.0
|
||||
ENDCG
|
||||
Blend Off
|
||||
AlphaToMask Off
|
||||
Cull Back
|
||||
ColorMask RGBA
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
Offset 0 , 0
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "Base"
|
||||
Tags { "LightMode" = "ForwardBase" }
|
||||
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;
|
||||
half2 texcoord : TEXCOORD0;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
};
|
||||
|
||||
struct vertexOutput
|
||||
{
|
||||
float4 vertex : SV_POSITION;
|
||||
half2 texcoord : TEXCOORD1;
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
};
|
||||
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform half4 _MainTex_ST;
|
||||
uniform sampler2D _DetailTex;
|
||||
uniform half _DetailTexIntensity;
|
||||
uniform half4 _DetailTex_ST;
|
||||
uniform half4 _ColorLight;
|
||||
uniform half4 _ColorDark;
|
||||
half _DitherStrength;
|
||||
|
||||
|
||||
|
||||
|
||||
vertexOutput vert(vertexInput v)
|
||||
{
|
||||
vertexOutput o;
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
UNITY_TRANSFER_INSTANCE_ID(v, o);
|
||||
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.texcoord = v.texcoord;
|
||||
return o;
|
||||
}
|
||||
|
||||
inline half DitherAnimatedNoise(half2 screenPos) {
|
||||
half noise = frac(
|
||||
dot(uint3(screenPos, floor(fmod(_Time.y * 10, 4))), uint3(2, 7, 23) / 17.0f));
|
||||
noise -= 0.5; // remap from [0..1[ to [-0.5..0.5[
|
||||
half noiseScaled = (noise / _DitherStrength);
|
||||
return noiseScaled;
|
||||
}
|
||||
|
||||
fixed4 frag(vertexOutput i) : SV_Target
|
||||
{
|
||||
UNITY_SETUP_INSTANCE_ID(i);
|
||||
UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
|
||||
half ditherNoise = DitherAnimatedNoise(i.vertex.xy);
|
||||
half4 mainTexture = tex2D(_MainTex, i.texcoord.xy);
|
||||
half4 detailTexture =
|
||||
tex2D(_DetailTex, (i.texcoord.xy * _DetailTex_ST.xy) + _DetailTex_ST.zw);
|
||||
detailTexture = saturate(pow(detailTexture, _DetailTexIntensity));
|
||||
|
||||
half4 finalColor = lerp(_ColorDark, _ColorLight, (mainTexture.r * detailTexture.r) + ditherNoise);
|
||||
return finalColor;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
10
Assets/Oculus/Interaction/Samples/Shaders/room.shader.meta
Normal file
10
Assets/Oculus/Interaction/Samples/Shaders/room.shader.meta
Normal file
@@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a14dede2360c664f97c90665c986e32
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
preprocessorOverride: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user