It is currently Sun Jun 30, 2024 5:47 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Layer Groups: Where's the Maths?
PostPosted: Sun Oct 16, 2022 6:36 am  (#1) 
Offline
GimpChat Member
User avatar

Joined: Apr 20, 2011
Posts: 287
Location: Dane-ish Co., West Gonsin
GIMP Version: 2.10.18
Operating System: Linux
GIMP Experience: Experienced User



Having posted links to GIMP 2.10 documentation for Layers and Layer Groups, I settled back for a cozy evening-read of same.

I was surprised to find nothing in the latter regarding equations defining Layer-Group modes acting on Layers inside, corresponding to, for example, this one found in the former discussion of Layer modes:
Image

The Layer Group documentation mentions:
Layer Modes and Groups
A layer mode applied to a layer group acts on layers that are in this group only. A layer mode above a layer group acts on all layers underneath, outside and inside the layer groups.

but then goes on to discuss the Pass-through mode only.

However Layer Groups have apparently all the modes Layers do, and my experiments with Layer-Group mode-setting haven't led me to a greater understanding of how the Group mode interacts with underlying Layers' modes.

For example, I was about to ask, if I want to have three layers "add" to a background, should they be each be in Addition mode and the Group in Pass-through (or Normal: is there a difference in this simple case) or vice versa? However a quick consideration recalls that if underlying Layers are all in Normal mode, the topmost Layer will hide the others.

But what about more sophisticated examples?

What does Group-mode Additon do to Layer-mode Multiplication? (That may be a key question: when a Multiplication Layer is moved into a Group in Normal mode, what Layers is it then acting upon?)

I'm looking for a succint mantra that makes clear how Group modes affect Layer modes, both inside and outside it and other Groups below it in the Layer stack.

Something like Lenz's Law: "A change in magnetic flux will induce a current appearing in such a way as to tend to oppose the change in flux which induced it." (When stuck trying to figure out the polarity of an induced voltage, this little chant helps figure it out.)

"The mode of a Group will ..."

Perhaps I'm just asking about priorities: the order in which modes are applied.

Thank you.

_________________
--
GraMP
"Once you sit on your glasses, the rest of getting old seems obvious."


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Layer Groups: Where's the Maths?
PostPosted: Sun Oct 16, 2022 11:09 am  (#2) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4752
Groups act as parentheses in formulas. A layer applies to what is below at the same nesting level. So in a group, the layers of the group are composited between themselves and the group represents this (virutal) result, to which the group's blend mode (and mask) is applied, before being composited in the group above....

For instance, in this image, the color circles in addition mode apply to the whole background and the shape is ignored.

Attachment:
ksnip_20221016-180614.png
ksnip_20221016-180614.png [ 41.53 KiB | Viewed 507 times ]


By putting them in a group with the shape, the action is restricted to the shape: the Addition mode keeps the opacity of the pixels it is composited to, without a group this is the whole background, with the group this is only the non-transparent pixels in the shape.

Attachment:
ksnip_20221016-180620.png
ksnip_20221016-180620.png [ 44.27 KiB | Viewed 507 times ]


If you prefer, instead of having:

( add R ( add G ( add B ( normal Shape  Background ) ) ) )

You have:
(Normal ( add R ( add G ( add B  Shape  ) ) ) Background )


(where "∅" is a virtual, empty layer)

_________________
Image


Top
 Post subject: Re: Layer Groups: Where's the Maths?
PostPosted: Sun Oct 16, 2022 2:25 pm  (#3) 
Offline
GimpChat Member
User avatar

Joined: Apr 20, 2011
Posts: 287
Location: Dane-ish Co., West Gonsin
I'll add my spell-it-all-out-loud interpretation of your symbolic representations, for like (smaller-)minded people who will happen upon this.

> ( add R ( add G ( add B ( normal Shape Background ) ) ) )

"First [innermost parentheses] 'put'* Layer 'Shape' over Background using Normal mode."
"Next [next-outer parens] put Layer B over previous using Addition mode."
"Do the same for Layers G and then R."
* I hesitate to use the word 'add' to describe the parenthetical actions to avoid confusion with the mode "Addition."**
** Gosh! How often does one get to use superscripting in the forum?!

> (Normal ( add R ( add G ( add B Shape ) ) ) Background )

"First [innermost] put Layer B over Layer Shape using Addition mode."
"Then [next-outer] put Layer G over the previous."
"Do the same for Layer R."
"Finally put the previous over Layer Background using Normal mode."

If there are better words than "put" and "using" and "over", I will edit the post joyfully.

_________________
--
GraMP
"Once you sit on your glasses, the rest of getting old seems obvious."


Last edited by gramp on Sun Oct 16, 2022 2:37 pm, edited 1 time in total.

Top
 Post subject: Re: Layer Groups: Where's the Maths?
PostPosted: Sun Oct 16, 2022 2:32 pm  (#4) 
Offline
GimpChat Member
User avatar

Joined: Apr 20, 2011
Posts: 287
Location: Dane-ish Co., West Gonsin
To pay for my sin of having ofnuts do my work for me1, I've gone back and generated an .xcf for anyone else who'd like to experiment with Layer Modes, mimicking the earlier layout, but using a 50% gray background needed to see some mode effects. You'll find it attached.
Image

1 For which thank you, ofnuts. [And I suppose we'll all have to suffer through my sudden fascination with superscripting which fascinations usually disappear with the first nap.]


Attachments:
RGB_layers-and-groups.xcf [279.4 KiB]
Downloaded 11 times

_________________
--
GraMP
"Once you sit on your glasses, the rest of getting old seems obvious."
Top
 Post subject: Re: Layer Groups: Where's the Maths?
PostPosted: Mon Oct 17, 2022 1:23 am  (#5) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4752
gramp wrote:

If there are better words than "put" and "using" and "over", I will edit the post joyfully.


Technically the operation of putting a layer in what Gimp calls "normal" mode over another is indeed called the "over" operation.

_________________
Image


Top
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Layer Groups

5

No new posts Can ScriptFu or anything in Gimp automate the creation of layer groups

7

No new posts Clipping groups

6

No new posts Attachment(s) How can I separate an into groups?

2

No new posts Attachment(s) I should maybe join some other chat groups

3



* Login  



Powered by phpBB3 © phpBB Group