Saturday, 28 February 2009

Lightroom tip: selective masking

Ears up, Tanzania, January 2009

Lightroom 2.2, Windows XP
Read my tips intro if you're new.

Why is the brush tool so slow?

I've been doing quite a bit of brush work with Lightroom recently, especially playing with selective desaturation. I was getting frustrated by system slowdown and hang-ups so I went off to find out what's going on. what follows are some of the details, skip down to the Advice section for the what-to-do part.

In general, for small curves, limited regions and editing only a few images with the brush in a session, Lightroom 2.2 is very responsive. If, however, I start running large areas, many images in sessions or lots of changes, problems jump up.

How does Lightroom create the mask?

This is the central part of the problem, I think. When a mask is created, each stroke of the brush is saved as a separate multi-point curve. you can check this by saving the metadata to and .xmp file and opening it. the Mask has the form:

[crs:PaintBasedCorrections]
[rdf:Seq]
[rdf:li rdf:parseType="Resource"]
[crs:What]Correction][/crs:What]
[crs:CorrectionAmount]1.000000[/crs:CorrectionAmount]
[crs:CorrectionActive]true[/crs:CorrectionActive]
[crs:LocalExposure]0.000000[/crs:LocalExposure]
[crs:LocalSaturation]0.600000[/crs:LocalSaturation]
[crs:LocalContrast]0.000000[/crs:LocalContrast]
[crs:LocalClarity]0.200000[/crs:LocalClarity]
[crs:LocalSharpness]0.000000[/crs:LocalSharpness]
[crs:LocalBrightness]0.000000[/crs:LocalBrightness]
[crs:LocalToningHue]356.000000[/crs:LocalToningHue]
[crs:LocalToningSaturation]0.000000[/crs:LocalToningSaturation]
[crs:CorrectionMasks]
[rdf:Seq]
[rdf:li rdf:parseType="Resource"]
[crs:WhatMask/Paint][/crs:What]
[crs:MaskValue]0.900000][/crs:MaskValue]
[crs:Radius]0.023269[/crs:Radius]
[crs:Flow]1.000000[/crs:Flow]
[crs:CenterWeight]0.000000[/crs:CenterWeight]
[crs:Dabs]
[rdf:Seq]
[rdf:li]d 0.321572 0.469314[/rdf:li]
[rdf:li]d 0.326572 0.462008[/rdf:li]
[/rdf:Seq]
[/crs:Dabs]
[/rdf:li]
[rdf:li rdf:parseType="Resource"]
[crs:WhatMask/Paint][/crs:What]
[crs:MaskValue]0.900000[/crs:MaskValue]
[crs:Radius]0.023269[/crs:Radius]
[crs:Flow]1.000000[/crs:Flow]
[crs:CenterWeigh]t0.000000[/crs:CenterWeight]
[crs:Dabs]
[rdf:Seq]
[rdf:li]M 0.891740 0.296029[/rdf:li]
[rdf:li]M 0.894016 0.305266[/rdf:li]
[/rdf:Seq]
[/crs:Dabs]
[/rdf:li]
[/rdf:Seq]

[/crs:CorrectionMasks]
[/rdf:li]
[/rdf:Seq]
[/crs:PaintBasedCorrections]

the bit in bold shows two sets of points for two strokes but for a single region. Here I've replaced all the xmp <> with [] so it doesn't get screwed up by Blogger.

If you create a large mask (as I did for the whole leopard in the shot above) then you can end up with many lines, each with thousands of points. If you really want to get anal, these can be edited down with a text editor. Easily half the points can be removed (alternate points). tedious, and not recommended.

The more you edit, the more points are generated. If you have to go back over sections, you end up with lots of overlapping lines, and repeated work being done. I think, by experiment, that Lightroom is set up to interpret each line independently, which then goes to defining the area for applying the adjustments for a give brush mask. If you've got thousands of points, that's going to take time. So I suggest using some care, and good painting technique to improve things.

Advice

So here is my advice, particularly for large areas, in this order:

1. Use the mask overlay to show the mask as you paint (key O)
2. Start with a large brush and smooth continuous strokes for large areas.
3. Use the lowest flow you can get away with (cuts the number of points generated). Faster brush work needs a higher flow.
3. Avoid reworking areas
4. Zoom in and use a smaller brush for details and edges (generally with a lower flow, and slower brush strokes).

That should help cut down the number of points generated, and the number of line segments, which should maximise performance.

2 comments:

  1. Hi Martin,
    interesting finding you have made here. I knew LR stored the brushstrokes using some sort of vector represention, but I thought the data was reduced to represent the total area, not storing each stroke. That really explains why the brush was more or less ueless on my old computer, and why the performance was so variable.

    My strategy for this is make few and smooth brush strokes in LR. Very rarely do I trace sharp edges or create complex masks. If I need more precise control than a "blob", I'll go to PS.

    That said, I think the tool is very useful for many images that don't need that complex masks for corrections, and at least to get pretty close to the target before going into PS.

    ReplyDelete
  2. Kjell, I was surprised, too. In fact, the two strokes in the example above are just 2 points that I culled from a list that were several hundred points long for fairly simple strokes.

    ReplyDelete

I like comments, especially constructive ones.
Comments get emailed directly to me before publishing , so if you want to get in touch drop a comment.
All comments moderated by me before being published, keeps the spam at bay.