Join us on Discord!
You can help CodeWalrus stay online by donating here.

[C] CE Raymarching

Started by Snektron, March 15, 2016, 09:39:11 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Snektron

So i while ago i wanted to try out CE C programming. Since the CE has float support and a color screen i made a little ray marcher :)





You can view the source too:
https://github.com/Snektron/CERM
I recommend trying this out on an emulator, since it takes quite a while to generate an image.
The attached file is one made for an emulator. Since CE will freeze if it exits a program at maximum speed i've put a while(1); loop
so it doesnt quit in the program, but if you want to run it on an actual calculator you wil have to remove it and build it yourself :P
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Dream of Omnimaga

This looks cool. I wonder how long does it take to generate the image? Also why is the floor in the 2nd screenshot glitchy? Also can't you slow down the calculator before exiting to prevent crashes?

Anyway, I am curious about if this could be of any use if the quality was decreased considerably to save speed. It's definitively looking cool.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Dudeman313

Yes, it is pretty fancy. If you decreased the quality, I bet you could still make a pretty cool rotating Earth model.
  • Calculators owned: TI-84 PCE
  • Consoles, mobile devices and vintage computers owned: Android O Phone
Does this qualify as a signature? 
The answer is "Sure."


Snektron

On 100% speed it takes more than 10m to draw the model i think, so real time will be pretty impossible.
Quote from: DJ Omnimaga on March 15, 2016, 09:49:20 PM
This looks cool. I wonder how long does it take to generate the image? Also why is the floor in the 2nd screenshot glitchy? Also can't you slow down the calculator before exiting to prevent crashes?
The floor is glitchy because it doesnt have a high number of iterations. The calculator speed is set by the user, but i thought nobody wants to wait 15 min for an image :P
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Dream of Omnimaga

Aah ok. I was wondering since the sphere looked perfect while the floor didn't look as good.

You should try doing polygon 3D or even mode 7 stuff. Maybe even raycasting, since those would be more than fast enough on that calculator, especially in low color mode. :) @tr1p1ea once made a mode-7 engine for the CSE

  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Adriweb

#5
I made your program much faster (well, it's still slow, but...) by macro'ing stuff :)
PR on GitHub: https://github.com/Snektron/CERM/pull/1

(If you have a TI-Planet account, you can open the project in the online builder - maybe one day I'll have it directly linked to GitHub...)
  • Calculators owned: TI-Nspire CX CAS, TI-Nspire CX, TI-Nspire CAS (x3), TI-Nspire (x2), TI-Nspire CM-C CAS, TI-Nspire CAS+, TI-80, TI-82 Stats.fr, TI-82 Plus, TI-83 Plus, TI-83 Plus.fr USB, TI-84+, TI-84+ Pocket SE, TI-84+ C Silver Edition, TI-84 Plus CE, TI-89 Titanium, TI-86, TI-Voyage 200, TI-Collège Plus, TI-Collège Plus Solaire, 3 HP, some Casios
Co-founder & co-administrator of TI-Planet and Inspired-Lua

Dudeman313

Did you also remove the loop, so I can try it on my CE?
I would do it myself, but I can't because I'm afraid I'd do something terribly wrong by mistake, and I'm on my Nokia E63.
  • Calculators owned: TI-84 PCE
  • Consoles, mobile devices and vintage computers owned: Android O Phone
Does this qualify as a signature? 
The answer is "Sure."


Adriweb

#7
Well, I realized I made a mistake, I'm fixing it for now.
The infinite loop is still there, I'll attach a version without it.

Edit: there
  • Calculators owned: TI-Nspire CX CAS, TI-Nspire CX, TI-Nspire CAS (x3), TI-Nspire (x2), TI-Nspire CM-C CAS, TI-Nspire CAS+, TI-80, TI-82 Stats.fr, TI-82 Plus, TI-83 Plus, TI-83 Plus.fr USB, TI-84+, TI-84+ Pocket SE, TI-84+ C Silver Edition, TI-84 Plus CE, TI-89 Titanium, TI-86, TI-Voyage 200, TI-Collège Plus, TI-Collège Plus Solaire, 3 HP, some Casios
Co-founder & co-administrator of TI-Planet and Inspired-Lua

Dream of Omnimaga

Now I see what Cumred meant about being too slow to be of practical use O.O (I have CEmu set at 500% speed and it takes like 4 seconds to render one column of pixels using Adriweb's faster version. O.O
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Adriweb

#9
Oh yeah. It's still slow even unthrottled (more than 1200% for me - which makes it like around 0.5s for one line)

Edit: err, I meant 0.5s not 5s :P
  • Calculators owned: TI-Nspire CX CAS, TI-Nspire CX, TI-Nspire CAS (x3), TI-Nspire (x2), TI-Nspire CM-C CAS, TI-Nspire CAS+, TI-80, TI-82 Stats.fr, TI-82 Plus, TI-83 Plus, TI-83 Plus.fr USB, TI-84+, TI-84+ Pocket SE, TI-84+ C Silver Edition, TI-84 Plus CE, TI-89 Titanium, TI-86, TI-Voyage 200, TI-Collège Plus, TI-Collège Plus Solaire, 3 HP, some Casios
Co-founder & co-administrator of TI-Planet and Inspired-Lua

Dudeman313

Something tells me it's a good thing I didn't try to send this to my calculator... O.O
  • Calculators owned: TI-84 PCE
  • Consoles, mobile devices and vintage computers owned: Android O Phone
Does this qualify as a signature? 
The answer is "Sure."


Dream of Omnimaga

By the way, how fast is it if you only use a 40x30 area of the screen then scale it up?
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Adriweb

Using 8bpp anyway, it'd be much faster.
And combined to smaller+zoomed... yeah it might even become acceptably fast/slow.
  • Calculators owned: TI-Nspire CX CAS, TI-Nspire CX, TI-Nspire CAS (x3), TI-Nspire (x2), TI-Nspire CM-C CAS, TI-Nspire CAS+, TI-80, TI-82 Stats.fr, TI-82 Plus, TI-83 Plus, TI-83 Plus.fr USB, TI-84+, TI-84+ Pocket SE, TI-84+ C Silver Edition, TI-84 Plus CE, TI-89 Titanium, TI-86, TI-Voyage 200, TI-Collège Plus, TI-Collège Plus Solaire, 3 HP, some Casios
Co-founder & co-administrator of TI-Planet and Inspired-Lua

Dream of Omnimaga

Yeah I suggested lower color depth before, even 4bpp, but wouldn't that still involve rendering 320x240 pixels? My idea was to lower the resolution to reduce how many pixels need to be computed.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Snektron

Quote from: Adriweb on March 16, 2016, 01:43:01 AM
I made your program much faster (well, it's still slow, but...) by macro'ing stuff :)
PR on GitHub: https://github.com/Snektron/CERM/pull/1

(If you have a TI-Planet account, you can open the project in the online builder - maybe one day I'll have it directly linked to GitHub...)
Thanks! :)

Also the project was more to test the color capabillities of the CE, i could probably make something that runs way faster but i'll have to do that in another way :P
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Powered by EzPortal