Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.

"shader not supported" error with hololens

MathisMathis
edited May 2017 in Questions And Answers

The following shader is working with unity but is "not supported" when I run it on the HoloLens emulator. I can't find the reason for this error... Any help is greatly appreciated.

Shader "Custom/RenderDepth"
{
    Properties
    {
        _MainTex("Base (RGB)", 2D) = "white" {}
    _DepthLevel("Depth Level", Range(0, 1)) = 1
    }
        SubShader
    {
        Pass
    {
        CGPROGRAM

#pragma vertex vert 
#pragma fragment frag 
# include "UnityCG.cginc"


        uniform sampler2D _MainTex;
    uniform sampler2D _CameraDepthTexture;
    uniform fixed _DepthLevel;
    uniform half4 _MainTex_TexelSize;

    struct input
    {

        float4 pos : POSITION;
        half2 uv : TEXCOORD0;
    };

    struct output
    {
        float4 pos : SV_POSITION;
        half2 uv : TEXCOORD0;
    };


    output vert(input i)
    {
        output o;
        o.pos = mul(UNITY_MATRIX_MVP, i.pos);
        o.uv = MultiplyUV(UNITY_MATRIX_TEXTURE0, i.uv);
#if UNITY_UV_STARTS_AT_TOP
        if (_MainTex_TexelSize.y < 0) //Needs to be done because the 0 position is different in Direct3D-like and OpenGL-like
            o.uv.y = 1 - o.uv.y;
#endif

        return o;
    }

    fixed4 frag(output o) : COLOR
    {
        float depth = UNITY_SAMPLE_DEPTH(tex2D(_CameraDepthTexture, o.uv));
    depth = pow(Linear01Depth(depth), _DepthLevel);
    return depth;
    }


        ENDCG
    }
    }
}
Sign In or Register to comment.