I'm pretty bad with the mathz so I need some help here. I want to project a texture onto my terrain, around the position I click.
I got the basics of projective texturing and I thought that would would be a good idea to use it.
My idea was to simply use a viewmatrix from abouth the point and a orthogonal projectionmatrix with the size of the texture.
But the results are pretty wierd and since I don't understand the math behind the projectionmatrix I hoped someone could help me out here.
Perspective projection is (at its core) simply dividing the x and y by the (z * field of view), so that the further away something is, the smaller it looks. Practical implementations in computer graphics also map the desired scene depth range to the range of the viewport (typically 0...1) to accommodate the discrete range of a depth buffer and to establish a frame of reference for the depth in general.
Orthogonal projection, by contrast, is usually a combination of linear scaling and translation, with no correlation between the depth of the geometry and its scale.
If you need projection like that from a spotlight, then you need perspective projection as opposed to orthogonal. Orthogonal projection would suit a (pseudo)infinitely far away light source, like the sun as seen from earth, though.