Hello everyone.

We have decided to phase out the Mixed Reality Forums over the next few months in favor of other ways to connect with us.

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.

The plan between now and the beginning of May is to clean up old, unanswered questions that are no longer relevant. The forums will remain open and usable.

On May 1st we will be locking the forums to new posts and replies. They will remain available for another three months for the purposes of searching them, and then they will be closed altogether on August 1st.

So, where does that leave our awesome community to ask questions? Well, there are a few places we want to engage with you. 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. 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.