Deform a mesh by random values in vertexshader


I just started to get familiar with writing shaders. What I want to do, is to deform a mesh by random values, so that each Vertex is being set off by a slightly different vector, so that I could connect a spread of random 3d vectors. So I thought that would be a simple multiplication

float3 Offset; *= Offset;

But with that ALL vertices are being offset (so when I connect a spread with more than 3 values, a completely new object is being created with a different offset). How can I perform that operation for each Vertex?



use texture instead, since you have more then one vertex…
if i remember correct you need to do tex2Dlod
and sample some offset texture in vertex shader.

otherwise you can try with arrays
but you need to know amount of vertices
something like:

float3 Offset[16](16);

for ( i = 0 ; i < 16 ; i++) 
{ *= Offset[i](i);

not sure if it works tho