Dark Bit Factory & Gravity

PROGRAMMING => Other languages => Blitz => Topic started by: Clyde on January 17, 2007

Title: Jims 3D Engine Source[BB2D]
Post by: Clyde on January 17, 2007
Originally Post from The Home Brew Forums (http://p205.ezboard.com/3D-Engine-Source/fyabasicprogrammingfrm22.showMessage?topicID=167.topic) By Jim Shaw.


Some of you have been asking for the source to my 3D engine. It got quite far but never got finished, largely due to ezboard messing up.

It supports:

3D Geometry with multiple models all with their own scale and orientation.
Full 3D clipping.
Flat and Gouraud shading.
Flat and Gouraud texture mapping.
Affine and non-affine texture mapping.
Z-Buffer and non-Z-Buffered.
Static, RWX, 3DS ASC and Milkshape model file loading.

It's relatively quick, though it'd be possible to squeeze out a little bit more if you switched to a wbuffer.

I really should have finished it off, but here's pretty much where it got to: 3D Engine (http://members.iinet.net.au/~jimshaw/Blitz/typetri.zip)

Edit: Now Fixed for wbuffer: 3D Engine with wbuffer (http://members.iinet.net.au/~jimshaw/Blitz/typetriw.zip)

Enjoy!
Jim
Title: Re: Jims 3D Engine Source
Post by: Paul on January 17, 2007
holy shit man... thats awsome... how long did it take to make that???   just awsome...
Title: Re: Jims 3D Engine Source
Post by: Jim on January 18, 2007
As you can see there's a lot of cut and pasting so it didn't take too long :).  The hardest part was the clipper.  Normally I do that iteratively, plane by plane, but without using pointers that's very hard, so I did it recursively. ???
The other thing I like about this is that I sacrifice an extra If check per pixel from the wbuffer to see if the colour pixel was written since the wbuffer was last cleared, meaning I don't have to WritePixelFast any unrendered pixels.  WPF is too slow in B2D.

Jim
Title: Re: Jims 3D Engine Source
Post by: MrP on January 18, 2007
Im not going to say anything about that......... I'll just add some karma............ (for someone that is crap at maths and this 3d stuff, just be assured that respect has been issued where it needs to be)
Title: Re: Jims 3D Engine Source
Post by: mike_g on January 18, 2007
There have been times when I sat around and wondered how a 3D engine could be coded. For a while this occured frequently but dident last long until I got bored of not knowing what I was trying to think about. Anyway from what I have seen here  is theres a fair bit of code in there packed with hardcore maths. You get karma for that jim ;D  Hopefully I will be able to begin to figure this stuff out some time. Much thanks for sharing the code.  :cheers: