CodeWalrus

Development => PC, Mac & Vintage Computers => Topic started by: Snektron on March 15, 2016, 09:39:11 PM

Title: [C] CE Raymarching
Post by: Snektron on March 15, 2016, 09:39:11 PM
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 :)

(http://i.imgur.com/kSpzNf6.png)

(http://i.imgur.com/gJutRdG.png)

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
Title: Re: CE Raymarching
Post by: Dream of 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?

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.
Title: Re: [C] CE Raymarching
Post by: Dudeman313 on March 15, 2016, 09:56:08 PM
Yes, it is pretty fancy. If you decreased the quality, I bet you could still make a pretty cool rotating Earth model.
Title: Re: [C] CE Raymarching
Post by: Snektron on March 15, 2016, 10:06:09 PM
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
Title: Re: CE Raymarching
Post by: Dream of Omnimaga on March 15, 2016, 10:17:52 PM
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

(http://img.ourl.ca/1404906982.gif)
Title: Re: CE Raymarching
Post by: 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 (https://tiplanet.org/pb/?id=1381_1457422033_3d129a21b9) - maybe one day I'll have it directly linked to GitHub...)
Title: Re: [C] CE Raymarching
Post by: Dudeman313 on March 16, 2016, 01:50:54 AM
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.
Title: Re: CE Raymarching
Post by: Adriweb on March 16, 2016, 01:51:33 AM
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
Title: Re: CE Raymarching
Post by: Dream of Omnimaga on March 16, 2016, 02:10:47 AM
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
Title: Re: CE Raymarching
Post by: Adriweb on March 16, 2016, 03:03:08 AM
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
Title: Re: [C] CE Raymarching
Post by: Dudeman313 on March 16, 2016, 03:42:19 AM
Something tells me it's a good thing I didn't try to send this to my calculator... O.O
Title: Re: CE Raymarching
Post by: Dream of Omnimaga on March 16, 2016, 04:24:20 AM
By the way, how fast is it if you only use a 40x30 area of the screen then scale it up?
Title: Re: CE Raymarching
Post by: Adriweb on March 16, 2016, 04:26:38 AM
Using 8bpp anyway, it'd be much faster.
And combined to smaller+zoomed... yeah it might even become acceptably fast/slow.
Title: Re: CE Raymarching
Post by: Dream of Omnimaga on March 16, 2016, 04:28:44 AM
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.
Title: Re: [C] CE Raymarching
Post by: Snektron on March 16, 2016, 03:29:29 PM
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 (https://tiplanet.org/pb/?id=1381_1457422033_3d129a21b9) - 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
Title: Re: [C] CE Raymarching
Post by: Dudeman313 on March 21, 2016, 01:54:45 PM
Quote from: Cumred_Snektron on March 16, 2016, 03:29:29 PM
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 (https://tiplanet.org/pb/?id=1381_1457422033_3d129a21b9) - 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
I'd want to see it. :)
Title: Re: CE Raymarching
Post by: Dream of Omnimaga on March 21, 2016, 08:19:16 PM
Quote from: Cumred_Snektron on March 16, 2016, 03:29:29 PM
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 (https://tiplanet.org/pb/?id=1381_1457422033_3d129a21b9) - 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
I hope the only alternate way is not to make resolution 4x3 @Cumred_Snektron <_<