Jump to content
Our response time is longer than usual currently. We're working to answer users as quickly as possible and thank you for your continued patience.

Complex Non-destructive Mask


Recommended Posts

Your_different_mask_parts.png.d4058d751c83d0018305d4bf37a07e34.png

This is a completely non-destructive mask, which is a group of many layers.
You can use many raster and vector layers/objects in one mask. And of course, you can edit them!
Nondestructive_Mask.afphoto  Nondestructive_Mask_Test.afphoto  Nondestructive_Mask.afassets

How to use

Place your mask parts between the Procedural Texture and the Fill Layer. If necessary, change the background transparency, changing the Fill Layer color.

01.gif.1beb92874a550096cd9e7cd10ff1e745.gif

 

To apply this mask-group only to a specific layer, nest it.

02.gif.3976636e6b1271afefb18c3af7dd4431.gif

 

To apply a mask-group to multiple layers, select mask-group and desired layers below, and group them.
Then change blending mode for this new group, from Passthrough to Normal.

03.gif.cedae078a29f2c5dea9c493ae6ea7dea.gif

 

How it works

This is a group with the "Erase" blending mode. This group has two main layers, the Procedural Texture and the Fill Layer.
The Procedural Texture turns rgb and grey pixels into alpha. Formula: 1-rgbtoi(R,G,B)-a=Alpha  Many thanks to @NotMyFault
Fill layer is required to control the background transparency.

Mask-Group.png.4e7cbbe28b6312b47b772dba23f02530.png

 

In conclusion

This non-destructive composite mask allows you to fine-tune individual parts of the mask, achieving the desired result.
Affinity interactivity allows you to see the result of your operations in real time, unlike some other programs.

Opportunities

  • Nondestructive editing and moving
  • Multiple individual mask parts
  • Vector and raster
  • Color and greyscale
  • Applying adjustments


Nondestructive_Mask_Test_1.png.da3c340a65efe57e6441e908df5a8734.png

Created using a mask consisting of many parts

Link to comment
Share on other sites

Nice, the erase blend mode was the missing piece in my tries

Mac mini M1 A2348

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

 

Link to comment
Share on other sites

Here a even nicer filter:

  1. replaced manual RGB by rgbtoi
  2. added "-a"

The input variable "a" allows you to gradually fade the mask effect, to reveal hidded areas. This is really usefull to edit masks at the edges, beeing able to see both the background and the actual mask in realtime.

 

image.png.07f9f3e257770f7bb66cd92cc16dcc67.png

Mac mini M1 A2348

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

 

Link to comment
Share on other sites

1-rgbtoi(R,G,B) fully matches the quality of a regular mask. While 1-(R+G+B)/3 which gives a small color banding on the gradients.
Files reuploaded.

Link to comment
Share on other sites

Wow!

Without you, I would never have understood, limited to my understanding. Thank to you telemax and NotMyFault

 

 
Without error,
 the formula 1- (0.2126 * R + 0.7152 * G + 0.0722 * B) -a gives the same result in 16 bit or 32 bit,
knowing that for a strict mask 8 bit is sufficient,
can you confirm me please
Link to comment
Share on other sites

Hi Max,

that really depends on your needs and definition of "strict mask".

  • hard edges for a sharp cut-out: 1 bit is enough
  • featherd edges of objects to smoothen transition to background: normally only 1-5 pixels wide, so you wouldn't neet more then 4-16 alpha values, 5 bit would be ok
  • CGI, 3D renders, smooth transitions between layers filled with saturated primary color gradients, sky or monochromatic areas? You need the maximum possible! In Affinity (and as far as i know in all file formats), alpha channel is always limited to 8 bits, or 256 different values.

So yes, 8 bit is sufficient (or even overkill) in all cases listed above.

The only situation where you might need more bits is when you use the alpha channel for other purposes than masking, e.g. game developers use alpha for z-axis (3D depth channel).

To give an accurate answer your question, we first need to know your specific use case (defintion of "strong mask"). But i assume it will be ok ;-)

Mac mini M1 A2348

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

 

Link to comment
Share on other sites

Hi NotMyFault

 

Thank take  time for answer to me

I' m not a professionnal

I'm just a retiree who has time to explore some solutions,
in fact my interest is more, the ability to mix transparent images, shots of images included in vector shapes in a plane, an image wider, possibly with a z depth. ( Affinity, Open GL?, blender?).
In fact I use less and less mask but more and more layers in Erase mode, with paintbrush with modultation opacity
Well I'm not going to waste you more time thank you again

 

 

Link to comment
Share on other sites

Hi Max and telemax,

it is a great pleasure to share some challenges & tricks with you.

Have a nice weekend,

Timo

Mac mini M1 A2348

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

 

Link to comment
Share on other sites

Pardon a tad ignorance. What does rgbtoi do, exactly. Presumably takes R, G and B and converts to single integer? What's the algorithm, please.

Thanks

Dave Straker

Cameras: Sony A7R2, RX100V

Computers: Win10: Chillblast i9 Custom + Philips 40in 4K & Benq 23in; Surface Pro 4 i5; iPad Pro 11"

Favourite word: Aha. For me and for others.

Link to comment
Share on other sites

On 3/8/2021 at 8:24 AM, Max P said:

Hi dmstraker

  Take a color in Hex, and extract componant in decimal,  [0....255]

   if i remenber well

Hex: #fed33c  rgb(254,211,60)

The help say

rgbtoi

  use  rgbtoi(S r, S g, Sb) or rgbtoi(V rgb)     

Thanks, @Max P. It's nice to have lots of functions though it would be nicer if the help system told us a bit more about what they do.

Dave Straker

Cameras: Sony A7R2, RX100V

Computers: Win10: Chillblast i9 Custom + Philips 40in 4K & Benq 23in; Surface Pro 4 i5; iPad Pro 11"

Favourite word: Aha. For me and for others.

Link to comment
Share on other sites

On 3/7/2021 at 9:44 PM, dmstraker said:

Pardon a tad ignorance. What does rgbtoi do, exactly. Presumably takes R, G and B and converts to single integer? What's the algorithm, please.

Thanks

Hi,

 

it uses the conversion factors defined in ITU-R 601

https://en.wikipedia.org/wiki/Grayscale

Luma coding in video systems

Main article: luma (video)

For images in color spaces such as Y'UV and its relatives, which are used in standard color TV and video systems such as PAL, SECAM, and NTSC, a nonlinear luma component (Y') is calculated directly from gamma-compressed primary intensities as a weighted sum, which, although not a perfect representation of the colorimetric luminance, can be calculated more quickly without the gamma expansion and compression used in photometric/colorimetric calculations. In the Y'UV and Y'IQ models used by PAL and NTSC, the rec601 luma (Y') component is computed as

Y′=0.299R′+0.587G′+0.114B′{\displaystyle Y'=0.299R'+0.587G'+0.114B'}Y'=0.299R'+0.587G'+0.114B'

where we use the prime to distinguish these nonlinear values from the sRGB nonlinear values (discussed above) which use a somewhat different gamma compression formula, and from the linear RGB components

Mac mini M1 A2348

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

 

Link to comment
Share on other sites

Just now, NotMyFault said:

it uses the conversion factors defined in ITU-R 601

https://en.wikipedia.org/wiki/Grayscale

Luma coding in video systems

Main article: luma (video)

For images in color spaces such as Y'UV and its relatives, which are used in standard color TV and video systems such as PAL, SECAM, and NTSC, a nonlinear luma component (Y') is calculated directly from gamma-compressed primary intensities as a weighted sum, which, although not a perfect representation of the colorimetric luminance, can be calculated more quickly without the gamma expansion and compression used in photometric/colorimetric calculations. In the Y'UV and Y'IQ models used by PAL and NTSC, the rec601 luma (Y') component is computed as

Y′=0.299R′+0.587G′+0.114B′{\displaystyle Y'=0.299R'+0.587G'+0.114B'}Y'=0.299R'+0.587G'+0.114B'

where we use the prime to distinguish these nonlinear values from the sRGB nonlinear values (discussed above) which use a somewhat different gamma compression formula, and from the linear RGB components

Many thanks @NotMyFault! Do you know of any source where I can find more about other hardly-documented functions?

Dave Straker

Cameras: Sony A7R2, RX100V

Computers: Win10: Chillblast i9 Custom + Philips 40in 4K & Benq 23in; Surface Pro 4 i5; iPad Pro 11"

Favourite word: Aha. For me and for others.

Link to comment
Share on other sites

If would help if you second my request for better documentation ;-)

 

Mac mini M1 A2348

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

 

Link to comment
Share on other sites

and this

 

 

Mac mini M1 A2348

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

 

Link to comment
Share on other sites

actually, out of curiosity I'm trying to document them on my own. Lots of googling, trial & error, and reverse engineering. We should start a new thread to collect all user-generated documentation.

 

Mac mini M1 A2348

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

 

Link to comment
Share on other sites

36 minutes ago, NotMyFault said:

actually, out of curiosity I'm trying to document them on my own. Lots of googling, trial & error, and reverse engineering. We should start a new thread to collect all user-generated documentation.

 

Definitely. I'm into Procedural Texture programming and would like to know more.

Aside: I program in PT using Excel -- one statement per line, comment in next column, then concatenate all lines to cut/paste to PT. Conditionals are a pain but doable.

Dave Straker

Cameras: Sony A7R2, RX100V

Computers: Win10: Chillblast i9 Custom + Philips 40in 4K & Benq 23in; Surface Pro 4 i5; iPad Pro 11"

Favourite word: Aha. For me and for others.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...

Important Information

Please note there is currently a delay in replying to some post. See pinned thread in the Questions forum. These are the Terms of Use you will be asked to agree to if you join the forum. | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.