Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm working on a game which takes place on a two dimensional grid similar to the fluid background grid in Geometry Wars. It is implemented as a procedurally drawn spring system which may have force applied to the intersection points resulting in a primitive fluid dynamic simulation.

Let's say I want to elevate the grid into three-space. One way would be to upgrade the whole world to 3-d. Then I could render the grid to a texture and map it onto a plane which could be placed in three dimensions. What I am more interested in, however, is how I might 'fake' it by simulating perspective using 2-D. For example, its easy to vary the horizontal grid spacing based on the cell's row in the grid. By squeezing it at the top I can create a visually convincing vanishing point, but the physics and interaction with the grid is not right.

I'd like to be able to layer the 2-D grid over a separate 3-D layer such that they appear to be one. Have y'all seen the impressive demonstrations of anamorphic projection recently featured on YouTube?

Intrigued, I found another tutorial video which shows how to draw anamorphically using pencil and paper.

Anyone have an idea of how to approach the problem of creating an anamorphic projection space in 2-D that would line up with a given perspective projection as that of a typical 3-D Camera?

I envision that this would manifest as an array of weightings applied to each point in the 2-dimensional grid which I could use to modulate the physics forces that drive the grid, creating a more realistic spring system than is possible with a simple faked perspective.

share|improve this question
add comment

1 Answer

screen space position (x, y) = world position (x, y) / z

...The basis of perspective projection, I think this would be your starting point, assuming a pinhole camera (camera with infinitesimally small aperture) in both instances. Divide-by-z is what gives the impression of depth. You would need to match your divide by z in both projections, in order to match perspectives... and matching the viewing position goes without saying. Hence this is all going to be a lot easier if the viewpoint doesn't change... which, from what you've said, sounds like it's the case.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.