* WalrusIRC

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

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

0 Members and 1 Guest are viewing this topic.

Offline Vogtinator

  • Full User
  • Join Date: Dec 2014
  • Location: Germany
  • Posts: 108
  • Post Rating Ratio: +4/-0
  • Instruction counter
    • @UCii1mkxAsrIGvjFwS80YSmg
    • /u/Vogtinator
    • Vogtinator
    • ../../../cgi-bin/acct-view.cgi?userid=87663#
    • View Profile
crafti and nGL - a fast (enough) 3D engine for the nspire
« on: May 20, 2016, 10:05:13 pm »
Crafti v1.2

(Original thread with old versions and history on omnimaga: https://www.omnimaga.org/ti-nspire-projects/ngl-a-fast-(enough)-3d-engine-for-the-nspire)

No major changes, just some bugfixes and improvements.
I haven't tested classic support extensively, so if you're relying on that you should keep your old version around.
On a HW-W calc this should improve usability significantly, so please upgrade!

Download on GitHub


Improvements in crafti:
  • Bugfix: Division by 0 when calculating collision while looking straight ahead
  • Zehn compression for faster startup and less space requirements


Improvements in nGL:
  • Several performance improvements
  • Uses lcd_blit, so works natively on HW-W
  • On PC, use SDL for graphics
  • Add tools for converting wavefront obj
  • Add VECTOR3 and nglDrawArray
  • Add two new lessons to the tutorial


  • Calculators owned: TI-Nspie CX CAS, Casio FX-85ES

Offline DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18271
  • Post Rating Ratio: +91/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
I didn't knew this was still alive. I'm glad to see new updates to Crafti and nGL. :) Speed and size improvements are always welcome.

Also that Spongebob model looks amazing for a calculator :)
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

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

Offline alexgt

  • Just your friendly neighborhood Ninja Stach Fancy Iron Man
  • Super User
  • Join Date: Dec 2014
  • Location: Behind you
  • Posts: 2611
  • Post Rating Ratio: +6/-1
  • Something should go here...
    • /u/alexgt9123
    • View Profile
  • Gender: Male
Wow! nice job Voginator ;)
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

Offline gameblabla

  • Super User
  • Join Date: May 2015
  • Location:
  • Posts: 647
  • Post Rating Ratio: +11/-6
  • TI-nspire porter
    • View Profile
I feel like bumping this thread because this new version of crafti and nGL helped me porting it to the GCW0 with input controls.
Your initial SDL port didn't have controls, which i had to implement.
Source code with OPK is here :
https://github.com/gameblabla/crafti

I also had to fix some bugs with crafti.
For example, at higher resolutions, the inventory menu doesn't control properly so i have fixed that.
https://github.com/gameblabla/crafti/commit/cf276fa527ed4e25981a2209f09b215ba62ea1c3

Playing it on my zero, it runs much faster than on my nspire but i eventually found a bug
where if you go far enough, the textures will severely bleed.
I'm not sure how it can be fixed though : maybe extending the world ?
  • Calculators owned: TI Nspire CX, TI-89

Offline Vogtinator

  • Full User
  • Join Date: Dec 2014
  • Location: Germany
  • Posts: 108
  • Post Rating Ratio: +4/-0
  • Instruction counter
    • @UCii1mkxAsrIGvjFwS80YSmg
    • /u/Vogtinator
    • Vogtinator
    • ../../../cgi-bin/acct-view.cgi?userid=87663#
    • View Profile
Quote
Your initial SDL port didn't have controls, which i had to implement.
Thanks! I never bothered to do so because it was mainly just for engine testing and performance tuning
(valgrind and perf on a raspberry pi)

Quote
For example, at higher resolutions, the inventory menu doesn't control properly so i have fixed that.
Yeah, I never bothered with that either, at some places I hardcoded coordinates.

Quote
Playing it on my zero, it runs much faster than on my nspire but i eventually found a bug
where if you go far enough, the textures will severely bleed.
I'm not sure how it can be fixed though : maybe extending the world ?
If it runs fast enough, you can tune some settings in glconfig.h, especially BETTER_PERSPECTIVE.

It's great that you were able to port it, can you clean your port up a bit and submit a pull request?
  • Calculators owned: TI-Nspie CX CAS, Casio FX-85ES

Offline DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18271
  • Post Rating Ratio: +91/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
I am curious about how it looks like on the GCW0 :)
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

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

Offline gameblabla

  • Super User
  • Join Date: May 2015
  • Location:
  • Posts: 647
  • Post Rating Ratio: +11/-6
  • TI-nspire porter
    • View Profile
If it runs fast enough, you can tune some settings in glconfig.h, especially BETTER_PERSPECTIVE.
Sadly, i had already enabled this and it doesn't fix anything.
When i have enabled SAFE_MODE, it spams my terminal with this :
Code: [Select]
Warning : Texture coord out of bounds !
And here does it look like on my GCW0 (and PC) :



The map file also becomes much bigger.
Maybe it is a good idea to add insivible walls ?

Quote
I am curious about how it looks like on the GCW0 :)
I might do a video on that video but(t) basically, it's the nspire version running much faster.
Lately, i have also added some sound effects and music.

Quote
It's great that you were able to port it, can you clean your port up a bit and submit a pull request?
Hmm... That will take some time because i changed my git repo a quite bit compared to yours.
But i will look into it.
  • Calculators owned: TI Nspire CX, TI-89

Offline Vogtinator

  • Full User
  • Join Date: Dec 2014
  • Location: Germany
  • Posts: 108
  • Post Rating Ratio: +4/-0
  • Instruction counter
    • @UCii1mkxAsrIGvjFwS80YSmg
    • /u/Vogtinator
    • Vogtinator
    • ../../../cgi-bin/acct-view.cgi?userid=87663#
    • View Profile
If it runs fast enough, you can tune some settings in glconfig.h, especially BETTER_PERSPECTIVE.
Sadly, i had already enabled this and it doesn't fix anything.
When i have enabled SAFE_MODE, it spams my terminal with this :
Code: [Select]
Warning : Texture coord out of bounds !
And here does it look like on my GCW0 (and PC) :

Hm, that means there was a division by close-to-zero in the perspective divide.
It should be gone if you decrease the rendering distance, although it shouldn't
occur that often with BETTER_PERSPECTIVE... Did you run make clean?

Quote
The map file also becomes much bigger.
Maybe it is a good idea to add insivible walls ?
Why?

Quote
Quote
It's great that you were able to port it, can you clean your port up a bit and submit a pull request?
Hmm... That will take some time because i changed my git repo a quite bit compared to yours.
But i will look into it.

It's much appreciated!
  • Calculators owned: TI-Nspie CX CAS, Casio FX-85ES

Offline gameblabla

  • Super User
  • Join Date: May 2015
  • Location:
  • Posts: 647
  • Post Rating Ratio: +11/-6
  • TI-nspire porter
    • View Profile
Hm, that means there was a division by close-to-zero in the perspective divide.
It should be gone if you decrease the rendering distance, although it shouldn't
occur that often with BETTER_PERSPECTIVE... Did you run make clean?
Yes, i ran make clean several times my sweety but it is still there.
Decreasing the rendering distance doesn't seem to do much...
Same with BETTER_PERSPECTIVE.

Why?
So It happens less often ?
I admit i'm not quite sure what causes this to happen but you can see it only bleeds in the blue sky background...
Any idea for a workaround ?
  • Calculators owned: TI Nspire CX, TI-89

Offline Vogtinator

  • Full User
  • Join Date: Dec 2014
  • Location: Germany
  • Posts: 108
  • Post Rating Ratio: +4/-0
  • Instruction counter
    • @UCii1mkxAsrIGvjFwS80YSmg
    • /u/Vogtinator
    • Vogtinator
    • ../../../cgi-bin/acct-view.cgi?userid=87663#
    • View Profile
Hm, that means there was a division by close-to-zero in the perspective divide.
It should be gone if you decrease the rendering distance, although it shouldn't
occur that often with BETTER_PERSPECTIVE... Did you run make clean?
Yes, i ran make clean several times my sweety but it is still there.
Decreasing the rendering distance doesn't seem to do much...
Same with BETTER_PERSPECTIVE.

Why?
So It happens less often ?
I admit i'm not quite sure what causes this to happen but you can see it only bleeds in the blue sky background...
Any idea for a workaround ?

You could try to make the cubes smaller and change the camera so that it makes everything look right again,
that way the coords don't get out of bounds that easily. A proper fix would be to adjust the chunk's coordinates
to the player's position, so that the player is always at (0/0/0) and the chunks change coordinates instead of
the player. This will cost some vertex recalculation time, but will avoid large coordinates reliably.
  • Calculators owned: TI-Nspie CX CAS, Casio FX-85ES

Offline gameblabla

  • Super User
  • Join Date: May 2015
  • Location:
  • Posts: 647
  • Post Rating Ratio: +11/-6
  • TI-nspire porter
    • View Profile

I have made a basic port of Crafti for the Sega Dreamcast !
Like the GCW0 and nspire, it is still entirely software rendered but this DC port does not use SDL. (instead it just talks to vram_s)
The Dreamcast only has 16Mb of RAM, at first i encountered memory corruption on the images but i was able to reduce it so it is not noticeable.

