0

I am trying to replicate this effect: http://www.hys-inc.jp/ The only difference is that I want the particles to be positioned in such a way, that they resemble the Earth - a 'textured face' if you will.

Browsing through their code, this is what they use to set up the particles group:

var map = THREE.ImageUtils.loadTexture('/admin/wp-content/themes/hys/assets/img/particle.png');

    var m = new THREE.ParticleSystemMaterial({
      color: 0x000000,
      size: 1.5,
      map: map,
      //blending: THREE.AdditiveBlending,
      depthTest: false,
      transparent: true
    });

    var p = new THREE.ParticleSystem(g, m);
    scene.add(p);

This is all great, but how do I position them along a sphere to resemble the planet? I know how to do it in 2d rendering context, using a picture and pixels scanning to get the right coordinates for the particles' position, but I am clueless how to do it in 3d...

Any help is more then welcome

WestLangley
  • 102,557
  • 10
  • 276
  • 276
Georgi B. Nikolov
  • 976
  • 2
  • 13
  • 24
  • 1
    What are you asking exactly? "How do I position particles on the surface of a sphere?" or "How do I read pixel values out of image so that I can use that data for positioning objects?" or something else? As is, this questions is pretty broad. Narrow it down for us. – Alex Wayne Feb 02 '15 at 20:05

1 Answers1

0

If you have a grid of pixels that represents color values showing the surface of the earth in 2 dimensions as particles, to project it to 3 dimensions requires a sphere projection method. You can take a look at this question for the implementation of mercator projection.

how map 2d grid points (x,y) onto sphere as 3d points (x,y,z)

There are many methods for accomplishing this with a good deal of variation. Stereographic is another common approach : http://en.wikipedia.org/wiki/List_of_map_projections

Community
  • 1
  • 1
  • You can then use the 2d xy coordinates to act as your UV lookup. Use this value pair in a shader (or just canvas) to look up in a world map image to see if the particle is sitting in land or ocean, and then you can change your particle size or color based on this information. – Flux Feb 03 '15 at 01:25