3D projection doesnt work

T_01

Im trying to programm a 3D game with pure java, without any libraries like open gl (because i want to understand all the mathematics and techniches behind it). So, the first tests work very well, i can move around and rotate cubes and stuff like that, and i have a projection matrix to represent the camera of the world. But the this projection doesnt work correctly.

I can move the points around, but only about x and y, so right left, top bottom. but whenever i change the z coordinates of all points, nothing happens. The thing is my perspective projection isnt perspective at all. I can do everzthing, but points that are "far away" arent drawn "smaller"... why? Whats the problem?

Im working with matrices i already said, and use the following principe: every mesh has a list of lines, each line has to points, a point has the variables x, y, z, 1. So, whenever i want to transform all of these points i just multiply the needed transformation matrix (4x4) with each point matrix (4x1), and then the projection matrix with each point matrix, to get the new point matrix (4x1) of each point and drawing them again.

so i already said, the projection, (so the actual distance zoom) isnt working. why? Anyone an idea?

Thank you very much!

EDIT

okay, heres is some more information and code: Im using this projection matrix:

projectionmatrix

and here is some more code:

Camera.java

Graphics3D.java

BlockWorld.java That's the main programm, problem see line 48

Matrix.java

Slihp

You will need to transform your points using a perspective projection matrix rather than just a projection matrix to add depth

see

http://www.scratchapixel.com/lessons/3d-advanced-lessons/perspective-and-orthographic-projection-matrix/perspective-projection-matrix/

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related