MakieOrg / Makie.jl

Interactive data visualizations and plotting in Julia
https://docs.makie.org/stable
MIT License
2.4k stars 306 forks source link

GLMakie doesn't correctly use 2D to 3D transforms with the `surface` recipe #2890

Open asinghvi17 opened 1 year ago

asinghvi17 commented 1 year ago

Example:

f, a, p = surface(-180..180, -90..90, rand(100, 100); axis = (; type = LScene));
using Geodesy
mesh_transform = Makie.PointTrans{3}() do p::Point3
    return Point3f((ECEFfromLLA(WGS84())(LLA(p[2], p[1], p[3])) ./ 5f4)...) # use a scale factor to let the image be seen
end 
p.transformation.transform_func[] = mesh_transform
f
Screenshot 2023-04-22 at 10 10 00 PM

and CairoMakie (and WGLMakie) give: download-4

It might be that it isn't taking the 3D ness into account. The figure was displayed only after the transform func was changed, though.

Meshes seem to work fine - indicating that there is some peculiarity about the surface implementation.

ffreyer commented 1 year ago

https://github.com/MakieOrg/Makie.jl/blob/84a1cdf49d718f19b6fee36978c265fa1ad3ab03/GLMakie/src/drawing_primitives.jl#L571-L588 This is only doing a Point2 transform. Adding mat into this and unpacking it afterwards should fix this

asinghvi17 commented 1 year ago

Thanks! Will try to PR that on the flight today (I need to stay up somehow and this should help :D)

ffreyer commented 1 month ago

This may have been fixed by Float32/64 changes

asinghvi17 commented 1 month ago

Looks like WGLMakie is fine with it but GLMakie is not.

(Sidenote: it's super cool that camera updates propagate between a scene displayed using 2 different backends :D)

https://github.com/user-attachments/assets/401e6f53-60ac-439a-af5a-056a1f441278