Created
July 30, 2019 10:24
-
-
Save andyshora/42c97afd82ad87cad98dbd3747433d85 to your computer and use it in GitHub Desktop.
BufferGeometry with alpha custom blending
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
particlesGeometry.current = new THREE.BufferGeometry() | |
particlesGeometry.current.addAttribute('position', new THREE.Float32BufferAttribute(positions.current, 3).setDynamic( true )) | |
particlesGeometry.current.addAttribute('color', new THREE.Float32BufferAttribute(colorBuffer, 3).setDynamic( true )) | |
const loader = new THREE.TextureLoader() | |
const texture = loader.load(lensflare) | |
texture.premultiplyAlpha = false | |
texture.needsUpdate = true | |
const blendSrc = { name: 'SrcAlpha', constant: THREE.SrcAlphaFactor } | |
const blendDst = { name: 'DstAlpha', constant: THREE.DstAlphaFactor } | |
const material = new THREE.PointsMaterial({ | |
map: texture, | |
size: 2, | |
vertexColors: THREE.VertexColors, | |
sizeAttenuation: true, | |
blending: THREE.CustomBlending, | |
blendSrc: blendSrc.constant, | |
blendDst: blendDst.constant, | |
blendEquation: THREE.AddEquation, | |
transparent: true, | |
depthTest: false | |
}) | |
const mesh = new THREE.Points( particlesGeometry.current, material ) | |
Author
andyshora
commented
Jul 30, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment