Author Topic: Glib : a 3D graphics axe library  (Read 91365 times)

0 Members and 1 Guest are viewing this topic.

Offline tr1p1ea

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 647
  • Rating: +110/-0
    • View Profile
Re: GLIB a graphics axe 3d librairy
« Reply #135 on: July 08, 2013, 07:40:19 pm »
Exactly, when drawing a solid wall you dont have to transform each pixel into texture space ... you are just drawing horizontal lines!

Either way it looks great ... but i was wondering how the texture is mapped. It looks like an 8x8 texture but it appears to have taken a triangle slice of the texture? Or is the whole 8x8 texture not mapped to a single triangle (since it should look distorted when you map a square to a triangle).
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."


Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: GLIB a graphics axe 3d librairy
« Reply #136 on: July 09, 2013, 07:42:25 am »
Thanks to tr1p1ea, I managed to perform backface culling in Axe :)



I don't know if you already do it, but if you don't, I'll be glad to explain how it works. It's pretty fast (although you don't see it because I optimized nothing ;D ), and only consists in one formula (but the conditions in which it works are just a PITA to set up).
« Last Edit: July 09, 2013, 07:48:37 am by Matrefeytontias »

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: GLIB a graphics axe 3d librairy
« Reply #137 on: July 09, 2013, 09:25:40 am »
Either way it looks great ... but i was wondering how the texture is mapped. It looks like an 8x8 texture but it appears to have taken a triangle slice of the texture? Or is the whole 8x8 texture not mapped to a single triangle (since it should look distorted when you map a square to a triangle).

It map a texture according with the U,V coordinate in texture space given at the 3 points who made the triangle

Matref, your backface culling is very interesting. Since I rewamp the polygons sytem, I was forced to remove z-sorting, and I start to study this method in fact  ;D. I will be happy if you can explain me this.

Anyway, some new screeenshots (and I work now hard on the lib to release it as fast as I can !)
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline pimathbrainiac

  • Occasionally I make projects
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1731
  • Rating: +136/-23
  • dagaem
    • View Profile
Re: GLIB a graphics axe 3d librairy
« Reply #138 on: July 09, 2013, 10:34:08 am »
That looks AMAZING!!!

Keep up the good work, as always!
I am Bach.

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: GLIB a graphics axe 3d librairy
« Reply #139 on: July 09, 2013, 01:25:04 pm »
That looks AMAZING!!!

Keep up the good work, as always!
thanks  :D

Matref, I finally don't need your backface culling, because I manage to create something user-friendly (well I hope so  XD ) and which can manage backface culling, as well as a LOT of other things  ;D
But, I really want to see how you do it  :)

Anyway, I am close to the update, but there is some very bad bugs I want to correct before the release, so maybe tomorrow. I don't think I will have the time to correct everything this evening, though  :P
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: GLIB a graphics axe 3d librairy
« Reply #140 on: July 09, 2013, 03:33:47 pm »
I love the opaque cube and the smile texture especially. I wonder if that engine could be used for some sort of Starwing/Starfox/Lylat Wars game  but with fewer polygons (such as ships being flat but able to rotate and stuff)?

Offline tr1p1ea

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 647
  • Rating: +110/-0
    • View Profile
Re: GLIB a graphics axe 3d librairy
« Reply #141 on: July 09, 2013, 05:12:55 pm »
The textured face looks really good, and it runs at a decent speed too!
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."


Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: GLIB a graphics axe 3d librairy
« Reply #142 on: July 09, 2013, 05:40:32 pm »
Yeah, I like that face and it is running pretty good IMO! :D

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: GLIB a graphics axe 3d librairy
« Reply #143 on: July 10, 2013, 11:25:31 am »
A litlle screenshot to show the backface culing thing. Note that a lot of lines can be remove, I currently work on this.  :P
Vertex isn't process if face is remove.

It's currently run at +-31 fps, but I hope gain more speed.

« Last Edit: July 10, 2013, 11:25:50 am by TheMachine02 »
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: GLIB a graphics axe 3d librairy
« Reply #144 on: July 10, 2013, 11:53:26 am »
Looks good :)

So how do you perform it ? Because we with tr1p1ea had to find a horribly inaccurate and unflexible workaround, so I'm wondering.
« Last Edit: July 10, 2013, 11:53:42 am by Matrefeytontias »

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: GLIB a graphics axe 3d librairy
« Reply #145 on: July 10, 2013, 12:59:43 pm »
I simply perform the normal vector of each faces using a cross product. With that, I have the plan equation of the face, and I check the camera pos according to this equation. The result is positive or negative, and I hide face according to data definition. The only thing that we have to worry is  when all the points of the face is not on the same plan (sqare only), but one workaround is to increase geometry complexity (or simply be careful)
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: GLIB a graphics axe 3d librairy
« Reply #146 on: July 10, 2013, 01:16:25 pm »
and I check the camera pos according to this equation.
What do you mean by that ? What's the calculation performed ?

EDIT : did you use this method : http://flipcode.com/archives/Building_a_3D_Portal_Engine-Issue_06_Hidden_Surface_Removal.shtml ? If yes, how did you manage to get rid of the overflow that I always encounter when normalizing the vector with sqrt(x²+y²+z²) ?

In either way, how did you do that ? >_>
« Last Edit: July 10, 2013, 01:50:59 pm by Matrefeytontias »

Offline tr1p1ea

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 647
  • Rating: +110/-0
    • View Profile
Re: GLIB a graphics axe 3d librairy
« Reply #147 on: July 10, 2013, 05:39:31 pm »
Yeah he is doing it a more traditional way (and thus more accurate). The method we used was the 'quick and easy' way, with the tradeoff being accuracy (though it is minimized if you sort faces, though with proper culling you may not need to sort if you are using convex objects).
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."


Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: GLIB a graphics axe 3d librairy
« Reply #148 on: July 10, 2013, 06:35:50 pm »
That still doesn't tell me how he does it, since I miserabily failed at doing so :/

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: GLIB a graphics axe 3d librairy
« Reply #149 on: July 11, 2013, 05:30:38 am »
This tuto is weird. I use this method, but I only do the cross product. Taking the tuto code, I remove the

Code: [Select]
         double len=sqrt(A*A+B*B+C*C);
         A=A/len; B=B/len; C=C/len;

line, since by definition, the cross product give one of the possible normal vector of the face. No need to normalize the vector. This vector give automatically the plane equation of the face, ax+by+cz-d=0. I then replace the x,y,z value by the x,y,z camera position , and check the sign of the result.
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html