Home Game Development matrix – Transforming the beam level for depth testing

matrix – Transforming the beam level for depth testing

0
matrix – Transforming the beam level for depth testing

[ad_1]

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

o = uCamera.xyz, 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. (https://stackoverflow.com/a/10324884/13369695).

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here