Sorry about that @SecondMan, here's the updated Atom.
Thanks again,
David
Match Tint [SUBMITTED]
Moderator: SecondMan
- SecondMan
- Site Admin
- Posts: 4781
- Joined: Thu Jul 31, 2014 5:31 pm
- Location: Vancouver, Canada
- Been thanked: 18 times
- Contact:
Re: Match Tint
No need to apologise for sharing 
Update available in Reactor now, thanks and please check

Update available in Reactor now, thanks and please check

- Chad
- Fusionator
- Posts: 1555
- Joined: Fri Aug 08, 2014 1:11 pm
Re: Match Tint
Fusion includes image functions for this:
inimg:AlphaMultiply(outimg)
inimg:AlphaDivide(outimg)
- Shem Namo
- Fusionista
- Posts: 649
- Joined: Sun Oct 06, 2019 9:15 pm
- Location: North Israel
- Real name: David Kohen
- Been thanked: 1 time
Re: Match Tint
Thanks @SecondMan, it all works as expected now.
Thanks @Chad, I really like the built in Image functions,
but I did notice that when you have a fuse that uses a DCTL kernel, using any of the Image functions makes the fuse significantly slower.
So I added the code to the GPU code instead, it's only like 12 lines.
Here's the GPU code:
Did I implement the Alpha Divide/Multiply right?
Thanks again,
David

Thanks @Chad, I really like the built in Image functions,
but I did notice that when you have a fuse that uses a DCTL kernel, using any of the Image functions makes the fuse significantly slower.
So I added the code to the GPU code instead, it's only like 12 lines.
Here's the GPU code:
Did I implement the Alpha Divide/Multiply right?
Thanks again,
David
- TintParams = [[
- float colorW[3];
- float colorB[3];
- float amount;
- float saturation;
- int prePost;
- int srcCompOrder;
- ]]
- TintKernel = [[
- __KERNEL__ void TintKernel(__CONSTANTREF__ TintParams *params, __TEXTURE2D__ src, __TEXTURE2D_WRITE__ dst) {
- DEFINE_KERNEL_ITERATORS_XY(x, y);
- float4 image = _tex2DVecN(src, x, y, params->srcCompOrder);
- float3 white = to_float3_v(params->colorW);
- float3 black = to_float3_v(params->colorB);
- float amount = params->amount/100.0f;
- if(params->prePost == 1){
- if(image.w != 0.0f){
- image.x /= image.w;
- image.y /= image.w;
- image.z /= image.w;
- }
- }
- float saturation = params->saturation;
- float luma = (image.x * 0.299f) + (image.y * 0.587f) + (image.z * 0.114f);
- image.x = saturation * image.x + (1.0f - saturation) * luma;
- image.y = saturation * image.y + (1.0f - saturation) * luma;
- image.z = saturation * image.z + (1.0f - saturation) * luma;
- float3 color = to_float3(image.x, image.y, image.z);
- float3 map = color;
- map.x = _mix(black.x, white.x, color.x);
- map.y = _mix(black.y, white.y, color.y);
- map.z = _mix(black.z, white.z, color.z);
- color.x = _mix(color.x, map.x, amount);
- color.y = _mix(color.y, map.y, amount);
- color.z = _mix(color.z, map.z, amount);
- image.x = color.x;
- image.y = color.y;
- image.z = color.z;
- if(params->prePost == 1){
- image.x *= image.w;
- image.y *= image.w;
- image.z *= image.w;
- }
- _tex2DVec4Write(dst, x, y, image);
- }
- ]]
- Shem Namo
- Fusionista
- Posts: 649
- Joined: Sun Oct 06, 2019 9:15 pm
- Location: North Israel
- Real name: David Kohen
- Been thanked: 1 time
Re: Match Tint [SUBMITTED]
Hi everyone,
When I was first making this fuse, I saw that in the After Effects "Tint" effect there is a convenient little button that allows you to automatically swap the 2 colors from the 2 color pickers.
I didn't know how to do this back then, but I finally figured it out.
Here is a little update with the button added.
Thanks again,
David
When I was first making this fuse, I saw that in the After Effects "Tint" effect there is a convenient little button that allows you to automatically swap the 2 colors from the 2 color pickers.
I didn't know how to do this back then, but I finally figured it out.
Here is a little update with the button added.
Thanks again,
David
You do not have the required permissions to view the files attached to this post.