08-16-2022, 07:13 AM
Are you working in "Linear space" or in "Perceptual"?
Originally, Gimp worked in a gamma-corrected perceptual space: The 255 available values per channel do not represent the level directly, but are a function of it (about a square root: but 1/2.24instead of 2). This gives more level points to distinguish the darks (the middle gray, is around 180 instead of 128). And all computations were done directly on these values.
When you use a [0.0 ... 1.0] scale, you are using floating point and are not limited by the number of distinct value points, so your values can represent the level directly.
The I-M+0.5 formula was applied directly on the gamma corrected values
gamma( R ) = gamma( I ) - gamma( M ) + 0.5
But in linear space you do:
gamma( R ) = gamma( I - M + 0.5 )
(in the second case the gamma isn't applied on the stored values, but applied when passing the data to the display (or exporting to JPEG/PNG)
There is a way to tell if this is your problem: in Gimp 2.10 the "legacy" blend modes(*) are applied on the linear values as if they were gamma corrected, so if the legacy Grain Extract produces the same result as your Blender computation, you are doing the computation on lianear values.
(*) this is the small selector at the end of the blend mode selector in the Layers list, Wilber's head switching the modes to "legacy". You also get a (l) in the mode name:
Originally, Gimp worked in a gamma-corrected perceptual space: The 255 available values per channel do not represent the level directly, but are a function of it (about a square root: but 1/2.24instead of 2). This gives more level points to distinguish the darks (the middle gray, is around 180 instead of 128). And all computations were done directly on these values.
When you use a [0.0 ... 1.0] scale, you are using floating point and are not limited by the number of distinct value points, so your values can represent the level directly.
The I-M+0.5 formula was applied directly on the gamma corrected values
gamma( R ) = gamma( I ) - gamma( M ) + 0.5
But in linear space you do:
gamma( R ) = gamma( I - M + 0.5 )
(in the second case the gamma isn't applied on the stored values, but applied when passing the data to the display (or exporting to JPEG/PNG)
There is a way to tell if this is your problem: in Gimp 2.10 the "legacy" blend modes(*) are applied on the linear values as if they were gamma corrected, so if the legacy Grain Extract produces the same result as your Blender computation, you are doing the computation on lianear values.
(*) this is the small selector at the end of the blend mode selector in the Layers list, Wilber's head switching the modes to "legacy". You also get a (l) in the mode name: