HDR Peak Fit (RUDRA)
Where the extra brightness goes
- image
- image
- report
Why you need a peak fit at all
Your HDR master is scene-linear with no ceiling. The sun in it might be 8000 nits. The display it's going to has a peak, and a good encoder would rather you handled that deliberately than let the codec clip it. So a peak fit is a shoulder: below the knee, nothing moves; above it, luminance eases toward the display peak instead of hitting it like a wall.
The second half of the job is the bit everyone forgets. A highly saturated blue sky whose luminance is perfectly fine can still have one channel above the peak. Brightness fits, gamut doesn't. You have to give up something, and this node makes you choose: saturation or brightness.
That choice is the whole article, honestly. Keep luminance is RUDRA's default and holds the pixel's hue and brightness while letting saturation slide - a blue sky goes slightly less blue but stays just as bright. Scale does the opposite: hue and saturation intact, brightness reduced. Blue stays vivid, but the sky is dimmer than you measured. For skies, sunsets and anything a colourist will point at, Keep luminance is right and it's why it's the default. For a specular glint where the colour is the point and nobody's measuring luminance, Scale can look more honest.
How it works
Below knee_nits (0 means RUDRA's 0.75 × peak, so 750 nits at a 1000-nit display) the image passes through untouched. Above it, the shoulder compresses luminance smoothly toward peak_nits, applying a single gain per pixel so the pixel's channel ratios - its hue - survive. Nothing above the knee is clipped flat; it rolls.
Measurement and output are both in Rec.2020, and the output comes back scene-linear in the same space you fed in, so a Rec.709 master stays a Rec.709 master.
Inputs and outputs
Required: image, image_space (Rec.709, Rec.2020, ACEScg AP1, ACES2065-1 AP0 - PQ and HLG are refused, so hand it linear), peak_nits (100–10000, default 1000), and peak_fit. Optional: knee_nits (0 to 9999, step 10) and reference_white_nits (203 default - what 1.0 means in your image).
Out: image and a report string. Read the report once, at least; it tells you what it did rather than leaving you to diff pixels.
Install
Ships with the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/fxtd-studios/radiance
cd radiance
python -m pip install -r requirements.txt
Or ComfyUI Manager → search Radiance → Install, restart, refresh. Windows portable: python_embeded\python.exe for pip. No model downloads.
Where people get burned
Don't fit twice. HDR Dynamic Metadata runs the same shoulder and peak fit internally, and it's on by default there (apply_peak_fit). If you've already run Peak Fit on the master, turn that off - its tooltip says exactly that: off means the frames are already mastered to the peak. Applying a shoulder twice isn't catastrophic (the second pass has little left to do above the knee) but your measured MaxCLL and your picture will disagree slightly, which is the kind of thing that only shows up when QC flags it.
Knee too low, and you've graded the whole image. knee_nits at, say, 100 on a 1000-nit display puts most of the picture inside the shoulder and the mid-tones flatten. Leave it at 0 unless you specifically want an earlier roll-off.
Peak higher than the display. Setting peak_nits to the master's maximum rather than the target's maximum does nothing useful - you've asked the node to fit the picture to a display that doesn't exist. This is a delivery step; put the number the TV actually does.
It doesn't tonemap. Peak Fit compresses the excess; it does not give you an SDR view. For that you want the output transform or the brackets out of RUDRA Master Write. Two different jobs, and people conflate them constantly.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Scene-linear HDR master. | |
| image_space | COMBO | Linear (Rec.709) | What the HDR is: scene-linear in these primaries, 1.0 = reference_white_nits. PQ / HLG are not accepted. |
| peak_nits | FLOAT | 1000100–10000 | The display's peak. No channel ends above it (in Rec.2020). |
| peak_fit | COMBO | Keep luminance (RUDRA default) | For a colour whose luminance fits but one channel does not: give up saturation (Keep luminance) or brightness (Scale). |
| knee_nitsopt | FLOAT | 00–9999 | Where the shoulder starts. 0: RUDRA's 0.75 x peak. |
| reference_white_nitsopt | FLOAT | 20380–400 | Nits of 1.0 in the image (BT.2408: 203). |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| report | STRING | — |