Just ordered a festive 8-bit ray traced baubles custom sweater 😂

https://mastodon.me.uk/@bbcmicrobot/111762132859648345

BBC Micro Bot :mastodon: (@[email protected])

Attached: 1 image I ran @coprolite9000's program and got this. Source: https://bbcmic.ro/?t=9ctpk #bbcbasic

mastodon.me.uk
BBC BASIC graphics actually make for great chunky knitwear designs. Who knew
The jacquard loom has come a long way. I would post a link to buy / grift, but that wouldn’t yield enough profit for me to want to compromise the principles of being a strictly money losing endeavor
@bbcmicrobot good commitment to the bit there, well done 😜
@bbcmicrobot there is something exciting about the idea of a bot that turns toots into jumpers though…
The ray traced festive bauble sweater turned out pretty well btw #jacquard #loom

BBC BASIC rendered festive knitwear another world first no one asked for courtesy @bbcmicrobot 🤓

#merry #christmas @coprolite9000

@bbcmicrobot @coprolite9000 Danielle, @quephird , I was thought this could be of interest. Happy Christmas Eve to you!
@bbcmicrobot I spent far too long trying to understand that ray trace program. Still don't get it, it's magic I guess?
Coprolite9000 (@[email protected])

@bbcmicrobot Raytracing core borrowed from other people - I just added some ordered dithering! (Yes, I'm rummaging through my old Twitter archives. This was originally posted back in late 2021...)

mastodon.me.uk

@bbcmicrobot @nske @kweepa It loops over each pixel in the screen in turn and traces a ray for each - line 40 sets up the initial ray then line 50 traces it, testing if it hits the sphere, and if so calculates the reflection angle and loops to trace the reflected ray (via the GOTO50).

Line 60 handles the chequerboard - e.g. if you replace it with V=ABSV the ground is just an inverted version of the sky.

Line 70 sets the colour (with dithering in this version).

The main trick is that there's really only one sphere! It is at coordinates (I,I,I) (that's capital i). For each pixel, I is initially set to 1 if we're tracing the right half of the screen and -1 for the left, then the sign of I is flipped each time the ray reflects of the sphere (since it's not physically possible for a ray bouncing off one sphere to hit that same sphere again without reflecting off the other sphere first.

This one sphere trick can be extended to render more than just two spheres - e.g. I posted a version some time ago with a line of spheres where the coordinates of the sphere get incremented/decremented based on the sign of the direction of the reflected ray. I also have an unposted work in progress which just adds spheres top left and bottom right, but I've haven't yet got all the inter-sphere reflections working right.

@rheolism @bbcmicrobot @nske @kweepa You used GOTO 😮
@cyberspice #bbcmicrobot
0MO.1:DIMS(99):S=S:A=0:P=1:I=PA.+238:MOVE640,512:G.2
1A=(A-N)MOD360
2L=I?-1MOD15:N=VAL$I:REP.I=I+1:U.I?-1DIV16<>3:G.L
4N=P:S(S)=S(S)-1:IFS(S)I=S(S-1)EL.S=S-2
5P=N:G.2
7A=(A+N)MOD360:G.2
9S=S+2:S(S-1)=I:S(S)=N:G.2
10PL.P,COSRADA*N,SINRADA*N:G.2
13REMT12T24F60R15|PF30R30P1|
I ran @rheolism's program and got this.
Source: https://bbcmic.ro/?t=bdS1n #bbcbasic
Owlet BBC BASIC Editor

@cyberspice @rheolism
Why is everyone hating on GOTO when just about every processor has unconditional JMPs?
@bbcmicrobot ...how ...where ...please take my money!
@bbcmicrobot I need that. Where did you order it from?
@bbcmicrobot this would he amazing on a jumper.