Surface normals not properly transformed by markersize
scaling.
#3702
Labels
bug
CairoMakie
This relates to CairoMakie, the vector backend for Makie based on Cairo.
GLMakie
This relates to GLMakie.jl, the OpenGL backend for Makie.
good first issue
WGLMakie
This relates to WGLMakie.jl, the Web-based WebGL backend for Makie.
To draw an ellipsoid, one can start with a sphere mesh and apply an anisotropic scaling via
markersize
:The shading is wrong because the surface normals have not been properly transformed. @ffreyer pointed out on Slack that only one line of the GLMakie vertex shader should be changed:
Makie.jl/GLMakie/assets/shader/particles.vert
Line 103 in 14b65a0
This line should read
vec3 N = normals / s;
. That is, it should include an element-wise division by the scaling factors. With this fix, I get the correct visual result:Presumably a similar change is needed for WGLMakie and CairoMakie, on these lines:
Makie.jl/WGLMakie/assets/particles.vert
Line 37 in 14b65a0
Makie.jl/CairoMakie/src/primitives.jl
Line 940 in 14b65a0
Below is a derivation explaining why its appropriate to divide by the scale factors.
The text was updated successfully, but these errors were encountered: