Tag Info

Hot answers tagged

14

So long as the matrix M is invertible (which it generally will be, unless you're doing something very unusual), then computing the matrix inverse of M will give you a matrix that does what you want. That is, if M performs some transformation, inverse(M) performs the "opposite" transformation. Most matrix/vector libraries provide a means for computing the ...


3

From what I read from the shaders the light is in world-space and the light calculation is done on the object in part in untransformed object-space. You need to compute your lighting with both light & model in world-space or both in camera space. Whenever moving the camera messes up the lighting it means some of the data is calculated in a different ...


2

If your transformation matrix is a rotation matrix then you can simplify the problem by taking advantage of the fact that the inverse of a rotation matrix is the transpose of that matrix. If your transformation matrix represents a rotation followed by a translation, then treat the components separately. The inverse is equivalent to subtracting the ...


2

In your matrix lib there is probably a function called inverse. That is probably what you are looking for.


1

The transformation Matrix to transform from the space on the left to the space on the right is [1 0 0 1 ] [0 1 0 -1.5] [0 0 1 0 ] [0 0 0 1 ] Well this is not correct, the matrix you have shown is actually to transform any point from the space on the right to the space on the left. The correct matrix to transform from the ...


1

World position is vertex position multiplied by world matrix, not view matrix. So it should be like this in the vertex shader: output.WorldPos = mul(input.Pos,World); Unless you want View position to work with. I haven't checked the code for bugs if you want to use that.



Only top voted, non community-wiki answers of a minimum length are eligible