3

I am using the Three.js library to render colored particles. I am iterating over the data and trying to set the color using RGB values.

particle = new THREE.Particle( new THREE.ParticleCanvasMaterial({ color:new THREE.Color().setRGB(j[0],j[1],j[2]), program: particleRender }));

sample values in the array are

139 123 124
118 115 122
163 160 177

I've also tried the following

particle = new THREE.Particle( new THREE.ParticleCanvasMaterial({ program: particleRender }));
particle.material.color.r =j[0];
particle.material.color.g =j[1];
particle.material.color.b =j[2];

But this doesn't seem to color the points. Or sometimes I occassionally see one point that is colored. What am I doing wrong here? I feel I am missing something small and silly.

1 Answer 1

5

The RGB values should be between 0 and 1, inclusive.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.