How do I add a 2nd texture uniform in the Kick.js shader editor so my shader can use it? The URL for Kick.js is:
http://www.kickjs.org/example/shader_editor/shader_editor.html
I modified the default shader in Kick.js. It uses one texture. I successfully used the ‘Textures’ panel to add a 2nd texture by referencing an image I found with images.google.com.
Now the problem is that the ‘Uniforms’ panel does not show the texture sampler uniform. How can I make this uniform appear?
By the way, here is my shader code. However, I do not believe this code is part of the problem. Thanks for any help.
#ifdef GL_ES
precision highp float;
#endif
varying vec3 vColor;
varying vec2 uv;
uniform sampler2D video_tex;
uniform sampler2D video_mask;
void main(void)
{
vec4 samp_video = texture2D(video_tex,uv);
vec4 samp_mask = texture2D(video_mask,uv);
vec3 samp_virtual = vec3(1,0,0);
float alpha = samp_mask.r;
//gl_FragColor.rgb = (alpha)*samp_virtual.rgb + (1.0-alpha)*samp_video.rgb;
gl_FragColor.rgb = samp_mask.rgb;
gl_FragColor.a = 1.0;
}
You code works just fine 🙂
You need to bind the textures to the uniform variables. The process takes two steps: