c/render: Explain how we get the direction [NFC]

This commit is contained in:
Jakob Bornecrantz 2023-09-18 02:53:34 +01:00
parent 7996013e4d
commit dd21f3c7ec

View file

@ -140,7 +140,13 @@ vec3 get_direction(vec2 uv, uint view_index)
values.xy = values.xy * ubo.pre_transform[view_index].zw + ubo.pre_transform[view_index].xy;
values.y = -values.y; // Flip to OpenXR coordinate system.
// This works because values.xy are now in tangent space, that is the
// `tan(a)` on each of the x and y axis. That means values.xyz now
// define a point on the plane that sits at Z -1 and has a normal that
// runs parallel to the Z-axis. So if you run normalize you get a normal
// that points at that point.
vec3 direction = normalize(values.xyz);
return direction;
}