Hi thanks for the response,
Sorry I wasn’t very clear.
1. So let’s say I have a PLY file with just vertices and no faces or anything else like this:
ply
format ascii 1.0
element vertex 10
property float x
property float y
property float z
property list uchar int vertex_indices
end_header
-1.096243 -34.75982 -9.593866
-1.026878 -34.69783 -9.696553
-1.026878 -34.64236 -9.569579
-3.354581 -32.12786 5.258512
-3.272709 -32.05115 5.177201
-3.272709 -32.03098 5.314286
-1.264096 -34.68545 -15.23503
-1.167952 -34.59552 -15.27826
-1.167952 -34.63902 -15.14671
-2.080832 -36.91751 -12.30752
(The real file is many thousands of vertices)
2. and then let’s say I want to make a point cloud out of it using Three.Points
like so:
//imports & definitions omitted
const modelLoader = new PLYLoader();
modelLoader.load(myPLYFile, function(plyGeom){
const modelGeometry = plyGeom;
const modelMaterial = new THREE.PointsMaterial({color:0xFFFFFF,size:0.5});
const model = new THREE.Points(modelGeometry, modelMaterial);
scene.add(model);
},undefined,function(error){
//oh no!
})
So far so good.
However, instead of the standard square that Three.PointsMaterial gives me I would like it to be any one of an array of images and I would also like the z rotation to be addressable / controllable.
I know that I can use an image instead of the square and even set an alpha map (sorry in my initial post I called this a ‘sprite’ - my legacy terminology from other software/libraries) like so:
const particleSprite = new THREE.TextureLoader().load( 'particlesprite.png' );
const particleAlpha = new THREE.TextureLoader().load( 'particlealpha.png' );
const pointSpriteMaterial = new THREE.PointsMaterial({
size: 0.5,
map:particleSprite,
alphaMap:particleAlpha,
transparent:false
}
The problem:
I need much more control over the points / particles than this. For instance, I would like to programatically set the image/sprite/texture and rotate the particles as mentioned before (maybe also set other geometric properties).
I only ever need the particles to appear in “2D” and pointed at the camera like the basic Three.Points()
and PointsMaterial()
does already. I also love that these classes/objects are so lightweight with regards to resources. Perhaps as a result of this efficiency, I don’t seem to have any more control over particles as a result when they are in Points/PointsMaterial objects.
I know that I can simply create a huge mass of PlaneGeometry()
s on the scene to achieve what I am after but the resource overhead is not acceptable for the project so my question is:
Question:
Is there a way to extend Point/PointsMaterial to be able to control each point a bit more like a Plane/Texture?
Thanks very much!