Hello webgl experts.
I would like to use console.log() in three.js shader code, or something similar with that.
Of course I know that console.log() is imporsible in glsl code.
My idea is to use Uniform.
First. declare a uniform in javascriop.
Second. change it’s value to something you want to show in console.
Then, detect the uniform value is changed in javascript.
you can not print my_new_uniform using JavaScript, the best you can do is to map the value into the [0,1] range and set it as the output pixel color in the fragment shader, then pick it up from the screen.
Uniform values for THREE are simply JavaScript variables as any other, you can track changes in their values by any JavaScript means available, this has nothing to do with 3D.