three.js - Lighting a Particle System in THREEJS/GLSL -
i made particle system buffergeometry in threejs. want particles receive light. is difficult (impossible?) because geometry doesn't have faces light?
i'm working in shader created. created geometry in threejs.
are particles not in world space? in camera space only?
what simple glsl fragment shader equation lighting particles?
it depends on kind of material using particles. if using shadermaterial , write own fragmentshader, have implement lighting in shader code. example, lighten particles close light source, lighten color distance between each particle , light position:
vec3 lightposition = vec3(1.0, 2.0, 3.0); float lightstrength = 0.1; float distancetolightsource = distance(particleposition, lightposition); vec4 lightercolor = particlecolor * distancetolightsource * lightstrength;
Comments
Post a Comment