[HELP] 3D Programming in pure java.

Hey, guys i’ve recently created a 3D engine in pure java. (pure java meaning i didn’t use Java3D, lwjgl, etc) that currently views a cube and its convenient for me (simply create a model, vertex list and face list then add both list to the model, then simply render the model), although it does not contain any parser’s yet. (so i can load .obj models and other 3d model file formats)

UPDATE: you may now download my source/app to check this out for your self.

THE ISSUE:

It shows a perfect CUBE when the cube is centered within the camera…
BUT as you move the camera and the cube becomes closer to the edge of cameras view, some of the faces appear to change into rectangles (like the cube stretches) so the problem is my math i guess? i was hoping someone would have stomped this challenge before and have some good tips.

thanks for any help, i’ll post pics if needed.

CUBE CENTERED
[spoiler]


[/spoiler]

Cube moved to the end of the camera.
[spoiler]


[/spoiler]

Better Cube Example
[spoiler]

[/spoiler]

DOWNLOADS:

Source Code: https://www.dropbox.com/s/z2xltl9tyw6h39x/3DLibrary.rar?dl=0

Runnable Jar: https://www.dropbox.com/s/duy8nif69a32re5/3DTest.jar?dl=0

Yeah post pictures, sounds like normal perspective distortion though

perspective distortion huh? im fairly new to all this so i wouldn’t know but that is something for me to look into.

I’ve also added 2 pictures and a GIF of my issue, thanks for the reply.

Perfectly normal… you’ve got a really wide field-of-view for your camera which distorts things heavily towards the edges. If you had a real mathematical camera model with a raytracer you’d even see the edges of the cube curve instead of being straight lines.

To minimise the effect, move the camera further away from the cube, and shrink the field of view, which gives a more telephoto sort of shot.

Cas :slight_smile:

Thank you for the reply man, i will play around with those two factors a bit.

UPDATE: i couldn’t get it down :C, maybe ill check out some tutorials on FOV.

You can edit your links to make them directional links.

Source Code: https://dl.dropboxusercontent.com/s/z2xltl9tyw6h39x/3DLibrary.rar

Runnable Jar: https://dl.dropboxusercontent.com/s/duy8nif69a32re5/3DTest.jar