Skip to main content

normal_mapped

Function normal_mapped 

Source
pub fn normal_mapped(
    n: V3,
    q0: V3,
    q1: V3,
    st0: [f32; 2],
    st1: [f32; 2],
    texel: V3,
) -> V3
Expand description

The normal n turned by a tangent-space normal map’s stored values texel (0..1, green up in the picture), on a surface where going along q0 moves the picture coordinates (u right, v down) by st0 and going along q1 by st1. No tangents are stored: the frame comes from those differences, as in Schüler’s “Normal Mapping Without Precomputed Tangents”. n comes back alone where the coordinates don’t change. The shader in the app computes the same from screen derivatives.