Alternatively, join us on Discord.

[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
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


DJ 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.

Dudeman313

Yes, it is pretty fancy. If you decreased the quality, I bet you could still make a pretty cool rotating Earth model.
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
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


DJ 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


Adriweb

March 16, 2016, 01:43:01 am #5 Last Edit: March 16, 2016, 01:51:41 am by Adriweb
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...)
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.
Does this qualify as a signature? 
The answer is "Sure."


Adriweb

March 16, 2016, 01:51:33 am #7 Last Edit: March 16, 2016, 01:57:15 am by Adriweb
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
Co-founder & co-administrator of TI-Planet and Inspired-Lua

DJ 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

Adriweb

March 16, 2016, 03:03:08 am #9 Last Edit: March 16, 2016, 03:43:50 am by Adriweb
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
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
Does this qualify as a signature? 
The answer is "Sure."


DJ Omnimaga

By the way, how fast is it if you only use a 40x30 area of the screen then scale it up?

Adriweb

Using 8bpp anyway, it'd be much faster.
And combined to smaller+zoomed... yeah it might even become acceptably fast/slow.
Co-founder & co-administrator of TI-Planet and Inspired-Lua

DJ 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.

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
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Powered by EzPortal