-
-
Notifications
You must be signed in to change notification settings - Fork 317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
weird interplay between scale and lightposition #600
Comments
Oh... that's likely because we don't scale the normals correctly... |
You could try generating and plotting a mesh instead of the surface plot using GeometryBasics
vertices = Point3f0.(x, y, z)[:]
N, M = size(x)
lin = LinearIndices(x)
faces = [QuadFace(
lin[i, j], lin[i+1, j], lin[i+1, j+1], lin[i, j+1]
) for i in 1:N-1 for j in 1:M-1]
m = normal_mesh(vertices, faces)
mesh!(scene, m, color=z) If that fixes it then this is might also be a problem caused by using uv coordinates here. |
Thanks. Then I tried the follow code:
and got the output: |
BTW, is there a simple way to get a single color plot using surface! ? The keyword argument like color=:orange used in mesh! doesn't work for surface! |
I think you can do The second mesh plot looks like the normals are inverted. If you do faces = [QuadFace(
lin[i, j], lin[i, j+1], lin[i+1, j+1], lin[i+1, j]
) for i in 1:N-1 for j in 1:M-1] that should get fixed. But that doesn't solve your problem. I think Simon is right - there is something wrong with how GLMakie applies the scaling. |
I think this is already be fixed on the SSAO branches (regardless of whether you use SSAO). You could try with JuliaPlots/AbstractPlotting.jl#424 and JuliaPlots/GLMakie.jl#97. |
Yes, you are right. |
Looks fine to me now, both with scaling the plot and scaling the scene. |
I was drawing a surface plot of some configuration of a quantum system, using the following code:
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:
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?
The text was updated successfully, but these errors were encountered: