Reputation: 345
I'm struggling to apply a correct tint color to this animation in Three.js. Even if I apply correct tint color eg: #008080 the actual color is not green just blue or something. It looks like there is some calculation of the highlight color. How do I switch it off or control it?
const PARTICLE_SIZE = 1;
const textureAttr = {
resolution: 64,
radius: 32,
color: '#008080'
};
Working example here:
https://jsfiddle.net/6cq1re9o/
Upvotes: 1
Views: 153
Reputation: 14645
The color was modified by the fragment shader:
// noise RGB values
float r = 1. - 2.0 * noise;
float g = 0.0;
float b = 1. - 1.0 * noise;
vec3 foo = vec3(r*2.0, g, b*1.5);
// calculate a new color using the above noise
gl_FragColor = vec4( foo, 1.0 ) * texture2D( texture, gl_PointCoord );
// grab the textel
gl_FragColor = texture2D( texture, vec2(pos.x, pos.y) );
// or just use the noisy bit without the noise
// gl_FragColor = texture2D( texture, gl_PointCoord );
texture2D docs here. It simply returns a color of a point on a texture.
Check it out in this fiddle.
If you want to "control" it, then you'd need to modify the foo
RGB color which is used as noise.
Upvotes: 2