# Transitioning 3D surface plot to Makie v0.20

**URL:** <https://discourse.julialang.org/t/transitioning-3d-surface-plot-to-makie-v0-20/106928>\
**Category:** Visualization\
**Tags:** plotting, makie\
**Created:** [November 30, 2023, 5:38am UTC](https://discourse.julialang.org/t/transitioning-3d-surface-plot-to-makie-v0-20/106928 "2023-11-30T05:38:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yhchang96](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yhchang96/32/36499_2.png) [@yhchang96](https://discourse.julialang.org/u/yhchang96)\
**Post date:** [November 30, 2023, 5:38am UTC](https://discourse.julialang.org/t/transitioning-3d-surface-plot-to-makie-v0-20/106928/1 "2023-11-30T05:38:10Z")

</div>

I had a figure which consists of multiple 3D surface plots. The script looks something like

```julia
using CairoMakie; CairoMakie.activate!()

update_theme!(Surface = (diffuse = Vec3f(1,0), specular = Vec3f(0.2), shading = true))

fig = Figure()
g = GridLayout(fig[1,1])

update_theme!(light_direction = Vec3f(1,2,3))
ax1 = Axis3(g[1,1], elevation=pi*30/180)
surface!(ax1, x, y, z1)

update_theme!(light_direction = Vec3f(-3,2,1)) # update lighting for another surface plot
ax2 = Axis3(g[1,2], elevation=pi*40/180)
surface!(ax2, x, y, z2)

fig

```

With the recent release of Makie v0.20, what’s the proper way to set the light direction? After reading the documentation, apparently I need to change `shading=FastShading` or something else, but I can’t quite figure out the light direction. I tried something like `ax1.scene.lights = [DirectionalLight(RGBf(1,1,1), Vec3f(1,2,3))]`, but the 3D plot looks black regardless of the RGB and the Vec3f.

---

<div class="post-metadata">

**Author:** ![ffreyer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ffreyer/32/21569_2.png) [@ffreyer](https://discourse.julialang.org/u/ffreyer)\
**Post date:** [November 30, 2023, 10:46am UTC](https://discourse.julialang.org/t/transitioning-3d-surface-plot-to-makie-v0-20/106928/2 "2023-11-30T10:46:56Z")

</div>

`shading` is automatically determined by the lights you have in a scene so you don’t need to set it here. You only need to when you want something different to the default, e.g. no shading on a surface plot or shading on a poly plot.

For the light direction it’s easy to trip over the numbers you want. If you want a light source straight above your plot, then the light is shining down so the direction is `Vec3f(0, 0, -1)`.

Setting `ax1.scene.lights = [DirectionalLight(RGBf(1,1,1), Vec3f(1,2,3))]` will leave you with a directional light going diagonally up and no ambient light. So you should see the side facing -z illuminated by the directional light and the side facing +z completely black.
