I want to create a fog-like object to achieve the temperature field effect. Attached drawings:
As shown in the figure, we know the temperature value of each position in the scene space, and different temperature sections show different colors.
I initially used the following methods to achieve, but the effect is not good:unamused::
var particles = datas.length;
var geometry = new THREE.BufferGeometry();
var positions = [];
var colors = [];
for (let index = 0; index < particles; index++) {
const element = datas[index];
positions.push(element.v[0], element.v[2], element.v[1]);//position
var colorArray = temperature2Color2(element.t);//color
colors.push(colorArray[0], colorArray[1], colorArray[2]);
}
geometry.addAttribute('position', new THREE.Float32BufferAttribute(positions, 3));
geometry.addAttribute('color', new THREE.Float32BufferAttribute(colors, 3));
geometry.computeBoundingSphere();
var material = new THREE.PointsMaterial({ //ShaderMaterial
size: 20,
vertexColors: THREE.VertexColors,
sizeAttenuation: true,
// morphTargets:true,
transparent: true,
// dithering:true,
precision: "highp",
// premultipliedAlpha: true,
side: THREE.DoubleSide,
opacity: .25
});
var points = new THREE.Points(geometry, material);
points.renderOrder = 0;
points.name = "scene_pointsTemp"
scene.add(points);
I really hope to get some good advice about it,Thank you in advance:hugs:.