bugMyPaint - Bugs: bug #20157, [wish] 'overlay' and 'soft light' ...

 
 
Show feedback again

You are not allowed to post comments on this tracker with your current authentification level.

bug #20157: [wish] 'overlay' and 'soft light' layer blending Mode.

Submitted by:  David REVOY <deevad>
Submitted on:  Sat 08 Sep 2012 12:13:15 PM UTC  
 
Severity: 1 - WishPriority: 5 - Normal
Status: Ready For TestPrivacy: Public
Assigned to: Andrew Chadwick <achadwick>Open/Closed: Closed
Release: 1.0.0Git+Planned Release: None
Operating System: Kubuntu 12.04

(Jump to the original submission Jump to the original submission)

Fri 04 Jan 2013 08:56:58 PM UTC, comment #6:

This bug has been closed because it is marked ready-for-test and
no further comments have been added in a long while. Since we
have not heard otherwise, we assume that the fixes works as intended.

If there are problems with the implemented functionality, please
file a new issue.

Jon Nordby <jonnor>
Project Administrator
Thu 08 Nov 2012 02:12:49 AM UTC, comment #5:

I've added the full set of blend modes from http://www.w3.org/TR/compositing/ as well. Didn't realize it'd gone live as a full TR. Better late than never!

Can you test a few more blend modes please, Deevad?

Forum: http://forum.intilinux.com/mypaint-development-and-suggestions/new-on-git-master-more-blend-modes/

Andrew Chadwick <achadwick>
Project AdministratorIn charge of this item.
Wed 31 Oct 2012 10:25:48 PM UTC, comment #4:

Congratz ! ( and thanks for the new feature )

I ran a series of test and the blending mode behave very well.

My references : mainly Krita and the ( and visually Inkscape , SVG doc ).

I made this *.ora file to test Mypaint < > Krita < > Gimp : http://david.revoy.free.fr/forums/Mypaint/2012-10-31_blendmode-tester_mypaint.tar.gz (of course Gimp 2.8.x fail, but that was expected ).

There is a subtle difference between output flatten of Krita and Mypaint from the same file, but visually it's impossible to see, even with the best monitor. I saw it only by using a 'difference' blending mode on the 2 rendering, and increase contrast on the composited result to see it. Probably the 15bit thing of Mypaint. This is too subtle to be taken into account , visually it's perfectly similar.

David REVOY <deevad>
Project Member
Wed 31 Oct 2012 08:08:31 PM UTC, comment #3:

And somewhat belatedly, soft-light done!

https://gitorious.org/mypaint/mypaint/commit/3d1f3be947c8cb8424c36d5d3a8029bd88b062f0

As before the attached file should look like the W3C example in

http://www.w3.org/TR/SVGCompositing/#comp-op-soft-light

when saved as a transparent PNG which is then opened in something like ristretto or eog, or another program that renders transparent images over chequered backdrops.

David: (and anybody else reading this) could you please test every blend mode to make sure they're all working correctly please? You can probably use the attached files and the w3.org reference for a quick visual inspection, adjusting the blend mode. I'm asking because I've refactored rather a lot of the math the module uses internally...

