Best way to detect if vec3 is between vec3(x) and vec3(y) in glsl
Posted
by
elect
on Game Development
See other posts from Game Development
or by elect
Published on 2014-08-21T08:22:04Z
Indexed on
2014/08/21
10:31 UTC
Read the original article
Hit count: 319
As titled
I am sampling from a texture and if the color is somehow gray [vec3(.8), vec3(.9)] and an uniform is 1 I need to substitute that color with another one
I am not a glsl veteran but I am pretty sure there is a more elegant and compact (without mentioning faster) way than this:
vec3 textureColor = texture(texture0, oUV);
if(settings.w == 1 && textureColor.r > .8 && textureColor.r < .9
&& textureColor.g > .8 && textureColor.g < .9
&& textureColor.b > .8 && textureColor.b < .9)
© Game Development or respective owner