How to add pixel values to z vector of a mesh

Hi,

I have a texture with size 150150 and a mesh with 150150 vertices. I want to read the R channel of the texture and add its value to the according vertex in the mesh. I multiplied R channel with the B channel of the absolute world position. Although the deformation is correct it is not enough. I am comparing it with the code I have made in C++ for the same matter and the result is not the same.
can some one give me a better suggestion of what to do ?