PlaneGeometry - Apply transparency using shaders

Hi Three Enthusiasts,

I would like to make a planeGeometry transparent in the black parts but still show the red circle that changes size with u_time using shaders.

I tried to put the transparent property to “true” but with no luck. I also tried to apply 0.0 to the alpha channel for transparency (gl_FragColor.a = 0.0) but without success.

Your inputs are much appreciated

Thanks,

Slightly changed fragment shader:

float colVal = dot(color,red_color);

gl_FragColor = vec4( colVal,0.0, 0.0, colVal );

got this:

1 Like

I would also suggest to not make the plane transparent but use an alpha cutout instead. You can do this by setting the alphaTest property of your shader material to a value like 0.5. In this way you don’t get these ugly dark edges.

If you need blending, you can keep the transparency but set premultipliedAlpha to true.

1 Like

@prisoner849 and @Mugen87

You guys are bosses !!!