Weird interplay between scale and lightposition in Makie

I was drawing a surface plot of some configuration of a quantum system, using the following code:

using Makie
l = w = 30.0
p = m = 120
x=l*[(i-0.5)/p-0.5 for i = 1:p] #x ranges in (-15,15)
y=w*[(i-0.5)/m-0.5 for i = 1:m] #y ranges in (-15,15)
scene = Scene()
limits = FRect3D((-1.5, -1.5, 0), (3.0, 3.0, 2.5))
update_limits!(scene, limits)
z = … #data of the configuration stored in a (120,120) array z, ranging in (0, 2.25)
surf = surface!(scene, x/10, y/10, z, colorrange=(-150,50))[end]
wf = wireframe!(scene, x/10, y/10, lift(x->x, surf[3]), transparency=true, color=(:black, 0.1))

Here I divided x and y by 10 because the ranges of x and y are much larger than z, and I didn’t know how to use the scale! method at that time. Then the output was the following image, with a very nice shining effect:


Later I knew the scale! method, so I revised the above code to the following one:

scene = Scene()
scale!(scene, (1,1,10))
limits = FRect3D((-15, -15, 0), (30, 30, 2.5))
update_limits!(scene, limits)
z = … #data of the configuration stored in a (120,120) array z, ranging in (0, 2.25)
surf = surface!(scene, x, y, z, colorrange=(-150,50))[end]
wf = wireframe!(scene, x, y, lift(x->x, surf[3]), transparency=true, color=(:black, 0.1))

In this way, I can get the correct ticks on the x and y axes, but now the output becomes:


The shining effect is gone. I realized that this result may be caused by an improper lightposition parameter, and I saw from somewhere that the default lightposition is Vec3f0(1,2,3), so maybe I should set a lightposition=Vec3f0(10,20,3) in the latter code? However, that proved to have no help (actually made the case even worse). I also tried various kinds of lightposition parameters, without any success. Any solutions suggested?

2 Likes

@photor Hi I just asked a question here on Makie as well. I was told that here doesn’t get much visibility to Makie issues. It was suggested that I join the slack channel for Makie. That said I did get an answer here. I would join the slack channel and if you get and answer post it back here so other user’s can view Q’s and solutions. You can request to join here,

1 Like