mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-15 23:02:14 +00:00
Cineon Converter: Gamma 1 gives linear output and saved projects keep their render (#2312)
## Behavior A new Cineon Converter opens with Gamma 1.7. Its Version parameter is 2 by default. A converter saved before Version existed opens as version 1, retaining its Gamma value, keyframes, and expression text and rendering on its original scale. Reset keeps the instance's Version. In version 2: - Log to Linear raises the exposure to `1 / gamma` before subtracting the black offset and normalizing: `(E^(1/g) - O^(1/g)) / (1 - O^(1/g))`, with `E = 10^((code - white) * 0.002 / 0.6)` and `O` the exposure at the black point. Gamma 1 gives linear output, and a larger Gamma lightens the midtones. Highlight Rolloff then applies as before, and Linear to Log is the inverse. - Log to Log returns code values unchanged at Gamma 1 and raises the normalized code value to `1 / gamma` at other values. With custom black or white points, the code values first go through the Gamma 1 conversion. The CPU and GPU paths match. Version 1 instances render as before, and Interpret Footage ▸ Cineon Settings keeps its existing formula, which agrees with the version 2 Converter at Gamma 1. The public Cineon Converter documentation (https://helpx.adobe.com/after-effects/using/utility-effects.html) describes Gamma as a midtone control and gives no defaults or formula. The default, the Log to Linear curve and the Log to Log behavior come from running and scripting After Effects 26.5 on my own machine and reading back the rendered pixels. In After Effects, choosing Log to Log also sets Gamma to 1 and Highlight Rolloff to 0; EffectCraft does not do that yet, because no command sets one parameter from another. Animation preset format 3 records `cineonVersion` for a saved Gamma property and stores effect key times relative to the first key. Presets in formats 1 and 2 without that tag contain version 1 Gamma values; format 2 already has relative effect key times. Applying a whole old Cineon Converter also gives it version 1. Exposed Essential Properties Gamma values convert to the target converter version where their target is unambiguous (the conversion keeps the linear point; other Gamma values follow each version's own curve); enabled expressions on another scale are skipped instead of rewriting their source. A saved Gamma records the Version its converter has at the current time. Applied to a converter whose Version is keyframed, a Gamma preset keeps those keys: the Gamma is converted to the one version they hold, or skipped when they hold several or an expression sets the Version. A preset that also holds the Version sets it from that property. The project schema remains 2. `docs/architecture.md` describes the behavior above. ## Validation Effect tests check version 2 Log to Linear at Gamma 1.7 (codes 95 to 685) and Gamma 2.2 (codes 180 to 620), and Log to Log at Gamma 1 (Rolloff 0 and 20) and Gamma 1.7, against the measured 8-bit values within one or two codes, plus round trips, version 1 rendering and the Interpret Footage agreement at Gamma 1. GPU tests compare the version 2 paths with the CPU. Engine tests cover old projects, Reset, presets, keyframes, and Essential Properties. Commands run on `74d398c2`: - `cargo fmt --all -- --check` - `cargo clippy -p effectcraft-effects -p effectcraft-gpu -p effectcraft-project -p effectcraft-engine --all-targets -- -D warnings` - `cargo test -p effectcraft-effects`: 546 passed (including `effects_doc_is_current`, so `docs/effects.md` needs no change), 1 ignored, plus 6 - `cargo test -p effectcraft-project`: 47 passed - `cargo test -p effectcraft-gpu`: 253 passed, 1 ignored - `cargo test -p effectcraft-engine`: 1,007 passed, 5 ignored, plus 27
This commit is contained in:
1 parent
7cbefaf70f
commit
d6c9ad6643
12 files changed
+1101
-79
No files matched your search
@@ -121,6 +121,44 @@ their bottom-right quarter. Tracking data of effects that analyse footage (Warp
|
||||
Camera Tracker, Tracked Shape Matte) is left as it is: footage has a source rectangle, whose effect space
|
||||
did not change.
|
||||
|
||||
Cineon Converter has a hidden Version parameter (`version`). In version 2, Log to Linear raises
|
||||
the exposure to `1 / gamma` before subtracting the black offset and normalizing at the white
|
||||
point. Highlight Rolloff then limits highlights. Linear to Log reverses those operations. Log to
|
||||
Log raises the normalized code value to `1 / gamma` at the default black and white points. Custom
|
||||
points use a Gamma 1 conversion before that power. In version 1, Log to Linear raises the
|
||||
black-offset normalized value to `1.7 / gamma`, and Log to Log uses its original reference curve.
|
||||
A new instance is version 2 with
|
||||
Gamma 1.7. An instance saved before the parameter existed opens as version 1
|
||||
(`migrate::legacy_default`), with its Gamma, keyframes and expressions unchanged, and renders as
|
||||
it did. A whole Cineon Converter applied from an animation preset saved before the parameter
|
||||
existed is also version 1. Opening a project does not change any expression or the project schema.
|
||||
Reset keeps an instance's Version and sets Gamma to 1.7.
|
||||
|
||||
A project saved with the Version parameter opens in an earlier build, since its schema is still 2.
|
||||
That build keeps the Version parameter it does not know and reads every Gamma on version 1's
|
||||
scale. A version 1 instance renders there as it did before. A version 2 instance's Gamma is read
|
||||
there as a version 1 Gamma, so its default Gamma 1.7 renders as linear. It renders lighter in this
|
||||
build. Earlier builds apply format 4 animation presets the same way and ignore
|
||||
`cineonVersion`.
|
||||
|
||||
Animation presets are format 4 (`effectcraftAnimationPreset: 4`). A saved property that is a
|
||||
Cineon Converter's Gamma records that instance's version at the current time in `cineonVersion`.
|
||||
So does an Essential Properties value whose control drives only Cineon Converter Gammas of one
|
||||
version, directly or through nested comps. A keyframed Version counts there only when its keys
|
||||
that play hold one value without easing between them. A Version that an expression sets has no
|
||||
version to record. The Gamma properties of format 1 to 3 presets are version 1 Gammas. Applying a
|
||||
Gamma to a Cineon Converter on the layer sets that instance's Version to the recorded one. When
|
||||
that Version is keyframed, its keys stay and the Gamma is converted to the one version they hold;
|
||||
the Gamma is skipped when the keys hold several versions or an expression sets the Version. A
|
||||
preset that also holds the Version sets it from that property.
|
||||
Applying it to an Essential Properties value converts the value, its keyframes and their speeds to
|
||||
the version of the Gammas that the control drives (dividing by 1.7 from version 1 to version 2).
|
||||
That conversion aligns the linear points, but the two versions use different curves at other
|
||||
Gamma values. Interpret Footage Cineon Settings continues to apply Gamma after black-offset
|
||||
normalization, so its output agrees with version 2 Converter at Gamma 1.
|
||||
Expressions in a preset are applied as saved, and an Essential Properties Gamma with an enabled
|
||||
expression that was saved on another version is skipped.
|
||||
|
||||
## 4. Rendering
|
||||
|
||||
`Renderer::comp_frame(comp, t)` walks the layers bottom to top. For each visible layer it renders
|
||||
|
||||
Reference in new issue
Block a user