Fresnel
Mix.install([
{:plotly_ex, "~> 0.3"},
{:kino, "~> 0.18"}
])
Section
lighting.fresnel controls how much light the surface reflects at glancing
angles (edges of the surface). High values make the edges appear brighter than
the center — a common effect in physically-based rendering. Range is 0.0 to
5.0. Default is 0.2.
alias Plotly.{Figure, Surface}
z = for i <- 0..24 do
for j <- 0..24 do
r = :math.sqrt((i - 12) * (i - 12) + (j - 12) * (j - 12))
if r < 12, do: :math.sqrt(max(0, 144 - r * r)), else: 0
end
end
Figure.new()
|> Figure.add_trace(Surface.new(z: z, colorscale: "RdBu", lighting: %{fresnel: 0.2}))
|> Figure.update_layout(title: "Fresnel: 0.2 (default, subtle edge glow)")
|> Plotly.show()
Figure.new()
|> Figure.add_trace(Surface.new(z: z, colorscale: "RdBu", lighting: %{fresnel: 5.0}))
|> Figure.update_layout(title: "Fresnel: 5.0 (bright edge reflection)")
|> Plotly.show()