Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (794)
Games in Android Showcase (234)
games submitted by our members
Games in WIP (864)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [HELP] 3D Programming in pure java.  (Read 1099 times)
0 Members and 1 Guest are viewing this topic.
Offline codyorr5

Senior Newbie

Medals: 1

« Posted 2019-02-07 07:28:11 »

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.


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 moved to the end of the camera.

Better Cube Example


Source Code:

Runnable Jar:

Offline Archive
« Reply #1 - Posted 2019-02-07 07:40:50 »

Yeah post pictures, sounds like normal perspective distortion though

Offline codyorr5

Senior Newbie

Medals: 1

« Reply #2 - Posted 2019-02-07 09:36:22 »

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.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline princec

« JGO Spiffy Duke »

Medals: 1096
Projects: 3
Exp: 20 years

Eh? Who? What? ... Me?

« Reply #3 - Posted 2019-02-07 11:36:37 »

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 Smiley

Offline codyorr5

Senior Newbie

Medals: 1

« Reply #4 - Posted 2019-02-07 23:29:09 »

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.
Offline 8Observer8
« Reply #5 - Posted 2019-04-09 17:58:05 »

You can edit your links to make them directional links.

Source Code:

Runnable Jar:
Pages: [1]
  ignore  |  Print  

hadezbladez (3181 views)
2018-11-16 13:46:03

hadezbladez (1151 views)
2018-11-16 13:41:33

hadezbladez (3151 views)
2018-11-16 13:35:35

hadezbladez (629 views)
2018-11-16 13:32:03

EgonOlsen (3918 views)
2018-06-10 19:43:48

EgonOlsen (4402 views)
2018-06-10 19:43:44

EgonOlsen (2622 views)
2018-06-10 19:43:20

DesertCoockie (3441 views)
2018-05-13 18:23:11

nelsongames (3573 views)
2018-04-24 18:15:36

nelsongames (4620 views)
2018-04-24 18:14:32
Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!