set pm3d depth lighting primary 0.7 specular 0.5
set object 1 rect from sc 0,0 to sc 1,1 behind fc "#114400"
set palette defined (0 "#9999ff", 0.5 "#990000", 1 "#cc9900")
set samples 128
set isosamples 64
unset border
unset tics
unset colorbox
unset key
set xyplane 0
set term pngcairo size 480,240
set out "stereogram.png"
set parametric

c = 5
set urange [-pi/128:pi]
set vrange [-pi:pi]
set xrange[-c+3:c+3]
set yrange[-c-3:c-3]
set zrange[-c+1.5:c+1.5]

x(u,v) = sin(u)*cos(v)
y(u,v) = sin(u)*sin(v)
z(u,v) = cos(u)
xt(u,v) = (pi-u)*cos(v)/pi
yt(u,v) = (pi-u)*sin(v)/pi
zt(u,v) = u

R0 = 0.5
set multiplot
set origin 0.05,0
set view 70, 2, 2.0, 2.8
splot \
'++' u (x($1,$2)):(y($1,$2)-5):(z($1,$2)+0.5):(1) w pm3d,\
'++' u (xt($1,$2)):(yt($1,$2)):(zt($1,$2)):(0) w pm3d,\
'++' u (R0*x($1,$2)):(R0*y($1,$2)-1):(R0*z($1,$2)+2):(0.5) w pm3d
unset object 1
set origin 0.55,0
set view 70, 5, 2.0, 2.8
splot \
'++' u (x($1,$2)):(y($1,$2)-5):(z($1,$2)+0.5):(1) w pm3d,\
'++' u (xt($1,$2)):(yt($1,$2)):(zt($1,$2)):(0) w pm3d,\
'++' u (R0*x($1,$2)):(R0*y($1,$2)-1):(R0*z($1,$2)+2):(0.5) w pm3d
unset multiplot