Game Development Reference
In-Depth Information
Nowwehavethebasisvectorscompleteandwiththepositionofthequad,wecanconstruct
the screen aligned transform.
This will be the quad's world transformation we will pass to the graphics device when we
want to render.
matrix inverseView = matrix::Invert(view);
vector3 v = world.Translation() - inverseView.Translation();
v.Normalize();
vector3 right = v.Cross(view.Up());
transform = matrix::Create(right, view.Up(), v, world.Translation());
3.12.1.2World Oriented Quad
Attimes wewanttorenderquadsoriented totheworlditself, unlike ascreen aligned quad,
the world oriented quad's transformation does not need to be updated to maintain it facing
the camera, instead, any world space direction vector may be used as the quad's normal
which we will use to build the basis around this axis.
In this case since the position and orientation of the camera is irrelevant, we do not need to
calculate the inverse view matrix, rather, any direction vector v can be provided.
Given the quad's normal vector v we will compute the orthonormal basis against the
world's up default direction.
Computing the cross product of the quad's normal with the world's up direction we will
compute the right vector r .
Search WWH ::




Custom Search