# Light position for 3D surface plots with bands

I tried following the example in this tutorial to create a 3D surface plot with a ‘side band’:

``````using GLMakie; GLMakie.activate!()   # v.0.8.2

cmap = Reverse(:Spectral_4)
lightpos1 = Vec3f(4, -5, 5)

set_theme!()
update_theme!(
lightposition = lightpos1,
Axis3 = (protrusions = 0, elevation = pi/4, azimuth = -pi/3),
Surface = (specular = Vec3f(0.2), shading = true, diffuse = Vec3f(0.8)),
Band = (specular = Vec3f(0.2), shading = true, diffuse = Vec3f(0.8)),
)

# generate data for sample plot:
x = range(-3, 3, length=100)
y = range(-2, 2, length=100)
z = [sin(x + y^2) for x in x, y in y]
xpt = [x for x in x, y in y]
ypt = [y for x in x, y in y];

function boundary_values(a)
return [a[1,:]..., a[2:end,end]..., a[end,end-1:-1:1]...,a[end-1:-1:1,1]...]
end

bxpt = boundary_values(xpt)
bypt = boundary_values(ypt)
bzpt = boundary_values(z)

upper = Point3f.(bxpt, bypt, bzpt)
lower = Point3f.(bxpt, bypt, bzpt*0.0 .+ minimum(bzpt))
lower_colors = bzpt*0.0 .+ minimum(bzpt);

###########################################################################################

fig = Figure()
ax  = Axis3(fig[1,1]; aspect =(1,1,0.5))

surface!(ax, xpt, ypt, z; colormap=cmap, shading=true)
band!(ax, lower, upper; color = [lower_colors..., bzpt...], colormap=cmap)

fig
``````

The results look like this:

Since I set the `lightposition` to `Vec3f(4, -5, 5)`, I expect a light source located at `(x,y,z)=(4,-5,5)` (please correct me if I misinterpret `lightposition`). From the figure, it does look like the light source comes from somewhere near the specified coordinates based on the color shading, but the color shading at the side bands doesn’t look right. When I rotate the 3D plot in the pop-up window to inspect the color shading, it looks like the apparent light position for the `band` is rotated by 180 degree in the x-y plane compared to that for the `surf`:

Is this a bug or are there some tricks in setting the light position?

Probably the normals are flipped the other way. Maybe you can specify the side bands with x and y reversed?