## help with writing my own simple 3d engine

**category:**code [glöplog]

@zorke: Zed3D tutorial from 1996 gives a lot of info.

hmm... zed3d looks a bit complicated with math.

what are the prerequisites for this?

what are the prerequisites for this?

A book on vectors and matrices should provide the basics. It might seem complicated, but hang in there and take small steps at a time. Perhaps your math teacher can point you in the right direction.

i heard you do polygon calculations in baycentric space nowadays. however the oldschool way is just fun. there are several old papers on the subject. i recently started all over again writing a rasterizer since i lost all of my old source. i used an old paper on Digital Differential Analyzers (DDA's). Or you could write everything as a raytracer and integrate polygon rendering in that engine.

oh, and btw, where can one get the second reality source? ;)

oh, and btw, where can one get the second reality source? ;)

Here you can learn How to make a vector cube. Amiiigaaaahh. In other news I think the 2nd Reality source was recently released.

you dont even know how to make a vector cube if you know how to make a vector cube.

k.. ive got my triangle drawing function ready. heh. yes ive learnt matrices and two d vectors so it looks like i need to learn threed ones. just out of curiosity, would i be behind in my maths from an international standard? since the edu system where i live is crap. im currently doing quadratic, cubuc, quartic polynomials, and that stuff

You can "learn" vector math from books or Internet, it's plentyfull... but it won't replace practice for having a true, deep understanding of them. 3d engine is perfect way to put that into practice ;) I would say, you need those:

* Vector addition/subtraction (trivial)

* Dot product, cross product, the various ways to compute them and their various interpretation.

* Matrix/vector product (one matrix => one linear transformation eg. combination of a rotation/scale/shear/symmetry)

* Homogeneous coordinates (how to have translations as a linear transformation, using a 4th coordinate)

* Vector addition/subtraction (trivial)

* Dot product, cross product, the various ways to compute them and their various interpretation.

* Matrix/vector product (one matrix => one linear transformation eg. combination of a rotation/scale/shear/symmetry)

* Homogeneous coordinates (how to have translations as a linear transformation, using a 4th coordinate)

zorke: Vector math started in 11th grade (age 17) for me, so your school is probably ok.

Some basic trigonometry and differentials are helpful, too, if you want to rotate stuff.

Some basic trigonometry and differentials are helpful, too, if you want to rotate stuff.

you can think to an abstration layer like mine libs (http://deaddeer.free.fr/) usefull to make cross-Platform engine.

and also. what is the most hip way to define the z axes? should z be positive into the screen or negative into the screen?

The most hip way to define the z axis, is pointing along the axis of the hip-bone. Duh.

Z usually increases into the screen.

It decreases into the screen in OpenGL, and increases into the screen in Direct3D, no?

It goes up in OSG :P

Heightmaps ftw though :)

Surely you mean depthmaps?

It's quite common to have the

**world-space**Z-axis pointing up, indeed. But I suspect zorke was referring to the eye-space and/or clip-space Z-axis.kusma: Quite possible that OpenGL is right-handed - haven't used it for a long time now. D3D is left-handed.

Of course it's right-handed; what else would it be? There's only one reasonable choice :-)

Depends - would you describe walking forward as an action best described with an increasing or a decreasing number? :)

if gl depth is towards you they both right handed. d3d is just a handstand shooter and gl shooting back. ;)

if you shoot ghetto style they're both left. d3d ownz that. and gl is a fallen hip shooter. :D