#
# pm3d lighting model with specular highlighting
#
unset key
unset border
unset colorbox
set view 33, 291, 1.2, 1.3
set bmargin 0
set tmargin 0
set samples 200, 200
set isosamples 200, 200
set xyplane -0.05
set format ""
set grid x y lt black
unset ztics
set urange [ -20. : 20. ]
set vrange [ -20. : 20. ]
set zrange [ -0.25 : 0.5 ]

set style fill solid 1.00 noborder
set pm3d implicit at s depth noborder

slice(x,y) = (x**2+y**2 < 10.0) ? 1.0 : (x**2+y**2 > 300.0) ? NaN : sin(abs(atan2(x,y)))
sinc2(x,y) = sin(sqrt(x**2+y**2))/sqrt(x**2+y**2)
flatten(x,y) = sqrt(x**2+y**2)/5.
F(x,y) =  sinc2(x,y) * slice(x,y) * flatten(x,y)

set title "pm3d lighting model with specular highlighting"
set pm3d lighting primary 0.5 specular 0.2
splot '++' using 1:2:(F($1,$2)):(0xAAEEEE) nosurface lc rgb variable

pause -1 "Hit <return> to continue"
reset

set title "PM3D surfaces with specular highlighting"

unset border
unset key
set object 1 rect from screen 0, 0, 0 to screen 1, 1, 0 behind 
set object 1 rect fc  rgb "gray"  fillstyle solid 1.0  border -1
set view 236, 339, 1.245, 1.0
set isosamples 75, 75
unset xtics
unset ytics
unset ztics
set parametric
set dummy u,v
set urange [ -pi : pi ]
set vrange [ -pi : pi ]

set palette rgbformulae 8, 9, 7
set style fill solid 1.0 noborder
set pm3d depthorder noborder
set pm3d lighting specular 0.6

splot cos(u)+.5*cos(u)*cos(v),sin(u)+.5*sin(u)*cos(v),.5*sin(v) with pm3d, \
    1+cos(u)+.5*cos(u)*cos(v),.5*sin(v),sin(u)+.5*sin(u)*cos(v) with pm3d

pause -1 "Hit return to continue"
reset
