我正在创建大量的粒子(确切地说是 80,000 个),并且已经设置了一个透明的贴图,但是,并不是所有的粒子都是透明的。
我使用了一个透明的 PNG 图像: (它几乎看不见,但是确实存在)作为材质贴图,然而它显示了黑色背景,如下所示:
如果你仔细观察,一些粒子可以很好地混合在一起(没有重叠的黑色边缘),但是有些则不能。这可能是因为有太多重叠的透明对象,或者这不应该是问题吗?
这是生成我的粒子的代码片段:
// load the texture
var map = THREE.ImageUtils.loadTexture('img/particle.png');
// create temp variables
var geometry, material;
// create an array with ParticleSystems (I need multiple systems because I have different colours, thus different materials)
var systems = [];
// Loop through every colour
for(var i = 0; i < colors.length; i++) {
// Create a new geometry
geometry = new THREE.Geometry();
// create a new material
material = new THREE.ParticleBasicMaterial({
color: colors[i],
size: 20,
map: map, // set the map here
transparent: true // transparency is enabled!!!
});
// create a new particle system
systems[i] = new THREE.ParticleSystem(geometry, material);
// add the system to the scene
scene.add(systems[i]);
}
// vertices are added to the ParticleSystems' geometry here
为什么一些粒子有黑色背景?