I might not know how texture2D works actually


My shader works well but I can’t apply the second line of code below:

vec3 texture = texture2D(uTexture, vUv).rgb;
vec3 aa = texture2D(uTexture, vUv).rgb;

I got this error

If I comment the second line, everything is fine. I can’t apply texture2D twice ? I tried everything else, it’s the only solution I see.

Thanks for your help

you assigned the variables “aa” and “texture” to the same value…
I don’t know the purpose of this, but you should either say vec3 aa = texture

I don’t work with shaders but that’s all I could come up with…

Think of it as of a reserved word. Try to use something like tex or texture1 instead.

1 Like

Thank you, it must be that, I will check tomorrow