Search the Community
Showing results for tags 'alpha blending'.
-
I am trying to implement an "Additive Shader" (from space shooter tutorial) where BLACK pixels are transparent (or do NOT ADD) and the rest of color add on top... Do we (BabylonJS Community) has a shader already that does something like that??? if not, i will have to make one... I tried to start off by just return a transparent color: void main(void) { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); } I have "needsAlphaBlending = true" on shader material options object BUT I STILL SEE BLACK SQUARE (I little less bright , but still there)... I would assume that setting a color rgba (0,0,0,0) would make EVERY pixel transparent... But it is not. Any help or info would be very kool
- 10 replies
-
- alpha blending
- shader
-
(and 1 more)
Tagged with:
-
I need 3 cylinders in a geometry like the one here https://www.babylonjs-playground.com/#FFZ9HL#1 with transparency. But once the alpha value is below 1 (change line 14 in PG) the alpha blending doesn't work properly, the cylinder on the right goes in front of the cylinder in front. I know that there are some artifacts for alpha blending, but from the initial view direction the center of the bounding sphere of the cylinder in front (which should coincide with the center of this cylinder) should be closer to the observer than the centers of the two other cylinders. Am I missing something? In general, I figured out that for this specific problem the depth test and alpha blending should work perfect if I divide each cylinder in half and place the center of the bounding sphere at the middle of the end cap for each of the 6 half cylinders. But how can I do this?