1

I want the sprite in the scene don't change the size when the camera zoom in or out. and the sprites use different canvas texture as the material.

I found that the sizeAttenuation in ParticleBasicMatierial can work for me. But if I use the WenGLRenderer, I must use ParticleSystem instead of the Particle with the CanvasRenderer.

I currently use ParticleSystem to contain only one vertex, and every vertex correspond to one ParticleSystem, so there are about 800+ ParticleSystem in my scene, this can work, but consume a lot.

Obviously, I can't use "HUD" as the example in three.js source, because the sprites are all in 3D scene.

Can some one help me. Or add the sizeAttenuation to Sprite Material! Thanks!

Edric
  • 24,639
  • 13
  • 81
  • 91
Michael Ma
  • 71
  • 2
  • 5

1 Answers1

6

If you want to prevent size attenuation with sprites, and you are using a perspective camera, you can set the sizeAttenuation property of your material to false:

var material = new THREE.SpriteMaterial( {

    color: 0xffffff,
    map: texture,
    sizeAttenuation: false

} );

This feature was added in three.js r.96.

EDIT: Updated to three.js r.96

WestLangley
  • 102,557
  • 10
  • 276
  • 276
  • Hello, WestLangeley, I tried this approach, i does't work well. if I set the scale_factor to 3, the sprite is too big, and I set to 30, look well, but the size attenuation is as before. – Michael Ma Jun 17 '14 at 14:35
  • Start with this fiddle http://jsfiddle.net/9GudA/ and edit it to demonstrate your problem. – WestLangley Jun 17 '14 at 15:48
  • Sorry for my later reply, I had tried a few times more, it did work well, thanks very much for your help! – Michael Ma Jun 22 '14 at 13:48