Place sprites at certain positions using a shader

192 Views Asked by At

What I achieved:

I created a shader (based on this code with this plant asset) that takes a black and white reference image (like a height map) and places plants on a grid determined by the darkness/lightness-value of the respective pixel.

Black and white image to plants

Where I am stuck:

I am trying to get a more organic look (instead of looking like a tileset) so I used poisson-disc-sampling to get random-looking coordinates for where I want to place the plants. In "normal" code I'd just loop through the array of the generated coordinates and draw a sprite ... but I have no clue how to do that with a shader.

Approach using poisson-disc-sampling

Question:

Is it even possible to use a shader to place images at certain positions?
(I could obviously generate a static image but I am planning to adjust the shader to simulate wind going over the vegetation like this)

Thanks already in advance for any tip or help!

0

There are 0 best solutions below