gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Graphics > help me with this 3D, please...

#26565 - lordmetroid - Sat Sep 18, 2004 7:12 pm

I talked to LordGraga on #gbadev regarding 3D expert people, and he strongly recommended me to talk to you...
It would be appreciated if you could help me out somewhat getting this camera transformation correct. I've been struggling with it for way to long and starting lose interest working on it... it's just bugging the hell out of me. I understand if you are too busy, but it would really be appreciated if you could help me out.

I only rotate around the Y-axis so this will make certain things easier.
I first started out by rotating my vertice with
Code:

R_y =
[cos(a) 0 -sin(a) 0]
[  0    1    0    0]
[sin(a) 0  cos(a) 0]
[  0    0    0    1]


However as I plotted my <X|Z> one can see the frustum as it's full of the vertice, and it rotated along with the camera except double the speed...
So I switched cos and sin in my rotation matrix.
Now instead all vertice Z values are positive... and X varies from positive to negative values, like one can expect...

The coordinates are allready translated this is a side effect from my frurstum culling algorithm, so what I'm rotating is allready translated...

However when I try to convert my coordinates to the screen (x/z, y/z) and plot my vertice using <X|Y> I don't get anything that could make sense... as I rotate the camera the dots representing my vertice are moving horizontally rapidly without any pattern...
_________________
*Spam*
Open Solutions for an open mind, www.areta.org

Areta is an organization of coders codeing mostly open source project, but there is alot of sections like GBA dev, Language learning communities, RPG communities, etc...

#26708 - pan69 - Fri Sep 24, 2004 7:05 am

Instead of translating/rotating your camera you could also translate/rotate your world instead. I always find it easier to translate/rotate the world and keep the camera at a fixed position.

- Pan

#26709 - lordmetroid - Fri Sep 24, 2004 8:02 am

Isn't that what I'm doing?
I'm applying these calculations on the vertice... so I would guess that means I do it on the world...
_________________
*Spam*
Open Solutions for an open mind, www.areta.org

Areta is an organization of coders codeing mostly open source project, but there is alot of sections like GBA dev, Language learning communities, RPG communities, etc...