Skip to the content
The light

The light

Kaustics has one point light, and it has a size. That is what makes shadows soft, and what makes caustics sharp near what throws them and softer the further the light travels, as they are under a real bulb.

Swift
KausticsLight(
    position: [1.6, 0.7, 1.4],
    color: [1, 0.95, 0.88],
    intensity: 12,
    radius: 0.025)
Property Default Meaning
position [0, 2, 0] Where the light is, in world space.
color [1, 1, 1] Its color, linear.
intensity 4 Its strength: the irradiance one unit away.
radius 0.03 Its radius, in world units.

#Intensity

Irradiance falls off with the square of the distance. A surface d units away, facing the light, receives color * intensity / (d * d). Move the light twice as far away and it gives a quarter of the light, so it needs four times the intensity to look as bright.

The caustic texture is in the same units, so caustics and direct light add up correctly. See Your own Metal pipeline.

#Radius

A larger radius casts softer shadows and blurs caustics more the further they travel. A very small one keeps caustics sharp. The demo’s light size slider runs from 0.002 to 0.15.

How the radius turns into blur is in How it works.

#Values to start from

These are the values the demo uses.

Scene intensity radius color Distance to the pivot
Ring 8 0.025 [1, 0.95, 0.88] 1.7
Still life 8 0.025 [1, 0.95, 0.88] 2.0
Glass 3 0.015 [1, 0.95, 0.88] 1.7
Prism 10 0.004 [1, 1, 1] 1.6
Pool 55 0.04 [1, 0.97, 0.92] 5

#Moving it

In a KausticsView, dragging moves the light around scene.lightPivot. You can also set scene.light.position yourself, every frame if you like. See Scenes and the view.