Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Get normal failing when Accurate G-Buffer Normals is on

Discussion in 'General Graphics' started by YJack, Nov 25, 2022.

  1. YJack


    Apr 7, 2010
    I'm having issues to get normals in URP. What am I missing?
    The code below return normals if Accurate G-Buffer Normals Off but returns white if On.

    The same happens getting directly....
        float3 normal = SAMPLE_TEXTURE2D(_CameraNormalsTexture, sampler_CameraNormalsTexture, UnityStereoTransformScreenSpaceTex(i.texcoord)).xyz;

    The code below to unpack when GBuffer packed is used is not helping...

    float2 remappedOctNormalWS = Unpack888ToFloat2(normal); // values between [ 0, 1]
    float2 octNormalWS = remappedOctNormalWS.xy * 2.0 - 1.0; // values between [-1, +1]
    normal = UnpackNormalOctQuadEncode(octNormalWS);

    upload_2022-11-25_10-47-20.png upload_2022-11-25_10-47-45.png

    Attached Files: