Stereogram "HI" + STAR

Post Reply
mapifisher
Posts: 7
Joined: Fri Apr 21, 2023 10:59 pm

Stereogram "HI" + STAR

Post by mapifisher »

100 REM ****** "HI" + STAR
200 REM ***
210 REM *** CODE ADAPTED FROM
220 REM *** PDF PAPER YOU CAN GOOGLE    94-HWT-SI-IHW-SIRDS
230 REM ***
240 SCREEN128
250 CLS
260 E = 2.5
270 MU = 1/3
280 DPI = 60
290 ES = E * DPI
300 PD = 20
310 C = 128
320 H=240
330 W=240
340 DIM D(W),S(W),P(W)
350 SY = H/PD
360 SX = W/PD
370 FOR Y=0 TO H-SY STEP SY
380 REM ***
390 REM COMPUTE IMAGE ONE HORIZONAL LINE AT A TIME
400 REM ***
410 FOR X=0 TO W-SX STEP SX
420 READ DA
430 FOR I=0 TO SX-1
440 D(X+I) = DA
450 NEXT I
460 NEXT X
470 REM ***
480 REM COMPUTE RESTRAINTS
490 REM ***
500 FOR X = 0 TO W-1
510 S(X) = X
520 NEXT X
530 FOR X = 0 TO W-1
540 DP = D(X)
550 SP = INT( (1 - MU * DP) * ES / (2 - MU * DP) + 0.5)
560 L = INT(X-SP/2)
570 R = L + SP
580 IF L < 0 OR R >=  W GOTO 840
590 REM ***
600 REM *** NO CONSTRAINT WHEN NOT VISIBLE IN EITHER EYE
610 REM ***
620 V = 0
630 T = 1
640 ZT = DP + 2 * (2-MU*DP) * T / (MU*ES)
650 V = (D(X-T) < ZT) AND (D(X+T) < ZT)
660 T=T+1
670 REM ***
680 REM *** S() UPDATED GETS CONSTRAINTS
690 REM ***
700 IF V AND (ZT<1) GOTO 640
710 IF NOT V GOTO 840
720 LL = S(L)
730 IF (LL=L) OR (LL=R) GOTO 830
740 IF LL >= R GOTO 780
750 L = LL
760 LL = S(L)
770 GOTO 820
780 S(L) = R
790 L=R
800 LL = S(L)
810 R = LL
820 GOTO 730
830 S(L) = R
840 NEXT X
850 FOR J = 0 TO SY-1
860 REM ***
870 REM *** CREATE P(X) = LINE OF IMAGE
880 REM ***
890 FOR X=W-1 TO 0 STEP -1
900 IF S(X) = X GOTO 930
910 P(X) = P(S(X))
920 GOTO 940
930 P(X) = C * -1 * (RND(1) > 0.5)
940 NEXT X
950 REM ***
960 REM *** PLOT HORIZONTAL LINE OF IMAGE
970 REM ***
980 FOR X=0 TO W-1
990 PSET X,Y+J, P(X)
1000 NEXT X
1010 NEXT J
1020 NEXT Y
1030 REM  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9
1040 REM  =======================================
1050 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1060 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1070 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1080 DATA 0,0,0,1,0,0,1,0,0,1,1,1,0,0,0,0,0,0,0,0
1090 DATA 0,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0
1100 DATA 0,0,0,1,1,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0
1110 DATA 0,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0
1120 DATA 0,0,0,1,0,0,1,0,0,1,1,1,0,0,0,0,0,0,0,0
1130 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1140 DATA 0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0
1150 DATA 0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0
1160 DATA 0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0
1170 DATA 0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0
1180 DATA 0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0
1190 DATA 0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0
1200 DATA 0,0,0,0,0,0,0,1,1,0,1,1,1,0,0,0,0,0,0,0
1210 DATA 0,0,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,0,0,0
1220 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1230 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1240 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Last edited by mapifisher on Sat Apr 22, 2023 4:56 am, edited 1 time in total.
mapifisher
Posts: 7
Joined: Fri Apr 21, 2023 10:59 pm

Stereogram X16 logo

Post by mapifisher »

100 REM *** X16 LOGO
200 REM ***
210 REM *** CODE ADAPTED FROM
220 REM *** PDF PAPER YOU CAN GOOGLE    94-HWT-SI-IHW-SIRDS
230 REM ***
240 SCREEN128
250 CLS
260 E = 2.5
270 MU = 1/3
280 DPI = 60
290 ES = E * DPI
300 PD = 20
310 C = 128
320 H=240
330 W=240
340 DIM D(W),S(W),P(W)
350 SY = H/PD
360 SX = W/PD
370 FOR Y=0 TO H-SY STEP SY
380 REM ***
390 REM COMPUTE IMAGE ONE HORIZONAL LINE AT A TIME
400 REM ***
410 FOR X=0 TO W-SX STEP SX
420 READ DA
430 FOR I=0 TO SX-1
440 D(X+I) = DA / 18
450 NEXT I
460 NEXT X
470 REM ***
480 REM COMPUTE RESTRAINTS
490 REM ***
500 FOR X = 0 TO W-1
510 S(X) = X
520 NEXT X
530 FOR X = 0 TO W-1
540 DP = D(X)
550 SP = INT( (1 - MU * DP) * ES / (2 - MU * DP) + 0.5)
560 L = INT(X-SP/2)
570 R = L + SP
580 IF L < 0 OR R >=  W GOTO 840
590 REM ***
600 REM *** NO CONSTRAINT WHEN NOT VISIBLE IN EITHER EYE
610 REM ***
620 V = 0
630 T = 1
640 ZT = DP + 2 * (2-MU*DP) * T / (MU*ES)
650 V = (D(X-T) < ZT) AND (D(X+T) < ZT)
660 T=T+1
670 REM ***
680 REM *** S() UPDATED GETS CONSTRAINTS
690 REM ***
700 IF V AND (ZT<1) GOTO 640
710 IF NOT V GOTO 840
720 LL = S(L)
730 IF (LL=L) OR (LL=R) GOTO 830
740 IF LL >= R GOTO 780
750 L = LL
760 LL = S(L)
770 GOTO 820
780 S(L) = R
790 L=R
800 LL = S(L)
810 R = LL
820 GOTO 730
830 S(L) = R
840 NEXT X
850 FOR J = 0 TO SY-1
860 REM ***
870 REM *** CREATE P(X) = LINE OF IMAGE
880 REM ***
890 FOR X=W-1 TO 0 STEP -1
900 IF S(X) = X GOTO 930
910 P(X) = P(S(X))
920 GOTO 940
930 P(X) = C * -1 * (RND(1) > 0.5)
940 NEXT X
950 REM ***
960 REM *** PLOT HORIZONTAL LINE OF IMAGE
970 REM ***
980 FOR X=0 TO W-1
990 PSET X,Y+J, P(X)
1000 NEXT X
1010 NEXT J
1020 NEXT Y
1030 REM  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9
1040 REM  =======================================
1050 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1060 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1070 DATA 0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0
1080 DATA 0,0,9,8,0,0,0,0,0,0,0,0,0,0,0,0,8,9,0,0
1090 DATA 0,0,0,8,7,0,0,0,0,0,0,0,0,0,0,7,8,0,0,0
1100 DATA 0,0,0,8,7,6,0,0,0,0,0,0,0,0,6,7,8,0,0,0
1110 DATA 0,0,0,8,7,6,5,0,0,0,0,0,0,5,6,7,8,0,0,0
1120 DATA 0,0,0,0,7,6,5,4,0,0,0,0,4,5,6,7,0,0,0,0
1130 DATA 0,0,0,0,7,6,5,4,3,0,0,3,4,5,6,7,0,0,0,0
1140 DATA 0,0,0,0,0,0,0,0,3,0,0,3,0,0,0,0,0,0,0,0
1150 DATA 0,0,0,0,0,0,0,0,3,0,0,3,0,0,0,0,0,0,0,0
1160 DATA 0,0,0,0,0,0,0,4,3,0,0,3,4,0,0,0,0,0,0,0
1170 DATA 0,0,0,0,0,6,5,4,0,0,0,0,4,5,6,0,0,0,0,0
1180 DATA 0,0,0,0,7,6,5,4,0,0,0,0,4,5,6,7,0,0,0,0
1190 DATA 0,0,0,0,7,6,5,0,0,0,0,0,0,5,6,7,0,0,0,0
1200 DATA 0,0,0,0,7,6,0,0,0,0,0,0,0,0,6,7,0,0,0,0
1210 DATA 0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0
1220 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1230 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1240 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Last edited by mapifisher on Sat Apr 22, 2023 4:57 am, edited 1 time in total.
TomXP411
Posts: 1781
Joined: Tue May 19, 2020 8:49 pm

Re: Stereogram "HI" + STAR

Post by TomXP411 »

Neither one of these seems to work - the emulator just sits there on a white screen.

How long should it take to render these images?

Also, are these programs written for R42 of the emulator and ROM?

edit: Ok, something finally started happening. Maybe adding a message like "it will take xx minutes to start" would help.
mapifisher
Posts: 7
Joined: Fri Apr 21, 2023 10:59 pm

Re: Stereogram "HI" + STAR

Post by mapifisher »

Agree, it's not fast, takes about 20 seconds for 12 lines, so about 240/12*20 seconds = 400 seconds or about 7 minutes to complete a render. But hey, it's an 8-bit machine running BASIC, certainly would have been worth the wait in the 1980s.

If you are using emulator you can use the -warp option when calling x16emu to speed things up.
kelli217
Posts: 531
Joined: Sun Jul 05, 2020 11:27 pm

Re: Stereogram "HI" + STAR

Post by kelli217 »

I made an anaglyph out of it since my eyes don't focus at the same distance so it's tough for me to see these kinds of 3D images.
Attachments
Butterfly3D.png
Butterfly3D.png (15.22 KiB) Viewed 7496 times
mapifisher
Posts: 7
Joined: Fri Apr 21, 2023 10:59 pm

Re: Stereogram "HI" + STAR

Post by mapifisher »

That's cool! How did you do create the anaglyph? Did you change the BASIC program, or use some other tool on a PC?
Ed Minchau
Posts: 503
Joined: Sat Jul 11, 2020 3:30 pm

Re: Stereogram "HI" + STAR

Post by Ed Minchau »

Oh, look, a sailboat.
kelli217
Posts: 531
Joined: Sun Jul 05, 2020 11:27 pm

Re: Stereogram "HI" + STAR

Post by kelli217 »

mapifisher wrote: Mon Apr 24, 2023 4:56 pm That's cool! How did you do create the anaglyph? Did you change the BASIC program, or use some other tool on a PC?
I used Stereo Photo Maker. The best way to look for it is probably to search for "stphmkre". Loaded the same image twice, once as the left image, once as the right image, and used the manual alignment tool to match one background point to the same background point 'over' by one repeating group. Created a grey anaglyph.

(Screwed up which one was which and wound up having to hit the 'swap l/r' button... ah well.)

Cropped it down horizontally to just the outermost edges of the butterfly's wings, and saved it.
voidstar
Posts: 490
Joined: Thu Apr 15, 2021 8:05 am

Re: Stereogram "HI" + STAR

Post by voidstar »

I gotta confess, "I don't get it" - Im not seeing anything but static. Maybe my eyes are just too old now?

Sort of like how my ears can't "hear" CRT's anymore...
Post Reply