Light shading for 'inverted' surface plot in GLMakie

If I want to plot an ‘inverted’ surface, like the cupcake mold in the top figure below.

I set the light directions to be

lights = [
        AmbientLight(RGBf(1, 1, 1)),
        SpotLight(0.4*RGBf(1, 1, 1), Point3f(10, 0, 2.5), Vec3f(-1,  0, -0.1), Vec2f(0.25pi, 0.25pi))

I haven’t optimized the lighting effects yet, but right now it’s coming from the right side of the screen. Notice that the lighting for the upper gray mold is incorrect: the inverted protrusion should be lighted, and the inner region should be dark, but I guess it has problems calculating the unit normal to the surface?

For the bottom plot, I invert the mold, and the shading is correct: the right side of the surface, which is facing the light source, becomes brighter. Are there any ways to make the lighting correct for the top plot with the inverted surface?

So after some trial and error I think I have a temporary fix:

X = ones(length(y)) .* x'
Y = y .* ones(length(x))'

surface!(ax, X, Y, Z)
surface!(ax, X', Y', Z .+ 0.01)

So apparently the unit normal of the surface depends on the x and y coordinate, so by transposing the X and Y matrix I either get correct lighting for the outer (inverted protrusion) or the inner surface. So if I plot two identical surface Z but with different X and Y, with the surface defining the ‘correct’ inner lighting slightly above the one for the outer surface, then at least qualitatively I get the correct lighting.

Still it would be nice if there is a better way to achieve the same effect.

You can set invert_normals = true to get lighting on the other side or set backlight = 1 to get lighting on both sides