CodeWalrus

Featured Member Projects => Completed and Inactive Projects => [Inactive] gLib 3D polygon library (TI-83+/84+/CE/83PCE) => Topic started by: TheMachine02 on January 19, 2015, 05:10:01 PM

Title: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on January 19, 2015, 05:10:01 PM
[cross posted from various site]

As some of you already know, I passed the last few month to convert GLib to an axiom, and if you doesn't know/or guess it, well SURPRISE !  :
I am proud to finally present this works, and hope we will be able to see some 3D project appears. Of course keep in mind
that this is a calculator engine, even if performances are definitly WAY more superior to axe version (thanks to asm/code refactoring).

In cliping, for example, I've got almost a 50%, even 55% performances boost....

For the new features/ changes from the axe version :
-library now use matrix, way more powerful than the previous method that I used, and for now faster
-VBO has been limited to 8 and for now can't be supressed (but don't worry you will soon be able to do that, and I'll post in tuto a way to do it from axe point of view)
-Many many many optimization, size wise and speed wise. Standard cube (example provided) run at more than 40 fps ....

Anyway, the little test screen :

(https://img.ourl.ca/fast_cube.gif)

note that the white a the begining is definitly a gif bug >_>

And of course, the download is attached. (I hope I don't forget anything in it !) Wait a little for a tuto update, and you will be able to play with it at is full potential  ;)
Concerning the source, I am pretty sure that Asm guru will find a lot, lot of optimization, feel free to take a look  ;D
Also, there is most likely going to have update, for example new optimization, bug fixes, but the syntax won't hopefully change (except if a small change can boost performance like hell  :P)

EDIT : there will be a change in syntax, cause this change does indeed increase performance like hell  :P


Almost finished tuto: https://codewalr.us/index.php?topic=692.msg21406#msg21406

gLib is making is way to color calculator and ez80 !! Screenies in the thread.



The download is obsolete, there is a new version (4.0.0) in the tuto thread  ;)
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: pimathbrainiac on January 19, 2015, 05:14:31 PM
YAY! Now for that portal game... *runs*

I can't wait for the tutorial. This will be really useful!
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: Snektron on January 19, 2015, 05:49:29 PM
I've actually been working on some 3d projection myself :)
ASM only though, and so far it has only some basic MultiplyMM and
MultiplyMV, but it is quite optimized (and big, MultiplyMM is 400 row, excl macros).
Anyway, im interested in how you do your calculations? Floating points or
just signed ints? Im using zeda's 24-bit float lib :)
And great work! :D
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: TheMachine02 on January 19, 2015, 06:16:11 PM
definitly signed int, as 24 bits float will definitly leed to pretty much sslllooow thing. As we don't have many cycles for calculation, it could only be viable with int. (Altough that maybe half float could be use - 16 bit float, with 8bit mantissa, 7bit exponnent, 1bit sign, allowing doing only a 8x8 multiplication for multiplying two numbers)
My projection code is pretty much slow, since I use division. (altough that I made a fast math one, but limited in range) You can look at the code if you want  ;)
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: Snektron on January 19, 2015, 06:21:35 PM
Ah, i was thinking about 16 bit signed int when i started, but i felt that wouldnt be precise enough :/
And i will defenitely look at your src :)
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: TheMachine02 on January 19, 2015, 06:24:13 PM
Well, projection IS on 16 bit signed, and is relatively precise ....  :). It actually well enough for a 96x64 screen.
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: Snektron on January 19, 2015, 06:32:16 PM
And MVP calculation? i haven't really timed, but i'll see if i can record some gif :P
EDIT: (https://lh5.googleusercontent.com/-4SrFjFnaMJU/VL1Q9nahBmI/AAAAAAAABXQ/sL8o0qlb6UY/h120/mm.gif)
this is 3 multiplies every frame, running at 15 Mhz mode (its not the fastest, but what do you expect
with floats on a z80 :P). Also it's 'only' 6K since i unrolled ALL multiplications in the mm and mv :P
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on January 20, 2015, 09:01:27 AM
I'm glad that this is alive again and now an axiom. :D Hopefully it's easier to use for Axe coders now :D
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: TheMachine02 on January 20, 2015, 10:16:16 AM
Matrix calculation is also made with integer, 7bit integer to be more precise. [-64,64] and precision is ok, as well as speed :

(http://i.imgur.com/wyvlIDQ.gif)

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  :)
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: Keoni29 on January 20, 2015, 10:22:26 AM
Which software do you use to record these? The gif error is really strange. Looks quite impressive though :)
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: TheMachine02 on January 20, 2015, 10:24:58 AM
I am using wabbitemu, and I don't know what is causing this error. I've never had it before  :(
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: Snektron on January 20, 2015, 02:10:47 PM
My GIF is wabbit too yet idont have any problems
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: TheMachine02 on January 20, 2015, 02:14:17 PM
bah it isn't too bad, and I think I can ircummvent this bug by launching program at the start of the screen.
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on January 21, 2015, 05:01:44 AM
Quote from: TheMachine02 on January 20, 2015, 10:16:16 AM
Matrix calculation is also made with integer, 7bit integer to be more precise. [-64,64] and precision is ok, as well as speed :

(http://i.imgur.com/wyvlIDQ.gif)

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  :)
This almost lools like this could be used for terrain generation because of the low resolution :)
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: novenary on January 21, 2015, 02:40:16 PM
Whoa this looks really epic. I didnt know you were making it an Axiom. Great job. :D
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: Snektron on January 22, 2015, 09:28:42 PM
Quote from: TheMachine02 on January 20, 2015, 10:16:16 AM
Matrix calculation is also made with integer, 7bit integer to be more precise. [-64,64] and precision is ok, as well as speed :

(http://i.imgur.com/wyvlIDQ.gif)

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:
(https://lh4.googleusercontent.com/4Jx8i5l2NDvajDduhxXMMQJBTTu87nZReroL47jmvL4=w140-h93-p)
Cheaty isometric 3d in Axe, 1024 points ^^ (it's probably faster in asm).
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga 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
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: Snektron 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 :)
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: TheMachine02 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:

_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?
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga 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?
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: Snektron 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
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: TheMachine02 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)



Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga 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)
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: TheMachine02 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.
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on January 30, 2015, 05:12:01 PM
Aah ok. How many vertrex would a cube contain, for example?
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: TheMachine02 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.
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: Snektron on January 30, 2015, 06:17:47 PM
To clarify: a vertex is a point in space.
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga 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
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: TheMachine02 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
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: Snektron on April 11, 2015, 02:14:23 PM
Maybe change "Vertex" with "Vtx" instead of "Vx"?
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: TheMachine02 on April 11, 2015, 02:17:58 PM
It is indeed better, but the gGenVtxArray(0) will create a blank line... wich is bad  :P

EDIT:Not so bad in fact, due to the presence of a store right after it.... dunno.
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: Snektron on April 11, 2015, 02:23:45 PM
Maybe replace "Array" with "Arr"?
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: TheMachine02 on April 11, 2015, 02:27:15 PM
I may also use gGenVAO() and gVAOAttrib(), wich is close to what the function do in fact. Arr is a bad idea due to a line created with "->A"

EDIT : finally using gGenVAO and gVertexAttrib seems fine, I'll stick with these for the moment.
Title: Re: -gLib a (relatively) fast 3D library
Post by: CKH4 on April 12, 2015, 02:05:02 AM
Is the tutorial going to be updated? And is the development version of axe 1.2.2?
Title: Re: -gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on April 12, 2015, 04:22:54 AM
I like the command name ideas personally :) (the last one, that is)

Also I'm glad this project is still alive. :)
Title: Re: [Axiom] -gLib a (relatively) fast 3D library
Post by: TheMachine02 on April 12, 2015, 03:33:11 PM
This project is always alive  :P
Anyway, I started to do a big update, with lot of change.... that's mainly why I didn't really update tuto. I find current pipeline ins't really well adapted for game rendering/low memory and that there is too much bottlenecks....
Problem is that there will be commands changes  :-\
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on April 12, 2015, 03:40:52 PM
Better finish the update before updating the tut though
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on April 14, 2015, 05:32:53 AM
I agree. Hopefully you also won't run into too many issues during the update. >.<

How much RAM does the engine use for a small map?
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on April 14, 2015, 05:51:27 AM
You have no idea on how this update is difficult XD

gLib will use approximatly 2500 bytes of RAM, and it is a fixed size, plus 256 bytes per added vertex attrib.
One good thing is I can render 1024 vertex or more with only this size of RAM (Previous VBO would have needed 16384 bytes...) , if code is well organized (different vertex array array are rendered sequentially, wich is pretty much good for portal rendering or such).
The only minus is that a standard cube will still need these 2500 bytes ... wich can be a bit too much, but I doubt the use of gLib will stick to a cube anyway  ;D
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on April 14, 2015, 06:26:06 AM
Ahh not bad then. I thought it used like 20 KB of RAM or something, if not more. If only TI had gotten their act up together earlier. The TI-83PCE and 84+CE both have 150 KB of RAM. A 83+ or 84+ with this much RAM would have been epic. And I see. I guess it's fine if the size is fixed, because after all, most people who make games will probably tell users in the readme that they need at least a certain amount of free RAM.
Title: Re: gLib a (relatively) fast 3D library
Post by: Duke "Tape" Eiyeron on April 14, 2015, 10:42:11 AM
It's a very good thing you get around size problems, we could end with a decent looking project on calcs! :D
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on April 14, 2015, 01:19:45 PM
Im actually interesting in how far this project resembles OpenGL. I mean, is it easier to learn this if you know some
of the OpenGLES2 pipeline?
Also i think you can violate $4000 - $7FFF (the app space) so thats another 16k ram free
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on April 14, 2015, 05:17:30 PM
Knowing openGL definitly helps in understanding the lib. Some element are openGL based, other not, but at least it has some standard 3d rendering stuff. Also one nice thing with the update is that gLib will be also an asm lib in same time being a axiom  :P One file to rules them all
/me runs
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on April 14, 2015, 05:25:29 PM
Well thats quite cool actually :P
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on April 15, 2015, 01:57:38 AM
By being an ASM lib, does it mean it will also be useable by hybrid BASIC programmers?
Title: Re: gLib a (relatively) fast 3D library
Post by: TheMachine02 on April 15, 2015, 06:11:57 AM
I can indeed add that, even if that require slighty more works to correctly interfacing with the OS vars, and being more slow :p
But this is definitly doable.
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on April 15, 2015, 06:36:00 AM
I guess if it used hooks it would be faster, but the problem is that you would need to make sure that the hook chains properly with Doors CS, ZStart, Omnicalc, Symbolic or xLIB.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on April 15, 2015, 09:58:41 AM
Hooks chaining is not really hard (though you need to find a safe place in the ram to store the hook, someone really should make a standard for this), but the user also has to activate them in the right order
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on April 16, 2015, 03:17:48 AM
Yeah that's the issue I think. In your case, would the hook have to be installed after DCS?

As for standards, Kerm started a topic in 2013 to setup some standards right from the start on the CSE, so I assume it will be the same for the CE. This is to avoid problems like on the 83+ where we ended up with about 3-4 different shells and libs of programs and stuff like xLIB that didn't chain properly with Symbolic/Omnicalc. So when ASM really gets started on that calc, if you ever decide to code for it and port your program, then you might need to make sure to check which RAM area to use and what not to use.
Title: Re: gLib a (relatively) fast 3D library
Post by: Duke "Tape" Eiyeron on April 16, 2015, 07:28:37 AM
Yeah, but not everyone wants the same shell. I'm okay at defining standards but avoid them to be too restrictive and blocks competiton/concurrency.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on April 16, 2015, 08:24:21 AM
Quote from: DJ Omnimaga on April 16, 2015, 03:17:48 AM
Yeah that's the issue I think. In your case, would the hook have to be installed after DCS?
Depends on what the user wants to run first. With a parser hook it shouldn't really matter though (if both apps chain properly) unless
some commands use the same token...
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on April 16, 2015, 09:30:40 AM
Yeah indeed, but I definitely do that a the end, after the asm lib/axiom is complete  :P
Also I like how I have speed up triangle filling code : asm version is 4x faster than axe version XD, and is +-300 bytes smaller... that put the theorical triangle output rate at almost 192 Tri/s, almost 2x more than the axe version  :D ... and I haven't finished to optimize filling and many other things.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on April 16, 2015, 12:57:56 PM
Wow that's quite a fast algorithm. How do you test the filling algorithm?
Title: Re: gLib a (relatively) fast 3D library
Post by: Duke "Tape" Eiyeron on April 16, 2015, 02:05:59 PM
That's prettty amazing to have that amount of triangles drawn/s as we are on a calculator. Do you take account of the fact that a triagnle close to the camera will take longer to draw than a small triangle?
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on April 16, 2015, 02:29:27 PM
Quote from: Cumred_Snektron on April 16, 2015, 12:57:56 PM
Wow that's quite a fast algorithm. How do you test the filling algorithm?

cycles counting / fps testing

Quote from: Duke "Tape" Eiyeron on April 16, 2015, 02:05:59 PM
Do you take account of the fact that a triagnle close to the camera will take longer to draw than a small triangle?
Actually I based the calculation on triangles who fill 1536 pxl - one quarter of the screen.
Title: Re: gLib a (relatively) fast 3D library
Post by: Duke "Tape" Eiyeron on April 16, 2015, 04:08:45 PM
Neato! I can't wait until someone does a RPG with it! :D
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on April 16, 2015, 04:43:38 PM
Yeah that'd be really cool :D
Title: Re: gLib a (relatively) fast 3D library
Post by: Duke "Tape" Eiyeron on April 16, 2015, 05:15:54 PM
And yet, it'll probably get out just after HL3, such projets are really hard to get done.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on April 17, 2015, 02:24:50 PM
Quote from: Duke "Tape" Eiyeron on April 16, 2015, 04:08:45 PM
Neato! I can't wait until someone does a RPG with it! :D

Hehe  :P strange things happens
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on April 17, 2015, 04:16:20 PM
Quote from: Duke "Tape" Eiyeron on April 16, 2015, 07:28:37 AM
Yeah, but not everyone wants the same shell. I'm okay at defining standards but avoid them to be too restrictive and blocks competiton/concurrency.
yeah it's more to avoid compatibility issues. For example, many Ion games crashed in MirageOS and vice-versa and if people played Metroid II or XXR they had to uninstall Omnicalc and Symbolic.

Quote from: Duke "Tape" Eiyeron on April 16, 2015, 04:08:45 PM
Neato! I can't wait until someone does a RPG with it! :D
Illusiat 3-D :P
Title: Re: gLib a (relatively) fast 3D library
Post by: Duke "Tape" Eiyeron on April 18, 2015, 09:16:25 AM
ROL 3D, or Reuben 3D! :D
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on April 18, 2015, 04:16:53 PM
Having detailed graphics will be difficult though. Wonder in waht extend RPG are adapted to this engine.
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on April 19, 2015, 11:22:24 AM
I don't think textures are necessary (or at least detailed ones). If someone just remakes an early Illusiat game into 3D he could just use lines for walls. By the way, does this support field of view, as in only being able to see stuff at a certain maximum distance?
Title: Re: gLib a (relatively) fast 3D library
Post by: CKH4 on April 19, 2015, 01:41:52 PM
I believe it does have field of view but I've only used 2.0 model view camera.
Also look at this https://www.omnimaga.org/ti-z80-calculator-projects/%28axe%29collision-detection-library/
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on April 19, 2015, 04:07:02 PM
I does not have a 'real' field of view actually, far things are always rendered, even if the will make evrything overflow  :P Principally cause the clipping in far range is pretty painful to do, ince I can't relly on the rotated coordinate (wich may have overflow). Matrix rendering does change this though, as you can render world from almost every point you want (just has a limited vertex range).
So, yeah, far thing are rendered.

Quote from: DJ Omnimaga on April 19, 2015, 11:22:24 AM
I don't think textures are necessary (or at least detailed ones).
Textures.... hehe  :P I'll doubt we'll see them in real-time one day...
I was more talking about detailed line or filled decors (with more than 3 vertex  :P )
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on April 19, 2015, 04:11:51 PM
Thanks for the explanation. :)  And yeah if even texture-less 3D is slow then perhaps games like Illusiat 3 should be avoided.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on April 19, 2015, 04:46:28 PM
well it is 3D on calc  :P so don't expect huge performance (even if gLib start to be more than game - able)

EDIT:

is this :

gGenVAO(0)->G
.delete vao, it is the axe delvar command
Delvar G

is better than this:

gGenVAO(0)->G
gDeleteVAO(0)


first method does use extra 8 bytes/VAO, but the second one does waste more bytes in code, and use an extra command ( 32 max/axiom, and I want to fit almost everything is this update :p)
In total, it only really change for the end user, design speak-wise.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on April 19, 2015, 09:24:56 PM
Depends on how much you use it in the code
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on April 24, 2015, 05:24:30 PM
One or two time max I'll say. Cause this is only for freeing memory  :P
Also, does somebody knows a good documentation generator for z80 asm ?
Cause writing all the doc by myself is balh :p
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on April 25, 2015, 10:13:04 PM
Do you mean a program that comments your code for you?
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on April 26, 2015, 10:02:35 AM
More a program wich extract comment from source file and then put it in form.
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on April 26, 2015, 06:51:01 PM
Ah ok. How different would they look like?
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on April 28, 2015, 05:43:42 PM
Well, maybe something like :

Routine name
-INPUT : register and stuff
-OUTPUT: what the routine output
What does the routine
-WARNING: maybe some warning about the command
-Speed of the routine (in TStates)

I guess I'll just have to do it manually, like in html or in pdf form. It is not too much difficult, just slower.

Also: I finally find a way to implements real pixel shader in gLib. They'll to be compiled in asm though. Pretty much happy of me right now  8) First thing I've implemented is Z-Buff and I am pretty much impressed of how well it run  :P, altough there is artefact due to the algo used.

EDIT : pixel shader only works on triangle for now, but I am currently implementing them into line drawing
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on April 28, 2015, 06:00:18 PM
Quote from: TheMachine02 on April 28, 2015, 05:43:42 PM
Also: I finally find a way to implements real pixel shader in gLib. They'll to be compiled in asm though. Pretty much happy of me right now  8) First thing I've implemented is Z-Buff and I am pretty much impressed of how well it run  :P, altough there is artefact due to the algo used.
*.*
TI 84+ Raymarch shaders?
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on April 28, 2015, 06:04:44 PM
Nah. They are pretty much limited to be speedy as they are. I don't even proprely implemented linear interpolation of vertex parameters  :P

Here some spec though :

; pixel shader ps_1.0
; registers specifications:
; #input Color     : 1 [1 byte(s)] [R]      [default=color]
; #temp integer     : 1 [1 byte(s)] [R/W] [ldefault=undef]
; #sampler/texture : 1 [2 byte(s)] [R/W] [default=null]
; #output color    : 1 [2 byte(s)] [R/W] [screen adress]
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on April 28, 2015, 08:26:58 PM
I am curious about how fast pixel shading would be, considering my 2006 graphic card (previous computer) didn't even support them.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on April 28, 2015, 08:29:42 PM
That's quite surprising actually, pixel shaders are a big part of modern games.
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on April 28, 2015, 08:34:26 PM
Yeah true. I guess maybe the card just had minimal support for such stuff. It was a lower end card too (the last video card to support PCI cards IIRC, since by then everything was for PCI-E and AGP and my computer lacked those). It could have been the games not taking my card into account, though, and thus, thinking it lacks pixel shading.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on April 28, 2015, 08:43:53 PM
Ah yes, the old "pixel shader xx" error.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on April 29, 2015, 07:55:20 AM
They are as fast as usual filling is fast  :P + speed of the shading itself of course. But there is no overhead to use or not a pixel shader.
However, they are no where close to the pixel shading from openGl or directX of course. They are limited to 16 bytes of asm command, and call is allowed but pretty much to slow to be pratical. They scale well for stencil/zbuff or such algorithm though.
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on April 29, 2015, 03:39:04 PM
If you can get 2 FPS from this I am definitively curious about how an Illusiat 3 clone would look like in this. Since the original game has the character move across an entire room instantly with just one arrow keypress, then a 3D remake could probably do the same and rotate by 45° at a time. Perhaps for walking it should be 1.5 FPS, though, because moving across two entire rooms in just one second might look a bit unrealistic. :P
Title: Re: gLib a (relatively) fast 3D library
Post by: ben_g on May 02, 2015, 11:45:54 PM
So, I've been playing around with this again.

I'm trying to add in billboards (using Matref's scaled sprites axiom), but I'm a bit stuck at calculating the scale.
I know that gVBOVertex(id) returns the coordinates of the point on the screen in {°GScreenX} and {°GScreenY}, but {°GScreenZ} doesn't exist, so I have no idea how I should calculate the distance between a point and the camera. Without the distance, I have no idea how I should calculate the scale.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on May 02, 2015, 11:50:19 PM
Yeah, screen coords are 2d only. They dont need a z pos (were leaving the z-buffer out of this). You'll need to find a way to use it from the position you supply
Title: Re: gLib a (relatively) fast 3D library
Post by: ben_g on May 02, 2015, 11:55:06 PM
Screen coordinates are usually 3D, and the z coordinate indicates how far a point is from the screen.

gLib probably calculates points in all 3 dimensions (since that's how most 3D to 2D conversions work), but it either isn't returning it, or it's returning it with a different name.
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on May 03, 2015, 06:16:14 AM
Ohai ben_g, long time no see :). Hopefully @TheMachine02 can help you there. Or maybe @matrefeytontias could help a bit if he looked into gLib before.

By the way is this for the 3D thing you used to work on several years ago?
Title: Re: gLib a (relatively) fast 3D library
Post by: matrefeytontias on May 03, 2015, 08:09:45 AM
gVBOVertex(id) also put the 3D coordinates in GVertexX, GVertexY and GVertexZ if I remember correctly, or something like that.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on May 03, 2015, 09:19:43 AM
gVBOVertex(id) does only put the full-3d coordinate in the new gPositionX,Y,Z structure, and doesn't give screen position.
The gVBOPoint(id) does give the screen position (wich are now 1 byte) and the clipCode in hl.
The new gVBOGetData allow retrieve evrything in one pass though. the syntax is gVBGetData(destination_adress, size, offset, id), so I guess you most likely want to call it like that : gVBGetData(°GscreenX, 8, 0, id)
The screen coordinate will be in °GScreen, and the vertex coordinate in °GPosition. This is basically the "bottleneck" I  talked about. VBO are pretty badly implemented, and need a pretty much whole refactoring. gLib spent to much time in those vertex data manipulation  :P
So yeah, this is the current syntax, but that will most likely change.
Title: Re: gLib a (relatively) fast 3D library
Post by: ben_g on May 03, 2015, 06:25:00 PM
Quote from: DJ Omnimaga on May 03, 2015, 06:16:14 AM
Ohai ben_g, long time no see :). Hopefully @TheMachine02 can help you there. Or maybe @matrefeytontias could help a bit if he looked into gLib before.

By the way is this for the 3D thing you used to work on several years ago?
Well, I've been more or less active on omnimaga lately, but I kind of forgot about this site. I'll try to be more active here too.

And this isn't really for anything I've already worked on (I'm mainly just trying stuff out, looking at what stuff I can get together), but I might pick up one of those projects when I can get enough things working.

Quote from: TheMachine02 on May 03, 2015, 09:19:43 AM
gVBOVertex(id) does only put the full-3d coordinate in the new gPositionX,Y,Z structure, and doesn't give screen position.
The gVBOPoint(id) does give the screen position (wich are now 1 byte) and the clipCode in hl.
The new gVBOGetData allow retrieve evrything in one pass though. the syntax is gVBGetData(destination_adress, size, offset, id), so I guess you most likely want to call it like that : gVBGetData(°GscreenX, 8, 0, id)
The screen coordinate will be in °GScreen, and the vertex coordinate in °GPosition. This is basically the "bottleneck" I  talked about. VBO are pretty badly implemented, and need a pretty much whole refactoring. gLib spent to much time in those vertex data manipulation  :P
So yeah, this is the current syntax, but that will most likely change.
Using GPosition seems to work, thanks.
(https://img.ourl.ca/screenshot-4.gif)
Title: Re: gLib a (relatively) fast 3D library
Post by: CKH4 on May 03, 2015, 06:29:31 PM
Pretty cool effect, maybe you could make a solar system like that.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on May 03, 2015, 06:32:31 PM
Or maybe a... FBO particle system? (http://img.codewalr.us/dealwithit.png)
Though i dont think there are real FBO's in gLIB... though they shouldnt be too hard to implement (i guess its already implemented if you can render
to a different buffer... though you'd need to be able to use it as texture too)
Title: Re: gLib a (relatively) fast 3D library
Post by: CKH4 on May 03, 2015, 06:36:37 PM
Give it a try cumred. I would love to see the result.

Anyways what does gposition do? If its a variable does it return numbers for how far from the camera it is? Or is it a command like GPosition()?
Title: Re: gLib a (relatively) fast 3D library
Post by: alexgt on May 03, 2015, 06:37:14 PM
That could be a start to textures?!
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on May 03, 2015, 06:38:06 PM
But my FBO particle system doesnt need glib since its only 2d... Though i could try to make the starfield i made for DarestEx
Title: Re: gLib a (relatively) fast 3D library
Post by: ben_g on May 03, 2015, 06:42:37 PM
Quote from: Cumred_Snektron on May 03, 2015, 06:32:31 PM
Or maybe a... FBO particle system? (http://img.codewalr.us/dealwithit.png)
Unfortunately, this is still rather slow (the screenshot runs at 10fps@6MHz), so it's not really suitable for rendering a lot of particles.
The scale (0-255) is currently calculated with 8129/√(GPositionZ), which is rather slow (and the scale isn't perfect either). If I can find a better calculation, then it might be faster.

EDIT: The slowdown has been fixed. I had a pause 100 somewere in my code that I forgot to take out :banghead:

Quote from: CKH4 on May 03, 2015, 06:36:37 PM
Give it a try cumred. I would love to see the result.

Anyways what does gposition do? If its a variable does it return numbers for how far from the camera it is? Or is it a command like GPosition()?
GPosition is the location of a vertex in 3D screen space. GPositionX and GPositionY are the X and Y coordinates of a point on the screen (with (0,0) being the center), and GPositionZ is the depth (or, how far away the point is from the camera).
Title: Re: gLib a (relatively) fast 3D library
Post by: CKH4 on May 03, 2015, 07:51:22 PM
So what numbers are the GPositionZ usually between?
Title: Re: gLib a (relatively) fast 3D library
Post by: ben_g on May 03, 2015, 10:35:00 PM
GPositionZ varies between 0 and the distance between the camera and the point furthest from the camera.
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on May 03, 2015, 11:07:19 PM
Quote from: ben_g on May 03, 2015, 06:25:00 PM
Quote from: DJ Omnimaga on May 03, 2015, 06:16:14 AM
Ohai ben_g, long time no see :). Hopefully @TheMachine02 can help you there. Or maybe @matrefeytontias could help a bit if he looked into gLib before.

By the way is this for the 3D thing you used to work on several years ago?
Well, I've been more or less active on omnimaga lately, but I kind of forgot about this site. I'll try to be more active here too.

And this isn't really for anything I've already worked on (I'm mainly just trying stuff out, looking at what stuff I can get together), but I might pick up one of those projects when I can get enough things working.

Quote from: TheMachine02 on May 03, 2015, 09:19:43 AM
gVBOVertex(id) does only put the full-3d coordinate in the new gPositionX,Y,Z structure, and doesn't give screen position.
The gVBOPoint(id) does give the screen position (wich are now 1 byte) and the clipCode in hl.
The new gVBOGetData allow retrieve evrything in one pass though. the syntax is gVBGetData(destination_adress, size, offset, id), so I guess you most likely want to call it like that : gVBGetData(°GscreenX, 8, 0, id)
The screen coordinate will be in °GScreen, and the vertex coordinate in °GPosition. This is basically the "bottleneck" I  talked about. VBO are pretty badly implemented, and need a pretty much whole refactoring. gLib spent to much time in those vertex data manipulation  :P
So yeah, this is the current syntax, but that will most likely change.
Using GPosition seems to work, thanks.
(https://img.ourl.ca/screenshot-4.gif)
Looks very good! :) As for the site don't worry about it. IIRC tr1p1ea didn't even know it opened until like February, despite the big red countdown timer of doom on the front page in late December. :P

Quote from: Cumred_Snektron on May 03, 2015, 06:32:31 PM
Or maybe a... FBO particle system? (http://img.codewalr.us/dealwithit.png)
Though i dont think there are real FBO's in gLIB... though they shouldnt be too hard to implement (i guess its already implemented if you can render
to a different buffer... though you'd need to be able to use it as texture too)
Actually is your FBO Particle system 2D or 3D? It seems to have 3D in it but I'm unsure. I am asking because AngelFish on Omnimaga did one for the TI-83 Plus once (I don't remember if he released it, though) IIRC
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on May 03, 2015, 11:28:41 PM
My FBO particle system is 2D, though i want to make a 3d version too someday
Title: Re: gLib a (relatively) fast 3D library
Post by: TheMachine02 on May 04, 2015, 05:40:27 PM
Quote from: ben_g on May 03, 2015, 06:42:37 PM
The scale (0-255) is currently calculated with 8129/√(GPositionZ), which is rather slow (and the scale isn't perfect either). If I can find a better calculation, then it might be faster.
I might immplement the fast square root routine I found one day on the net in gLib, because the axe one is definitly slow (as it wasn't speed optimized). Billboard definitly lokk great though :)

Btw, gLib does support layer rendering, at least for triangle code (not line for now, but I am on it :p)
gPosition usually vary between 0 and at max 8192, but that really depends on the user.... I've also extended gLib point range from [-256,256] to [-1024,1024].

Title: Re: gLib a (relatively) fast 3D library
Post by: ben_g on May 04, 2015, 05:49:10 PM
Quote from: TheMachine02 on May 04, 2015, 05:40:27 PM
Quote from: ben_g on May 03, 2015, 06:42:37 PM
The scale (0-255) is currently calculated with 8129/√(GPositionZ), which is rather slow (and the scale isn't perfect either). If I can find a better calculation, then it might be faster.
I might immplement the fast square root routine I found one day on the net in gLib, because the axe one is definitly slow (as it wasn't speed optimized). Billboard definitly lokk great though :)
Well, I actually thought it was very slow because there was a 'Pause 100' in my code for debugging that I forgot to take out.... It isn't too bad now, it should be useable in games.

I still have 2 questions about this axiom though:
1) The GModelView camera (if it's still called like that) rotates in 'third person' around the center. Is there a way to keep all funtionality of that camera, but move the point it rotates around?

2) I'm trying to make an editor, and for that, I have a 3D cursor. I use vertex 255 to store the cursor coordinates, but it doesn't seem to work (the cursor is always in the exact center of the screen). I use this code:ᴇ4000→°Verts
ᴇ459A→°CurX
ᴇ459C→°CurY
ᴇ459E→°CurZ

0→CurX→CurY→CurZ

gGenVBO(°Verts,256)→G
ReturnIf GError
gVBOParam(°GVBOSET,G)

While 1

CurX+getKey(19)-getKey(35)→CurX
CurY+getKey(28)-getKey(26)→CurY
CurZ+getKey(20)-getKey(36)→CurZ

gVBOUpdate(255,255)

gVBOPoint(255)
Pt-Change({°GScreenX}-3,{°GScreenY}-3,°CUR)
//°CUR is a pointer to a sprite of a cross with the center at (3,3)

gGetKey

DispGraphClrDraw
EndIf getKey(15)

Am I doing something wrong here?
Title: Re: gLib a (relatively) fast 3D library
Post by: matrefeytontias on May 04, 2015, 06:43:43 PM
Well yeah, you can't write bytes outside of $8000-$FFFF. Anything before that area has no effect since it's Flash memory.
Title: Re: gLib a (relatively) fast 3D library
Post by: ben_g on May 04, 2015, 06:47:07 PM
I swapped a RAM page in $4000-$8000, so it is in RAM. And I also move vertices based on the position of the cursor, and they work, indicating that the cursor values are indeed changing.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on May 05, 2015, 08:11:16 PM
Your code look fine, apart the fact that it need to setup a matrix to run (but I suppose you've done it), so I can't really tell  :-\
Also, there is no more camera, only a 3x3 matrix for scale and rotation, along with a 2x3 bytes vector holding translation. So you can just tra,slate your point using gTranslate(Data(0r,0r,0r)) or directly writing to it at {°GMatrix+9}r,+11,+13. gTranslate will most likely  diseappear though, cause it is pretty much an useless command.



Title: Re: gLib a (relatively) fast 3D library
Post by: Snektron on May 05, 2015, 10:57:30 PM
Quote from: ben_g on May 04, 2015, 06:47:07 PM
I swapped a RAM page in $4000-$8000, so it is in RAM. And I also move vertices based on the position of the cursor, and they work, indicating that the cursor values are indeed changing.
Actually, is it safe to use $4000-$7FFF? I mean the os uses it for flash pages all the time so you should just be able to push the current page, do anything with $4000-$7FFF and then pop the page back in without breaking anything right?
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: tr1p1ea on May 05, 2015, 11:00:07 PM
It's safe so long as you are careful with BCALLS and such. There are many programs that utilise this area without causing harm.

I for one am always looking for good screenies, are there are new ones for this project? :).
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on May 05, 2015, 11:04:44 PM
Ohh nice. Though i guess doing the same thing with $8000-$B777 (from an app) woulndt work (provided you swap a flash page in)
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on June 01, 2015, 09:40:45 AM
Leaving this here. Look at this fps counter (in wabbit)  :P
Title: Re: gLib a (relatively) fast 3D library
Post by: matrefeytontias on June 01, 2015, 09:58:14 AM
We require screenshots !
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on June 01, 2015, 09:59:16 AM
Bah it is the same old cube  :P I really need to find an new test figure.
Title: Re: gLib a (relatively) fast 3D library
Post by: Duke "Tape" Eiyeron on June 02, 2015, 11:52:39 AM
Why not Suzanne (http://en.wikipedia.org/wiki/Blender_%28software%29#Suzanne)?
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on June 02, 2015, 03:01:45 PM
It is a bit too much heavy for my engine   :P I am more looking for a 64 vertices model, but there isn't many  <_<
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on June 02, 2015, 03:14:08 PM
Maybe a simple sphere?
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on June 03, 2015, 03:26:42 AM
Link from Zelda? (maybe the one from SolidFrame by tr1p1ea but without filled polygons)

The issue with cubes is that spinning cubes were done about 100 times in Axe, ASM and even TI-BASIC, so it tends to not be as convincing now. It's usually best to showcase a more complex model to show the true potential of a 3D engine.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on June 03, 2015, 09:50:00 AM
Convert a crysis 3 map and run it :P
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: tr1p1ea on June 03, 2015, 10:39:33 AM
What format do you take the model data in? There might be some good low poly models around that could be converted.

I made a Wavefront OBJ converter for my engine, it might be possible to adapt it?
Title: Re: gLib a (relatively) fast 3D library
Post by: CKH4 on June 03, 2015, 12:26:06 PM
How much faster is the new version? Also when I have tried to compile newer versions in the past it hasn't worked. I'll try to compile this one and see.

Quote from: DJ Omnimaga on June 03, 2015, 03:26:42 AM
Link from Zelda? (maybe the one from SolidFrame by tr1p1ea but without filled polygons)

The issue with cubes is that spinning cubes were done about 100 times in Axe, ASM and even TI-BASIC, so it tends to not be as convincing now. It's usually best to showcase a more complex model to show the true potential of a 3D engine.
Links for ti basic cubes please.

Quote from: tr1p1ea on June 03, 2015, 10:39:33 AM
What format do you take the model data in? There might be some good low poly models around that could be converted.

I made a Wavefront OBJ converter for my engine, it might be possible to adapt it?
In the older version it was a point cloud stored in Data(s with lists to store the lines. It may have changed in the newer version though.

I could definitely make a low poly knife model if people wanted.

A converter would be so helpful too.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on June 03, 2015, 04:07:54 PM
Yeah I really have to create a converter. Data format haven't changed, still as CKH4 described. It is actually relatively easy to get a converter done, outputting appv file that then can be easily load into the engine.
I'll get that done then  :)
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on June 03, 2015, 04:16:06 PM
Quote from: CKH4 on June 03, 2015, 12:26:06 PM
How much faster is the new version? Also when I have tried to compile newer versions in the past it hasn't worked. I'll try to compile this one and see.

Quote from: DJ Omnimaga on June 03, 2015, 03:26:42 AM
Link from Zelda? (maybe the one from SolidFrame by tr1p1ea but without filled polygons)

The issue with cubes is that spinning cubes were done about 100 times in Axe, ASM and even TI-BASIC, so it tends to not be as convincing now. It's usually best to showcase a more complex model to show the true potential of a 3D engine.
Links for ti basic cubes please.

There is an entire ticalc.org folder just for 3D BASIC engines and cubes :P http://www.ticalc.org/pub/83plus/basic/graphics/3d/
Title: Re: gLib a (relatively) fast 3D library
Post by: CKH4 on June 03, 2015, 04:32:11 PM
Quote from: DJ Omnimaga on June 03, 2015, 04:16:06 PM
Quote from: CKH4 on June 03, 2015, 12:26:06 PM
How much faster is the new version? Also when I have tried to compile newer versions in the past it hasn't worked. I'll try to compile this one and see.

Quote from: DJ Omnimaga on June 03, 2015, 03:26:42 AM
Link from Zelda? (maybe the one from SolidFrame by tr1p1ea but without filled polygons)

The issue with cubes is that spinning cubes were done about 100 times in Axe, ASM and even TI-BASIC, so it tends to not be as convincing now. It's usually best to showcase a more complex model to show the true potential of a 3D engine.
Links for ti basic cubes please.

There is an entire ticalc.org folder just for 3D BASIC engines and cubes :P http://www.ticalc.org/pub/83plus/basic/graphics/3d/
Wow. Most of those dont have perspective but still those are impressive for basic.

Edit.
I tried to compile testasm with Axe 1.2.2 but I get error axiom on gProject at the end of the program.
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on June 03, 2015, 04:47:44 PM
Note that some of them have animated GIF screenshots that are speed up, though. This trend was popular in 2006, so it's best to try them in an emulator or on calc to see the true speed.
Title: Re: gLib a (relatively) fast 3D library
Post by: CKH4 on June 03, 2015, 04:50:29 PM
Yeah I can tell for some of them. Surprisingly my 3d cube was pretty fast compared to those and it was in pure basic.

Also @TheMachine02 in case you missed it.
I tried to compile testasm with Axe 1.2.2 but I get error axiom on gProject at the end of the program.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Haobo on June 03, 2015, 05:29:50 PM
Quote from: CKH4 on June 03, 2015, 04:50:29 PMI tried to compile testasm with Axe 1.2.2 but I get error axiom on gProject at the end of the program.

There is an issue with Axe files and axioms. You need to use the alpha version. I asked theMachine02 about it before, he said that the new version broke something with axioms or whatever. Here's a link (https://www.omnimaga.org/the-axe-parser-project/latest-updates-(***do-not-post-here!***)) to the updates page, I think it was the 1.2.1a version.
Title: Re: gLib a (relatively) fast 3D library
Post by: CKH4 on June 03, 2015, 06:06:11 PM
I got the same error in 1.2.1 and in 1.2.0 I get the summaration symbol y.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Haobo on June 03, 2015, 08:05:09 PM
I can't find the email that themachine02 sent to before when I messaged him :(. He gave me a link to the version, and I was able to compile it afterwards. Either way, all it did was display a cube that could rotate, in case ya wanted to know what the testasm did.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on June 03, 2015, 08:35:25 PM
Humm.. yeah. Current version of axe is fairly broken with axiom.
I know there is a link somewhere on the net, but I kinda lost it. I can upload the 'good' version tomorrow if you want though. (Idk if I can do this though  :( ). At worst, send me PM/email, and I'll send it you back.

EDIT : I think it is this link : https://dl.dropboxusercontent.com/u/34812306/Axe.8xk
Just right click and save.
Title: Re: gLib a (relatively) fast 3D library
Post by: CKH4 on June 03, 2015, 08:56:00 PM
Quote from: Haobo on June 03, 2015, 08:05:09 PM
I can't find the email that themachine02 sent to before when I messaged him :(. He gave me a link to the version, and I was able to compile it afterwards. Either way, all it did was display a cube that could rotate, in case ya wanted to know what the testasm did.
Thanks for looking. I try to do edits rather than just to test it but nothing big. I used to use the non axiom version and that was fun but pretty slow compared to the new version.

Quote from: TheMachine02 on June 03, 2015, 08:35:25 PM
Humm.. yeah. Current version of axe is fairly broken with axiom.
I know there is a link somewhere on the net, but I kinda lost it. I can upload the 'good' version tomorrow if you want though. (Idk if I can do this though  :( ). At worst, send me PM/email, and I'll send it you back.

EDIT : I think it is this link : https://dl.dropboxusercontent.com/u/34812306/Axe.8xk
Just right click and save.
Thanks. It works great now. Maybe you should ask Runner (is he the maintainer now?) if you can include that version in your .zip.
Title: Re: gLib a (relatively) fast 3D library
Post by: pimathbrainiac on June 04, 2015, 09:00:37 AM
Just would like to point out that the latest version of Axe can always be found here (http://axe.eeems.ca). As well as the latest development release.

EDIT: oh wait you were talking about having to go back in version... still, if the development release fixes the problem, it is the latest one.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on June 04, 2015, 09:38:32 AM
(Bad) looking bunny !

(imgur broken, idk why, see attachment)

I converted this low poly model from the standford one. I'll look better once I'll add line in there I guess  :P
It run pretty well for 148 vertices (at 6MHz).

Quote from: pimathbrainiac on June 04, 2015, 09:00:37 AM
EDIT: oh wait you were talking about having to go back in version... still, if the development release fixes the problem, it is the latest one.

Yeah, but older version doesn't fix the problem neither (or version <1.0) so, use developement version  :P
Title: Re: gLib a (relatively) fast 3D library
Post by: matrefeytontias on June 04, 2015, 09:51:35 AM
You better use backface culling on that :P
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on June 04, 2015, 10:01:13 AM
Yeah  :P  I have vertex normal, so it should be good to generate face normal in same time of face.
Title: Re: gLib a (relatively) fast 3D library
Post by: CKH4 on June 04, 2015, 11:47:02 AM
Oh that looks nice. Will back face culling speed it up or will the calculations be too much? Also I can't wait to see other models in this.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on June 04, 2015, 05:01:29 PM
whoa that looks awesome :D
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on June 05, 2015, 03:17:18 AM
Very impressive TheMachine02. Will adding lines slow it down a lot?
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on June 05, 2015, 07:42:06 AM
Most likely, indeed. Line are much more slower compared to dot. Backface will help a little, but problem is line redraw between face (~230 faces)

EDIT : new model! A deer, with 832 vertices, at ~1.5fps

EDIT2 : fixed broken screen.
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on June 05, 2015, 02:16:11 PM
So much detail O.O

Now if only it was possible to sort the dots to only display the ones closer to sides without losing too much speed, you could probably make animations from such models and at low resolution it would still look cool.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on June 05, 2015, 03:57:55 PM
That would be awesome :o
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on June 05, 2015, 04:58:17 PM
Mmmmhh  don't know. Speed could improve by only rendering these dot, but it still need to find a way to know wich dot to render. As vertex normal can't really be used for this (as it lead to strange/bad result), giving point face appartenance followed by a dot with face normal/camera could work, but it is pretty much heavy (and I'll need to add normal to my converter, as well as face, and I am lazy to do it  :P maybe yelling at me "gLib" could works but blah. Weather is too hot here to think XD)
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on June 05, 2015, 06:00:15 PM
Quote from: TheMachine02 on June 05, 2015, 04:58:17 PM
Weather is too hot here to think XD)

I know right <_<. Luckily it's raining now :)
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on June 06, 2015, 04:05:00 PM
It's only 18°C today :P

Good luck TheMachine02
Title: Re: gLib a (relatively) fast 3D library
Post by: alexgt on June 07, 2015, 05:06:36 AM
Whoa that deer looks awesome O.O did you program that or did you use a data file?
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on June 07, 2015, 09:02:40 AM
Maybe he generated a piece of code. That's what i did with my rickroll thing
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on June 07, 2015, 09:12:20 AM
I converted a obj file of a low ploy deer model found on the net (free of use of course), to a gLib friendly format and render it. So data file  :P
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: DarkestEx on June 07, 2015, 10:12:38 AM
Quote from: TheMachine02 on June 05, 2015, 07:42:06 AM
Most likely, indeed. Line are much more slower compared to dot. Backface will help a little, but problem is line redraw between face (~230 faces)

EDIT : new model! A deer, with 832 vertices, at ~1.5fps

EDIT2 : fixed broken screen.
Wooha, awesome  O.O
Title: Re: gLib a (relatively) fast 3D library
Post by: alexgt on June 07, 2015, 01:49:34 PM
Quote from: TheMachine02 on June 07, 2015, 09:12:20 AM
I converted a obj file of a low ploy deer model found on the net (free of use of course), to a gLib friendly format and render it. So data file  :P
Awesome!! I really want to get into 3D stuff especially with the HP Prime but I have to learn Java over the summer because that is the language that we will use in the robotics club at school.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on June 07, 2015, 01:52:57 PM
You might want to look at LWJGL (http://www.lwjgl.org/). (also f you wan't my engine containing basi classes for the window and stuff just say so ;))
Title: Re: gLib a (relatively) fast 3D library
Post by: alexgt on June 07, 2015, 04:07:48 PM
Awesome! I will most definitely use this over the summer :)
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on June 09, 2015, 08:57:22 AM
Yeah LWJGL is pretty much one of the best java openGl API. Even minecraft use it ... but badly  :P
That being said, still in optimisation, so vertex transform (projection+rotation) is about ~3300 TStates (about 30% faster than version 3.0.00) , wich is fairly good, now I am in the cache code, where most improvement will bee (about 35% faster forclipping setup, vertex fetch/cache)

Also, the game I am doing with this is paused, so don't expect it coming next week (that is, filling issue). But I'll definitly post a thread about it when I'll have a demo.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on June 09, 2015, 01:01:49 PM
Unreal 4: TI 83/84 edition? :P
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on June 09, 2015, 01:34:02 PM
Don't dream too much here  :P
Title: Re: gLib a (relatively) fast 3D library
Post by: alexgt on June 09, 2015, 01:37:09 PM
But still we can dream :P
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on June 09, 2015, 01:39:15 PM
With me having trouble to pull ~300Tri/s (about 30@10 fps) , no you can't  :P  ... and my current line drawing routine is wayyyyyy slower.
Title: Re: gLib a (relatively) fast 3D library
Post by: alexgt on June 09, 2015, 01:43:11 PM
Well anything 3D on a calc is still awesome :)
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on June 09, 2015, 01:50:02 PM
True...
So, what about desingning a GPU that uses hundreds of z80's and uses gLib as official rendering pipeline? :P
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on June 09, 2015, 01:52:10 PM
Quote from: alexgt on June 07, 2015, 01:49:34 PM
Quote from: TheMachine02 on June 07, 2015, 09:12:20 AM
I converted a obj file of a low ploy deer model found on the net (free of use of course), to a gLib friendly format and render it. So data file  :P
Awesome!! I really want to get into 3D stuff especially with the HP Prime but I have to learn Java over the summer because that is the language that we will use in the robotics club at school.
As long as you add placing blocks in Mineprime before taking on another HP Prime project :P
Quote from: Cumred_Snektron on June 09, 2015, 01:01:49 PM
Unreal 4: TI 83/84 edition? :P
I'm thinking more of Space Dementia or Star Fox.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on June 09, 2015, 01:56:23 PM
Quote from: Cumred_Snektron on June 09, 2015, 01:50:02 PM
True...
So, what about desingning a GPU that uses hundreds of z80's and uses gLib as official rendering API? :P

I'll guess this will never happen  :P More with some ez80 ....
/me runs

Quote from: DJ Omnimaga on June 09, 2015, 01:52:10 PM
I'm thinking more of Space Dementia or Star Fox.

Yeah, that is most likely possible, seing this : http://www.omnimaga.org/ti-z80-calculator-projects/star-fox/
(the famous starfox by thepenguin77)
Portal may be possible, but most likely with much more simpler scene.
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on June 09, 2015, 02:06:53 PM
Well, ThePenguin's Star Fox used some cheating, right? IIRC it was not 100% 3D or it used many shortcuts to get around limitations. I guess you could do the same since it's also for monochrome calcs, though. And Space Dementia is like Star Fox, but for the TI-89/92+/v200.


By the way, does GLIB have a 16x16 icon or something as logo? I was wondering for when I decide to make a sub-forum for this project and MinePrime.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on June 09, 2015, 02:12:05 PM
Quote from: DJ Omnimaga on June 09, 2015, 02:06:53 PM
Well, ThePenguin's Star Fox used some cheating, right? IIRC it was not 100% 3D or it used many shortcuts to get around limitations. I guess you could do the same since it's also for monochrome calcs, though.

The cheating is that he only project vertex, and doesn't rotate them. But my projection routine (wich I am quite proud of) is far superior than his project routine.

Quote from: DJ Omnimaga on June 09, 2015, 02:06:53 PM
By the way, does GLIB have a 16x16 icon or something as logo? I was wondering for when I decide to make a sub-forum for this project and MinePrime.

Well, no gLib doesn't have any logo. I have always been bad at pixel art.
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on June 09, 2015, 02:19:07 PM
Aah right, I was wondering what cheat he used. I guess back then 3D on calc wasn't as developed as now :P
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on June 09, 2015, 02:25:18 PM
I guess, yes. But it is true that starfox doesn't really need true 3D, as it is just polygons coming in one line. I doesn't even think that the first 3D version used rotation.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on June 09, 2015, 03:06:10 PM
Yeah you could just have a fixed camera for that. you wouldn't even need a matrix for that :P
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on June 11, 2015, 07:56:54 PM
Yeah I don't think there was rotation either. If someone wanted to be cheap he could probably also make walls only be pillars and skyscrapers that zooms in.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on June 17, 2015, 12:27:21 PM
I started to write doc in html way (pretty much copied from aether  :P). It is not really too hard to do it, as it is pretty straight code.

So what do you think of the color/font/style?
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: Snektron on June 17, 2015, 12:29:06 PM
It looks like very old webpages :P you should put it on internet too
Title: Re: gLib a (relatively) fast 3D library
Post by: CKH4 on June 17, 2015, 01:15:55 PM
I like it except for the background yellow. Easy to read, shows up ok on mobile. Pretty good I guess.
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on July 25, 2015, 01:46:46 PM
So now it is finally holidays for me, I can proprely work on gLib   :D

First, the pipeline. I found several optimization in code passing data to rest of pipeline, wich was fairly inefficient. By redesigning this code, I can also finally reimplement geometry shader - and allow to modify geometry on the fly. Some other improvement will also be better cliping code integration (possibility to calculate it in vertex shader, on in geometry shader if vertex will be moved/changed, without speed hit).
Second, cliping. The current 2D and 3D cliping algorithm are slow, because it first need to fetch data, and then clip using heavy math. However, I might be able to use better suited z80 algorithm to perform the same task. I am not sure if the result will be faster, so I'll need to try that.
At last, but not least, I setup a new record (at least, personnal record) : 3D wired cube running at 45 fps with the max being 47.5fps. And this is only with minor improvement in 3D calculation and heavy optimizations in projection code ( wich is now about 750TStates !). No change have being made to VBO code (wich use quite a lot of ressources).

I expect about 30% of speed improvement with the new version, but that will be mostly be less  :P
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on August 10, 2015, 04:12:59 AM
Awesome TheMachine02. What I would like to see (and I bet many other people as well) is a demo showcasing something more complex than a cube, though, such as Mario face (even if wireframe) and maybe even a small 3D map where you are in a room :)

I also wonder how fast it could render :walrii: or other sprites?
Title: Re: [Axiom] gLib a (relatively) fast 3D library
Post by: TheMachine02 on August 10, 2015, 09:04:35 PM
Yes, I know I need a demo. Not sure what it will be, but I guess it will be more complex than a cube (plus I am tired of cube speed testing  :P)

Quote from: DJ Omnimaga on August 10, 2015, 04:12:59 AM
I also wonder how fast it could render :walrii: or other sprites?

Depends the way it is render. Billboard sprite is quite fast, as ben_g show, but a textured quad/tri is like super slow. (And I didn't converted my code to asm yet).
Title: Re: gLib a (relatively) fast 3D library
Post by: Dream of Omnimaga on August 11, 2015, 07:27:53 AM
Yeah the issue is that there are like 300 cubes demos on ticalc.org, some even in BASIC. :P

And I see. SPrites would be nice.
Title: Re: [Axiom][3d] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on September 01, 2015, 04:43:30 PM
A new little model (1017 vertices) pushing the calculator to the last limit (at 6MHz at least)
The whole thing is running as about ~1.8 fps with point clipping going around.

(http://www.mirari.fr/ywJV)
Title: Re: gLib a fast 3D asm/axiom library
Post by: CKH4 on September 01, 2015, 06:59:21 PM
Wow that is very impressive. I can't wait to see the new version.
Title: Re: gLib a fast 3D asm/axiom library
Post by: alexgt on September 02, 2015, 03:30:15 AM
Awesome to see work being done on this again and that model looks amazing ;)
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on September 06, 2015, 05:30:00 AM
Wow, very great! Maybe less complex models will run at great speed in games? :)
Title: Re: [Axiom][3d] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on September 06, 2015, 12:30:19 PM
Yes indeed. Those little test has as objective to see how many vertices can be transformed at real time.  :P
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on September 06, 2015, 04:08:27 PM
That reminds me, would connecting each dot or at least the outer ones slow things down too much?
Title: Re: [ti-83+/84+][axe][axiom][3d][gLib] gLib a fast 3D asm/axiom library
Post by: Snektron on September 06, 2015, 08:57:01 PM
Great job :3 now someone port unreal to calculators :P
Title: Re: gLib a fast 3D asm/axiom library
Post by: novenary on September 06, 2015, 09:24:25 PM
Quote from: Cumred_Snektron on September 06, 2015, 08:57:01 PM
Great job :3 now someone port unreal to calculators :P
Yes, then we can run Borderlands 2 on the go.
Title: Re: [ti-83+/84+][axe][axiom][3d][gLib] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on September 06, 2015, 09:41:43 PM
Is there any reason why this only runs at 6MHz? I take it you might only own a 6MHz capable calc?

It would be worth enabling 15MHz if you distribute since others might want to make use of the extra speed.

Very impressive model btw, I was wondering if you had any plans to connect the vertices in any way?
Title: Re: gLib a fast 3D asm/axiom library
Post by: novenary on September 06, 2015, 09:50:07 PM
Quote from: tr1p1ea on September 06, 2015, 09:41:43 PM
Is there any reason why this only runs at 6MHz? I take it you might only own a 6MHz capable calc?

It would be worth enabling 15MHz if you distribute since others might want to make use of the extra speed.
I think this is for the optimization challenge. :)
Title: Re: [ti-83+/84+][axe][axiom][3d][gLib] gLib a fast 3D asm/axiom library
Post by: c4ooo on September 06, 2015, 09:51:22 PM
A z80 based gpu would be very cool, and I wonder how hard it would be. I have a z80 sitting around somewhere, but i dont think i have the skill to do something like this :P
Title: Re: gLib a fast 3D asm/axiom library
Post by: ben_g on September 06, 2015, 10:31:36 PM
Quote from: tr1p1ea on September 06, 2015, 09:41:43 PM
...
It would be worth enabling 15MHz if you distribute since others might want to make use of the extra speed.
...
Since this is an axiom, users can easily enable 15MHz mode on supported calcs using the 'Full' instruction. I don't think a library should force a certain CPU speed, and even while the great majority of z80 calcs sold right now is 15MHz, screenshots running at 6MHz show things that can be achieved on all the 38+ series calcs.
Title: Re: [ti-83+/84+][axe][axiom][3d][gLib] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on September 06, 2015, 11:43:32 PM
Ahh right, yes, I should have seen that its a library :).
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on September 07, 2015, 04:58:47 AM
I guess that since the author wants his lib to run at decent speed on 6 MHz models, that might explain why his screenshots are all at 6 MHz. As long as he doesn't force 6 MHz mode on 15 MHz calcs then it's fine.
Title: Re: [ti-83+/84+][axe][axiom][3d][gLib] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on September 07, 2015, 08:32:48 AM
Yes indeed. As ben_g said, it is up to the user to set or not 15MHz speed. My library doesn't touch the settings. And yes, I want to be somewhat useable at 6MHz, (and 6MHz speedy screenshot are cooler  :P ). That is why I always use 6MHz as a reference.

EDIT : for connecting dot, well I have to see. I might be able to put normal along point, so I can grab line normal easily, providing a basic culling,  and render it with line connected. It is work on the converter and on the axe program side . But it will definitly slower. ( a dot product is far slower than a pxl-on).
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on September 07, 2015, 08:57:13 AM
I see. Good luck. By the way, any estimate about when a small demo of a non-cube program might come out? :P
Title: Re: [ti-83+/84+][axe][axiom][3d][gLib] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on September 07, 2015, 09:58:53 AM
Nope  :P
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on September 07, 2015, 05:35:06 PM
It will never come out? O.O
Title: Re: [ti-83+/84+][axe][axiom][3d][gLib] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on February 02, 2016, 10:52:13 AM
So .... it been pretty much a long time since I've posted here. gLib is out in alpha. Yup you can play with it now.  :P I though I had putted the alpha download some times ago, but apparently not, I am sorry.
The beta is on the way, I am currently fixing stuff, optimizing all I can, and re-adding shaders, cause they are funny to play with  :D I still also need to find a way to efficiently process polygon, as well as there cliping. Shouldn't be too hard though. Finishing the tuto is also on my to-do list.
You can download everything in the tuto thread :

https://codewalr.us/index.php?topic=692.msg21406#msg21406
Title: Re: gLib a fast 3D asm/axiom library
Post by: alexgt on February 02, 2016, 01:09:54 PM
Nice, great to see a release ;)
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on February 27, 2016, 05:20:23 PM
Wow I just discovered an alpha was released. Great O.O I'll check it out later to mess around with it. Did you find more time to work on it since that update, by the way?

You should add screenshots to the first post @TheMachine02 , because some people who don't have time to give gLib a try might still want to see how it looks like in its current state before commenting. :)
Title: Re: [ti-83+/84+][axe][axiom][3d][gLib] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on February 28, 2016, 01:08:14 PM
I had some time to work on it, altough I didn't progress much, I am currently reworking the project code as well as cliping code. For screenshot, I just need to create fancy stuff  :P
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on March 01, 2016, 06:07:29 AM
Would a small-ish map be fast enough for this version?
Title: Re: [ti-83+/84+][axe][axiom][3d][gLib][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on May 26, 2016, 06:42:32 PM
(http://i.imgur.com/V5u5rW9.gif)

I *might* have got an ez80 calc and start playing with it.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on May 26, 2016, 06:52:57 PM
Wow I was kinda sure this was dead, since there hasn't been any progress in months. I'm glad it's still alive. This looks nice, by the way. :) How many dots does this have?
Title: Re: [ti-83+/84+][axe][axiom][3d][gLib] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on May 26, 2016, 06:53:47 PM
There is 1171 vertices rotated in real-time. ez80 is quite powerfull.  :P
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on May 26, 2016, 06:59:24 PM
Darn, that's a lot. If you add polygons and polygon sorting then you might want to reduce the amount of vertices, though O.O. Tr1p1ea posted a 3D :walrii: in his solidFRAME CE topic by the way :)
Title: Re: [ti-83+/84+][axe][axiom][3d][gLib] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on May 26, 2016, 07:04:11 PM
Yeah, definitly  :P And I indeed saw the 3D walrus. *Speed battle started* (just jooking). Polygons are definitly the next thing (with clipping), since rotations are kinda done. Some features :
-quaternions (I finally got them right this time, altough some strange things still bother me)
-16 bits world (no, no 24 bits world cause it would be too slow)
-still the same 3x3 matrix than old gLib

But indeed, this seemed dead because I didn't had much time those last month, and futhermore, I felt that in France the *pure* z80 was dying (and even if is still funny to do thing, z80 is wayyy to much limited - fancy 3d stuff are way too hard to do). But those new ez80 really interested me !!
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on May 26, 2016, 07:50:34 PM
There are still some monochrome calc users out there but I hope to see a CE version in the future too. :p
Title: Re: [ti-83+/84+][axe][axiom][3d][gLib] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on May 30, 2016, 09:42:24 AM
Polygons now works  ;)

(http://i.imgur.com/NEis08b.gif)

The triangle filling routine is quite fast, despite being absolutly huge (and not quite optimized for the moment, with few glitch here and here), working fully in ez80 mode. It use two parallel modified bresenham algorithm.
EDIT : it is about ~450 bytes.

the code


IDrawTriangle:
; (ix list of 2d coordinate)
#define x0 0
#define y0 3
#define x1 6
#define y1 9
#define x2 12
#define y2 15

#macro swap(a,b)
ld hl, (ix+a)
ld de, (ix+b)
ld (ix+a), de
ld (ix+b), hl
#endmacro

ld hl, (ix+y1)
ld de, (ix+y0)
or a, a
sbc hl, de
jr nc, _INoSwap1
swap(x0,x1)
swap(y0,y1)
_INoSwap1:
ld hl, (ix+y2)
ld de, (ix+y1)
or a, a
sbc hl, de
jr nc, _INoSwap2
swap(x1,x2)
swap(y1,y2)
_INoSwap2:
ld hl, (ix+y1)
ld de, (ix+y0)
or a, a
sbc hl, de
jr nc, _INoSwap3
swap(x0,x1)
swap(y0,y1)
_INoSwap3:
; y0<y1<y2
; changing edges are y0-y1 and y1-y2
ld hl, (ix+x0)
ld de, (ix+x2)
ld bc, $09DD2B ; dec hl, add ix,bc
or a, a
sbc hl, de
; if x0>x1, edge goes to left
jr nc, _IEdge0
; edge goes to right
ld bc, $09DD23 ; inc hl, add ix,bc
ex de, hl
or a, a
sbc hl, hl
sbc hl, de
_IEdge0:
ex de, hl
or a, a
sbc hl, hl
sbc hl, de
ld (IDeltaX0), hl
ld (ISMC_Code0), bc
ld hl, (ix+y2)
ld de, (ix+y0)
or a, a
sbc hl, de
ld (IDeltaY0), hl
; block 0 is the constant block
ld hl, (ix+x0)
ld de, (ix+x1)
ld bc, $09FD1B ; dec de, add iy,bc
or a, a
sbc hl, de
; if x0>x1, edge goes to left
jr nc, _IEdge1
; edge goes to right
ld bc, $09FD13 ; inc de, add iy,bc
ex de, hl
or a, a
sbc hl, hl
sbc hl, de
_IEdge1:
ex de, hl
or a, a
sbc hl, hl
sbc hl, de
ld (IDeltaX1), hl
ld (ISMC_Code1), bc
ld hl, (ix+y1)
ld de, (ix+y0)
or a, a
sbc hl, de
ld (IDeltaY1), hl
; block 1 is the variable block

ld a, 2
push af
ld a, l

ld hl, (ix+y0)
ld h, 160
mlt hl
add hl, hl
ld de, (ix+x0)
add hl, de
ld de, (IFramebuffer)
add hl, de
ex de, hl
sbc hl, hl
add hl, de

push ix

ld ix, (IDeltaY0)
ld iy, (IDeltaY1)

__ITriangleOuter__:
or a, a
jp z, _INextHalf
__ITriangleInner__:
push af

IDeltaX0=$+1
ld bc, $000000
add ix, bc
ld a, ixh
rla
jr nc, __INoSignChange0__
IDeltaY0=$+1
ld bc, $000000
__IBlockRestoreLoop0__:
ISMC_Code0=$
nop
add ix, bc
ld a, ixh
rla
jr c, __IBlockRestoreLoop0__
__INoSignChange0__:

IDeltaX1=$+1
ld bc, $000000
add iy, bc
ld a, iyh
rla
jr nc, __INoSignChange1__
IDeltaY1=$+1
ld bc, $000000
__IBlockRestoreLoop1__:
ISMC_Code1=$
nop
add iy, bc
ld a, iyh
rla
jr c, __IBlockRestoreLoop1__
__INoSignChange1__:
; hl = adress1, de = adress2
push hl
sbc hl, de
jr z, _ISizeIs0
push de
jr nc, _IDrawLine
add hl, de
ex de, hl
or a, a
sbc hl, de
_IDrawLine:
; de= right point, hl = size
mlt bc ; hack to clear bcu faster than ld bc,0
ld b, h
ld c, l
sbc hl, hl
add hl, de
; hl = de
inc de
IColor=$+1
ld (hl), 255
ldir
pop de
_ISizeIs0:
pop hl
ld bc, 320
add hl, bc
ex de, hl
add hl, bc
ex de, hl
pop af
dec a
jr nz, __ITriangleInner__
_INextHalf:
lea bc, ix+0
pop ix
pop af
dec a
ret z
push af
push af

push bc
push hl

ld hl, (ix+x1)
ld de, (ix+x2)
ld bc, $09FD1B ; dec de, add iy,bc
or a, a
sbc hl, de
; if x0>x1, edge goes to left
jr nc, _IEdgeC1
; edge goes to right
ld bc, $09FD13 ; inc de, add iy,bc
ex de, hl
or a, a
sbc hl, hl
sbc hl, de
_IEdgeC1:
ex de, hl
or a, a
sbc hl, hl
sbc hl, de
ld (IDeltaX1), hl
ld (ISMC_Code1), bc
ld hl, (ix+y2)
ld de, (ix+y1)
or a, a
sbc hl, de
ld (IDeltaY1), hl
ld a, l

ld hl, (ix+y1)
ld h, 160
mlt hl
add hl, hl
ld de, (ix+x1)
add hl, de
ld de, (IFramebuffer)
add hl, de
ex de, hl

pop hl
pop ix

jp __ITriangleOuter__

[close]
Title: Re: gLib a fast 3D asm/axiom library
Post by: ben_g on May 30, 2016, 09:51:18 AM
Will the b&w version still be updated, or are you going to focus completely on the colour version?
Title: Re: [ti-83+/84+][axe][axiom][3d][gLib] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on May 30, 2016, 10:06:13 AM
I'll indeed continue to update b&w, but it is pretty much near completion (there isn't many thing I can do to speed up thing futher). Only thing left are more high level function and more fast vector function.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on May 30, 2016, 04:50:52 PM
Nice to see progress and a new screenshot. :) I'm glad the monochrome version will still be updated. I know that monochrome calcs are less popular now and some people gave up on them, but they still have a solid base of users, like when the TI-83 when it got replaced with the TI-83+.
Title: Re: [ti-83+/84+][axe][axiom][3d][gLib] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on May 30, 2016, 05:36:34 PM
And more screenshot !

(http://i.imgur.com/FgNkFIr.gif)
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on May 30, 2016, 08:47:24 PM
Is that a Chocobo? O.O
Title: Re: [ti-83+/84+][axe][axiom][3d][gLib] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on May 30, 2016, 09:15:44 PM
It is indeed. Still need to implement backface culling/z-sorting, and more support for color  :P
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on May 30, 2016, 11:11:56 PM
If you are refering to polygon sorting, then I hope you don't have too many issues with it and no big slowdowns. >.<

Do you use 8 bpp mode by the way?
Title: Re: [ti-83+/84+][axe][axiom][3d][gLib] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on May 31, 2016, 06:54:48 AM
BFC should speed things up nicely, however sorting might be a small hit, depending on how it is performed. For a model viewer you could get away with a few assumptions.

How many verts/faces is that model TheMachine? It looks very nice!
Title: Re: [ti-83+/84+][axe][axiom][3d][gLib] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on May 31, 2016, 08:29:34 AM
Quote from: DJ Omnimaga on May 30, 2016, 11:11:56 PM
Do you use 8 bpp mode by the way?

Yes, I do. I also use double buffer with correct swaping (giving me nice free vsync !)

Quote from: tr1p1ea on May 31, 2016, 06:54:48 AM
BFC should speed things up nicely

Yeah definitly. I guess I'll end up doing it in world space, so I won't need to transform backculled vertices (and won't need rendering the polygon). Implementation is pretty memory intensive however, so I am thinking on how I could pack thing up.

Quote from: tr1p1ea on May 31, 2016, 06:54:48 AM
sorting might be a small hit, depending on how it is performed

yeah, that kinda bother me. Sorting might not be the most efficient way to do it. I'll think about it.

Quote from: tr1p1ea on May 31, 2016, 06:54:48 AM
How many verts/faces is that model TheMachine? It looks very nice!

341 verts and 563 faces.
Title: Re: [ti-83+/84+][axe][axiom][3d][gLib] gLib a fast 3D asm/axiom library
Post by: Snektron on May 31, 2016, 09:37:47 AM
Looks very good :) Will you be able to do shading?
Title: Re: [ti-83+/84+][axe][axiom][3d][gLib] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on May 31, 2016, 11:11:44 AM
Well dependof what you want to talk about with shading. Is it pixel shading, face shading, gouraud shading ... ?  :P

Pixel shading might be too slow, however, gouraud shading might be possible. Face shading is pretty much easy, and is kinda left to the user of the lib.
Title: Re: [ti-83+/84+][axe][axiom][3d][gLib] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on May 31, 2016, 12:11:25 PM
Cool, I was wondering how many degrees (0-360) you are rotating that model by per frame?

Also do you plan on making a project with it yourself, or just releasing as a lib?
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on May 31, 2016, 12:44:22 PM
Isn't pixel shading a bit overkill for a calculator, if we're talking about the typical PC pixel shaders? Because I remember that in even 1998-2000 many video cards had no pixel shading support (or maybe it was just pixel shading 2.0 that wasn't supported?)
Title: Re: [ti-83+/84+][axe][axiom][3d][gLib] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on May 31, 2016, 01:35:56 PM
Quote from: tr1p1ea on May 31, 2016, 12:11:25 PM
Cool, I was wondering how many degrees (0-360) you are rotating that model by per frame?

Also do you plan on making a project with it yourself, or just releasing as a lib?

The model rotate by ~0.7° (ie circle is represented by 512 subdivision) each frame. It kinda lack precision, but I don't really know why >_>.
About project, I guess I'll try to do something, but I don't promise anything. Developping the library is already pretty tough  :P

Quote from: DJ Omnimaga on May 31, 2016, 12:44:22 PM
Isn't pixel shading a bit overkill for a calculator, if we're talking about the typical PC pixel shaders?

Yeah, it won't definitly be like PC pixel shader. It is not like they have dedicated units to do this  :P However, I count texturing into pixel shading (with per pixel lightning calculation). Those may be too slow for the CE.... but I'll try one day  :P

EDIT :
(http://i.imgur.com/rLoDvXr.gif)
So exporting blender material almost work (ie, I still need to remplace name with correct color), and that is pretty much cool.

Also put together hackish back face culling, which supreisely didn't speed up thing (it might be however just hided by the vsync (800000 TStates delta between frame, and the implementation is kinda loosy), but it show what precision is to expect from polygon. (For now, cause I plan to increase subpixel precision). There is also somme poly removed even if they shouldn't cause there is no double face poly support obviously.

(http://i.imgur.com/AX6PYZR.gif)
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on May 31, 2016, 09:40:25 PM
That new chocobo really looks great! The 2nd lower quality one doesn't look bad either, although the tail is a bit weird in it. Good job! :)
Title: Re: [z80/ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on May 31, 2016, 11:56:20 PM
Yeah pretty sure it's the same model, but without double-sided polygons parts of the tail will disappear with backface-culling enabled.

Things are coming along very nicely though! When do you plan on implementing draw order/sorting?

I did some minor work on a chocobo model I found online to get it to 252 faces which might be a bit more calc friendly. I'll clean it up if you want to test it out?
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 01, 2016, 04:32:14 AM
Ah I thought it was a different model with a much lower polygon count.

I definitively think that space shooter games with very simple 3D ship models (even if it means the wings are flat) or stick figure platformers could be doable.
Title: Re: [z80/ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 01, 2016, 07:58:58 AM
Quote from: tr1p1ea on May 31, 2016, 11:56:20 PM
Yeah pretty sure it's the same model, but without double-sided polygons parts of the tail will disappear with backface-culling enabled.

It is definitly what happen  ;)

Quote from: tr1p1ea on May 31, 2016, 11:56:20 PM
Things are coming along very nicely though! When do you plan on implementing draw order/sorting?
I did some minor work on a chocobo model I found online to get it to 252 faces which might be a bit more calc friendly. I'll clean it up if you want to test it out?

Well I can test (I just need the obj file and the mlt file and I can import it from there). Draw order is high on my todo list, but for now I am implementing correct data structure and optimizing a few thing (my triangle filling routine start to rock !). (yeah, I am kinda short of time with my exams coming next week)

But yeah, this calc as a lot of power to play with (and I have ony scratch the surface, I don't even use the $E30800 space right now (ie, space with less wait states when I read data)  :P
3D space shooter is more than doable.


EDIT : with tr1p1ea chocobo model :
(http://i.imgur.com/HJuY7K6.gif)

Color are a bit off and I should have scaled it more, but it runs quite faster hopefully  :P There is 252 faces/168 verts.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 01, 2016, 07:01:35 PM
I like it. You should make a new screenshot with fixed colors and higher zoom :)
Title: Re: [z80/ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 02, 2016, 04:13:42 PM
Color fixed and zoom +

(http://i.imgur.com/rKVoBfR.gif)

Look pretty nice  :P

EDIT : was bound to happen I think  >:D :

(http://i.imgur.com/me58D9L.gif)

There is 256 frames needed for a complete turn here (twice as fast as chocobo's screens)
Title: Re: gLib a fast 3D asm/axiom library
Post by: Lionel Debroux on June 02, 2016, 05:57:06 PM
This looks pretty nice :)
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 02, 2016, 06:00:14 PM
That new chocobo is even better, and glad to see that tr1p1ea's :walrii: model is compatible :D
Title: Re: [z80/ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 02, 2016, 06:01:59 PM
Well he puted the walrii as a .obj on the thread, so I just needed to convert it. I have an (almost) working converter to get an include file from obj file.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 02, 2016, 06:18:35 PM
I wonder how the data looks like in z80 or C form, though. I don't have Blender but I am curious about if data can be converted easily for use on the HP Prime...
Title: Re: [z80/ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 02, 2016, 07:16:10 PM
Well you can convert obj to pretty much anything you want:  https://en.wikipedia.org/wiki/Wavefront_.obj_file
I just convert them to be able to read them more easily in asm (and scale + material handling). Depend on what you have on the Prime, I guess it could be easily done.


what happen ith an huge model (1841 vertices, 3485 faces)
(http://i.imgur.com/ynqshkZ.gif)
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 02, 2016, 09:55:51 PM
The Prime uses some sort of list of coordinates IIRC. 1 rectangle for example is something like ((0,0),(0,10),(10,10),(10,0)) or maybe it was with brackets.

Also that last model is running at quite good speeds considering how complex it is for calculators. :) Is that Lara Croft?
Title: Re: [z80/ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on June 02, 2016, 10:08:39 PM
Very impressive! The lara croft is a nice achievement ... and good to see walrii running at a higher resolution!

I should really work on that model more :).

I saw on IRC that you were looking at trying to implement face sorting, have you had any luck?
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 03, 2016, 05:35:24 AM
Yeah I was curious about that. I know that solidFRAME has sorting but his models seems to have more details so I was curious about if the slowdown would be severe.
Title: Re: [z80/ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 03, 2016, 09:33:51 AM
I actually run my engine at 320x240 resolution ... I am not sure if solidFrame run at this resolution or not actually. That is why they look more detailed. (Or solidframe just draw triangle with 2x2 pixel size, dunno). tr1p1ea if if you can enlight us on this point you are welcome  ;)

Also, about z-sorting, well doing it right is kinda hard, especially with a library implementation. Two though : spatial coherency might be used (that is, from a frame to an other frame, not much change in the sorted list, so insertion sort might be great here). And the second one is it *might* be a good idea to get backface culling running before trying to sorting polygons ... data structure need to be quite robust also. So, many problem, many solution, but not enough time (for now) to implement them  :P

Quote from: DJ Omnimaga on June 02, 2016, 09:55:51 PM
The Prime uses some sort of list of coordinates IIRC. 1 rectangle for example is something like ((0,0),(0,10),(10,10),(10,0)) or maybe it was with brackets.

Also that last model is running at quite good speeds considering how complex it is for calculators. :) Is that Lara Croft?

It is indeed a lara croft model from the legend game (kinda scale down). Seeing the format, I guess that could be done. Just some C and you are good.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 03, 2016, 04:18:00 PM
I think solidFRAME still runs at 160*120, scaled up or in 8bpp mode, for compatibility with the CSE version, but I could be wrong.
Title: Re: [z80/ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 03, 2016, 05:53:24 PM
Quote from: DJ Omnimaga on June 03, 2016, 04:18:00 PM
I think solidFRAME still runs at 160*120, scaled up or in 8bpp mode, for compatibility with the CSE version, but I could be wrong.

That could be, indeed.

Sooooo have a badly optimized crappy z-sorting algorithm (and I am serious here  :P)

(http://i.imgur.com/U9TU91X.gif)
(512 frames for one turn)
Z-sorting :                                                                                               without :
(http://i.imgur.com/duvSbQF.gif)    (http://i.imgur.com/rLoDvXr.gif)
(512 frames for one turn)
(http://i.imgur.com/2ew91f7.gif)
(256 frames for one turn, only 3000 poly cause I reached the 65536 bytes limit  O.O)

So there is no backface culling, and algo is pretty crappy, but I guess that spacial coherency payed : there is an inital overhead (more or less big, lara model get a biiiig overhead), but once this is passed, the thing that take time is actually calculating the Z key for all the polygon. Look good though.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 03, 2016, 06:35:21 PM
The first ones are quite impressive, speed-wise :D. The Lara Croft one got pretty slow, though O.O (but it's pretty intensive in polygons so that's expected)
Title: Re: [z80/ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 03, 2016, 07:08:29 PM
Yeah that is because there is more overhead trying to process the triangle than actually drawing it  :P

But, yeah, other got nearly 0 overhead, because the list doesn't change much between frame.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 03, 2016, 09:07:06 PM
So I will ask again like I did on Omni: Would this engine be useable for very simple maps? (eg plain-colored walls with no texture and hardly any details) It would definitively be cool to see some sort of simple game using this engine for both very simple models and simple maps) (the character could just be made of cubic shapes like in Minecraft)
Title: Re: [z80/ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on June 04, 2016, 03:47:20 AM
Yes solidFRAME draws half-res ... the models look good at 320x240, nice work!
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 04, 2016, 04:45:53 AM
Would drawing at lower resolution with doubled pixels improve the speed, by the way?
Title: Re: [z80/ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 04, 2016, 11:00:39 AM
Quote from: DJ Omnimaga on June 04, 2016, 04:45:53 AM
Would drawing at lower resolution with doubled pixels improve the speed, by the way?

Well less drawing would mean more performance ... but then on small triangle you aren't limited by drawing, but by overhead (which is quite huge right now). So, I don't know. Maybe, I'll said.

Quote from: DJ Omnimaga on June 03, 2016, 09:07:06 PM
Would this engine be useable for very simple maps?

In the current state, no. There is no cliping going around, and thing are pretty much messy.  :P  However, once it will be more clean, I'll guess something like X3D would be doable.


EDIT : btw tr1p1ea, what Z index are you using for sorting ? right now, I use average of 3 vertices z coordinate after the transform, but it raise some issue with a simple cube :

(http://i.imgur.com/p8eHlSs.gif)

EDIT2 : beware of the crime hour ....

(http://i.imgur.com/r3mMdkG.gif)
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 04, 2016, 03:52:47 PM
Haha I remember that little guy from Final Fantasy VII in battles (assuming it's him?). Looks quite nice. :)

For maps, maybe @catastropher could help if he's still around?
Title: Re: [z80/ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 04, 2016, 04:10:51 PM
Well he appears in many FF actually ... :P

Well I guess designing a simple map isn't *so* hard, I'll take a try one day...
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 04, 2016, 04:15:51 PM
Yeah I know, but FFVII semeed to be the only one I remembered exactly him from. :P IIRC he was in older ones too but I forgot which, plus I don't think he always did his death attacks the same way in older ones.

Title: Re: [z80/ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 04, 2016, 04:19:27 PM
Yeah, many monsters changed attack between ff. I do think he appears in V,VI,VII, VIII, IX, X,XIII.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 04, 2016, 04:21:22 PM
True, but I think starting in FFVII he always did the same attack for the next games, right? (slowly move towards party then instakill everyone)
Title: Re: [z80/ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 04, 2016, 04:23:46 PM
Well it depends from the monster, and at least in VIII the attacks are kinda different. But in all case ther are like super hard to defeat  <_<
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 04, 2016, 05:14:45 PM
Yeah I remember that 1 vs 1 battle with Cloud where I kept hitting the enemy and he would not go down, then I was dead. I hated running into that monster x.x (not as much as Marlboro, tho)
Title: Re: [z80/ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 05, 2016, 08:46:38 AM
So I kinda optimized the sorting routine  :P  Should almost be overhead free now.

(http://i.imgur.com/6UtInK1.gif)

Next step is raster bugfix and optimization  :P
Title: Re: [z80/ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on June 05, 2016, 08:50:22 AM
Looks good man!

Did you end up going with avg z still or something else?
Title: Re: [z80/ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 05, 2016, 09:21:49 AM
Yeah, still Z-average. It is the faster guess. (Altough I can pretty much change this easily). I figured that backface culling should get rid of most of the fighting issue. If you have a better idea ...  :P
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 05, 2016, 03:39:56 PM
Pretty good now :D. Hopefully you can optimize it further :)
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 05, 2016, 05:53:49 PM
Well seeing there is the clipping and backface culling  I need to implement, I am definitly not done optimizing and coding  :P. The pure sorting code will be hard to optimize further though.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 05, 2016, 08:18:55 PM
I hope that you can implement both clipping and sorting at the same time O.O
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 09, 2016, 10:12:47 AM
Quote from: DJ Omnimaga on June 05, 2016, 08:18:55 PM
I hope that you can implement both clipping and sorting at the same time O.O

That shouldn't be an issue  :P

So on side note, I wrote a timer code, and I've been able to analyse a frame, for the chocobo model (341 vertices, 563 faces). The frame is composed as follow :

-vertices transform  -   890000 TStates
-sorting                     -   230000 TStates
-clear framebuff       -   530000 TStates
-triangle drawing      - 2300000 TStates

Which put the frame at around ~4000000 TStates, or about ~12fps. Impressive I guess !  :P
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 09, 2016, 06:41:35 PM
Yeah 12 is very nice for a calculator. :)
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 09, 2016, 07:05:30 PM
It also put the triangle filling routine at ~4000TStates (for small triangle size at least), or about 12000 Triangles/s  :w00t:
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 09, 2016, 07:10:01 PM
By the way, how fast a Starwing space ship is? I forgot if that was attempted.
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 09, 2016, 07:27:07 PM
Wasn't tested, but given the model I found on the net (36 vertices, 52 faces), it is quite fast :

(http://i.imgur.com/Q8JLJkZ.gif)
(512 frames for one turn)

EDIT : and yeah, it broke z-sorting too.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Snektron on June 10, 2016, 12:47:36 PM
Quote from: TheMachine02 on June 09, 2016, 10:12:47 AM
Quote from: DJ Omnimaga on June 05, 2016, 08:18:55 PM
I hope that you can implement both clipping and sorting at the same time O.O

That shouldn't be an issue  :P

So on side note, I wrote a timer code, and I've been able to analyse a frame, for the chocobo model (341 vertices, 563 faces). The frame is composed as follow :

-vertices transform  -   890000 TStates
-sorting                     -   230000 TStates
-clear framebuff       -   530000 TStates
-triangle drawing      - 2300000 TStates

Which put the frame at around ~4000000 TStates, or about ~12fps. Impressive I guess !  :P

530000 for a frame clear? o.o
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 10, 2016, 01:05:08 PM
Yeah <_<. This is about 76800 bytes to clear at 7 TStates/bytes. (Actually it is more 540000TStates)
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 10, 2016, 03:30:42 PM
Quote from: TheMachine02 on June 09, 2016, 07:27:07 PM
Wasn't tested, but given the model I found on the net (36 vertices, 52 faces), it is quite fast :

(http://i.imgur.com/Q8JLJkZ.gif)
(512 frames for one turn)

EDIT : and yeah, it broke z-sorting too.
Would there be a way to make z-sorting work with every type of model? Also this looks kinda nice despite the glitches. :)
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 10, 2016, 03:51:03 PM
Well, I don't know. Z-sorting wasn't ever meant to be 100% correct (with the exeception of much more complicated algorithm...). I'll try something else than Z-average.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 10, 2016, 03:52:43 PM
Oh ok, I thought it was just compatibility-related, as in a different model format or something.
Title: Re: gLib a fast 3D asm/axiom library
Post by: ben_g on June 10, 2016, 05:22:55 PM
Basically, the only way to do it correctly in any case is Z-buffering instead of Z-ordering, because you can't correctly render special cases like intersecting triangles or cyclic overlap (https://upload.wikimedia.org/wikipedia/commons/thumb/7/78/Painters_problem.svg/220px-Painters_problem.svg.png) by just changing the drawing order.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 10, 2016, 05:51:21 PM
Would that be much slower?
Title: Re: gLib a fast 3D asm/axiom library
Post by: ben_g on June 10, 2016, 06:06:20 PM
It depends on the polygon count. If there are a lot of polygons, it will be faster. It requires a ton of memory though.
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 10, 2016, 08:07:34 PM
I am pretty sure it would be a magnitude slower, because we'll need to interpolate the Z value inside the rasterizer loop - which is kinda bad - and we'll alos need an other 320x240 buffer (and with a width of 16bits min, cause precision = 156KB = all the RAM we have). So, no, it isn't a good idea  :P

EDIT : the correct way with z-sorting  would be to slipt the triangles which might overlapse, and it is a slow process. (and sort with zmin/zmax of every triangles)
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on June 11, 2016, 12:49:17 AM
Yeah z-buffering (or s-buffering) is the real way to handle things but too memory intensive. I'm sure there are some other ways to achieve this but perhaps a different model could help? (ie; keep intersecting polygons in mind when modeling).
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: rwill on June 11, 2016, 09:54:28 AM
If your model is static, you want good sorting, cannot afford a Z-Buffer, and can live with
a higher polygon count you might want to apply Binary Space Partitioning to a model and
render accordingly.

But really, the way to go is to keep sorting problems in mind when creating the model,
maybe making manual splits of large polygons and keep parts of the model kind of convex.
I remember that a lot of the first 3D Games had sorting problems.

You really should apply backface culling.
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 11, 2016, 02:48:53 PM
yeah, backface culling is a must. It almost implemented though  :P BSP however might be a bit overkill.
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on June 12, 2016, 04:46:34 AM
Did you decide to go with proper bfc or quick bfc?
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: unregistered on June 12, 2016, 08:35:41 AM
Quote from: TheMachine02 on June 10, 2016, 01:05:08 PM
Yeah <_<. This is about 76800 bytes to clear at 7 TStates/bytes. (Actually it is more 540000TStates)
I recommend you the "Push" method  ! only 258 832 States :thumbsup:
( https://codewalr.us/index.php?topic=1395.msg40164#msg40164 )
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 12, 2016, 03:32:03 PM
Quote from: tr1p1ea on June 12, 2016, 04:46:34 AM
Did you decide to go with proper bfc or quick bfc?
Not really decided for the moment, quick bfc seems enough, but proper bfc is nice thing to have  <_<. Proper bfc come with quite a huge cost though (since the polygon/eye vector need to be reduced).

And yeah the fast clear screen might find is way to the lib, one day  :P
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 12, 2016, 05:59:35 PM
/me wonders how a 3D Reuben would look like
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 13, 2016, 06:30:58 PM
(http://i.imgur.com/v3OOSbU.gif)
Rough lightning and backface culling  :P  (this screen is 256 frames/turn)
Title: Re: gLib a fast 3D asm/axiom library
Post by: ben_g on June 13, 2016, 07:37:47 PM
That looks nice. Maybe you could also have some code to 'bake' the lighting to the polygon colour data, so that you only need to compute it once. It only works with a fixed model and light source, but it could be useful when you start to actually render an environment with it.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Snektron on June 13, 2016, 07:40:00 PM
Quote from: TheMachine02 on June 13, 2016, 06:30:58 PM
(http://i.imgur.com/v3OOSbU.gif)
Rough lightning and backface culling  :P  (this screen is 256 frames/turn)
Thats pretty impressive o.o
Nice job :D
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on June 13, 2016, 09:32:30 PM
Looking good man :).
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 14, 2016, 02:06:57 AM
Wow it looks really great with lightning O.O
Title: Re: gLib a fast 3D asm/axiom library
Post by: Lionel Debroux on June 14, 2016, 05:29:42 AM
Yeah, backface culling and most of all lighting add a new dimension to the rendered images.
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: Snektron on June 14, 2016, 09:21:26 AM
Im surprised by how fast it runs :o
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 14, 2016, 09:49:43 AM
Thanks guy  :P ... About speed, still the old same 12fps (I miss 15fps by not much though, since bfc make the triangle rendering at about 1500000TStates (or -800000 from without)). I've just made one turn 256 frames (whereas some screen run at 512frames/turn).

Quote from: ben_g on June 13, 2016, 07:37:47 PM
That looks nice. Maybe you could also have some code to 'bake' the lighting to the polygon colour data, so that you only need to compute it once. It only works with a fixed model and light source, but it could be useful when you start to actually render an environment with it.

Yeah, definitly. There will be quite of precalculation in model loading.

EDIT : fixed light look nice too

(http://i.imgur.com/zXYkU44.gif)
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on June 14, 2016, 09:48:30 PM
Hey nice, you also have double sided polygons working which is nice :).
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 14, 2016, 09:52:50 PM
Quote from: tr1p1ea on June 14, 2016, 09:48:30 PM
Hey nice, you also have double sided polygons working which is nice :).

Actually, no, I just didn't put bfc  :P
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on June 14, 2016, 09:55:55 PM
Ahh right, do you plan on supporting double sided polys?
Title: Re: gLib a fast 3D asm/axiom library
Post by: ben_g on June 14, 2016, 10:07:40 PM
Especially when lighting is involved, it may be easier to not use double sided polygons and just model them as 2 polygons of which 1 has an inverted normal. This is often done in PC games (mostly because it's hard to define for every polygon if it's double-sided or not and rendering a few extra polygons usually has a smaller impact than rendering a full model without backface culling.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 15, 2016, 01:25:28 AM
Very nice lightning so far. I wonder how the animation would look like if you made the light rotate instead of the model?
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 15, 2016, 09:30:51 AM
(http://i.imgur.com/jQb56IG.gif)
As about double sided polygons, seeing the current state of the engine, it may be better to do not support them and instead go as ben_g said, put two polygons with inverted normal. Since one will be removed anyway, that put only a small overhead (the bfc is pretty much the first thing before polygon processing).

EDIT : so, I've got appv loading working, which is nice, since the whole thing is now smaller. I also corrected few bug. However, it induced a small overhead, along with the bug corrections. So, the chocobo model now miss the 12fps mark by less than 80000TStates <_<. (I don't understand some of the overhead in the rendering code, but I think it is due to the corrected bugs... ) Anyway, have a download to test  :D
Please note that keeping the appv in the archive WILL crash calc, because no unarchivate function as been implemented...  :P
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 15, 2016, 10:40:47 PM
Darn, that lightning/shading rotation looks pretty cool. I'll give this a try on my calc soon. Glad to see a download :)


Also I finally made a sub-forum for this project :3= https://codewalr.us/index.php?board=63.0
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 16, 2016, 10:05:23 AM
Quote from: DJ Omnimaga on June 15, 2016, 10:40:47 PM
Also I finally made a sub-forum for this project :3= https://codewalr.us/index.php?board=63.0

Thank you a lot  :D

To celebrate this, have a screenshot with backface culling (I duplicate bad looking poly and fliped the normal in blender) and lightning !

(http://i.imgur.com/tmSLyX9.gif)
(256 frames/model turn)

So, since I duplicated the poly, the vertices count and poly count kinda goes up (433 vertices, 627 polygons), but backface culling removed quite a lot of useless work for the engine and so in run @12fps now (one frame standing at about ~3800000 TStates). There is futhermore perpolygon light calculation (that is, one more dot product per poly).

Have also a download with the new model + program !

EDIT : it was also my 200e post  :D
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 16, 2016, 04:45:49 PM
12 FPS is quite good considering how complex that model is :D
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 16, 2016, 08:12:20 PM
So, I finally got appv reading from the archive working. Actually it didn't add too much overhead (about 250000 TStates per frame). Pretty sure I can reduce the actual number of read from the model, with pipeline optimization.
And yeah, 12fps is really good, but I guess some carefull optimization could improve it. I am more on implementing stuff though  :P Optimization will come later  ;)
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 16, 2016, 09:41:03 PM
Glad to see it now supports archived appvars. Otherwise it can be a bit annoying if we have to unarchive/archive stuff back and forth. I could understand if you couldn't support that for speed reasons, though.
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 16, 2016, 09:57:01 PM
Well, I just need to limit read from model and the speed impact is more than limited, thanks to the linear adress. (Don't need page swapping like on old z80). There is added wait-states indeed, but it isn't too bad. Thee chocobo model still run at about ~12fps even if the appv is archived.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 16, 2016, 11:23:21 PM
Good to hear :)

Now Star Fox gogogo :trollface:
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 17, 2016, 12:54:19 PM
I've been playing with light and I though this screen look so cool that I've should post it  :P It is only a black background combined with ambient lightning and a light coming from the top.
Few things under the hood, small opts (removed about ~100000TStates). On side note, I think I may be able to move the backface culling test in the world space, allowing to not transform the vertex which should be backface culled. That come at a little cost of 3 bytes supplemntary data per polygons, but that isn't too bad. Proper pipeline implementation is still being writed, so didn't start to implement it. Few bugs fixes here and here too, and few new functions. (Still have to get a proper vector/quaternion/matrix library implementation though, as only a few functions are implemented).
So yeah, next clipping  <_<

(http://i.imgur.com/iFAeaBF.gif)

Have your little download to play with too  ;) (even if there isn't much to do...)
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 17, 2016, 04:35:49 PM
This looks even cooler on a black background O.O
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 20, 2016, 04:06:36 PM
I worked a bit on the converter so converting model to 8xv appv aren't as messy as there were, and so I converted the tomberry model to lighning+backface culling. Result look nice I guess, although lightning look  bit weird, but that is because of the model (low lighted color from begining and really blocky model).

(http://i.imgur.com/owyZx2Q.gif)

Some stuff under the hood too, as always, some cliping functions have been implemented.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 20, 2016, 04:40:57 PM
Looks nice :)

Btw can this engine be used in a C game?
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 20, 2016, 04:47:08 PM
In the current state, nope. It will need wrapper around function to work proprely since most of the function take input as registers. This is feasible though (but require some works).
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 20, 2016, 06:47:30 PM
Ah sorry to hear. Maybe something to consider in the future, since most CE devs program in C or hybrid BASIC (for hybrid BASIC someone could write a lib that uses real() like xLIBC but if you have GLIB installed it lets them use it to draw polygon-based images or something.)
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 20, 2016, 07:12:34 PM
C library was planned at the begining, I've just concentrate on getting things work  :P. As for hybrid basic, why not ? I doubt it will be feasible in term of speed ... depends on what you'll do outside of the library (and usually, it will be physic (hard), model handling (hard in basic), ressource loading/matrix setup).
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 20, 2016, 10:03:25 PM
For hybrid BASIC I think the main use would be drawing of static models and perhaps some slow animations of simple models. For example, if someone wants to display enemies in an RPG battle.
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 21, 2016, 09:30:54 AM
Well in that case I guess we don't need to many commands, and that may be possible. Futhermore, it could be used with sprite by grosged to handle correctly the 8bpp mode and text/sprite. I'll try then  :P

EDIT : did you really think I won't put epic screenshot before I leave for holidays ? Well, you are wrong !

(https://tiplanet.org/forum/images/forum_uploads/11153_1466544999_5769b367c6b59.gif)

>3400 polygons, with bfc  :P And I know some colors are off. Blame blender for that, I need to fix the model <_<
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on June 21, 2016, 10:49:27 PM
Looks awesome man!
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: Snektron on June 21, 2016, 10:56:13 PM
Looks very good. Rip in pasta fps though :P
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 22, 2016, 07:42:27 AM
Sorry to see you won't be around for the Summer, but if you can manage to see this before leaving, that last screenshot looks amazing. :D That slow frame rate means you need to remove some polygons or effects, though :P
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 22, 2016, 08:01:54 AM
I leave tommorrow actually (yeah, I won one days with internet  :P )

I've fixed the color :

(http://i.imgur.com/d5Ze8rl.gif)

And yeah, this is definitly the max the engine can support. Anyway, this model is about 55K (1841 vertices / 3485 polygons) , so it is pretty much amazing the amount of works the ez80 can do before surrending :p According to my timers, this thing run at about ~3-4 fps. But blame z-sorting, this is what crash performance <_<

EDIT : I just though of a way to make sorting way faster. Maybe this will works or not, dunno, I will try (but you won't  most likely see the results before my return :p)
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 22, 2016, 03:55:17 PM
That looks better, although there's a white spot on her. :P By 55K do you mean it's 55 KB large?

Hopefully you can get some public wi-fi access during your absence :)
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on June 22, 2016, 04:03:09 PM
Yeah, it is 55Kb large  :P. In an appv hopefully, but still. The white spot is actually is the model and is correct, altough I agree, it look a bit strange. And yeah, will see if I will have wifi  <_<
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 22, 2016, 04:04:43 PM
Lol, that's like 30% of the RAM O.O.
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: Ti64CLi++ on June 30, 2016, 04:24:51 PM
Good.  ;)
It is possible to create an glib, but with an ide on-calc like mimas for ti 84+?
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on June 30, 2016, 05:18:02 PM
There is no on-calc ASM editor for the TI-84 Plus CE sadly. Or do you mean like a new language with both gLib and an on-calc editor built-in?

Also welcome to CodeWalrus @neuronix :3=
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: Ti64CLi++ on July 01, 2016, 01:36:43 PM
@DJ Omnimaga thank you.
Is it possible to change my nickname to Ti64CLi++?
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on July 02, 2016, 07:54:51 AM
I didn't know you were Ti64CLi++ until now. I thought you were two different person on TI-Planet. O.O

But I guess it would be a good move to avoid confusion on Planète-Casio, because Planète-Casio founder had the exact same nickname as you in 2005. :P But for a nick change you need to poke @Streetwalrus @aeTIos or @Juju
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on July 12, 2016, 02:47:09 PM
-Activity report-10/07

First thing I've implemented is proper sorting (with the almost definitive algorithm), with a constant speed. That is, no more penality due to spacial locality if the list isn't almost sorted. It is slower than insertion sort for a static frame, but who want static things anyway ?
Performance wise, it is quite good. Less than 4,000,000 TStates for almost 3500 triangles. With a constant speed, it is even better than z-buffer :P It consume quite some memory, but I can use the framebuffer since the sorting occurs before the drawing and the clear.

Comparaison for lara model (3490 triangles,2566 vertices) (and yeah, it is an updated model) :

Insertion :                            New way :
(http://i.imgur.com/WUmGoqk.gif) (http://i.imgur.com/H29WcCe.gif)

Next stuff, I've updated a bit my model converter. New screeny :
-Dragon model:
(http://i.imgur.com/R6BryAd.gif)
-Low poly chocobo:
(http://i.imgur.com/nNET9Hx.gif)
-New lara model:
(http://i.imgur.com/0l8TuCN.gif)
I've also toyed a bit with FSAA (ie, full screen anti aliasing), using an internal render resolution of 320x240 downscaled to 160x120. Meh, 320x240 look better :P (Anyway, primary goal of this routine was to test my color blending routine, so it is good. And it allow great looking 160x120 screen)

(http://i.imgur.com/gdx1Ro8.gif)

Fullscreen:
(http://i.imgur.com/ZcvyVuE.gif)

Continuing with the antialiasing, I am currently seing if I can't implement it at low cost. It really look too good:

(http://i.imgur.com/gUd2dRW.png)

And some new renders :

(http://i.imgur.com/XFYNDYG.png)
(http://i.imgur.com/BNyDL34.png)

And when I tell you FSAA give great 160x120 screen (for forum pic for example)
(http://i.imgur.com/USJEY78.png)

Screeny update the model by 30° rotation each frame.

Some bugs have been corrected, as always.

What is being currently implemented :
-cliping. I hate this, but I guess you knew it already :P
-some cool stuff, like quaternion slerp, more helper functions
-some high level routine for model handling
-some secret things obviously :walrii:

Seeing performance result, I wonder what will be possible with this library. Much more than with z80 obviously and colors help a lot too. About the compiled size, I am reaching 5K, but there is lot of useless code and cleaning will be necessary I guess. (Blame the sorting code, it is 453 bytes)

Also, it doesn't exist mimas compatible code of gLib, however, the axiom version 4.0.0 could be used as a base for an asm lib on mimas. There would be quite a lot of writing though, and you'll need to know basis of 3D to get something working. Can be done though, the source is on github is you want to see it. (don't take the 3.0.0 version, it is totally deprecated :P)

Anyway, I have failed one of my exams, so it is kinda paused for the moment

-EOF-
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on July 12, 2016, 04:30:14 PM
Sorry to hear about the failed exams D:. Nice to see progress, though. Those nee screenshots look amazing! :)
Title: Re: gLib a fast 3D asm/axiom library
Post by: ben_g on July 17, 2016, 02:03:53 PM
Quote from: TheMachine02 on July 12, 2016, 02:47:09 PM
(http://i.imgur.com/H29WcCe.gif)
You managed to render a lit 3500 triangle model at that speed? This lib is getting really amazing.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on July 17, 2016, 04:42:54 PM
Yeah, I can definitively see this used in a game with less details.
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on August 21, 2016, 10:21:54 AM
not bad
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: Ti64CLi++ on August 25, 2016, 08:41:17 AM
@DJ Omnimaga Thats right. An user changed my nicknamme. But if I want to connect me, I should use neuronix :(
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on August 25, 2016, 04:23:19 PM
@TheMachine02 Wow that transparency effect looks amazing! O.O

@Ti64CLi++ Would you like your login name to be changed as well?
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on August 30, 2016, 08:37:49 AM
-Activity report-

Soooooo, let's start with alpha blended triangle :

(http://i.imgur.com/fAKJ93M.gif)

(http://i.imgur.com/xM0fVRb.gif)

I does look good, but is very slow due to the need of doing a linear interpolation per pixel (452 TStates !)(using MB register, 422TStates) (if somemone want to do better, well I won't say no :P ). Usefull for some light effect/transparency like windows or reflects, but don't use it too much in your scene. Pretty sure it can be optimized way further, I'll look into that. Hopefully, depth sorting have a good side effect here :D
Another application : ghhhooooossstttt >:D

(http://i.imgur.com/4R0rdAt.gif)

Second thing is a ICopyTexImage2D command :

(http://i.imgur.com/gV19N4S.gif)
It is a must for billboard. It isn't very much optimized though, and can be made better.

Some new models:
Suzanne:

(http://i.imgur.com/bBK9ym2.gif)

Walrii:

(http://i.imgur.com/KGjEOCN.gif)

New color (converter fix') :

(http://i.imgur.com/rfuK0H3.gif)

At last but not least, edges antialiasing. Look good, altough it is costly (the implementation force the engine to recalculate a lot of thing, antialiased triangle routine would be better) (it is kinda a post process right now, also explaining odd pixels).
Screeny are 'theorically' x64 AA but 8 bits color haven't enough precision to display full filtering potential. The filling is almost x4.5 slower. Not sure a limited x2 or x4 aa would be faster, but it worth a try.

(http://i.imgur.com/giGPpz5.gif)
(http://i.imgur.com/hSsPuN3.gif)
(http://i.imgur.com/nIlJZpr.gif)

The triangle rasterisation routine now also implement left filling convention, using the center of pxl as on/off, which turn out to have much higher raster quality at the cost of a slower triangle setup (about 200 TStates). With other optimisation made, the speed is almost the same as before (for average size triangle, model showed have a lot of reeeeeaallllly small triangles, which put an higher pressure on setup), and inner loop is faster. Screeny :

(http://i.imgur.com/NBYryw7.png)

(http://i.imgur.com/OmG9fV2.png)

Next big steep in quality, texture :P (kinda crazy hard to get them working, but I'll figure out one day).

I started to make internal memory managment better, in futur of a release, as well as a .h file for a C linking. Currently library use a 512 bytes buffer, 512 bytes of data included in program, and few variables. There is also triangle buffer, 6 bytes per triangles, and a vertex buffer, which will most likely get some refactoring.

I am targeting an alpha release at the end of the summer, with all majors routines coded. Maybe I'll do a game too if I have time.

About the maximum the engine can handle, it is more a question of RAM buffer : for now the vertex buffer and the triangle buffer are fixed RAM area. The 2500vx/3500tri model use about 41000 bytes of RAM. I intend to lower the RAM cost, altough I am not sure it will be the case. At least, the model will be compressed (Lz77 most likely) to lower memory cost.

Planed max are :
IMAX_TRIANGLE=4096
IMAX_VERTEX=2048
Which should be enough for a game. Anyway, perf would be crappy with more.
For z80 version, max are :
gMAX_TRIANGLE=256
gMAX_VERTEX=256
That would already take about ~5000bytes of RAM and I don't want to take all RAM left to the user :P (futhermore, 256 vertices transformed is almost 1/6e of CPU time at 6MHz)

Cliping start to made his way into the library. Culling example :

(http://i.imgur.com/TlxbW6r.gif)

   The engine actually compute outcode for plane but they aren't used yet to do *actual* clipping. Anayway, clipping is tricky because the pipeline need to consider generation of new geometry piece ; and since the actual pipeline consider the whole scene as one batch to sort and render (as such multiple source is possible, just ouputed to a common batch), clipping should theorically happen before depth sorting. However, I fear it might be too hard for the engine to follow. At 4096 triangles max, if all need clipping, imagine what RAM it will be using and which data it will need to follow. The second method is to do cliping just before actual render, after depth sorting. The drawback is that culled triangles will be sorted along the in-frustrum triangles, altough I could make a quick calculation when computing depth key of the triangle to see if it is behind the z=0 plane. Of course triangle behind other plane will be sorted, but it will still remove a good part of unecessary geometry. The other problem of this method is that some polygons will have an odd z-average depth. I could add up a constant z-depth (ie, 8388608) as such that negative z are now positive (and handled flawlessly by the sorting algorithm). (The depth allowed range would be -8388608,8388608).

   Anyway, the good part of all of this is that instead of computing on the fly a plane code, it is fused in the projection. Only add about ~50TStates and automatically stop the projection and switch to clip if point is out (out point doesn't have to be projected). The only thing is that if the point is out on X axis only, the switch need to be delayed to second part of the projection algorithm, but it is only about 200TStates (which is still faster than the speed of a detached compute code routine). You can't imagine how this pipeline give me headacke <_< . The gLib pipeline was much simpler due to the limited geometry handling and limited features. Maybe a upgrade to this new in-formation pipeline could do great thing too. I must say that the new vertex id storage is quite interesting, since it store directly vbo adress, instead of a relative (0,1,2,3..) id. Switch to data adress if quite fast and is only necessary one time, whereas the vbo adress is alway used. It remove all adressing part which was an huge bottleneck of previous pipeline. Well, I want to run the (low poly) chocobo model on the z80 (at 6MHz of course) so there is quite some work left :P

Anyyyyyywayyyy, let's stop ranting.

Todo list:
-pipeline&clipping
-texture
-high level commands (bone, model...)
-port of sorting and triangle filling to z80 (to axiom form, for version 4.0 beta) (port of the projection algorithm used in ez80 version to z80 blew up my already fast projection routine (smaller, faster, more precise), putting a cube at over >54 fps , ~50fps average.) (let's go to 60')
-start writing a doc'
For later version :
-proper material support (?)
-proper lightning support

-EOF-
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on August 31, 2016, 01:43:04 AM
Nice to see you again. I like the progress and hopefully you might be able to make the anti-aliasing faster, because it looks friggin amazing. Also that :walrii: is fast :D

Would the 2D image scaling thing be used for textures and 2D sprites like in Doom?
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on September 01, 2016, 08:34:47 AM
Quote from: DJ Omnimaga on August 31, 2016, 01:43:04 AM
Would the 2D image scaling thing be used for textures and 2D sprites like in Doom ?

Yep, it is the objective.

As for AA, it is quite hard to get it running at a good speed. I am currently trying a x2 only AA (which increase quality netherless) but is fast as it only use 50% blending. (and there isn't a lot of thing to track).
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: Snektron on September 01, 2016, 10:52:15 AM
Looks pretty impressive. I hope it being used in actual games. Though they might need a lot more triangles and stuff.
Title: Re: gLib a fast 3D asm/axiom library
Post by: ben_g on September 02, 2016, 12:24:41 PM
Quote from: TheMachine02 on September 01, 2016, 08:34:47 AM
Quote from: DJ Omnimaga on August 31, 2016, 01:43:04 AM
Would the 2D image scaling thing be used for textures and 2D sprites like in Doom ?

Yep, it is the objective.

As for AA, it is quite hard to get it running at a good speed. I am currently trying a x2 only AA (which increase quality netherless) but is fast as it only use 50% blending. (and there isn't a lot of thing to track).

Maybe you could look into FXAA (https://en.wikipedia.org/wiki/Fast_approximate_anti-aliasing) which is much faster than MSAA (at least on computers, it may be bad on calculators because they lack shading hardware). But since calculators generally handle low-poly environments, an AA triangle drawing routine would probably be best for both quality and speed.

For in games, I think that it's best to drop AA and instead use that processing power for more triangles and/or textures. AA makes renders look very pretty, but I think games are better off with more detailed levels rather than with AA'd rendering. AA is still a nice feature for stuff like model viewers though, since framerate and responsiveness is not  that important there.
Title: Re: gLib a fast 3D asm/axiom library
Post by: JosJuice on September 04, 2016, 12:56:44 PM
Wow, that GIF with the anti-aliased chocobo... For a second, I almost forgot that it was running on a calculator O.O
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on September 04, 2016, 04:32:14 PM
Yeah I know the feeling JosJuice :P

As for anti-aliasing it isn't necessary, but it can be handy for screenshots. Maybe you could make it so we can render one anti-aliased frame by pressing a specific key when AA is disabled?
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: Ti64CLi++ on September 07, 2016, 04:06:32 PM
@DJ Omnimaga Yes I would like if it is possible ;)
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on September 07, 2016, 04:24:49 PM
Ok. @Streetwaljuju@poke.
Title: Re: gLib a fast 3D asm/axiom library
Post by: novenary on September 07, 2016, 06:28:05 PM
Quote from: DJ Omnimaga on September 07, 2016, 04:24:49 PM
Ok. @Streetwaljuju@poke.
Care to uh, brief me up ? :P

Edit: nvm, got it. Your password is gonna be reset, you'll receive an email about it.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on September 08, 2016, 03:44:40 AM
Yeah I hate how SMF resets the password. I think there's a way to do it without reseting it but I don't know if it's safe. Also above I tried posting mentions without the @ :P
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on September 18, 2016, 02:15:16 PM
Quote from: ben_g on September 02, 2016, 12:24:41 PM
Maybe you could look into FXAA (https://en.wikipedia.org/wiki/Fast_approximate_anti-aliasing) which is much faster than MSAA (at least on computers, it may be bad on calculators because they lack shading hardware). But since calculators generally handle low-poly environments, an AA triangle drawing routine would probably be best for both quality and speed.

Well the current AA method in not even msaa, but some sort of analytical aa. As for FXAA first it is a depth aware filter (and I don't have a z-buffer),  and it need to search through all pixel (76800), so it is at least 2M TStates. And that is a lot  :P

Anyway, the next thing is definitly textures.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on September 18, 2016, 07:40:07 PM
Will textures be any fast enough to be useful, though?  O.O

Good luck :)
Title: Re: [z80][ez80][3d][gLib][asm][axe][axiom] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on September 18, 2016, 08:37:29 PM
Well texturing should be about twice as fast as alpha-screenshot. I plan about ~200TStates per pixel (and want less of course !) vs the 450TStates of alpha/pixel.
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on September 22, 2016, 12:32:21 PM

As you can see, not everything as been implemented, but once it will, a solid base will be created for 3D on CE.


EDIT : so a few progress on texture mapping :

(https://tiplanet.org/forum/images/forum_uploads/11153_1474666390_57e59f965b6a4.png)

Texture gradient are for now hardcoded and a lot of thing isn't proprey implemented, but it is on good way.
It need 4 divisions for setup though, so about 2000 ticks. Inner loop is from 126 to 136 TStates, so it give a fillrate of about 350KPxl/s
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on September 25, 2016, 11:39:05 AM
Sooooo this is technically a triple post, but anyway  :P

(http://i.imgur.com/5cn6yOD.png)

Texture now works (and there isn't hardcoded value, this is the full routine !). There is quite a lot of optimisation to do right now, but it less important. The maximum size of the texture is 127x255 which allow quite some stuff. (A 127x255 texture is 32385 bytes ). I now will focus on clipping and also in handling model seams correctly (as if, in a model, on vertex share different texture coordinate). Texturing isn't finished either, I want to implement a BC1 type texture compression (ratio of 1/2) with decompression during texel fetch.

As for speed, the inner texture loop is exactly 114 TStates, +10TStates when changing texture coordinate. This is a theorical 421000KPxl/s. Of course, this isn't reachable in pratice, but give a good indication of what is possible.
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: catastropher on September 25, 2016, 03:16:55 PM
Nice work! I can't wait to see this once it's done! I have two questions:
A lot of people think you have to sort all the points in the polygon or something, but I just this method that I came up with (which runs in linear time):

Spoiler

typedef struct X3D_PolyVertex {
    X3D_Vex2D v2d;
    int16 intensity;
    int32 u, v;
    int32 z;
} X3D_PolyVertex;

typedef struct X3D_PolyLine {
    uint16 total_v;
    X3D_PolyVertex** v;
} X3D_PolyLine;

_Bool x3d_polyline_split(X3D_PolyVertex* v, uint16 total_v, X3D_PolyLine* left, X3D_PolyLine* right) {
    // Force the polygon to be clockwise
    x3d_polyvertex_make_clockwise(v, total_v);
   
    int16 top_left = 0;
    int16 top_right = 0;
    int32 max_y = v[0].v2d.y;
   
    int16 i;
    // Find the top left point, the top right point, and the maximum y value
    for(i = 1; i < total_v; ++i) {
        if(v[i].v2d.y < v[top_left].v2d.y) {
            top_left = i;
            top_right = i;
        }
        else if(v[i].v2d.y == v[top_left].v2d.y) {
            if(v[i].v2d.x < v[top_left].v2d.x)    top_left = i;
            if(v[i].v2d.x > v[top_right].v2d.x)   top_right = i;
        }
       
        max_y = X3D_MAX(max_y, v[i].v2d.y);
    }
   
    left->total_v = 0;
    right->total_v = 0;
   
    // Grab the points for the left polyline
    do {
        left->v[left->total_v] = v + top_left;
        top_left = (top_left + 1 < total_v ? top_left + 1 : 0);
    } while(left->v[left->total_v++]->v2d.y != max_y);
   
    // Grab the points for the right polyline
    do {
        right->v[right->total_v] = v + top_right;
        top_right = (top_right != 0 ? top_right - 1 : total_v - 1);
    } while(right->v[right->total_v++]->v2d.y != max_y);
   
    return left->total_v > 1 && right->total_v > 1;
}
[close]
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on September 25, 2016, 03:31:41 PM
The routine definitly doesn't do any perpective correction for speed sake. The poor ez80 can't do divide on is own and it is about 500TStates. That would mean about 30TStates/pxl in more, but that is without counting the fact it would destroy many register that the routine would need to restore.
It does only draw triangle, as drawing polygons might be quite hard to get on pure ez80 asm. I'll look into your method, which look like quite interesting.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on September 25, 2016, 11:32:45 PM
Ideally, you should avoid splitting your lib too much, because people will get confused about what is Iris3D and what does gLib do, like with various other softwares. I'm glad you got textures working by the way. I can't wait for animated eye-candy. :)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on September 26, 2016, 07:35:38 PM
So, there is progress :

(https://tiplanet.org/forum/images/forum_uploads/11153_1474918218_57e9774acfb02.gif)

Quite a lot a textured poly drawn if you ask me. The uv texture coordinate is kinda mess up in some model due to the lack of texture repeat. Anyway, look good. I'll will try to speed this up to the speed of the light of course, but I don't promise anything. (Futhermore, the model is created to have two texture on it, and I doesn't implement such texture switch already)

As for split, well dunno. I can do thing as such I have a modulable environnement, in that case the library will be straight renamed as Iris3D on ez80 plateform (but still gLib on b&w). As such, the developper chose directly what does he want to use as function and only the used functions are included in final program.
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: catastropher on September 26, 2016, 09:09:33 PM
Nice work so far! :D I'm sure you know this, but I'm just throwing it out there. If you have a texture dimension that is a power of two (2^n), logical anding the u and v values with (2^n - 1) will give you texture wrapping. So your loop would look something this (this isn't real code, I just wrote it as an example):

Spoiler

typedef struct {
    int x;
    fp16x16 u, v;   // 16.16 fixed point
    fp16x16 z;
} ScanlineValue;

typedef struct {
    unsigned char size;
    unsigned char* texels;
} Texture;

void draw_scanline(ScanlineValue* left, ScanlineValue* right, Texture* tex, int y, short* zbuf) {
    int dx = (right->x - left->x != 0 ? right->x - left->x : 1);
   
    fp16x16 du = (right->u - left->u) / dx;
    fp16x16 dv = (right->v - left->v) / dx;
    fp16x16 dz = (right->z - left->z) / dx;
   
    fp16x16 u = left->u;
    fp16x16 v = left->v;
    fp16x16 z = left->z;
   
    for(int x = left->x; x <= right->x; ++x) {
        int zz = z >> 16;
       
        if(zz < zbuf[y * SCREEN_WIDTH + x]) {
            int uu = (u >> 16) & (tex->size - 1);
            int vv = (v >> 16) & (tex->size - 1);
           
            screen[y * SCREEN_WIDTH + x] = tex->texels[vv * tex->size + uu];
            zbuf[y * SCREEN_WIDTH + x] = zz;
        }
       
        u += du;
        v += dv;
        z += dz;
    }
}

[close]
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on September 27, 2016, 02:08:35 PM
Well the issue isn't that I don't know how to do wrapping, it is because doing such will be way to slow  :P
I don't recalculate the real texture adress in the inner pxl loop, I barely offset it. As such, it is quite faster. (But there isn't wrapping). Actually, the only triangles which would pose an issue is the triangle starting at one side of the texture and finishing at the other ... but there isn't much triangle doing so.

EDIT : I might have fixed texture coordinate bug from my converter. This is a part of the model of ashe from ff12. (about 1300 triangles)

(http://i.imgur.com/nxsECWF.gif)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: Snektron on September 27, 2016, 03:07:06 PM
Shaders when

Looks very good btw.
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on September 27, 2016, 03:28:10 PM
Well, pixel shader won't be implemented anytime soon, because a call is really slow  :P Anyway, I could do vertex/geometry shader.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on September 27, 2016, 04:07:16 PM
I am impressed at the speed those textured models run at. O.O
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on September 27, 2016, 04:56:37 PM
Quote from: DJ Omnimaga on September 27, 2016, 04:07:16 PM
I am impressed at the speed those textured models run at. O.O

Yeah, ez80 still pack some punch. I wish they'd put 1wait state ram everywhere though >_>. I hope however to make it run faster by creating lut for some of setup operation, and with general optimisation (and there is a lot to be found in this routine !).  Also keep in mind there is no perpective correction, so texture could appears somethime completly off.

Anyway, chocobo are cute <3
(http://i.imgur.com/QI0xZbH.gif)

EDIT : dark shiva from ff10 isn't bad either. This is about 2500 triangles  O.O (much less displayed though, with bfc)
(http://i.imgur.com/d4XCy8U.gif)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: catastropher on September 28, 2016, 02:06:57 AM
When I was writing the texture mapper for X3D, I figured out a way to avoid doing the texels[v * tex_w + u] calculation, or any sort of complex logic to update an internal pointer. I just pre-multiply v by the width of the texture and make sure that only multiples of tex_w are counted (since it's interpolated, you could end up with e.g. v = 2.5 * tex_w, which would give you two and a half scanlines which is wrong) with v by doing a bitmask:

// Texture size of 64 -> 6 bits
const int TEX_BITS = 6;

// Fixed point precision for u and v
const int FRAC_BITS = 10;

fp du = ((right->u - left->u) << FRAC_BITS) / dx;
fp u = left->u << FRAC_BITS;

// Premultiply v by the width of the texture (make sure the type of v is big enough!)
fp dv = ((right->v - left->v) << (FRAC_BITS + TEX_BITS)) / dx;
fp v = left->v << (FRAC_BITS + TEX_BITS);

...

// Mask because only whole multiples of tex_w are meaningful (i.e. whole scanlines of texels)
const int v_mask = ((1 << TEX_BITS) - 1) << (FRAC_BITS + TEX_BITS);

for(int i = left->x; i <= right->x; ++i) {
    int index = ((v & v_mask) + u) >> FRAC_BITS;
   
    *screen_ptr = texels[index];
   
    ++screen_ptr;
    u += du;
    v += dv;
    ...
}


Using a more complex mask, this can also be used for super fast texture wrapping. Let me know if you're interested and I can give you more details!
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on September 28, 2016, 06:47:16 AM
Well, I need to see how I can convert this method to asm  :P I use a slighty different method currently : I add int(du)+tex_size*int(dv) and update a fractionnal part with frac(du)*65536+frac(dv). As such, when the register containing the fractional part produc a carry, I offset the texture coordinate by one, and if a bit is rolled into the mid register (ie, High register), it is offseted by tex_size.
I use this method because the ez80 is quite limited on register and it allow me to do not reload gradient into the register each loop.

EDIT :

(https://tiplanet.org/forum/images/forum_uploads/11153_1475073807_57ebd70faf8c4.gif)

(https://tiplanet.org/forum/images/forum_uploads/11153_1475073801_57ebd7092e576.gif)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on October 02, 2016, 06:59:01 PM
(https://tiplanet.org/forum/images/forum_uploads/11153_1475434594_57f15862e719d.gif)

(https://tiplanet.org/forum/images/forum_uploads/11153_1475434161_57f156b16ffed.gif)

(https://tiplanet.org/forum/images/forum_uploads/11153_1475336504_57efd9384014e.gif)

This has just happened
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on October 04, 2016, 03:49:34 AM
Is the Xbox One emulator next on the list? O.O

Just kidding, this is just getting cooler and cooler. Make sure the new engine features doesn't drag the entire speed down, though, for those who don't want to use (too many) textures. :)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on October 04, 2016, 06:39:17 AM
Of course  :P The flat and textured mapped triangle are two separated routine, and lightning in texture in much more of a quick hacked test than option - but yeah it won't slow down everything. (No I won't put an if test in the inner loop  O.O )
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on October 06, 2016, 07:11:50 PM
That's good :). Also I'll give this a try soon. Also does the lib allow displaying scaled models, as in doing everything at the resolution we like, such as 160x120?
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on October 07, 2016, 11:43:43 AM
Well, you can render at a lower resolution, but I still didn't implemented pixel scaling, for filling the whole screen even if the resolution is smaller. (Actually, it might be a bit slower to render at 160x120 upscaled to 320x240 @8bpp, because of reading full framebuffer and writing it to the displayed framebuffer).

EDIT :

(https://tiplanet.org/forum/images/forum_uploads/11153_1475854863_57f7c20f55089.gif)

(https://tiplanet.org/forum/images/forum_uploads/11153_1475854568_57f7c0e897aab.gif)

Okay, buggy as crazy due to my texture routine, slow because it is like totally unoptimized, but multiple texture per model are now possible  :P

Note to myself : take the current texture routine, throw it, and redo it.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on October 07, 2016, 04:25:26 PM
Good luck! This looks cool by the way. :3=
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on October 09, 2016, 06:29:09 PM
next thing to do: import of blender save-files for on-calc rendering  :ninja: looks great (as always)  :thumbsup:
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on October 10, 2016, 08:59:43 AM
Well, my converter work with .obj (wavefront format) and .mtl file, so I can import on calc almost any blender model.  (-_(//)); Of course, special blender thing like lightning or fur aren't available, but it isn't a big thing to  worry about  :P
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on October 10, 2016, 10:40:35 AM
 O.O You do realize I was just joking right...?
but the fact you actually support that is amazing!
I cant wait for the first water-animations and stuff wiith subtitles saying "rendered on my calc"  :thumbsup:
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on October 10, 2016, 03:09:19 PM
Well obj support was quickly added cause entering model by hand would be a nightmare  :P Anyway, I am confident that a true water simulation is quite impossible on calc...
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on October 10, 2016, 03:11:37 PM
dont you usually use the word "confident" when talking about great plans and making positive promises? Like fighting drugs and racism and stuff...?
Stop misunsing one of my favorite words!  (-_(//));

But yess... I guess fear you're right xD
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on October 10, 2016, 03:16:04 PM
MMhhh yeah, confident might not be the best word. More like 'sure'  :P

However, a simple water with transparent texture and moving texture, and maybe a bit of vertex displacement might run well though.
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on October 10, 2016, 03:17:02 PM
water in minecraft-style? ;D
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on October 10, 2016, 03:29:57 PM
Yeah  :P. Also, for resolution switching, here is 160x120 :
(http://i.imgur.com/SjlAn70.gif)
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on October 10, 2016, 04:27:43 PM
Nice! Also I wonder how fast such model would run on the HP Prime (it would not have any texture and only have 1 gradient color, though)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on October 10, 2016, 04:33:04 PM
nice speed! ^^ MAybe you should zoom back a bit so when rotating the feet are still inside of the pictore (as triangles that are partially outside of the screen aren't displayed) ^^

If you reduced it to half or 1/3 the size (as it ould be needed for games) and also reduced teh quality of the model (noone notices at that resolution) it should run really smooth *-*
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on October 10, 2016, 04:36:22 PM
Quote from: p2 on October 10, 2016, 04:33:04 PM
Maybe you should zoom back a bit so when rotating the feet are still inside of the pictore (as triangles that are partially outside of the screen aren't displayed) ^^

Yeah that was to show off that culling work at custom resolution  :P
Anyway, a game could be doable even at 320x240, and that what game should aim for, cause halfscreen doesn't look *that* good. But anyway, those are way much bigger model than a game should contains  :D
(1700 polygons is waaaaay too much)


EDIT : some nice debugging screen  :P

(http://i.imgur.com/0jV7UHH.gif)
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on October 19, 2016, 02:51:11 AM
Lol actually at first I thought it was some sort of shading changing effect XD. It actually looks cool
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on October 19, 2016, 08:31:43 AM
Quote from: TheMachine02 on October 10, 2016, 04:36:22 PM
EDIT : some nice debugging screen  :P
(http://i.imgur.com/0jV7UHH.gif)
That looks AWESOME!! :D
But I guess that's at full rendering speed...? >.<
It would be really cool if you could make her appear like that and then start doing some fancy fight moves or something like that :thumbsup:
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on October 19, 2016, 04:45:00 PM
Quote from: p2 on October 19, 2016, 08:31:43 AM
But I guess that's at full rendering speed...? >.<
It would be really cool if you could make her appear like that and then start doing some fancy fight moves or something like that :thumbsup:

Nah it is slowdown by a halt somewhere in the texturing setup, since this model render without halt at more than 2fps  :P
Animation would be a cool addition, altough I am still figuring how to do that proprely  :D
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on October 20, 2016, 09:45:32 AM
you have to make chewing cows *-* they look great ;D
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on October 20, 2016, 03:02:23 PM
So several update of the texture code. First it use exx, so don't expect perfect timed interrupts when you use it  :P

Second, it is faster. Like x1.5 to x2 faster :

(https://tiplanet.org/forum/images/forum_uploads/11153_1476974414_5808d74e91c17.gif)

And third, it support texture up to 255x255 shamelessly :

(https://tiplanet.org/forum/images/forum_uploads/11153_1476975092_5808d9f4cf9f5.gif)

Of course, 255x255 will be hardly usefull in pratice, but who know  :P (And anyway, it was a consequence of optimization and algorithm making)
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on October 20, 2016, 08:03:33 PM
Darn, so many details. :O
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: c4ooo on October 20, 2016, 08:07:53 PM
As amazing as it looks, it would nice if you where to provide more practical demos that ran at better FPS ;)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on October 20, 2016, 09:05:45 PM
or maybe also stick to one model and create a comparison post to directly see the imrpovements/changes you have made? :) That would be nice :)
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on October 27, 2016, 07:12:16 PM
I'm definitively curious about how fast would 16 arwings rotate, in frames per second. And by arwing I mean the SNES ones, for less polygons and no texture.
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on October 27, 2016, 08:18:54 PM
Well, I don't have the original snes model, but by lurking around on the net, I found an average polygon count of ~30 triangles. So, 16 times this model would be less triangle than the high poly (629 tri) chocobo posted earlier in the thread, and would run even faster (so >12 fps) (and with depthsorting). Of course this a bit speculation, but it should be fairly correct.
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on October 28, 2016, 04:00:19 AM
I don't think you are going to need 16 of those on-screen in a game situation though? So the performance might be better in reality.

That being said, if they are too close to the camera it could be a drain :(.

Looks AWESOME btw @TheMachine02 !
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on October 28, 2016, 03:05:26 PM
So just wanted to try that one day. Sure it is quite broken (ie, converter broke uv coordinate), no bfc cause broken too, and no cliping, but still cool  :P

Spoiler
(http://i.imgur.com/w6q0Fry.gif)
[close]

And yeah, a strafox is more than doable. Just need to get on it one day  :P
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on October 28, 2016, 04:24:43 PM
Quote from: tr1p1ea on October 28, 2016, 04:00:19 AM
I don't think you are going to need 16 of those on-screen in a game situation though? So the performance might be better in reality.

That being said, if they are too close to the camera it could be a drain :(.

Looks AWESOME btw @TheMachine02 !
I said 16 in case someone made a Star Fox clone with an Area 6 style stage where there could easily be that many enemies at once on the screen actually
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: xMarminq_ on November 13, 2016, 05:01:38 PM
Laggy DOOM in the future?  ;)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on November 13, 2016, 06:48:00 PM
I am pretty sure a doom styled game won't happen soon with this engine. Why ? Because it is definilty not adapted for and it is quite a lot of work to get it running :P Keep in mind this is a polygonal engine, and doom is rather based off a raycasting engine. Well, to be fair, it could be done. But you will need a quite powerfull level structure  :P
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on November 13, 2016, 08:21:14 PM
Star Fox/Lylat Wars :P
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on November 18, 2016, 03:25:27 PM
So, some progress in optimization, but nothing visual  :P

I've been also toying with 160x120 buffer reconstruction to provide higher visual quality than simple plain pixel :

(https://tiplanet.org/forum/images/forum_uploads/11153_1479481931_582f1a4ba1e85.gif)

It only use a very simple pass for now, but with a bit more complex stuff, it could give quite good results.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on November 18, 2016, 05:36:10 PM
I like it so far. So detailed :)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on November 18, 2016, 10:47:19 PM
can you give us a demo for an oversimplyfied model? like a low-poly fox with only 16x16 tiles or something like that? :) Just so we get an idea of the speed :)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on November 19, 2016, 10:25:01 AM
Quote from: p2 on November 18, 2016, 10:47:19 PM
can you give us a demo for an oversimplyfied model? like a low-poly fox with only 16x16 tiles or something like that? :) Just so we get an idea of the speed :)

Of course  :) Have a demo with 3 ennemies of starfox64, the timer is time in ms per frame.

(http://i.imgur.com/9OzIQ2c.gif)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on November 19, 2016, 01:31:26 PM
Looks amazing TheMachine, very detailed and great speed.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on November 19, 2016, 09:39:25 PM
I like those Star Fox 64 models :3=
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: Viliami on November 20, 2016, 10:22:13 AM
Looks a lot faster, awesome.
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on November 20, 2016, 09:30:21 PM
well thats really an impressive demonstration. I wonder when the first games using your engine will be out ;D
I guess something like the good old PHOENIX shooter (from 83+) should be doable in 3d soon :D
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: xMarminq_ on November 20, 2016, 09:36:35 PM
Release something we can use to make these models! That would be cool.  :thumbsup:
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on November 21, 2016, 10:09:15 AM
as he mentioned he has imported blender models in the past for his demo, so if you actually plan an making the game you can already start ith lowres models 3d ;D
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on November 21, 2016, 06:01:40 PM
Indeed models are simply blender model. The only real limitation is texture wrapping which is inexistent. Everything else is supported (color material/texture/normal)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on November 21, 2016, 07:59:09 PM
Have you got any ideas on how to handle cases where objects are really close to the screen? As in, requiring very large triangles to be drawn.

I tried out the demo and the speed is awesome :).
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on November 21, 2016, 11:10:07 PM
How is the speed when no texture is being used other than solid colors?
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on November 22, 2016, 02:11:21 PM
Well flat filling is much faster than texture like about x5. For very huge triangle there isnt many possibilities. I am limited by ldir throughput at 7ts per pixel. Hopefully there shouldnt be such big tri in typical scene.
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on November 22, 2016, 08:01:18 PM
Well just thinking about when objects are close to the camera is all.
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on November 22, 2016, 08:08:38 PM
maybe the following will work (but might slow it down):
the edge of the camera angel (on the edge of what will be visible on the screen) add extra plains and calculate their collision lines with any object that's claser than XXXm to the "camera". Then only display the smaller field defined by those colission edges.
Buuut I guess you thoght about this months ago and thought it was a cty way to do stuff....
so just ignore it probably ^^
also can't wait to see a demo of one-colore models at full speed ;D
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on November 23, 2016, 05:35:51 AM
near plane clipping/culling is certainly an option, I guess it depends on the type of game/program is all.
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on November 23, 2016, 05:04:15 PM
Yeah, clipping is already half supported in the engine. Sure it could work, but I guess programms will need to be tweaked on per-game base. Anyway, there is also a way to do 5TStates/pxl but amout of work in the outer inner loop would almost supress all the benefit. So 7TStates/pixel that is all  :P
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on November 23, 2016, 05:11:03 PM
I really hope to see a mini game demo someday :)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on December 07, 2016, 10:27:41 AM
Progress !

(https://tiplanet.org/forum/images/forum_uploads/11153_1481105783_5847e1773b22e.gif)

(https://tiplanet.org/forum/images/forum_uploads/11153_1481106046_5847e27e9f18d.gif)

So yeah, clipping half-work now ! And ok, it is slow, but I am not finished yet  :P

EDIT : texture convert now support dithering & color boosting !

(https://tiplanet.org/forum/images/forum_uploads/11153_1481130839_58484357c6d97.gif)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on December 07, 2016, 10:30:06 AM
that's amazing :D
How did you do the landscape? is it an sphere-like 3d-model itself? O.O
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on December 07, 2016, 10:31:45 AM
Exactly  :) A ~100 polygons sphere model.
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on December 07, 2016, 10:34:17 AM
seriously: c that blue alien woman, she doesn't smile anyways. Just create a beautiful landscape and let the camera fly over it O.O
It looks amazing!! That would be more thn enough of a graphics demo ^.^

That warer... is the picture already a gradient? or is it real rendered with light and stuff?
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on December 07, 2016, 10:37:04 AM
Quote from: p2 on December 07, 2016, 10:34:17 AM
It looks amazing!! That would be more thn enough of a graphics demo ^.^
That warer... is the picture already a gradient? or is it real rendered with light and stuff?

Thanks, and yeah, I planned a demo  :P
Anyway, no, there isn't any real time light here. It would be in really pasta fps if it was  :P It is only the texture which give this effect.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on December 08, 2016, 01:43:45 AM
That is just beautiful O.O. I wonder how fast it runs if you reduce the quality, such as the vertical and horizontal resolution of the background? And what if it's turned into a 2D scrolling bitmap?


I just tried the demo and noticed it comes with many files. Is there a list of controls available somewhere?
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on December 08, 2016, 08:51:49 AM
Having a lower resolution on the background won't make things faster. However, turning it to a 2D bitmap would be a massive boost - but break thing when you look up or down. The method here is the conservative method - you can do what you want, it'll always look good.
All the file there is with the demo are all the texture file - I guess I could pack them, but well this is a demo, so I didn't do it  :P

Controls are just right and left key to rotate the model cause I never bothered to implement more  :P
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: Snektron on December 08, 2016, 09:28:58 AM
Pretty awesome :o
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: kotu on December 11, 2016, 08:38:49 PM
Quote from: TheMachine02 on November 19, 2016, 10:25:01 AM
Quote from: p2 on November 18, 2016, 10:47:19 PM
can you give us a demo for an oversimplyfied model? like a low-poly fox with only 16x16 tiles or something like that? :) Just so we get an idea of the speed :)

Of course  :) Have a demo with 3 ennemies of starfox64, the timer is time in ms per frame.

(http://i.imgur.com/9OzIQ2c.gif)

looks amazing but that timer doesn't look like it's being updated 20 times per second :p

did you cheat? lol
like it

*edit*
im being forced to admit it probably is 20 fps
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on December 11, 2016, 08:53:30 PM
Yeah, in fact it alternate between 20 & 15 fps due to vertical synchronisation. The timer doesn't change when the frame change though, and that is quite logical  :P (I get the precise TStates count with general purpose timer)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on December 12, 2016, 08:11:25 PM
Finally a more real life screenshot !

(https://tiplanet.org/modules/archives/captures/1481570293free_hackish_cam.gif)

I must say that for an unoptimized state, it run quite well  :P There is also bug in the clipping & texture (due to atlasing), but that should be easy to fix.
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on December 12, 2016, 08:29:26 PM
omg omg omg O.O
that sooo much makes me want to create indoor-games like horror mazes and c like that :love:
the speed s pretty impressive.
How far does the actual size affect the framerate? Given there's always the same amount or polygons visible but you're in a labyrinth 10 times the size, how big do you think would the slowdown be? :)
edit: have you tried overlapping the polygons just a liiiiittle bit to prevent the white lines? ;)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on December 12, 2016, 11:09:12 PM
Quote from: p2 on December 12, 2016, 08:29:26 PM
How far does the actual size affect the framerate? Given there's always the same amount or polygons visible but you're in a labyrinth 10 times the size, how big do you think would the slowdown be? :)

Mmmmhhh not sure what you meant there, but the more thing you render (even tiny tiny tiny triangle) the more the engine start to choke  :P I think that a room based render could work quite flawlessly.

Quote from: p2 on December 12, 2016, 08:29:26 PM
edit: have you tried overlapping the polygons just a liiiiittle bit to prevent the white lines? ;)

Yes, but the issue is that it is quite painful to do by hand  <_<
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on December 13, 2016, 03:28:41 AM
Wow, you really got rooms to work?? O.O I think this (with different textures) would be enough for an Illusiat 3D port.  Anyway this looks amazing and the speed is impressive considering the platforms limitation. As for the white artifacts, is it possible to choose their colors so that they can be the same as most textures?
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on December 13, 2016, 08:35:40 AM
what I ment was the following:
Imagine a HUUGE underground facility: 100 rooms and stuff, but all super simple like just 4 walls and 1 table.
at any moment there would be only very little visible (1 room) but there would be lots of map data in background.
How much would be the slowdown from that additional (cirrently not visible) map data? (all the stuff that's hidden behind the walls) :)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on December 13, 2016, 02:32:03 PM
It depends from how the game engine run, and game engine isn't handled by gLib  :P You could just throw everything to render but I am pretty sure it wouldn't be pretty. You could however does a simple room system with : render current room, render adjacent room, and then it would just run super well  :P

As for white artefact, it is hard to supress them & nah I can't change their color. Texture setup need an upgrade  :)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p4nix on December 13, 2016, 03:35:30 PM
Quote from: p2 on December 13, 2016, 08:35:40 AM
what I ment was the following:
Imagine a HUUGE underground facility: 100 rooms and stuff, but all super simple like just 4 walls and 1 table.
at any moment there would be only very little visible (1 room) but there would be lots of map data in background.
How much would be the slowdown from that additional (cirrently not visible) map data? (all the stuff that's hidden behind the walls) :)
That concept would, as @TheMachine02 said, only require you to have one room at any time loaded. Imagine it just like Minecraft, where the world is split into chunks - you can't have the whole world in RAM, but the part of the world you want to show.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on December 19, 2016, 05:30:57 PM
For collision detection, can't you just make sure that the floor is always flat and do collision like if you did it in 2D, even if that requires using a separate tilemap data ? It wouldn't be ideal but maybe that might be fast enough
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on December 19, 2016, 05:40:22 PM
Yeah, it can work indeed. At least if everything is aligned, but that's no fun  :P

EDIT : btw I saw you didn't had all the last screen.

(https://tiplanet.org/forum/images/forum_uploads/11153_1481643399_58501587df31f.gif)

(https://tiplanet.org/forum/images/forum_uploads/11153_1481558636_584eca6c228a4.gif)

(https://tiplanet.org/forum/images/forum_uploads/11153_1481736633_585181b911648.png)

(https://tiplanet.org/forum/images/forum_uploads/11153_1481996890_58557a5a011b8.gif)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on December 19, 2016, 07:31:31 PM
that landscape in different color settings looks awesome O.O
also I really REALLY love the others O.O
but still, someone stole half of your door :trollface:
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on December 20, 2016, 04:10:40 AM
Wow, that landscape changing colors and the subway looks great. :D
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on December 20, 2016, 02:02:46 PM
Thanks guy  :D

(https://tiplanet.org/forum/images/forum_uploads/11153_1482181035_585849ab7f3cf.gif)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on December 20, 2016, 02:14:50 PM
I really like it how the missing shadows plus high color contrasts give it its own atmophere ^.^
also is that dark blue thing supposed to be a tube or a hallway or something like that...?

maybe you could add a light texture to the lamps? :)
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on December 30, 2016, 07:11:39 AM
For missing shadows I assume he could probably just use darker copies of the textures for walls facing certain directions, but in general, I guess the trick is to make sure that it's not hard to distinguish each walls from each others so that it doesn't look weird.

Also nice training room :). The speed is impressive considering how many different elements appear in it.
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on January 02, 2017, 06:47:06 PM
Finally got some animation right !

(https://tiplanet.org/forum/images/forum_uploads/11153_1483379536_586a9350367b1.gif)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on January 02, 2017, 08:29:58 PM
Looks awesome!

What is the size of the model data?
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on January 08, 2017, 10:30:37 AM
The model size is more or less 16K. Animation take 15 bytes per bone & per frame. Since this model have 15 bones and 22 frames, i is about 5K of animation only data.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on January 08, 2017, 05:41:48 PM
Looks awesome TheMachine02 :)

Have you tried rendering the beginning area outside from Starwing/Star Fox SNES by the way? It had few polygons so I am curious about how fast it runs with the arwing base and a few ships in the sky
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on January 08, 2017, 05:46:59 PM
I could, but that mean I need to retrieve the landscape model somewhere and I have no idea how  :P

Should run pretty fast though, at least 6-7fps.
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on January 10, 2017, 11:07:16 AM
Is this a futur game ? Yes. Speed is the unknown factor though  :P

(https://tiplanet.org/forum/images/forum_uploads/11153_1483983158_5873c936b8cc1.gif)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p4nix on January 10, 2017, 01:42:50 PM
Who needs framerates when graphics are better than most games you see on a computer :P
Congratulations again on everything you have done so far, John Carmack would be jealous!
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on February 05, 2017, 06:38:02 AM
I am very late @TheMachine02 but this looks impressive. If you can manage to simplify some elements and increase the speed then maybe some game could be done with this engine. Is there any collision detection?
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on February 05, 2017, 06:25:03 PM
Mmmmhhh yeah speed is the big thing to work on  :P Sure the room can be simplified, but that is no fun. And no, there isn't collision detection, although in a TR like game, it can be handled in 2D so it isn't an issue.

Anyway, some more eye candy :

(http://i.imgur.com/uURwOcM.gif)

(http://i.imgur.com/Z7MY8sw.gif)

Why this old model ?  Because you can see that speed was improved by 20%  between before and now :P
(http://i.imgur.com/4acYoa0.gif)

Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on February 05, 2017, 11:46:19 PM
Looks awesome man, and a 20% speed increase is fantastic - especially for such a complex model.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on February 07, 2017, 02:41:36 AM
Wow, those run much faster O.O
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on February 25, 2017, 04:42:24 PM
(http://i.imgur.com/IraTtUk.gif)

(http://i.imgur.com/WX13eMU.gif)

And the speed increase is not over yet  :P Compared to precedent screen, it is about 15-20% performance increase.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on February 25, 2017, 05:02:17 PM
Woah, this is almost playable speed without any quality decrease. Awesome job O.O
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on February 26, 2017, 10:53:00 PM
That's amazing O.O
I guess simplyfied maps (like doom maps) should work in a nice framerate even with an animated, running 3D character like this O.O
You should even get a higher fps than nDoom, even tho you have much more details  :thumbsup:
wow <3

Once you find the time, you should definitely write a big tutorial on how you managed to boost the speed so much!!  :)

Edit: THAT WAS YOUR 300th POST, YAAY  :love:
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on February 26, 2017, 10:56:03 PM
Hm I have the feeling that Doom might be faster but not by much, unless they used some weird tricks and speed shortcuts?
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on February 26, 2017, 10:58:37 PM
nDoom has much simpler maps//much less visible poligons at once plus no animated characterlike that (only 2D stuff).
So you can't directly compare the FPS.
But I'm still convinced that if nDoom would run on gLib, it would be faster than it is now ;) Even after adding a running 3D character ^^
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on February 26, 2017, 10:59:32 PM
I seem to recall plenty of tunnels and walls that gradually changes direction and slopes in Doom, though O.O
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on February 26, 2017, 11:02:04 PM
Doom on the console or nDoom on the nSphire CX // nSphire CX CAS  ???
I dont know if they have similar maps, but the maps in nDoom were super simplified and the rooms were tiny plus had almost no 3D details in them. They were like squares with 45° consoles at maximum, nothing more complicated...
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on March 04, 2017, 03:59:54 PM
The more you reduce the triangle count, the faster rendering is  :P. Per triangle cost are some of the huge cost associated with the engine, but it decrease and decrease with optimization  :P

Anyway, I have reintroduced cheap lightning :

(https://tiplanet.org/forum/images/forum_uploads/11153_1488643122_58bae43228de9.gif)

It only add 15 ms to the rendering, which is pretty low. Backside with current lightning is that animated model aren't proprely lighted for now due to flaw in the pipeline.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on March 04, 2017, 09:14:45 PM
Looks great, as always :)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on March 05, 2017, 10:13:10 PM
Looking AWESOME!
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on March 09, 2017, 02:24:52 PM
So I had doubt at first with texturing + lightning with 256 colors as I found it a bit low, but next screen alleviated my doubt  :P

(https://tiplanet.org/forum/images/forum_uploads/11153_1489069026_58c163e295ebb.gif)
1135vx / 1881tris / ~4 fps

It is a statue from ff12, and I do think it look glorious  :P Still, of course, speed is quite low  <_<

Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on March 09, 2017, 02:28:10 PM
Just take my money O.O

How about  texturing + lightning with 256 colors + animated model now?  :thumbsup:
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on March 09, 2017, 02:35:06 PM
This is beautiful. I wonder what it looks like if the light is fixed to the camera while the model is rotating?
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on March 09, 2017, 02:39:38 PM
It gives that :

(https://tiplanet.org/forum/images/forum_uploads/11153_1489070349_58c1690d18cd9.gif)

I've also zoom in so you can appreciate texture detail  :P
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: Snektron on March 09, 2017, 09:50:06 PM
Really cool! I wonder if someday there'll be a 3D plotter that uses this. It seems the perfect base.
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: Ranman on March 10, 2017, 03:59:06 AM
Outstanding work sir!!  :thumbsup:

How long have you been working on this project?
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on March 10, 2017, 09:07:56 AM
On thé ez80 about one year .
Also I fear that it may not precise enough for a plotter.

Thanks :D
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on March 10, 2017, 05:33:16 PM
Quote from: TheMachine02 on March 09, 2017, 02:39:38 PM
It gives that :

(https://tiplanet.org/forum/images/forum_uploads/11153_1489070349_58c1690d18cd9.gif)

I've also zoom in so you can appreciate texture detail  :P
Darn I really need to make a video of this engine someday O.O
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on March 11, 2017, 10:30:49 AM
uuh right, there haven't been ANY demo videos of it so far, right? D:
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on March 13, 2017, 10:39:14 PM
The best thing ive ever seen on a calculator :).
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on March 13, 2017, 10:57:10 PM
@p2 demos are available, but probably not of that statue.
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on March 14, 2017, 01:20:38 AM
Well I was talking about full demo videos on youtube, not just GIFs ^^Are there some for gLib? :)

btw my 1773's post ^.^
Title: Re: gLib a fast 3D asm/axiom library
Post by: TheMachine02 on March 14, 2017, 07:51:53 AM
All demo are here https://tiplanet.org/forum/archives_list.php?order=hit&multi_chaine_search=Glib

And yeah there isnt any video of it.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Adriweb on March 15, 2017, 05:32:36 PM
Technically there are short videos available in critor's posts like here: https://tiplanet.org/forum/viewtopic.php?t=19710&p=214214#p214214
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on March 15, 2017, 06:49:15 PM
You should make a new topic in this section that has all screenshots and videos in it  since the beginning :3=
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on March 15, 2017, 07:01:23 PM
Quite a good idea, let's do this right now !  :P
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on March 15, 2017, 08:54:48 PM
(And demos...)

*runs*
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on April 13, 2017, 09:14:28 AM
I tried some 4000+ polygones model (the engine limit being 4096), and it look good.  :P

(https://tiplanet.org/forum/images/forum_uploads/11153_1492074460_58ef3fdc7add4.gif)

(https://tiplanet.org/forum/images/forum_uploads/11153_1492073996_58ef3e0cdc178.gif)

(https://tiplanet.org/forum/images/forum_uploads/11153_1492074199_58ef3ed708d2d.gif)

(https://tiplanet.org/forum/images/forum_uploads/11153_1492074794_58ef412a369a0.gif)

Still got some work, and speed issues, but yeah, at least it as a pretty much (even if slow) steady progress.
Title: Re: gLib a fast 3D asm/axiom library
Post by: _iPhoenix_ on April 13, 2017, 09:17:06 AM
Very cool!
Is there any way for you to bypass the limit (is it set in stone due to the algorithms, or is it a bound you set while creating)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on April 13, 2017, 09:17:44 AM
Nah, it is RAM limited  :P
Title: Re: gLib a fast 3D asm/axiom library
Post by: _iPhoenix_ on April 13, 2017, 09:18:55 AM
Oh.
Well, I don't think that will be a problem, at least for very long.
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: Alvajoy123 on April 13, 2017, 03:31:12 PM
this looks good   :thumbsup:

hope it can be used to make games.  :D
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on April 17, 2017, 04:23:44 PM
Wow, what frame rate does a 80 poly model gives now? O.O
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on April 17, 2017, 04:46:38 PM
Well I don't have a 80 tris model in my hand right now and I have a old and buggy (and pretty much unoptimized) glib version on this computer; but :

(http://i.imgur.com/iPiC7f7.gif)

212 tris, 155 verts. I would expect a minimum 30% speed boost against the current code I have.

EDIT : take a look at this screen, though :

(https://tiplanet.org/forum/images/forum_uploads/11153_1492191481_58f108f9478b8.gif)

Nearly 1400 tris, 1000 verts. And it run at about 280ms/frame. Given that rendering time scale quite well number of tris and vertex, I *think* 80 poly model should run under 40ms.
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on April 18, 2017, 12:14:23 AM
Amazingly impressive, the speed is awesome!

What would you say is your favourite speed optimisation so far?
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: c4ooo on April 18, 2017, 12:50:04 AM
You would make a game with this - doom maybe? :)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on April 18, 2017, 07:01:33 AM
I think the code I am most proud of is the vertex shader which is quite efficient and especially the perspective divide,  who doesnt even use a true division. It is about 2500 cycles max per vertex.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on April 18, 2017, 02:16:51 PM
Quote from: TheMachine02 on April 17, 2017, 04:46:38 PM
Well I don't have a 80 tris model in my hand right now and I have a old and buggy (and pretty much unoptimized) glib version on this computer; but :

(http://i.imgur.com/iPiC7f7.gif)

212 tris, 155 verts. I would expect a minimum 30% speed boost against the current code I have.

EDIT : take a look at this screen, though :

(https://tiplanet.org/forum/images/forum_uploads/11153_1492191481_58f108f9478b8.gif)

Nearly 1400 tris, 1000 verts. And it run at about 280ms/frame. Given that rendering time scale quite well number of tris and vertex, I *think* 80 poly model should run under 40ms.
That is awesome. With reduced poly count, we could definitively have a full game running at acceptable FPS. 8 FPS for a 3D calc game would definitively be good.
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on April 19, 2017, 09:01:33 PM
It should indeed. Well as long as framerate is somewhere between 6 to 10 fps it feel responsive enough. Still more polygons would be welcome  :P
/me returns optimizing
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on May 05, 2017, 12:31:30 PM
Implemented per vertex lightning, so I have an almost rock solid vertex shader now  :P I also have a key transparency for texture set.

(https://tiplanet.org/forum/images/forum_uploads/11153_1493830218_590a0a4a3e397.gif)

(https://tiplanet.org/forum/images/forum_uploads/11153_1493987482_590c709a24701.gif)
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on May 05, 2017, 02:14:28 PM
This is just getting better and better O.O
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on May 05, 2017, 02:59:10 PM
were the second model's wings ment to be hidden when shown  from behind...?  ;)

looks great as always, nice job!  :thumbsup:
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on May 05, 2017, 09:55:33 PM
Wings is just an effect of backface culling. So yeah not a bug just model issue.
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on May 06, 2017, 09:45:42 AM
Looks awesome as always!
Title: Re: gLib a fast 3D asm/axiom library
Post by: Lionel Debroux on May 27, 2017, 07:10:36 AM
It had been a while since I read this topic. That's fantastic work, as usual :)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on September 10, 2017, 09:29:40 PM
It isn't dead !

(https://tiplanet.org/forum/images/forum_uploads/11153_1505078095_59b5ab4f72772.gif)
(London, the whole level 4 of tomb raider. ~3500 triangles and 2000 vertices)

Don't look at the lightning, it is broken  :P

Seriously optimizing is taking most of my time now, and it is ... like .. you know hard  :P
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on September 10, 2017, 10:48:22 PM
Looks awesome man! The detail is crazy good.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on September 13, 2017, 05:14:26 PM
Looks good ^^

I wonder how would a small portion of Mario 64's castle (the first room) render and look like? :p
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on September 13, 2017, 11:56:46 PM
A SM64 level test would be great - but there could be an issue with N64 levels/models due to the size of polygon size and the lack of perspective correct texture mapping is all. You can see how affine texture mapping causes distortion when close to the camera and at angles and such. The PS1 got around this by not using large textured polygons - instead breaking them up into smaller ones to combat this. That being said, a game of that level of visual complexity is not really a realistic target if you want a playable framerate. BUT through some clever level optimization and thinking ... maybe it could be possible to an extent?!!!

If anyone can do it, it's TM02 :).
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on September 14, 2017, 09:31:24 AM
A second issue may arise, that is the N64 use a lot of repeating texture. And my engine doesn't support texture repeating at boundary. The fix is quite simple ; and fall in the same categorie of the issue discuted by tr1p1ea, break large polygons into smaller one. For the visual complexity of the game, well I must said that the previous screenshot doesn't include ANY way of doing thing proprely, it just send all polygons through the library (and vertex as well), which is, well, a bad way to do thing :P One of the primary optimization one can do in such context is bounding boxes, test a whole sub level part against frustrum with 8 vertices et skip it enterily if it is outside. Given that the library can handle different stream of polygons/vertex from different location and doesn't expect only one consecutive stream, this is a very interesting thing to do. Second optimization that may be doable is to reduce the far plan visibility, ie how far can you see polygons. PS1 used this technique very often, using some fog. We won't be able to do fog here, but it is still a good thin to have given that depth is computed for sorting anyway. Third reside in library optimization itself, which aren't at all done :P
As a side note, I need to also said that the current pipeline must process all vertex (this is mandatory due to clippping). So removing some vertex through the bounding boxes is even a better idea than before (2000 vertex process in the last screenshot IS heavy, at about 90ms).

Just to give you an idea, through code refactoring color glib is almost 400% faster than early version - and it is mostly through new algorithm / better pathway, not much from code micro-optimisation, apart from the texture mapping routine, in which I've already put a lot of work. So given the opportunity, (and mostly because two of the three optimization ins't glib work, but instead more of the user work, and I don't use my library well  :P ), the complexity may be pretty high. I also may start to do a more advanced use of the library for following demo because well I want more speed obviously.

To finish, well if one have the level, I can simply convert it and load it up in the engine  :)

EDIT : huh, I forgot to include last eye-candy, shame of me  :P

(https://tiplanet.org/forum/images/forum_uploads/11153_1505334360_59b994585ee4c.gif)

EDIT 2 : well I said that bounding should be user made, that is not totally true, as I could also make it mandatory, but I fear I may lose in flexibility. What do you think ?
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on September 14, 2017, 09:40:04 PM
Well the engine is already amazingly fast, I feel that making 3D models and levels SPECIFICALLY with the calc in mind could yield good results.

DAT EYE CANDY!!!! :).
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on September 15, 2017, 09:36:48 AM
Sure thing. Those level are end of life PSX quality grade, so don't wonder why there a bit heavy for the calc  :P Even considering the fact I have no (or limited vs PS1) lightning, the simple fact that it run *only* 8x slower (30fps vs 4-3fps) make me happy  :D (since the ez80 definitly doesn't have PSX hardware  :P )
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on September 16, 2017, 12:49:07 PM
Did the PS1 have a graphics card? I forgot, but this can play a big role in graphical performances
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on September 16, 2017, 12:52:51 PM
It has a dedicated GPU with 1Mb of VRAM indeed, which was quite efficient (well, for the time). It only supported linear mapping though. So yeah, pretty good  :P
Title: Re: gLib a fast 3D asm/axiom library
Post by: _iPhoenix_ on September 16, 2017, 04:02:06 PM
I have a render request.

You should come up with a gLib logo, with a lot of poly, and use it as a benchmark.

I also want to see a render of a CE rendering a CE.
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on September 18, 2017, 03:19:08 PM
Quote from: TheMachine02 on September 16, 2017, 12:52:51 PM
It has a dedicated GPU with 1Mb of VRAM indeed, which was quite efficient (well, for the time). It only supported linear mapping though. So yeah, pretty good  :P
That's impressive. I assume it also supported minimal shading?
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on September 22, 2017, 08:59:51 PM
It did supported some advanced stuff for the time, mainly gouraud shading along side with texture. Filtering was pretty minimal though, vs the N64 for example, but it has plenty of RAM.

Anyway, I started to implement bounding box, as they are finally quite easy to make them working in the pipeline, and hopefully should improve performance quite a bit  :P
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on September 22, 2017, 09:10:20 PM
sooo full support for my 4k VR Pr0n estimated by the end of next week?  ;)

seriously man, what you're doing there is magic  :thumbsup:
Also it'd be great to see a comparison of speed, like re-rendering one of the old demos with the current state of ur program so we can see the actual difference ^^
Guess then it'd probably be even more impressive than the more and more complex models (that are impressive enough already) ;D
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on September 22, 2017, 09:47:29 PM
Yeah I really should indeed. There wont be much improvement to flat filling though - havent touch the routine in ages - but texturing is an order of magnitude faster now.
I need to grab an old demo with some timing though to measure exactly the improvement. Maybe midna with the skybox ? (I need to see if I can fit texture in now caise the slybox I used was pretty huge, and I hard limited texture to 256x256)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on September 25, 2017, 09:08:24 PM
Cool indeed!

Do I remember correctly that you said you had 'texture read + write + pointer updates (buffer+texture)' down to 7cc per pixel?!

If so no wonder it's so fast!
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on September 26, 2017, 06:43:59 AM
The 7cc is for flat shading, it is just a ldir. Texturing come at about 26cc for unlighted, 32cc for lighted.
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on September 26, 2017, 10:21:49 AM
Okay well that makes more sense lol, amazing fast work man!

This is taking wait states into account?

(*shakes fist at wait states!*)

Any further updates?
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: c4ooo on September 26, 2017, 07:51:07 PM
<sarcasm> i heard modern RAM has wait states of a couple dozen nanoseconds, you should upgrade! </sarcasm>

Anyways, great job on the renderer. Now i just want to see a playable game use this :D
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on September 26, 2017, 08:56:18 PM
Yeah, it is counting everything  :P

Anyway I've entered a low activity phase (like reallly low), which is quite my futur right now (busy job!). So we'll see how that will evolve. Code is now on github !  https://github.com/TheMachine02/Virtual3D
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: tr1p1ea on September 28, 2017, 01:47:16 AM
Life gets in the way of coding for sure! But life tends to be pretty important so no problem!

Awesome work as always :).
Title: Re: gLib a fast 3D asm/axiom library
Post by: Dream of Omnimaga on September 28, 2017, 12:48:36 PM
Do you still go to school? Having a job and school at the same time sucks x.x
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on September 28, 2017, 02:42:58 PM
Actually the job la part of the school so yeah I still have school. And also a super important exam in 3 years  :P
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: p2 on September 28, 2017, 08:58:43 PM
ouch, that sucks... I wish you well tho, hope U still find enough time for programming :)

I thought about how cool it would be having a game using this as well...
But u start working on a new game using the gLib library...
...  and by the time u finish the first beta, there's a gLib version available that ruuns 3x faster...  <_<
I probably would wait a little longer with such projects  ;)
Title: Re: [gLib][3d][z80][ez80] gLib a fast 3D asm/axiom library
Post by: TheMachine02 on September 29, 2017, 05:20:22 AM
I doubt there will be major user syntaxic change now, merely new features. So you can quite start doing something  :P