Skip to content

Visual map doesn't work with DXT5 normal maps (e.g. parallax continued) #433

@JonnyOThan

Description

@JonnyOThan

Linx — 12:18 PM
Not 100% sure if the normal map is reinterpreted by Unity at this point, but it could be because my normals are DXT5_NM and KSP's aren't
My normals don't store the tangent Z so it's always 1
JonnyOThan — 12:19 PM
does it change how the channels.....right
yeah that'll do it I think
Linx — 12:19 PM
Yeah it does. Unity handles the conversion under the hood but I don't know if that's specifically for the GPU side or if it gets reprocessed before being packed into the Texture2D
JonnyOThan — 12:20 PM
the scansat code seems to be looking at the .z component to get a slope value for fake lighting
Linx — 12:21 PM
If you wanted to reproduce it, try

Vector3 sample = new Vector3(nrm.g, nrm.a, 1) * 2 - 1;
float reconstructedZ = sqrt(1.0 - saturate(dot(sample.rg, sample.rg)));
nrm = normalize(sample.r, sample.g, reconstructedZ);
pseudocode ofc

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