# CairoMakie invert\_normals = true not working

**URL:** <https://discourse.julialang.org/t/cairomakie-invert-normals-true-not-working/104496>\
**Category:** Visualization\
**Created:** [October 2, 2023, 11:48am UTC](https://discourse.julialang.org/t/cairomakie-invert-normals-true-not-working/104496 "2023-10-02T11:48:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![p\_f](https://avatars.discourse-cdn.com/v4/letter/p/45deac/32.png) [@p\_f](https://discourse.julialang.org/u/p_f)\
**Post date:** [October 2, 2023, 11:48am UTC](https://discourse.julialang.org/t/cairomakie-invert-normals-true-not-working/104496/1 "2023-10-02T11:48:39Z")

</div>

When plotting surfaces using CairoMakie they appear dull because invert\_normals = true doesn’t seem to work.

MWE: code that plots an open sphere using GLMakie and CairoMakie, with invert\_normals=true/false, and saves a png image. The CairoMakie spheres are lit on the inside with both invert\_normals=true and false.

```julia
using GLMakie,CairoMakie

function get_sphere_mesh(N,x0,a)
    X(r,theta,phi) = r * sin(theta) * sin(phi)
    Y(r,theta,phi) = r * sin(theta) * cos(phi)
    Z(r,theta,phi) = r * cos(theta)

    thetas = range(0.3*pi, stop=pi, length=N)
    phis = range(0, stop=2*pi, length=N)

    xs = a.*[X(1, theta, phi) for theta in thetas, phi in phis] .+ x0[1]
    ys = a.*[Y(1, theta, phi) for theta in thetas, phi in phis] .+ x0[2]
    zs = a.*[Z(1, theta, phi) for theta in thetas, phi in phis] .+ x0[3]
    
    return [xs,ys,zs]
end

GLMakie.activate!(inline=true)
f = Figure()
ax1 = Axis3(f[1,1],aspect=:data,title="GLMakie, invert_normals = true")
surface!(ax1,get_sphere_mesh(100,[0,0,0],0.1)...,invert_normals=true)
ax2 = Axis3(f[1,2],aspect=:data,title="GLMakie, invert_normals = false")
surface!(ax2,get_sphere_mesh(100,[0,0,0],0.1)...,invert_normals=false)
save("GLMakie_example.png",f)

CairoMakie.activate!(inline=true)
f = Figure()
ax1 = Axis3(f[1,1],aspect=:data,title="CairoMakie, invert_normals = true")
surface!(ax1,get_sphere_mesh(100,[0,0,0],0.1)...,invert_normals=true)
ax2 = Axis3(f[1,2],aspect=:data,title="CairoMakie, invert_normals = false")
surface!(ax2,get_sphere_mesh(100,[0,0,0],0.1)...,invert_normals=false)
save("CairoMakie_example.png",f)

```

My output:

 ![GLMakie_example](https://global.discourse-cdn.com/julialang/original/3X/7/0/70b674bcb374e5425afe089ad71727d64d5e1d91.png)  
 ![CairoMakie_example](https://global.discourse-cdn.com/julialang/original/3X/b/0/b09b170b413aa8c941d4515422e3027766ab82d1.png)

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [October 2, 2023, 12:50pm UTC](https://discourse.julialang.org/t/cairomakie-invert-normals-true-not-working/104496/2 "2023-10-02T12:50:46Z")

</div>

Seems like a bug in CairoMakie, could you open an issue?
