holzchopf.mojo2overlayshaders - blends like overlay in professional graphics software

Holzchopf

Moderator
Joined
Jul 31, 2017
Location
Bern, Switzerland
A new tiny module to share: Holzchopf.mojo2overlayshaders

It's a shader supposed to be best suited for colouring of images. It's the mix between multiply blending and additive blending you always wanted. But as shader, of course. So basically, when blending with white, the image gets brighter, when blending with black, it gets darker.

Here's what it does to this image:
doc_grey50.png


With SetColor(0.5, 0.5, 0.5)
doc_grey50.png

(yup, it's supposed to have no effect)

With SetColor(0.0, 0.0, 0.0)
doc_grey0.png


With SetColor(1.0, 1.0, 1.0)
doc_grey100.png


With SetColor(1.0, 0.0, 0.0)
doc_red100.png


For now, there's only one shader in the module. But maybe there will be more in the future.
 

Attachments

Holzchopf

Moderator
Joined
Jul 31, 2017
Location
Bern, Switzerland
OK fellow coders I went crazy on those fragment shaders and now I have a complete library to share with you!


mojo2fragmentshaders_banner.png


Now there's a whole bunch of shaders that allow you to manipulate the colours of an image in various ways. Plus some transform shaders =)

The overlay shader is still available but got renamed to BlendOverlayShader.

BlendMixShader
mixes vertex and fragment colour 50/50​
BlendMultiplyShader
multiplies vertex and fragment colour​
BlendAddShader
adds vertex and fragment colour​
BlendDarkenShader
takes darker one of vertex or fragment colour per component​
BlendLightenShader
takes brighter one of vertex or fragment colour per component​
BlendInverseMultiplyShader
inverse of product of inverses of vertex and fragment colours​
BlendInverseAddShader
one minus sum of one minus vertex and one minus fragment colour​
BlendOverlayShader
overlay (see first posting)​
BlendHdrLightningShader
like overlay but allows full saturation (hence the high dynamic range in the name)​
BlendAromatShader
like HDR lightning but spiced up. THIS IS THE ROLLS ROYCE OF LIGHTNING SHADERS​
BlendDifferenceShader
difference between vertex and fragment colour​
BlendSaddleShader
lets you gradually slide from normal to inverted image​
BlendGradeShader
reduces colour depth per channel​
TransProjectShader
projects ColorTexture by using a displacement map​
TransDisplaceShader
moves fragments of ColorTexture by using a displacement map​
TransSpreadShader
spreads fragments of ColorTexture relatively to nearest edge by using a displacement map​
GradientFillShader
maps from fragment red channel onto a gradient image​
ColorConvolutionShader
convolutes fragment colours with the colours of vertex​
BumpMapRotatorShader
used for rotating the normals of a bump map​

There's an extensive example in the cerberusdoc sub folder.
 

Attachments

Top Bottom