textureLoader not working on sprites

Good day all.

Moderate coffee amateur here. I am having a bit of trouble getting a sprite map to render with textures. I’ve started experimenting using parcel.js for modular approach to working with Three.js. With that, I’m trying to recreate one of the examples on the Three.js page ( three.js examples ). Unfortunately, my textureLoader does not appear to be working. Please see script below.

//This is from my particle.js file
var geometry = new THREE.BufferGeometry(); 
var vertices = [];
for ( var i = 0; i < 10000; i ++ ) {
    var x = 2000 * Math.random() - 1000;
	    var y = 2000 * Math.random() - 1000;
    var z = 2000 * Math.random() - 1000;
    vertices.push( x, y, z );
geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
var sprite = new THREE.TextureLoader().load( '../assets/basicGreenDot.png' );
const material = new THREE.PointsMaterial( {
  size: 15,
  sizeAttenuation: false,
  map: sprite,
  alphaTest: 0.5,
  transparent: true,
} );
material.color.setHSL( 1.0, 0.3, 0.7 );

var particles = new THREE.Points( geometry, material ); 

export { particles };

//This is in my index.js module.

scene.add( particles );

My scene is rendering correctly. I’ve tested doing simple cube in a seperate module. Then simply added to scene in my index.js.

Any advice will be celebrated :smiley:

What does that mean? Please be more specific and describe your expected and actual result in detail.

BTW: In general, issues get solved way more quickly if OPs demonstrate their problems with live examples.

1 Like

Nevermind. Found my issue

I had the actual load commented out. Ameture hour over here. Apologies for the inconvenience

1 Like