Page 1 of 1

Blend Mode Darken problem (Ghost offsets)

Posted: Sat Feb 18, 2012 4:42 pm
by Jonathan Francoeur
I'm making a solar map by creating layers of shadows. Where the shadows overlap it is darker.
My goal is that:
When there are 6 overlapping layers the colour is 100% black(RGBA000000ff). R,G&B=0 A=255
When there are 5 overlapping layers the colour is 100% black(RGBA000000cc). R,G&B=0 A=204
When there are 4 overlapping layers the colour is 100% black(RGBA00000099). R,G&B=0 A=153
When there are 3 overlapping layers the colour is 100% black(RGBA00000066). R,G&B=0 A=102
When there are 2 overlapping layers the colour is 100% black(RGBA00000033). R,G&B=0 A=51
When there are 1 layer of shadow the colour is 20%Black (RGBA00000033) R,G&B=0 A=0

My issue is that these are the colours that I'm getting when they overap:
A) (see and example SVG Image)
When there are 6 overlapping layers the colour is 100% black(RGBA000000ff). R,G&B=0 A=255
When there are 5 overlapping layers the colour is 100% black(RGBA000000cc). R,G&B=0 A=204
When there are 4 overlapping layers the colour is 100% black(RGBA00000099). R,G&B=0 A=153
When there are 3 overlapping layers the colour is 100% black(RGBA00000066). R,G&B=0 A=102
When there are 2 overlapping layers the colour is 100% black(RGBA00000033). R,G&B=0 A=51
When there are 1 layer of shadow the colour is 20%Black (RGBA00000033) R,G&B=0 A=0
opacity for each layer is set at 20% (I choses 20% because 100/5 is 20)
opacity for each (shadow) set at 0
Colour for each (shadow) set at 0RGBA000000ff
Blend Mode Normal
B) (see and example SVG Image) (PNG file Image)
My best luck has been changing blend mode to darken and opacity of objects to 20% with opacity of layer to 100% and my problem is these ghost rectangles that mess things up. I also notice that in previewing my post the shadows in B don't show.
Any ideas?
I've tried from Ubuntu 10.04 and Windows 7 with the same results. I'm using a Dell Dimension 8250

Re: Blend Mode Darken problem (Ghost offsets)

Posted: Sat Feb 18, 2012 11:10 pm
by ~suv
Jonathan Francoeur wrote:(…) and my problem is these ghost rectangles that mess things up.
Those are not ghost rectangles of offsets, but overlapping areas of the default filter effects region (which is larger than the object bounding box) - AFAIU the known limitation of the double-counting background as described in the Inkscape manual section for blend modes: Double counting background

Workaround: add a bottom layer with page-sized rectangle using a solid white fill.
Shadows2+solid_background.svg
(21.68 KiB) Downloaded 211 times

Jonathan Francoeur wrote:I also notice that in previewing my post the shadows in B don't show.
AFAICT that's due to most web browsers not fully supporting certain compositing filter effect in SVG files.

Re: Blend Mode Darken problem (Ghost offsets)

Posted: Sat Feb 18, 2012 11:27 pm
by ~suv
Alternative workaround to avoid the (visually distracting) 'ghost rectangles':
Reduce the filter effects region for each of the layer blend filters (in 'Filters > Filter Editor > Filter General Settings') to
  • Coordinates: X=Y=0.00
  • Dimensions: Width=Height=1.00
Shadows2-fitting-FER.svg
(22.27 KiB) Downloaded 229 times

Note: the resulting image differs from the first workaround (adding a solid filled object in the background).

Re: Blend Mode Darken problem (Ghost offsets)

Posted: Sat Feb 18, 2012 11:50 pm
by ~suv
The formulas used for the (layer) blend modes (RGB and opacity) can be found in the SVG 1.1 specification for the feBlend filter primitive.

[Solved] Re: Blend Mode Darken problem (Ghost offsets)

Posted: Sun Feb 19, 2012 2:34 pm
by Jonathan Francoeur
Thank you ~suv.
Your alternative workaround created the results I was looking for. Thank you for editing the SVG files and posting them so that I could see which work around did the trick this made it much easaier for me to choose a solution.
The first one while removing the "ghost offsets" yielded the same results as what we see in my first SVG (not enough contrast between shades).
The Second one yields exactly what I wanted.

Re: Blend Mode Darken problem (Ghost offsets)

Posted: Sun Feb 19, 2012 4:57 pm
by Jonathan Francoeur
Thank you very much for your reply. Your alternative method worked very well of my application using rectangles.
To further complicate things I would also like to achieve the same results using other polygones and circles.
Unfortunately the fix for rectangles does not work the same for circles. I'm sorry that I didn't use circles or polygones in my first post.
While we were able to achieve the desired results using rectangles, here is what it looks like with circles.
Image
here is the svg file
SVG Image
Thanks again.

Re: Blend Mode Darken problem (Ghost offsets)

Posted: Mon Feb 20, 2012 6:12 am
by RobA
I just wanted to jump in and let you know that what you are trying to do will not work.

Opacity is not additive the way you are thinking. If you have two black objects each at 50% opacity and overlap them, you do not get 100% opacity.

You have to think in terms of transmission. A 50% opacity lets though 50% of what is below it. SO if you stack a 50% opacity black object over another you will allow 50% of 50% of what is below it show through, or 25%. Which is the same as one black object at 75% opacity.

-Rob A>

Re: Blend Mode Darken problem (Ghost offsets)

Posted: Sat Mar 31, 2012 8:42 am
by Jonathan Francoeur
I've created a topic asking for help in wording this problem as a feature for submission to Launch Pad. http://www.inkscapeforum.com/viewtopic.php?f=28&t=11811#p43473

Re: Blend Mode Darken problem (Ghost offsets)

Posted: Sat Mar 31, 2012 10:45 am
by brynn
So as not to clutter the other topic, in case there is a way to do what you want, I decided to comment here. But my comment is that it might not be possible. There's a fundamental difference in the way that colors are printed and they way they are rendered on a computer screen. I've read about this, but only vaguely understand it. It has something to do with how our eyes work. And also, as you've learned in this topic, part of the problem (apparently) lies with the SVG standard. At the very least, it sounds to me like you'll have to wait for that to be corrected, and then for Inkscape to be brought into compliance with it. But as I've said, I don't have a very strong understanding of these things, and I'll leave it for those more knowledgeable :D

Re: Blend Mode Darken problem (Ghost offsets)

Posted: Tue Oct 09, 2012 6:57 am
by Jonathan Francoeur
THank you brynn. I hope that someone more knowledgeable somewhere some day will be able to figure this one out because solar maps are so great to have when planning for growing plants.