Link (with source) :
https://gameblabla.nl/files/crafti-dreamcast.zip

I should really make an abstraction to nGL/crafti so i don't have to make a specific fork or ifdef everything.
  • Calculators owned: TI Nspire CX, TI-89

Offline DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18271
  • Post Rating Ratio: +91/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
I wonder if it's easy to run homebrew on a DC because I got that console and I would definitively like to give this a try. (assuming this is finished and fully working, of course)
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

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

Offline gameblabla

  • Super User
  • Join Date: May 2015
  • Location:
  • Posts: 647
  • Post Rating Ratio: +11/-6
  • TI-nspire porter
    • View Profile
I wonder if it's easy to run homebrew on a DC because I got that console and I would definitively like to give this a try. (assuming this is finished and fully working, of course)
You're kidding right ? This thing has no protection against unlicensed software.
It's the reason why games like Sturmwind are possible.
Only some late US Sega Dreamcast are unable to play homebrew games on CD. (and the Sakura Taisen ones)

If you want to give it a try, burn it with DiscJuggler, Alcohol 120% or ImgBurn with the discjuggler dll.

Crafti for the Dreamcast is catching fire, it seems, it's newsed by almost every dreamcast fan website ... :P
http://www.thedreamcastjunkyard.co.uk/2017/01/crafti-homebrew-minecraft-clone-for.html
http://www.dcemu.co.uk/vbulletin/threads/1158397-Crafti-A-Homebrew-Minecraft-Clone-For-Dreamcast-Released
http://www.dreamcast.es/news.php?readmore=810

Tom from the Dreamcast Junkward made a quick video about it :


This makes me feel a bit bad, as Vogtinator is not even mentioned in the news, even though he made the game.
I'm already getting threats because they want me to improve the perf of the DC port, not even my GCW0 port got this kind of reception.
  • Calculators owned: TI Nspire CX, TI-89

Offline DJ Omnimaga

  • Omni founder & CW co-founder
  • CodeWalrus Staff
  • Super User
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Topic Management
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18271
  • Post Rating Ratio: +91/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • View Profile
    • DJ Omnimaga music store
  • Gender: Male
I am asking, because over a decade ago I remember that they seemed to have serious difficulties trying to copy Dreamcast discs. While homebrew has been possible for ages, I was worried that there were still various restrictions to circumvent and that for homebrew I needed to mod my console or something unless the homebrew content came on an actual Dreamcast disc medium. I'll have to check how recent my console is


ALso it's nice they made a video. Shame that some people were negative about this port, though.
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

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

Offline Vogtinator

  • Full User
  • Join Date: Dec 2014
  • Location: Germany
  • Posts: 108
  • Post Rating Ratio: +4/-0
  • Instruction counter
    • @UCii1mkxAsrIGvjFwS80YSmg
    • /u/Vogtinator
    • Vogtinator
    • ../../../cgi-bin/acct-view.cgi?userid=87663#
    • View Profile
Quote
I have made a basic port of Crafti for the Sega Dreamcast !
Like the GCW0 and nspire, it is still entirely software rendered but this DC port does not use SDL. (instead it just talks to vram_s)
Quote
Crafti for the Dreamcast is catching fire, it seems, it's newsed by almost every dreamcast fan website ... :P

Good job!

Quote
The Dreamcast only has 16Mb of RAM, at first i encountered memory corruption on the images but i was able to reduce it so it is not noticeable.

Is that the reason for the lack of the overlay textures? (Does it actually have 16 Mb (=2 MB) or 16 MB? The classic Nspire has about 8 MiB free with OS 3.9)

Quote
This makes me feel a bit bad, as Vogtinator is not even mentioned in the news, even though he made the game.
I'm already getting threats because they want me to improve the perf of the DC port, not even my GCW0 port got this kind of reception.

Hehe :P If you are able to improve the performance in a upstreamable way, please send patches!
There is certainly a lot of room left, but as I never did any software 3d rendering before nGL I implemented it the most KISS way.

For example, by using spans instead of a z-buffer, only the scanline segments that actually end up on the screen need to be drawn:
https://mikro.naprvyraz.sk/docs/Coding/1/S_BUFFER.TXT

Quote from the DCEmulation forum:
Quote
You should draw arrays of triangles, instead of calling a function for every vertex (glBegin vs. glDrawArrays)

This is already done for the main geometry: https://github.com/Vogtinator/crafti/blob/master/chunk.cpp#L251
  • Calculators owned: TI-Nspie CX CAS, Casio FX-85ES

 


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


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