Monday, August 29, 2022
HomeGame Developmentmatrix - Transforming the beam level for depth testing

matrix – Transforming the beam level for depth testing

I’ve a ray and its route is (o,d). Multiply it by the mannequin matrix to rotate the mannequin.

o =, d = GenRay();
o = vec3(uModel * vec4(o,1));
d = vec3(uModel * vec4(d,0));

Then beam, RayMarchLeaf(o, d, t, colour, regular); the place get the place vec3 t of the collision of the beam. (in mannequin coordinates).
Then traslate t to world coordinates :

t = vec3(inverse(uModel) * vec4(t,1)); // map to world pos;

Next want calc t relative to the digicam, for the next (my) depth check, how can do that?
Tried to multiply by inverse(uView) but it surely would not work.

Planned to do size(o-t) for depth testing.

It’s not clear why ‘map to world’ pos works when it is written all over the place that you must do that: V-1 * ( V * M ) == M. (



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments