On Sun, Jun 20, 2010 at 6:48 AM, Chris Wood <pson...@gmail.com> wrote:

> George,
>
> I think your shader is the problem here (although I've not got the plugin
> installed to be sure). You're setting the vertex colours to red with alpha
> at 0.0, then in the fragment shader you're ADDING the vertex colour to the
> texture colour. This totally messes up the colours, and of course if you
> change the alpha value in the vertex shader to 1.0 you get 1.0 + texture
> alpha, which means the whole quad is opaque.
>

I am totally aware that this is what I'm doing; I want to add color (with
alpha at 0), to a texture that has large areas of alpha. So, I don't see why
color add shouldn't work fine.... I guess I'm dubious about this "messing
up" colors, but I am willing to suspend my lack of disbelief. It's just that
in other paradigms alpha+alpha would be alpha.


> The 'blobby' look is probably down to alpha premultiplication (or lack of).
> Try something like:
>
> vec4 output = color + Color; // urgh at the naming there! ;D
> output.rgb *= output.a;
> return output;
>
> Maybe that will fix it.
>


This suggestion doesn't work for me, because it isn't legal in the shader
(getting an "output is reserved" message...). Thanks for the suggestion
though.

I knew I would get some crap from someone about the "(color+Color)" naming
 ;-)

-George


-George Toledo


>
> On 20 Jun 2010, at 08:37, George Toledo wrote:
>
> >
> >
> > I hope I'm asking this question in the right place, and there are sort of
> two separate issues at play - alpha calculation in GLSL shaders, and then
> Over/Alpha Blend modes.
> >
> > Is there support for alpha in GLSL shaders in QC?
> >
> > In a vertex shader, I have the following line:
> >
> >     Color = vec4(surfaceColor.rgb, 1.0);
> >
> > When I change it to:
> >
> >      Color = vec4(surfaceColor.rgb, 0.0);
> >
> > I see an unexpected difference in the alpha content on the final textured
> object in Over mode. While I do see it change from "quad" look to having
> areas of obvious transparency, it looks clearly wrong. SO, I had the bright
> idea to change the line...
> >
> > When I change it to :
> >
> >     Color = vec4(surfaceColor.rgba);
> >
> > I don't see any errors, but I see no difference when I change
> Opacity/Alpha value on the actual shader input for the surfaceColor. I would
> think that would be the "fix". However, it doesn't work completely (the
> color of the texture looks "blobby" in areas where alpha should be
> fading....more smoothly?)
> >
> > The only workaround I've found is to use actual alpha blending on the
> renderer, in this case, by using the Kineme AlphaBlend.plugin.
> >
> > Then, I see a clear difference between the two different alpha channel
> values, and by setting alpha to 0 in the shader, things work as expected.
> >
> > This is a sample composition; I apologize, because it's sort of
> non-standard, because one would need to install the AlphaBlend.plugin for
> this to render as I would expect it should in QC normally (in Over mode). I
> understand if no one is thrilled to look at this because of that, but it's
> not a question about a bug being caused by a 3rd party plugin (in this case,
> it's the only way to see what I expect to in Over with the shader at an
> alpha of 0, or with the surfaceColor.rgba line).
> >
> > -George Toledo
> >
> > <Shaded and Textured Particles Alpha Blend.qtz>
> _______________________________________________
> > Do not post admin requests to the list. They will be ignored.
> > Quartzcomposer-dev mailing list      (Quartzcomposer-dev@lists.apple.com
> )
> > Help/Unsubscribe/Update your Subscription:
> >
> http://lists.apple.com/mailman/options/quartzcomposer-dev/psonice%40gmail.com
> >
> > This email sent to pson...@gmail.com
>
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      (Quartzcomposer-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to