* WalrusIRC

You need to have 5 posts and not be part of restricted usergroups in order to use the WalrusIRC embedded shoutbox. However, you can also access our IRC channel called #CodeWalrus via EFnet.

Author Topic: gLib a fast 3D asm/axiom library  (Read 62712 times)

0 Members and 1 Guest are viewing this topic.

Offline Snektron

  • Lvl 69 Russian Snake
  • Super User
  • Join Date: Dec 2014
  • Location: Netherlands
  • Posts: 3165
  • Post Rating Ratio: +32/-0
  • SSSssssss.....
    • RobinDeWalvis
    • Kzyrox
    • RobinDeWalvis
    • quantuminfinity
  • Gender: Male
Re: -gLib a (relatively) fast 3D library
« Reply #15 on: January 22, 2015, 09:28:42 pm »
Matrix calculation is also made with integer, 7bit integer to be more precise. [-64,64] and precision is ok, as well as speed :



stress test with 256 points, 6fps at 6MHz (so for matrix rotation : 2304 fastmul per frame, and 256 div, 512 mul)
this test is without using fast math  :)

While we're on the point-cloud off topic:

Cheaty isometric 3d in Axe, 1024 points ^^ (it's probably faster in asm).
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Online xlibman

  • Omni founder & CW co-founder
  • Super User
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18799
  • Post Rating Ratio: +98/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • DJ Omnimaga music store
  • Gender: Male
Re: -gLib a (relatively) fast 3D library
« Reply #16 on: January 22, 2015, 11:47:59 pm »
Woah, that looks cool actually! It reminds me of water drop effects. It's slow but is it 6 MHz like the other screenshot? O.O
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline Snektron

  • Lvl 69 Russian Snake
  • Super User
  • Join Date: Dec 2014
  • Location: Netherlands
  • Posts: 3165
  • Post Rating Ratio: +32/-0
  • SSSssssss.....
    • RobinDeWalvis
    • Kzyrox
    • RobinDeWalvis
    • quantuminfinity
  • Gender: Male
Re: -gLib a (relatively) fast 3D library
« Reply #17 on: January 23, 2015, 12:14:29 am »
Yeah, but it's not much faster in full.
In ASM it could reach much more power, since
you only need a few registers. Ill look into that
In the near future :)
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Offline TheMachine02

  • Full User
  • Join Date: Dec 2014
  • Location:
  • Posts: 356
  • Post Rating Ratio: +14/-0
Re: -gLib a (relatively) fast 3D library
« Reply #18 on: January 29, 2015, 12:04:06 pm »
So, I was writing my primitive pipeline, when I had a LOT of flashes.
First, I've got idea for a new pipeline in vertex processing, however I simply don't know wich performance I can expect from it, and if it more efficient than my current pipeline.
I analized my pipeline, and find that my current caching system (aka VBO) is simply ... slow  :P

A new caching system worth to be designed, and I got an really interesting idea, but wich use lot of RAM : instead of having a VBO cache wich size is 16*NB_VERTEX+2 and wich is unaligned, I could do a cache of size 9*256 (2304 bytes), fixed size, and aligned
With this, I can acess the cache as interleaved array, and save +-15% of the previous cache fetch cycles.
BUT, the main drawback is the fixed size (VBO is a varyng size), and this also make my pseudo VBO totally unusefull : it need code rewriting.

As exemple, expected code for fetch:
Code: [Select]
_gVertexFetch:
ld h, gCache/256
ld a, (hl)
ld (gClipCode), a
inc h
ld e, (hl)
inc h
ld d, (hl)
inc h
ld (gPositionX), de
ld e, (hl)
inc h
ld d, (hl)
inc h
ld (gPositionY), de
ld a, (hl)
inc h
ld h, (hl)
ld l, a
ld (gPositionZ), hl
at 153 cycles

What do you think of all of this ? Should I try this pipeline, wich may totally change the using syntax of the core? (I know I don't already do the tuto, so it is not really to bad, but bleah) and does the cache system should be implemented this way?

Online xlibman

  • Omni founder & CW co-founder
  • Super User
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18799
  • Post Rating Ratio: +98/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • DJ Omnimaga music store
  • Gender: Male
Re: -gLib a (relatively) fast 3D library
« Reply #19 on: January 29, 2015, 03:20:53 pm »
I unfortunately don't know assembly so I am unsure what you mean by pipeline. Could you enlighten me about the benefits and drawbacks this would have in your program?
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline Snektron

  • Lvl 69 Russian Snake
  • Super User
  • Join Date: Dec 2014
  • Location: Netherlands
  • Posts: 3165
  • Post Rating Ratio: +32/-0
  • SSSssssss.....
    • RobinDeWalvis
    • Kzyrox
    • RobinDeWalvis
    • quantuminfinity
  • Gender: Male
Re: -gLib a (relatively) fast 3D library
« Reply #20 on: January 29, 2015, 03:49:03 pm »
Ah i think i get what he's trying to say. Instead of calculating the address of a vertex by adding up the
size of every vertex before it, have a fixed size for every element. (it's very hard for some of us to understand
since we don't do any ASM and/or 3D pipeline writing :P
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Offline TheMachine02

  • Full User
  • Join Date: Dec 2014
  • Location:
  • Posts: 356
  • Post Rating Ratio: +14/-0
Re: -gLib a (relatively) fast 3D library
« Reply #21 on: January 29, 2015, 04:16:06 pm »
 :P

A pipeline is the command flow of the program, it just tell wich action to do in order, like:

-rotate vertex -> project vertex -> render point.

The current system I used, have an indexed cache, storing the rotated vertex (in order to not re-rotate them if needed), acessing data this way :
Index_vertex*16+BaseAdress, this command giving adress of the location of the vertex, baseadress point to the really first element.

The new cache I designed doesn't acess data this way, but acess them way faster. However, there is drawback, and I liste them below:
*OLD :
-indexing is slow              ( --)
-flexibilty in size (user defined) (defined by the number of the vertex user input)  (++)
-theorical infinity of vertex (++)

*NEW:
-indexing is WAY faster (14% for vertex, 70% for x,y coordinate speed boost from previous routine) (++)
-fixed size of 7*256+512 bytes  (-, as a simple program will need lot of free RAM to be run)
-theorical 256 vertex per cache, but multiple cache can be used. (+, not really pratical)




Online xlibman

  • Omni founder & CW co-founder
  • Super User
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18799
  • Post Rating Ratio: +98/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • DJ Omnimaga music store
  • Gender: Male
Re: -gLib a (relatively) fast 3D library
« Reply #22 on: January 29, 2015, 08:26:05 pm »
Ah ok thanks for clarifying. I think RAM should not be an issue now that most people use ZStart and Doors CS7, unless it requires as much RAM as Gemini or something. For the cache size I guess it depends how large maps can be (eg a game where every map takes 1 second to go through might not be as fun)
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline TheMachine02

  • Full User
  • Join Date: Dec 2014
  • Location:
  • Posts: 356
  • Post Rating Ratio: +14/-0
Re: -gLib a (relatively) fast 3D library
« Reply #23 on: January 30, 2015, 10:37:07 am »
Well fixed cache can have at max 256 vertices, so allow pretty much complex map, and is smaller than 256 vetrtex with VBO.

Online xlibman

  • Omni founder & CW co-founder
  • Super User
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18799
  • Post Rating Ratio: +98/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • DJ Omnimaga music store
  • Gender: Male
Re: -gLib a (relatively) fast 3D library
« Reply #24 on: January 30, 2015, 05:12:01 pm »
Aah ok. How many vertrex would a cube contain, for example?
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline TheMachine02

  • Full User
  • Join Date: Dec 2014
  • Location:
  • Posts: 356
  • Post Rating Ratio: +14/-0
Re: -gLib a (relatively) fast 3D library
« Reply #25 on: January 30, 2015, 05:29:36 pm »
A cube contains 8 vertices. Btw, 256 is the limit of the nostromo's world if I remember well.

Offline Snektron

  • Lvl 69 Russian Snake
  • Super User
  • Join Date: Dec 2014
  • Location: Netherlands
  • Posts: 3165
  • Post Rating Ratio: +32/-0
  • SSSssssss.....
    • RobinDeWalvis
    • Kzyrox
    • RobinDeWalvis
    • quantuminfinity
  • Gender: Male
Re: -gLib a (relatively) fast 3D library
« Reply #26 on: January 30, 2015, 06:17:47 pm »
To clarify: a vertex is a point in space.
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Online xlibman

  • Omni founder & CW co-founder
  • Super User
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18799
  • Post Rating Ratio: +98/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • DJ Omnimaga music store
  • Gender: Male
Re: -gLib a (relatively) fast 3D library
« Reply #27 on: January 31, 2015, 03:47:29 am »
Thanks. It seems like it could definitively handle medium to large indoor maps. :) Maybe someone could make a 3D clone of Illusiat 3? :P
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline TheMachine02

  • Full User
  • Join Date: Dec 2014
  • Location:
  • Posts: 356
  • Post Rating Ratio: +14/-0
Re: -gLib a (relatively) fast 3D library
« Reply #28 on: April 11, 2015, 02:12:28 pm »
Soo.. I was implementing new function (testing my new pipeline), and I got stopped by the name  <_<

Like : should I name the function :
-gGenVertexArray() and gVertexAttrib() wich is really big (and with the large font doesn't really look good on the screen)
something smaller ?
-gGenVxArray() and gVxAttrib() but I feel that those two "lose" the understandness of the two other...
Basically :
-gGenVertexArray() create a vertex array ... :p or return the adress of an existing one.
gVertexAttrib add attribute (color, normal...) to the current vertex array.

Anyone got a little idea on that ?  :P

Offline Snektron

  • Lvl 69 Russian Snake
  • Super User
  • Join Date: Dec 2014
  • Location: Netherlands
  • Posts: 3165
  • Post Rating Ratio: +32/-0
  • SSSssssss.....
    • RobinDeWalvis
    • Kzyrox
    • RobinDeWalvis
    • quantuminfinity
  • Gender: Male
Re: -gLib a (relatively) fast 3D library
« Reply #29 on: April 11, 2015, 02:14:23 pm »
Maybe change "Vertex" with "Vtx" instead of "Vx"?
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


 


You can also use the following HTML or bulletin board code to share it on your page or forum signature!


Also do not forget to check our affiliates below.
Planet Casio TI-Planet Calc.news BroniesQC BosaikNet Velocity Games