Mode 7 style effects in Max2D

BlitzMax Forums/BlitzMax Programming/Mode 7 style effects in Max2D

Ninjacrat(Posted 2007) [#1]
Is there any way to achieve effects like

- tilting a sprite into the z-axis
- zooming and tilting the camera

by (ab)using the Max2D library?


ImaginaryHuman(Posted 2007) [#2]
Max2D uses an orthographic parallel projection, it has no perspective, so although you can apply rotation in all 3 axis, and it will sort of look like it rotates, the degree of rotation will be way inproportional. With a command like glRotatef(), it wont move in perspective, without first calling something like gluPerspective() or glFrustum() (in openGL) or some DX calls.

You also shouldn't really change the projection matrix to zoom or tilt the camera, you should move the modelview in front of the camera.


ImaginaryHuman(Posted 2007) [#3]
Max2D uses an orthographic parallel projection, it has no perspective, so although you can apply rotation in all 3 axis, and it will sort of look like it rotates, the degree of rotation will be way inproportional. With a command like glRotatef(), it wont move in perspective, without first calling something like gluPerspective() or glFrustum() (in openGL) or some DX calls.

You also shouldn't really change the projection matrix to zoom or tilt the camera, you should move the modelview in front of the camera.


Gabriel(Posted 2007) [#4]
You can do the latter by manipulating the projection matrix, for which there is a module around. One of IndiePaths, I believe.


Raph(Posted 2007) [#5]
I have done an isometric view heightfield terrain with zoom, tilt, and 360 degree rotation using the textured poly routines found on the forums here (Indiepath's and others). So yes, you can do quite a lot.


smilertoo(Posted 2007) [#6]
seems the obvious way would be to use a textured quad in opengl mode.


Grey Alien(Posted 2007) [#7]
I'm interested in this too...


TartanTangerine (was Indiepath)(Posted 2007) [#8]
You also shouldn't really change the projection matrix to zoom or tilt the camera, you should move the modelview in front of the camera.
Not if you have a more than a couple of models.

Read up on projection matrices and you will find out how to make isometric and perspective projections.


Ninjacrat(Posted 2007) [#9]
Read up on projection matrices and you will find out how to make isometric and perspective projections.


Got any links? :)

(In any case, the answer to 'can you do this with Max2D' seems to be: not without some pretty major hacking around. Too bad.)


tonyg(Posted 2007) [#10]
Perspective Projection and the View Frustum which is taken from the DX SDK documentation. Check modules D3D7Max2d.bmx and GLmax2d for how Bmax sets these and get a copy of projmatrix.bmx to see how Tim uses it.