• FEATURED

View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# Texture projecting (theoretical)

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

1 reply to this topic

### #1gnomgrol  Members

Posted 14 October 2012 - 03:37 AM

Hey guys,
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.

Thanks!

### #2Nik02  Members

Posted 14 October 2012 - 10:12 AM

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.

Edited by Nik02, 14 October 2012 - 10:31 AM.

Niko Suni

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.