Of course, here’s a basic example of what I’m trying to do.

I have a position stored in a texture.

and I want to translate these positions using another texture.

–

What I did in my vertex shader was creating translation matrix using values from the translation texture and multiplied the position of the vertex with that matrix.

```
uniform sampler2D sPtPosition;
uniform sampler2D sPtTranslation;
mat4 translation_matrix(vec3 t){
mat4 translation_matrix = mat4( 1.0, 0.0, 0.0, t.x,
0.0, 1.0, 0.0, t.y,
0.0, 0.0, 1.0, t.z,
0.0, 0.0, 0.0, 1.0);
return translation_matrix;
}
void main()
{
vec2 uvCoord = uv[1].rg;
vec4 ptTranslation = texture(sPtTranslation,uvCoord);
mat4 translationMatrix = translation_matrix(ptTranslation.rgb);
vec4 worldSpacePos = TDDeform(P);
worldSpacePos *= translationMatrix;
gl_Position = TDWorldToProj(worldSpacePos);
}
```

What I don’t understand is why this transformation works with a vertex position but won’t work with the value of a pixel. Here’s my pixel shader.

```
mat4 translation_matrix(vec3 t){
mat4 translation_matrix = mat4( 1.0, 0.0, 0.0, t.x,
0.0, 1.0, 0.0, t.y,
0.0, 0.0, 1.0, t.z,
0.0, 0.0, 0.0, 1.0);
return translation_matrix;
}
out vec4 fragColor;
void main()
{
vec4 ptPosition = texture(sTD2DInputs[0], vUV.st);
vec4 ptTranslation = texture(sTD2DInputs[1], vUV.st);
mat4 translationMatrix = translation_matrix(ptTranslation.rgb);
vec4 newPosition = ptPosition * translationMatrix;
fragColor = TDOutputSwizzle(newPosition);
}
```

Again, thanks for you time!

glsl-translate3.tox (3.7 KB)