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.

Beginners > GBA 3D Programming - intial directions?

#8207 - jonathan_ingram - Fri Jul 04, 2003 1:28 pm

Hello all,
I'm currently working on a piece of GBA work in C that will go towards some form of 3D work (ie: a basic engine demo'd with a walkthrough). Until this point i've been familiarising with all of the 2D graphical operations (sprite operations etc)....but this can only go so far.

Please can someone point me in the right direction into what needs looking at initially, ie:

-Basic Camera projections based on scene images
-Implementing some form of raytracing/casting algorithm
-Fudging the impression of 3D through the use of Sprites and Mode7

Your help appreciated, cheers.

#8209 - niltsair - Fri Jul 04, 2003 3:12 pm

Here's a raycasting engine tutorial, very helpfull :
http://www.permadi.com/tutorial/raycast/index.html

#8213 - jonathan_ingram - Fri Jul 04, 2003 3:34 pm

Cheers..doing other searches on google I also found a useful page:

http://www.btinternet.com/~ahcox/GBA/

which has a link to Michael Abrash's 'Black Book' which tackles all sorts of general graphics principles.

Thanks again.

#8214 - niltsair - Fri Jul 04, 2003 3:43 pm

Thanks for the link, i'm also somewhat trying to learn 3D engine programming in my spare times :-)

#9589 - Derek - Sat Aug 09, 2003 3:39 pm

This is the GBA engine im developing.

http://www.theteahouse.com.au/gba/index.html

Full source code is avaliable on the site. Im using 24:8 fixed point rotation and some "hard to find" matrix generation code. Look in ansic.h. Namely matrix_rotate_world() and matrix_rotate_object(). These functions setup a matrices for world and object rotation.

Code to rotation a vector is then:

p[i].x = fixmul(m[0][0], x) + fixmul(m[0][1], y) + fixmul(m[0][2], z);
p[i].y = fixmul(m[1][0], x) + fixmul(m[1][1], y) + fixmul(m[1][2], z);
p[i].z = fixmul(m[2][0], x) + fixmul(m[2][1], y) + fixmul(m[2][2], z);

The polygon render will then clip, project and texture map 64x64 8bit bitmaps to a mode 5 15bit 120x160 backbuffer with lighting.
V.Nice. Hope the code helps people.

Derek Evans