cancel
Showing results for 
Search instead for 
Did you mean: 

Presence Platform (Feedback/Issues)

mouse_bear
Retired Support

Do you have any feedback and/or issues in regards to the Presence Platform? Use this place to discuss, as we'll have members of the engineering team reviewing this thread!

 

Read the blog on Presence Platform here: https://developer.oculus.com/blog/introducing-presence-platform-unleashing-mixed-reality-and-natural...

11 REPLIES 11

JeffNik
Level 7

Is the v35 SDK available anywhere yet? Even a preview?

julienkay
Level 6

Currently with v40 of the Unity Integration, there's an issue with the Reticles only being displayed in one eye in all of the "DistanceGrab" examples. This happens using Multiview and Vulkan as the Graphics API.

 

It's trivial to add support for multiview to the "PolylineUnlit" shader:

 

Spoiler
/************************************************************************************
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 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 v, uint instanceID : SV_InstanceID)
            {
                #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

                v2f o;

                UNITY_SETUP_INSTANCE_ID(v);
                UNITY_INITIALIZE_OUTPUT(v2f, o);
                UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);

                float3 localPos = orientCubePointToSegmentWithWidth(v.vertex.xyz, p0.xyz, p1.xyz, p0.w, p0.w);
                float3 worldPos = mul(_LocalToWorld, float4(localPos, 1.0)).xyz;

                // Apply MVP 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
            {
                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
        }

    }
}

However, the shader is written in a way where the dashed lines won't match up between the two eyes, leading to a stereo disparity issue. Any ideas on how to fix that?