Hlsl - mesh array

Can anyone give me a few tips on how I might make a shader that will take an input mesh and texture, then draw a 2d array of that mesh, the same x/y count as the texture, with each pixel of that texture defining attributes of each relative mesh, eg z position?

I know I can use tex2dlod to get the texture data into the vertex shader, but I’m not sure how to setup the transform for the array of meshes. I need the equivalent of a linear spread > cross 2d > translate combo, but inside the shader.

Any ideas?

I don’t quite get what you’re asking for, but this may be what you’re looking for:
heightmap-displacement

That’s close, but imagine if there was a mesh drawn at each of the vertex points in that grid.

That’s what I’m after

GPU particles 3d static I would have thought would do it…?
The mesh part of it is probably what your missing, it does the spread count, the textures do the positon, or am I missing the point?

ahhh, maybe. Can you use any mesh as a particle?

tbh I’m kindof interested in how to do this as a learning exercise aswell

Yes any object, the example has cubes and spheres I think, its worth having a look and reading dottore’s documentation pdf too, where he explains whats going on!

Having a lot of fun with this btw. Thanks

Anyone know if it’s possible to texture transform individual ‘particles’ so I can have a different part of a texture on each?

Idea being that in an array of grids, each grid could display a small grid sized piece of a larger image.

Failing that, is it possible to colour each particle differently?

@mrboni:
individual texture transforms is possible.
either do it in the shader via an extra controltexture xy translate and xy scale fit nicely into rgba.
if you only need a static transformation for each particle its feasible to change the texcoord2 in mesh input patch directly

Thanks for the tip. Only need static for now.

I’m using the texture coordinates from a grid the with the same x/y resolution as the number of particles in the x/y array, into the vertex buffer join in the mesh input patch.

This has ‘tiled’ 4*4 copies of the texture across the array. Any idea why?

Image attached