(MyPaint has no "no background" mode yet, which makes visually inspecting what happens when you composite into the void. Then again, even the GIMP does its own thing here: looks like it uses src-in and not src-over for certain comparable ops.

(file #16733)

Andrew Chadwick <achadwick>
Project AdministratorIn charge of this item.
Mon 29 Oct 2012 10:08:16 AM UTC, comment #2:

Many thanks Andrew for working on it, this is a very cool new feature. I checked the rendering and files opening across Mypaint <> Krita , and it's a 'perfect'.

David REVOY <deevad>
Project Member
Mon 29 Oct 2012 03:46:15 AM UTC, comment #1:

Overlay and hard-light done,

https://gitorious.org/mypaint/mypaint/commit/e7b6510109e8a69b15f4fab4bbe8fc981b90665f
https://gitorious.org/mypaint/mypaint/commit/b7273e01e3843004b5557880ef8249518a3b6bad

and tested against the W3C examples

http://www.w3.org/TR/SVGCompositing/#comp-op-overlay
http://www.w3.org/TR/SVGCompositing/#comp-op-hard-light

They look identical if you save from MyPaint as transparent PNG and then display them over a grey-chequer background in something like ristretto or eog :)

Soft light is trickier due to the complexity of the W3C equation and having working in our somewhat odd scaled int representation. In other words, not quite there yet, but working on it.

http://www.w3.org/TR/SVGCompositing/#comp-op-soft-light

It requires a good sqrt() approximation for scaled ints. The Babylonian method with a lookup table of 16 or so starting guesses looks fast enough (avg ~1.977 iterations, max 8 in the range we use) and quite light on space. If we need it to go faster, we can use a full 15-bit LUT...

I don't think MyPaint should be bug-for-bug compatible with the GIMP. Soft-light is a different blend mode from overlay.

(file #16723, file #16724)

Andrew Chadwick <achadwick>
Project AdministratorIn charge of this item.
Sat 08 Sep 2012 12:13:15 PM UTC, original submission:

Intro

I come for the request of 2 'new' layers blending modes for Mypaint. Those modes are named on other softwares 'overlay' and 'soft light'. I use those layers in my digital comics to paste over a paper texture. Those blending modes are good for textures ; the bright data as well as the dark data on the layer influence the pixel under. It simulate well bump ( bright) and crease (dark ) of a paper texture. Perfect grey ( 50% ) is transparent. Many other use are also possible to do with them.

Formula

To quote wikipedia article about Blend mode, here is the pseudo formula :
Overlay : Result Color = if (Bottom Color < 128) then (2 * Top Color * Bottom Color / 255) else (255 - 2 * (255 - Top Color) * (255 - Bottom Color) / 255)
Softlight : This is a softer version of Overlay. Applying pure black or white does not result in pure black or white.
( source : http://en.wikipedia.org/wiki/Blend_modes#Overlay )
( other link : http://inlandstudios.com/en/?p=851 )

Open raster (*.ora) compatibiltiy

Gimp as well as Krita export inside the open raster stack xml file the information of layer mode. The 2 softwares agree on this markup :

for overlay :

for soft-light :

Test files to download :
2 mini open raster files with both blending mode, for test :
http://david.revoy.free.fr/forums/Mypaint/openraster_softlight-overlay.zip

Misc infos

A famous bug unsolved on Gimp since 2004 made Gimp use the same formula for "Soft-light" and "overlay" , making "overlay" wrong and inexistant in all Gimp since almost a decade. Users complain on forums, mailing list , on bug tracker, but after a research developpers sounds to wait for GEGL implementation to fix that since years. ( bug link :https://bugzilla.gnome.org/show_bug.cgi?id=162395 , mailing list : https://mail.gnome.org/archives/gimp-developer-list/2012-September/msg00037.html , etc ... ). Just for informations if test are done to re-open a *.ora on Gimp. Krita will give an accurate rendering. I hope Mypaint too.

Thanks in advance !

David REVOY <deevad>
Project Member

 

Attached Files
file #16733:  soft-light.ora added by achadwick (158kB - image/openraster)
file #16723:  overlay.ora added by achadwick (210kB - image/openraster)
file #16724:  hard-light.ora added by achadwick (220kB - image/openraster)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jonnor (Posted a comment)
  • -unavailable- added by achadwick (Updated the item)
  • -unavailable- added by deevad (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 04 Jan 2013 08:56:58 PM UTCjonnorOpen/ClosedOpen=>Closed
    Wed 31 Oct 2012 08:08:31 PM UTCachadwickAttached File-=>Added soft-light.ora, #16733
      StatusIn Progress=>Ready For Test
    Mon 29 Oct 2012 03:46:15 AM UTCachadwickAttached File-=>Added overlay.ora, #16723
      Attached File-=>Added hard-light.ora, #16724
      StatusNone=>In Progress
      Assigned toNone=>achadwick
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup