Search Unity

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

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

  1. YJack

    YJack

    Joined:
    Apr 7, 2010
    Posts:
    44
    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.
    SampleSceneNormals(i.texcoord);


    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: