The shader code in glsl3_pixel isn’t going to be directly compatible with the pixel shader for the material.
The GLSL material has a vertex and pixel shader that describes how to handle the rendering process where the lights, cameras, and geometry objects are supplied by TouchDesigner. A difference to consider between the glsl TOPs and the glsl materials are what variables are supplied for you. vUV, for example, is supplied for you by default in the glsl TOP, but not in the glsl material. Considering this, the approach in glsl3_pixel won’t work without modification as it relies on a touch declared input variable. Again important to consider is that you’re using point sprites - gl_PointSize. Each sprite (or billboard as you’ll sometimes called it in reference documents) has it’s own set of uv coords:
If you changed your pixel shader to (you’ll also want to turn up your gl_PointSize to something like 10):
[code]layout(location = 0) out vec4 fragColor;
void main(){
vec2 pointUVs = gl_PointCoord;
fragColor = vec4( pointUVs.rg, 0.0, 1.0 );
}[/code]
You can see that each billboard has its own unique set of texture coords. If you add a new sampler to your glsl material called color and use the moviefilein TOP as the sampled texture and change your pixel shader to:
[code]
layout(location = 0) out vec4 fragColor;
uniform sampler2D color;
void main(){
vec2 pointUVs = gl_PointCoord;
vec4 color = texture( color, pointUVs );
fragColor = vec4( color );
}[/code]
You’ll now have a banana on each of your point sprites.
One missing ingredient here is how to pass data between a vertex shader and a pixel shader. This is done with a struct and allows you to pass data from one portion of the pipeline to the next. This would let you do something like pass your computed uv coords from the vertex shader to the pixel shader without needing to recompute those vals.
In this case that solution will likely yield undesirable results as your uvs only describe a one dimensional array - your sampler for point position is only 1 pixel tall, which means that to sample color you’d need to compose your color look up to be only one pixel tall.
I don’t know if that helps or just makes things more confusing.