Skip to content

about BC5 format normal map #478

@mayhcat

Description

@mayhcat

in file ShadingUtils.slang
/** Convert RG to normal (unnormalized).
*/
float3 rgToNormal(float2 rg)
{
float3 n;
n.xy = rg * 2.f - 1.f;

// Saturate because error from BC5 can break the sqrt
n.z = saturate(dot(rg, rg)); // z = r*r + g*g
n.z = sqrt(1.f - n.z);
return n;

}

I think it should be:

float3 rgToNormal(float2 rg)
{
float3 n;
n.xy = rg * 2.f - 1.f;

// Saturate because error from BC5 can break the sqrt
n.z = saturate(dot(n.xy , n.xy)); // z = x*x + y*y
n.z = sqrt(1.f - n.z);
return n;

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions