GBagley Posted July 16, 2015 Share Posted July 16, 2015 Hi, I'm starting to play with shaders (AbstractFilter) in PIXI, but have gotten stuck trying to use the alpha value. It seems that in the vertex shader the attribute aColor.a (the alpha) is always at 1.0, even though in pixi I'm specifying that the alpha on the graphics object is lower. Which alpha value from pixi is being passed to the shader? Example here: http://jsfiddle.net/tLc5c8yd/ In this, one box has an alpha of 0.6 and the other has an alpha of 1.0. In the vertex shader, I'm trying to change the emitted color of the vertex based on the alpha (>= 1.0 is red, < 1 is green) but they both come up the same color. Quote Link to comment Share on other sites More sharing options...
xerver Posted July 17, 2015 Share Posted July 17, 2015 I think there is a misunderstanding, aColor is for "colorizing" or tinting an object. Your tint is white (by default) so you get vec4(1.0, 1.0, 1.0, 1.0). aColor is not the color of the object you are drawing it is the tint you are applying (and in some eccentric features can be used for premultiplied alphas). Quote Link to comment Share on other sites More sharing options...
GBagley Posted July 17, 2015 Author Share Posted July 17, 2015 I think there is a misunderstanding, aColor is for "colorizing" or tinting an object. Your tint is white (by default) so you get vec4(1.0, 1.0, 1.0, 1.0). Oh! I see. I grabbed the default TextureShader sources for some reason... Guessing I want the one of the primitive ones for Graphics objects instead. Could you describe the difference between the default PrimitiveShader and the ComplexPrimitiveShader, and when pixi uses each? Looks like the difference has something to do with coloring/blending -- complex using a uniform for color rather than an attribute?. Thanks Quote Link to comment Share on other sites More sharing options...
GBagley Posted July 17, 2015 Author Share Posted July 17, 2015 Nevermind. Reading through the source. Looks like ComplexPrimitiveShader is just for complex polygons (mode === 1). All other primitives (mode === 0) use the PrimitiveShader. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.