на память:
When calculating texture coordinates to sample from shadow map, flip the y/t coordinate and convert from the [-1, 1] range of clip coordinates to [0, 1] range of
used for texture sampling
сделать можно или на cpu
и умножить на MVP теней
или в шейдере править координаты тени
When calculating texture coordinates to sample from shadow map, flip the y/t coordinate and convert from the [-1, 1] range of clip coordinates to [0, 1] range of
used for texture sampling
сделать можно или на cpu
let shadowScale = scaleMatrix(.init(0.5, -0.5, 1))
let shadowTranslate = translationMatrix(.init(0.5, 0.5, 0))
let shadowTransform = shadowTranslate * shadowScale
и умножить на MVP теней
или в шейдере править координаты тени
shadowCoord.xy = shadowCoord.xy * 0.5 + 0.5;
shadowTextureCoord.y = 1 - shadowTextureCoord.y;
Буффер с данными материала и текстуры отправлять на рендер шадоумапы не всегда имеет смысл.