Dilute Node
The dilute node dilutes a color. "Dilute" could mean a number of different things:
- Reduce the opacity to a defined value.
- Reduce the opacity even more than it already is (e.g. cut it in half, so 80% goes to 40%)
- Return an opaque color that matches how the color would look at a given transparency against a particular background.
- Reduce its proportion in a blend with a second color.
The dilute node can do any one of these. It takes the following parameters:
- Color. The color you wish to change. Normally opaque (100% alpha) but can be translucent.
- Background. An opaque background color used only in the last two of the four output options.
- % Strength. A percentage value (0 to 100) used to define the desired alpha. 100% equals opaque; 0% equals transparent.
- Output. One of four possible modes:
- Set Alpha. Reset the alpha value of the input color to the supplied strength.
- Multiply Alpha. Multiply the input color's current alpha value by the percentage strength. If input color is opaque, this will have the same effect as Set Alpha, but if it is translucent, this setting can cause the color to fade even further.
- Opaque Against Background. Return an opaque color equivalent to the color produced by superimposing the input color with its alpha reset to the strength value against the supplied background color. The resulting color will be opaque (alpha = 100%), but will look like a translucent color against the background. If the input color is not opaque, its alpha value will be ignored and replaced with the supplied Strength value.
- Blend With Background. Blend the input color with the background color using a proportion defined by the supplied strength. Both colors will first be transformed from translucent to opaque against a white background, with the alpha of the input color set to Strength and the alpha of the background color set to (100 minus Strength). These two colors will then be blended using one of the seven procedures defined by the Blending Mode input.
- Blending mode. One of seven procedures used to blend two colors. Only used if Output is set to "Blend With Background". For this use case the most useful mode will probably be "Subtract Paint".
For more about the seven blending modes, see http://support.nodebox.net/discussions/show-your-work/680-new-blend...
NOTE. Dilute's proportional blending output is based solely on RGB values and so is somewhat crude. If you wish to transition between two colors and want more control over the intervening shades, consider using my palette node instead.
The four basic use cases for the dilute node are shown in the demo (attached)...
All four columns show dilute color outputs using an input color of pure blue at 50% opacity and a background of pure yellow. Each pill shape represents steadily decreasing strength values in 5% intervals from 100% at the top down to 5% at the bottom.
- COLUMN 1. Blue colors go from 100% opaque down to 5% opaque.
- COLUMN 2. Blue colors start at 50% opaque and steadily decrease down to 2.5% (5% of 50%)
- COLUMN 3. Colors start with 100% opaque blue and transition to increasingly transparent blue against a yellow background. Here a 50% strength produces a grayish tan color.
- COLUMN 4. Colors start with a blend of 100% blue vs. 0% yellow and transition to the reverse. This example uses the Subtract Paint blending mode. At a strength of 50% the blend is 50% blue and 50% yellow, which produces a green color.
Dilute is a fairly sophisticated node which does something that is actually fairly simple. For my original use case, if you only want to change the opacity of a color to 80%, just feed the color into the color node and 80 into the strength node - Done!
Comments always welcome.
John
-
dilute_node_screenshot.png 616 KB
- dilute_node.ndbx.zip 111 KB
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac