Page 1 of 2

New demo uploaded: 3d wire frame animated spaceship

Posted: Mon Sep 07, 2020 2:00 am
by desertfish



3d wire frame animated spaceship




View File






3d animated Cobra MK3 ship from Elite!  Uses 16 bits integer math and has hidden-line removal..

This is an almost 1-to-1 conversion of the same program I wrote for the C64, but it runs a lot faster on the CommanderX16 ?

Here is the (prog8) source code https://github.com/irmen/prog8/blob/master/examples/cx16/cobramk3-gfx.p8

 

I haven't figured out how to wait for the Vertical blank yet, to reduce the flickering perhaps...






 

New demo uploaded: 3d wire frame animated spaceship

Posted: Mon Sep 07, 2020 6:33 am
by AndyMt

Oh nice! I can already see something like "Elite" coming...


New demo uploaded: 3d wire frame animated spaceship

Posted: Mon Sep 07, 2020 8:04 am
by desertfish

Ok you put me on a mission ?   I now have to at least put all Elite's ship models into that program  https://www.c64-wiki.com/wiki/Elite#Spaceship_types

And we also have text mode Elite http://www.elitehomepage.org/text/index.htm

So who knows ?

 

edit: Right, that same site hosts various 3d model source files of the Elite shipts. I cobbled up a quick model viewer in Python....  Going to use that to convert the data into binary arrays that I can read into my 6502 program !

image.png.d6460d71e9a0aa0b7251f95f6ec31fdc.png


New demo uploaded: 3d wire frame animated spaceship

Posted: Wed Sep 09, 2020 11:46 pm
by desertfish

Yay, the exported ship data works in the Commander X16 version!  Attempt for the next version to implement hidden line removal in this version too.

image.png.e8c53ac95066247fc8d8e593fed75d70.png


New demo uploaded: 3d wire frame animated spaceship

Posted: Thu Sep 10, 2020 8:05 am
by Cyber

Wow! Are you serious about Elite?


New demo uploaded: 3d wire frame animated spaceship

Posted: Thu Sep 10, 2020 9:47 am
by desertfish

Nah, I'm not going to recreate Elite, the game. That would be way too much work.    The 3d code is not a full 3d engine but just capable of showing one spinning object in the center of the screen ?   I'm not going to expand that. I do want to add hidden line removal to it though  and the other dozen or so ship models. As a separate project maybe to compile or convert that text-mode Elite trading program.    That should be doable and will result in a fun little space trading game program (without fancy graphics though)


New demo uploaded: 3d wire frame animated spaceship

Posted: Sun Sep 13, 2020 3:57 am
by Cyber

I see. You can add spinning 3D ships to the same project as an encyclopedia entries.


New demo uploaded: 3d wire frame animated spaceship

Posted: Mon Sep 14, 2020 11:00 pm
by Nickenstein

Awesome! ?

I'm new here, and I don't have time to experiment until the weekend, but something I wanted to try was making a fixed-point math library with some vector-matrix-mult routines. I think you have beaten me to the punch on that! ?


New demo uploaded: 3d wire frame animated spaceship

Posted: Tue Sep 15, 2020 12:47 am
by desertfish

For this program I am not using a fixed point math library perse.  The math library that I use only has primitives for calculations on byte and word values.

The program   (written in prog8) does the actual 3d calculations taking fixed-point scaling into account.  So a hand written math library with 3d routines as well is still useful as it will be quite a bit faster that my generated assembly code I can imagine.


New demo uploaded: 3d wire frame animated spaceship

Posted: Wed Sep 16, 2020 9:30 pm
by desertfish

Slight update, I'm slowly working towards adding that hidden line removal. The actual math required isn't in there yet but I think I have the ship model data complete for it.

image.png.43d232d5e1232f0ea1137eeca00f2e90.png

Also I've looked at the source code of the text-Elite and it seems a lot more work to convert it to Prog8 than I anticipated. It is still something I would like to complete though, if only to validate the practical applicability of the language.