Watch the full tutorial

This Darktable Basics episode is a deep dive into AgX. It follows my interview with Troy Sobotka, the creator of AgX, which made its way into Blender and now Darktable. If you haven’t read it yet: “Stimuli is not colour”: a conversation with Troy Sobotka.

The example is a Formula 1 photo that starts out quite flat. We’ll take it to a brighter, deeper image, with a real sense of depth and rich colour.

Start with exposure

Before touching AgX, set your exposure. If you’ve followed my videos, you know the rule: expose for the midtones. For this image, that’s about +1.3 EV.

You’ll see some highlights blow out, on the front wing or the tyre. That’s fine: compressing those highlights into the image is exactly AgX’s job. Just get the midtones right and move on.

The settings tab

AgX has two tabs: settings and primaries. Most people only use settings. Today we’ll use both.

Start from the scene-referred default preset.

White and black points

First, set the white relative exposure and black relative exposure. The simplest way is auto tune levels: Darktable analyses the image and sets them. Here it lands at about −7.95 EV for black and +7.07 EV for white.

You can move them by hand. Bring the black point closer and the shadows turn black sooner. Watch the curve and the histogram: both move as you change these values.

Leave dynamic range scaling as it is; it’s a safety margin.

Shaping the curve

  • Contrast is the slope of the curve: how quickly you go from black to white. The midtones stay in place; only the transition gets steeper or gentler.
  • Shoulder power controls how the curve rolls into the highlights, and toe power into the shadows. Flatten them and you lose contrast. Go too far and an orange warning appears on the curve: you’ve inverted it, so pull back.

Pivot target output

By default, the midtones sit at 18%. Raising the pivot target output looks like adding exposure, but it isn’t: it changes the balance between the brightest and darkest points.

My advice: leave it at 18%, or nudge it slightly. If you need a big move to get the exposure right, go back to the exposure module instead. AgX is not the tool for exposing your midtones.

Look

The look section at the bottom works after the AgX mapping. I leave it alone for now; other modules can do that job.

Why this image: depth

Remember Troy’s point from the interview: a sense of depth in a picture comes partly from how colours attenuate as they get brighter. This flat image is a good test of AgX’s ability to bring back that 3D feeling.

The primaries tab

The primaries tab controls how each colour attenuates and shifts as it gets brighter, so the result reads more naturally to our eyes. Simple to use, very deep if you dig in, as my conversation with Troy showed.

See what it does

At the bottom there’s a small checkbox, disable adjustments. Use it only to compare, never leave it on.

Toggle it and look at the red nose of the car. With adjustments disabled, the nose looks flat. Enable them and you suddenly see its shape and angle. That’s AgX at work.

Choose a base

The primaries preset menu offers several bases:

  • Blender-like, the default
  • Smooth, less aggressive in its attenuation
  • Unmodified, which sets everything to zero

For this image, I chose smooth. Even switching from unmodified to smooth already changes some colours.

Attenuation and rotation

This image is full of red, so I worked on the red primary:

  • Increase the red attenuation and watch the nose: the way the reds move across it creates the 3D effect. I pushed it to an extreme in the video to show it clearly.
  • Rotate the reds. Depending on their intensity, reds lean toward yellow on one side or magenta on the other. I aimed for something close to the Toyota red. It takes some fiddling, and depends on your screen. Use snapshots to compare.

After tone mapping

The after tone mapping section lets you restore saturation in the midtones without bringing back the highlights. On this image, I pushed it a lot to get the reds back.

You can also reverse the rotation, so the darker reds stay true while the highlights keep the shift that creates depth.

The master purity boost raises the purity of every colour at once.

Then the look section

Only after the primaries, go back to the look section if you want more saturation. Remember it acts after tone mapping, so there’s a risk of clipping and losing data. And if you haven’t adjusted the primaries first, it won’t bring much.

My order: settings for the basics → primaries → look.

Final comparison

Back in the primaries tab, toggle disable adjustments once more. I adjusted the red a little, but the real gain is the depth: the image reads in three dimensions. Without the adjustments, it’s harder to read.

Here other elements of the photo help too. On some images, AgX’s primaries are what saves you from a picture that just doesn’t look right.

Wrapping up

This video came from a question on Reddit. If something’s missing, or you’d like a specific topic, leave a comment on the video. For Darktable news and the next part of the Troy Sobotka series, join my newsletter.