问题
what I'm trying to achieve is having a particle system where each particle have a portion of a given texture. Below is a example of a particles's buffergeometry using a shader material. so far I can make it look almost as it should, nonetheless, I dont know how to properly program the fragment shader in order to have the correct offset of the texture on each particle. the texture is 500x500px which is the same amount of particles.
http://www.pruebasmemo.co.nf/
fragment shader code:
uniform sampler2D map;
void main() {
vec2 T = gl_FragCoord.xy;
gl_FragColor = texture2D( map, gl_PointCoord / T + 0.5);
}
a bonus question is: why the particles get smaller as you zoom in?
来源:https://stackoverflow.com/questions/16436967/how-to-do-particles-texture-mapping-with-three-js-shadermaterial