additive layer blend mode

Bug #298831 reported by Quartz
8
Affects Status Importance Assigned to Milestone
Inkscape
Confirmed
Wishlist
Unassigned

Bug Description

I simply request a new blend mode, whose formula might look like something as simple as:*

X = A + B

where X is the computed color the layer will inherit at a given pixel, A is the original color assigned to the layer at a given pixel, and B is the computed color the layer beneath it inherited at the given pixel.

...Or however it might work. :) You get the idea, right?

* Ignoring opacity.

Revision history for this message
Quartz (quartz) wrote :

It would appear similar to the "screen" blend mode, but would have a considerably brighter result (and a considerably simpler formula, theoretically).

:)

Revision history for this message
Alexandre Prokoudine (alexandre-prokoudine) wrote :

We certainly understand why you want Addition mode from SVG 1.2 Draft that we cannot implement yet, because SVG 1.2 is not ready yet :-)

Changed in inkscape:
importance: Undecided → Wishlist
status: New → Confirmed
Revision history for this message
Quartz (quartz) wrote :

Wow, crazy! :D

I was browsing around in the SVG 1.1 docs on w3.org a little. SVG seemed so astonishingly featureful that I just assumed the additive blend mode was like the large number of more advanced features SVG defines that no application has implemented yet!

If you've implemented in Inkscape all the available blend modes so far, never mind. :) I guess now I'll have more to look forward to with SVG 1.2!

(And maybe keep track of this feature request once SVG 1.2 is a stable release.)

Thanks for your time! :D

Revision history for this message
Niko Kiirala (kiirala) wrote :

Additive layer blending can already be done in Inkscape - well, almost. Use composite filter with Arithmetic mode and multipliers (0, 1, 1, 0). This is "almost" because filter effects cannot archieve true layer blending when used over non-opaque background. The blended result will always be composited over the original background, yielding odd results if the background is translucent.

Revision history for this message
Quartz (quartz) wrote :

Please forgive my ignorance. I'm struggling to understand the specification. I'm looking at some pages here:
http://www.w3.org/TR/SVG11/filters.html#feCompositeElement
http://www.w3.org/TR/SVG11/filters.html#FilterPrimitiveInAttribute

I've been experimenting by creating a screen blend mode filter with the layer editing window in the Inkscape interface and either using the XML editing window or a separate text editor to directly edit the XML of the filter node. So far I've figured that by the multipliers being (0,1,1,0) you meant the k1-k4 attributes, arranged maybe something like:
    <filter
       inkscape:collect="always"
       id="filter3873">
      <feComposite
         inkscape:collect="always"
         operation="arithmetic"
         k1="0" k2="1" k3="1" k4="0"
         in2="BackgroundImage"
         id="feComposite3875" />
    </filter>

But Inkscape doesn't interpret this as I expect it to. Do you see what I have wrong here? I have the distinct feeling that some stray attribute I don't understand is confusing Inkscape.

Revision history for this message
Niko Kiirala (kiirala) wrote :

It seems you've figured it out just right and I have no idea why that wouldn't work. Using the filter effects editor in Inkscape would likely be easier than editing the XML directly, but that's just details.

A common problem with these blending modes is missing enable-background="new" (or the equivalent CSS definition) in some parent element of filtered object. Still, since you used the layer editing window to create the filter, Inkscape should have inserted that attribute in the SVG root node.

Revision history for this message
Quartz (quartz) wrote :

I can hardly contain my joy! It works! :D

Thank you ever so! That was the problem, looks like - the enable-background="new" attribute.

I have learned a great deal about Inkscape with this little exercise (including the presence of the filter editing window ;-P ), and the ability to composite objects additively in Inkscape will open a vast world of new possibilities to me as an artist!

The fact that it needs an opaque background is negligible - I don't mind at all. Using special blend modes over transparent backgrounds is kind of an ambiguous, semantically malformed construct in the first place; I always prefer to have more explicit control over the results. The target raster format for exporting - of course - doesn't even support any blending except "normal," so the idea has to be over and done with by the time the image is flattened. Which - of course - means no special blending arithmetic over transparent backgrounds.

Thank again for your time! :D I'm sure when SVG 1.2 is a stable release this'll all be much easier, but for now I have tremendously more freedom as an artist than before!

God bless!

su_v (suv-lp)
tags: added: filters-svg layers
Revision history for this message
Quartz (quartz) wrote :

Hey guys, Kiirala's workaround with the feComposite "Arithmetic" filter stopped working for me a few years back. Today I finally put my head into it and I'm not seeing any discussion, let alone fixes ... is it just me?

I have an enormous archive of files created with older versions of Inkscape using this technique, which was working 100% fine when they were created. (I have raster exports to prove it.) However, sometime after 2010 it stopped working, and now applying the feComposite filter has absolutely no effect on the image. Even opening the same old files unchanged, the filtered objects look opaque as though not filtered.

This is obviously a problem for me in reading and using my archived files with 100% fidelity. I can't just slap on a Screen blend mode instead and get the same result. 🙁

Currently failing for me on:
=> MacOS 10.14.6 with Inkscape 0.91 r13725 on XQuartz
=> MacOS 10.14.6 with Inkscape 0.92.2 5c3e80d on XQuartz
=> Fedora 24 with Inkscape 0.91 r13725

(Did Inkscape migrate from SVN to Git between 0.91 & 0.92? And yes, my Fedora machine is too old. 😝 Planning to replace it at some point.)

I'm thinking this has to be a bug, so maybe I'll make a new post. Thoughts welcome.

Thanks!

Revision history for this message
Quartz (quartz) wrote :

Oh I see now we've moved to GitLab. I'll post there soon.

Revision history for this message
Quartz (quartz) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.