Hi guys, I’ve got a particle system threejs shader with a png for a texture but on the alpha channel I see a black solid color, I’ve used a lot of blending custom function but not function.
What am I doing wrong?
this is the link: http://williammanco.cloud/particles/
Thanks
state.textures.particle = new TextureLoader().load(particleImage)
state.textures.particle.minFilter = LinearMipMapLinearFilter
state.textures.particle.flipY = false
state.textures.particle.needsUpdate = true
state.textures.particle.premultiplyAlpha = true
console.log(state.textures.particle)
this.mat = new ShaderMaterial({
vertexShader: vert,
fragmentShader: frag,
uniforms: {
texture: { type: 't', value: state.textures.particle },
color: { type: 'c', value: new Color(0xffffff) },
},
transparent: true,
blending: CustomBlending,
blendSrc: OneFactor,
blendDst: OneMinusSrcAlphaFactor,
blendEquation: AddEquation,
})
this.particles = new Points(this.geom, this.mat)
this.add(this.particles)
}
uniform vec3 color;
uniform sampler2D texture;
varying float vAlpha;
void main() {
gl_FragColor = vec4( clamp(color,0.0,1.0), clamp(vAlpha, 0.0, 1.0) ) * texture2D( texture, gl_PointCoord );
}