简体   繁体   English

使用Three.js制作由粒子组成的3d地球

[英]Making a 3d Earth, made up of particles with Three.js

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. 我正在尝试复制这种效果: http : //www.hys-inc.jp/唯一的区别是,我希望粒子的定位方式类似于地球,如果您将其称为“纹理化的脸”将。

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... 我知道如何在2d渲染上下文中执行此操作,使用图片和像素扫描来获取粒子位置的正确坐标,但是我不知道如何在3d中执行此操作...

Any help is more then welcome 任何帮助都比欢迎

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. 如果您拥有一个像素网格,该像素网格代表以2维表示地球表面的颜色值作为粒子,则要将其投影到3维,需要使用球体投影方法。 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) 如何将2d网格点(x,y)作为3d点(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 立体摄影是另一种常见方法: http : //en.wikipedia.org/wiki/List_of_map_projections

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM