* 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: Raymarcher  (Read 1659 times)

0 Members and 1 Guest are viewing this topic.

Offline Snektron

  • Lvl 69 Russian Snake
  • CodeWalrus Staff
  • Super User
  • Topic Management
  • Join Date: Dec 2014
  • Location: Netherlands
  • Posts: 3155
  • Post Rating Ratio: +31/-0
  • SSSssssss.....
    • RobinDeWalvis
    • Kzyrox
    • RobinDeWalvis
    • View Profile
    • quantuminfinity
  • Gender: Male
Raymarcher
« on: May 05, 2015, 10:46:20 am »
So i downloaded pico-8 a few days ago, and i made a shader-like thingy (basically it loops through every pixel and runs a function to get the color).
Ofcourse, i had to make a raymarcher with it:

It contains some vector functions, a few raymarch primitives (only 2 atm), atan, acos, sqrt (which i didnt make), and rgb-to-16-color converter, and some functions for the raymarcher lie getting normals and calculating a diffuse value.
The function "f" in the code makes the scene, the image just shows "return sdSphere(p, 2)" which makes a sphere with a radius of 2.
The variable "ro" is the camera position, and dir is the look direction. "sun" is the light direction. "STEPS" is the max # of steps, MAX_DST the maximum distance and EPS/EPS2 a small edge value. It takes a few sec to render an image, but it turned out pretty nice i think :D
(also press action to end the program when its done, or esc to stop it anytime)

EDIT: so i added the "opRep" function which repeates space and increased the max distance:
« Last Edit: May 05, 2015, 01:20:48 pm by Cumred_Snektron »


  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Offline CKH4

  • Extravagant Sushi
  • Super User
  • Join Date: Jan 2015
  • Location:
  • Posts: 872
  • Post Rating Ratio: +3/-2
    • View Profile
  • Gender: Male
Re: Raymarcher
« Reply #1 on: May 05, 2015, 11:16:07 am »
Can you make it move? How long does it take to draw the second imgae screen? This is very cool and I'll see what I can make with it.
  • Calculators owned: TI-83+, TI-84+


Offline Snektron

  • Lvl 69 Russian Snake
  • CodeWalrus Staff
  • Super User
  • Topic Management
  • Join Date: Dec 2014
  • Location: Netherlands
  • Posts: 3155
  • Post Rating Ratio: +31/-0
  • SSSssssss.....
    • RobinDeWalvis
    • Kzyrox
    • RobinDeWalvis
    • View Profile
    • quantuminfinity
  • Gender: Male
Re: Raymarcher
« Reply #2 on: May 05, 2015, 11:22:49 am »
Well, theoretically you can, and on real shaders its easy, but it takes a relatively long time to render one frame that it would take too long for movement. Also the second one takes like 30 sec or something, quite long :P (a plane takes longer though). You can decrease the render time by lowering the steps and max_dst, though the result would not be as good
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Offline CKH4

  • Extravagant Sushi
  • Super User
  • Join Date: Jan 2015
  • Location:
  • Posts: 872
  • Post Rating Ratio: +3/-2
    • View Profile
  • Gender: Male
Re: Raymarcher
« Reply #3 on: May 05, 2015, 11:31:04 am »
I'll see what I can do with it. I'm going to try anyway on the movement so maybe I'll do a time lapse.
  • Calculators owned: TI-83+, TI-84+


Offline Snektron

  • Lvl 69 Russian Snake
  • CodeWalrus Staff
  • Super User
  • Topic Management
  • Join Date: Dec 2014
  • Location: Netherlands
  • Posts: 3155
  • Post Rating Ratio: +31/-0
  • SSSssssss.....
    • RobinDeWalvis
    • Kzyrox
    • RobinDeWalvis
    • View Profile
    • quantuminfinity
  • Gender: Male
Re: Raymarcher
« Reply #4 on: May 05, 2015, 11:33:12 am »
Cool :) also keep in mind the ray dir still has a few bugs. It doesnt work right when you have any other value than vec3(1,0,0), vec3(0,1,0) or vec3(0,0,1) (i think itssomething with the mormalize function)

EDIT: i've updated the cartridge: The ray dir is now fixed :D. also i've added the sdBox primitive, but i've not really tested it.
« Last Edit: May 05, 2015, 01:22:39 pm by Cumred_Snektron »
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Offline matrefeytontias

  • Full User
  • Join Date: Nov 2014
  • Location: France
  • Posts: 198
  • Post Rating Ratio: +5/-1
  • Axe metalhead of vengence
    • @matrefeytontias
    • matrefeytontias
    • matrefeytontias
    • View Profile
  • Gender: Male
Re: Raymarcher
« Reply #5 on: May 05, 2015, 02:33:44 pm »
Nice :D I like the pixelated look it gives to a raymarcher.
  • Calculators owned: TI-83+.fr, TI-Nspire CAS prototype, TI-84+ CSE, TI-Nspire CX
My TI games (some got their own article on non-calc websites !) : http://www.ticalc.org/archives/files/authors/112/11202.html

My moozik (100% free metal) : http://www.soundcloud.com/matrefeytontias

Offline Snektron

  • Lvl 69 Russian Snake
  • CodeWalrus Staff
  • Super User
  • Topic Management
  • Join Date: Dec 2014
  • Location: Netherlands
  • Posts: 3155
  • Post Rating Ratio: +31/-0
  • SSSssssss.....
    • RobinDeWalvis
    • Kzyrox
    • RobinDeWalvis
    • View Profile
    • quantuminfinity
  • Gender: Male
Re: Raymarcher
« Reply #6 on: May 05, 2015, 02:42:49 pm »
Thanks! and i like that too :)
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


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: 18255
  • 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
Re: Raymarcher
« Reply #7 on: May 06, 2015, 09:53:32 pm »
Woah that looks very cool! That texture above could pretty much be used as pixel art in a sprite sheet O.O
  • 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)
??? ??? ??? ???

 


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