Ray tracing in a tweet

new graphics/music demos - bitshifters, 0xc0de, The Master + others
Post Reply
Kweepa
Posts: 24
Joined: Mon Dec 16, 2013 11:45 pm
Contact:

Ray tracing in a tweet

Post by Kweepa » Wed Sep 16, 2020 4:19 pm

https://twitter.com/bbcmicrobot/status/ ... 9258853379

(For some reason I called it ray casting...)

Code: Select all

1MO.2:P.'" Ray caster":H=.23:J=H*H:F.V=4TO32:F.U=0TO19:X=(U-10)/10:Y=(16-V)/20:Z=1/SQR(X*X+Y*Y+1):X=X*Z:Y=Y*Z
2D=4*Z*Z+J*Y*Y-3-J:B=0:IFD>0T=2*Z-H*Y-SQRD:X=T*X:Y=T*Y+H:Z=T*Z-2:B=4
3IFY<0P=(Y+2)/Y:C=((INT(X*P)+INT(Z*P))A.1)+B:EL.C=6:IFD>0C=C-(RND(1)>1-X-Y+Z)
4C.128+C:V.32:N.,
A high res version, and the result 30 minutes later:

Code: Select all

1MO.2:F.V=255TO0S.-1:F.U=0TO159:X=(U-80)/80:Y=(V-128)/160:Z=1/SQR(X*X+Y*Y+1):X=X*Z:Y=Y*Z
2D=4*Z*Z+.04*Y*Y-3.04:B=0:IFD>0T=2*Z-.2*Y-SQRD:X=T*X:Y=T*Y+.2:Z=T*Z-2:B=4
3IFY<0P=(Y+2)/Y:C=((INT(X*P)+INT(Z*P))A.1)+B:EL.C=6:IFD>0C=C-(RND(1)>1-X-Y+Z)
4GC.0,C:PL.69,8*U,4*V:N.,
beebraycast.png

User avatar
BigEd
Posts: 3336
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Ray tracing in a tweet

Post by BigEd » Wed Sep 16, 2020 5:01 pm

Splendid!

User avatar
Diminished
Posts: 490
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Ray tracing in a tweet

Post by Diminished » Wed Sep 16, 2020 5:35 pm

Classy.

Is the floor meant to be curved?

Kweepa
Posts: 24
Joined: Mon Dec 16, 2013 11:45 pm
Contact:

Re: Ray tracing in a tweet

Post by Kweepa » Wed Sep 16, 2020 7:24 pm

Yes?
No. :(

I must admit I didn't look into it too carefully.

EDIT: this fixes it (note the addition of H).

Code: Select all

1MO.2:F.V=0TO255:F.U=0TO159:X=(U-80)/80:Y=(V-128)/160:Z=1/SQR(X*X+Y*Y+1):X=X*Z:Y=Y*Z:H=2.2
2D=4*Z*Z+.04*Y*Y-3.04:B=0:IFD>0T=2*Z-.2*Y-SQRD:X=T*X:Y=T*Y+.2:Z=T*Z-2:B=4:H=2+Y
3IFY<0P=H/Y:C=((INT(X*P)+INT(Z*P))A.1)+B:EL.C=6:IFD>0C=C-(RND(1)>1-X-Y+Z)
4GC.0,C:PL.69,8*U,4*V:N.,
Last edited by Kweepa on Wed Sep 16, 2020 7:39 pm, edited 1 time in total.

User avatar
0xC0DE
Posts: 654
Joined: Tue Mar 19, 2019 7:52 pm
Location: The Netherlands
Contact:

Re: Ray tracing in a tweet

Post by 0xC0DE » Wed Sep 16, 2020 7:29 pm

Awesome! I saw it already on Twitter of course =D>
0xC0DE
"I program my home computer / Beam myself into the future"
:arrow: Follow me on Twitter
:arrow: Visit my YouTube channel featuring my demos for Acorn Electron and BBC Micro

Post Reply

Return to “new projects and releases: demoscene”