我正在使用Three.js ParticleSystem来显示大量的点,提供了很好的性能。
根据变焦水平,粒子可以非常接近彼此,这会造成一组奇怪的德莫伊夫条纹时,修改相机的位置。
构建该程序的代码:
var material = new THREE.ParticleSystemMaterial({
size : 250,
color : colors[i]
});
parentMesh.add(new THREE.ParticleSystem(geometries[i], material));有4个这样的粒子系统物体,其中一个有红色的物质,另一个是绿色、蓝色和黄色的。
我能做些什么来避免do工件的行为吗?
发布于 2014-05-30 09:45:28
如果没有任何屏幕截图/更多的代码,很难说是什么导致了这种效果。你的材料的尺寸相当大,所以首先我要降低它。然后我会禁用depthWrite来获取你的材料colors: colors[i], depthWrite : false });
我也会创建一个粒子系统,包含你所有的粒子。因此,您将所有顶点推入一个几何图形,并通过在几何图形中添加颜色数组来设置此顶点的颜色。然后,在您的材料中,将颜色设置为vertexColors。这样你就有了一个大缓冲区,而不是其中的4个。
var myColors = [new THREE.Color(0xff0000),new THREE.Color(0x00ff00),new THREE.Color(0x0000ff),new THREE.Color(0xffff00)], //your predefined colors
geometryColors = [];
for( var i = 0,j = geometry.vertices.length; i < j; i++ ) {
geometryColors[i] = myColors[(i%myColors.length)-1].clone(); //put the color into the geometryColors array (not sure if you really have to clone it)
}
geometry.colors = geometryColors;
var material = new THREE.ParticleSystemMaterial({
depthWrite : false,
size : 5,
vertexColors : THREE.VertexColors
});
parentMesh.add(new THREE.ParticleSystem(geometry, material));发布于 2014-07-19 12:01:50
如果没有代码和/或屏幕截图,很难确定,但这听起来很像http://en.wikipedia.org/wiki/Z-fighting的例子。当几何重叠时,对抗这种影响的方法是确保在深度轴上的几何平面之间有足够的距离。
https://stackoverflow.com/questions/21675283
复制相似问题