Ah, this is a better solution, in fact:
return vec4(sample(image, samplerCoord(image)) * alpha);
as it takes into account any transparent areas in the original image.
And the premultiply() doesn't actually seem to make any difference,
in this case, so I've left it out.
a|x
On 16 Oct 2008, at 15:21, Chris Wood wrote:
Fix found, thanks Alex!
If anyone else comes across this, it's caused by premultiplied
alpha. The fix for this case is just to change the return line in
the CI Filter to:
return premultiply(vec4(sample(image, samplerCoord
(image)).rgb,alpha));
Chris
2008/10/16 Chris Wood <[EMAIL PROTECTED]>
I'm in need of a basic 'image fade' filter, using transparency, and
I seem to have come across a pretty strange bug.
What I'm doing is:
1. Create an image.
2. Pass it through a CI filter. The filter just samples the image,
sets the alpha value in the 0.0 - 1.0 range, and returns the new
pixel. The transparency is the same across the whole image.
3. Pass the modified image to a billboard, with the transparency
set to 'over'.
What 'should' happen: the image should fade in + out, depending on
the alpha value.
What does happen: at alpha 1.0 the image is normal. At alpha 0.0,
it's transparent but appears to be doing additive blending, not
over blending. At 0.0, it looks identical to additive blending set
on the billboard, infact.
I've attached a composition showing the bug in action. There are
two billboards, showing a gaussian gradient. The one on the left
has transparency set in the gradient colours: transparency works
perfectly. The one on the right has an image with no transparency,
and transparency is applied in the CI filter. Transparency doesn't
work as it should. There are published parameters to control the
left/right transparency.
Am I making some silly mistake here? Or is it a bug? I find it hard
to believe nobody has done this before :)
Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list (Quartzcomposer-
[EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/the_voder%
40yahoo.co.uk
This email sent to [EMAIL PROTECTED]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]