Author Topic: nGL - a fast (enough) 3D engine for the nspire  (Read 242091 times)

0 Members and 1 Guest are viewing this topic.

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #60 on: February 16, 2014, 12:18:54 pm »
I'm rendering chunks only if the geometry changed into a VERTEX buffer.
If the geometry didn't change, I do the following:
Code: [Select]
glBegin(GL_QUADS);
nglAddVertices(buffer, buffer_length);
glEnd();
To generate the VERTEX array, I simply iterate through all AIR blocks and render the corresponding sides of adjacent blocks.
z-sorting is IMO slower than a z-buffer in this case, as it would require sorting every face every frame.
I tried to implement it and it looks weird (read: full of bugs) and wasn't much faster (15 fps vs 11)

To get a maximum performance minecraft game, it would be best to use my GLFix in nCraft, as it's more specialised for blocks than nGL.
Currently I have no class World which handles the faces between chunks (they get rendered always) and below them which you can't see.
So don't worry, there is still much room for performance improvements. It could be faster if I cache the transformed vertices instead of the whole untransformed chunk.
That'd mean much less matrix-vertex multiplications but iterating over each block.

Quote
Aw too bad it runs much slower with 16x16x16. Does it mean a Minecraft clone using this would actually be slower than nCraft?
I don't know the visible range of nCraft, but if it's < 32, crafti is as fast with textures as nCraft is without.

Edit: Found a trivial optimization I thought the compiler was smart enough to do itself but it didn't.
Results with 2*2 16*16*16 chunks and no world optimizations yet:
TEXTURE_SUPPORT: ~16fps
No TEXTURE_SUPPORT: ~30fps
« Last Edit: February 16, 2014, 01:23:20 pm by Vogtinator »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #61 on: February 16, 2014, 01:22:08 pm »
Oh ok I thought it ran slow regardless of the viewing range. I think in nCraft it's about 5 blocks away and if you want to view further, you have to press a key which renders the frame in 4-5 seconds.

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #62 on: February 16, 2014, 05:47:14 pm »
Here is a recent build of crafti. Can anyone tell me whether it's fast enough (fps-wise, not movement-wise)?
I'm fully aware of the artifacts..

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #63 on: February 16, 2014, 06:03:13 pm »
I'll give this a try, assuming it actually runs (I am unsure if I have the latest Ndless version and I am never able to send an OS file to my calc with less than 666% battery charge)

This is nCraft view depth and speed btw (I think I used Nover before running it and it ran at 242 MHz)

« Last Edit: February 16, 2014, 06:04:40 pm by DJ Omnimaga »

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #64 on: February 17, 2014, 03:24:45 pm »
Ok, newer version:
3*3 16*16*16 chunks: 48*48 viewing distance with ~32 fps when walking around.
I also resolved some artifacts, but there are still some perspective projection issues (jagged edges)
I'll post the source code and screen capture after I fixed those.

Edit: I just HAD to upload my first animation (runs at 60 fps BTW):
« Last Edit: February 17, 2014, 04:58:21 pm by Vogtinator »

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #65 on: February 17, 2014, 03:31:00 pm »
Does this require a specific (as in "not too old") revision of Ndless ? Because I can run nCraft but not crafti ("not supported").
And yeah, I have a really old revision :P

edit Indeed, works with r914.
However, I only figured out part of the controls, and my calc froze at some point O.O

Great job other than that :D
« Last Edit: February 17, 2014, 03:36:22 pm by Hayleia »
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #66 on: February 17, 2014, 05:02:20 pm »
Oh, I got ninja'd while editing...

Quote
Does this require a specific (as in "not too old") revision of Ndless ? Because I can run nCraft but not crafti ("not supported").
And yeah, I have a really old revision

edit Indeed, works with r914.
crafti uses c++ which supposedly needs bFLT to work correctly...

Quote
However, I only figured out part of the controls, and my calc froze at some point
Are you sure it froze and didn't just display the sky? I haven't had a freeze in a while, only crashes until I (hopefully) fixed them :)

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #67 on: February 17, 2014, 05:12:24 pm »
Oooooh that's awsum man :D

Offline CalebHansberry

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 135
  • Rating: +14/-0
  • This is my personal text
    • View Profile
    • Skylites Computers
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #68 on: February 18, 2014, 12:32:57 am »
Oh man, that looks so amazing, it's beyond words! I'm a huge Minecraft fan.  Make a Minecraft! :D Anyway, it looks soooo great!
You should know, I am a Christian.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #69 on: February 18, 2014, 12:37:42 am »
Quote
However, I only figured out part of the controls, and my calc froze at some point
Are you sure it froze and didn't just display the sky? I haven't had a freeze in a while, only crashes until I (hopefully) fixed them :)
The D-Pad and the number keys stopped responding. It's possible I made it crash myself though because I tried all the keys.
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #70 on: February 18, 2014, 09:27:52 am »
Sound like there was very good progress here. Good job for this first animation, it's look sooo greeaattt  :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: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #71 on: February 18, 2014, 03:54:43 pm »
Very great Vogtinator! O.O

Offline XiiDraco

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 513
  • Rating: +32/-5
  • Forget the numbers, just call me, Recreation.
    • View Profile
    • Black-Lark Games
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #72 on: February 19, 2014, 01:34:12 am »
I'm just... astonished.... I think I might go try and find a mini usb cable so I can start using my Nspire again just because of this...

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: nGL - a fast (enough) 3D engine for the nspire
« Reply #73 on: February 19, 2014, 02:54:56 am »
Wow, that is looking awesome! O.O

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

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: nGL - a fast (enough) 3D engine for the nspire
« Reply #74 on: February 19, 2014, 04:25:59 pm »
I tried to fix the depth issues and had to use floats (or int_fast64_t which is equally slow to divide somehow) which is slower (depends on vertex count)
Which version is better? Or should I keep both?