Randomly place sprites on texture?

I have 6 snowflake images and ideally I’d have a brush that chooses a random snowflake and places it randomly near the brush at a random size. But, if a brush like this is not possible, then how about a node setup plus a mask? What nodes should I look into?

Something like this:

image

I have no idea how to do this with a brush, but I recently created a node setup to do something similar.
I used a 4x4 snowflake texture atlas and distributed the snowflakes randomly using a voronoi texture. The texture I used are based on a public domain image that can be found here - I just made it black and white.

This is the result with the overall node setup:

And this is the node group scattering the snowflakes:

I don’t have time to go into too much detail on how this works, but you can have the blend file, if you wanna take a closer look: scatter_snowflakes.blend (2.1 MB)

To adapt it for your snowflakes you could put them into one image similar to the one I used and change the two value nodes in the frame labeled Snowflake Texture Grid Dimensions to match your image.
(Meaning if your snowflakes make up a 3 x 2 grid, change X to 3 and Y to 2)

If you don’t wanna put your snowflakes into a different image you can pick one of several image textures using a setup like described in this post:

I hope some of this is helpful :slight_smile:

3 Likes

perfect! What would make it even sweeter if there was a way to blur. Is there a blur effect in blender with nodes?

Unfortunately there is no actual blurring within the shader nodes. There is a workaround, where you can use noise to basically scramble the texture coordinates, which creates an effect that is kinda like a blur:


With this setup the ‘blur’ will always be grainy. You can mitigate that a bit by rendering at a higher resolution than you actually need and the downscaling it.

Another way could be to just split the image into three planes: One with the background material and two with only the snowflakes. Layering over each other with some distance and placing a camera looking straight down on them you can create a blur by using the cameras depth of field:

Blend file for the depth of field setup: scatter_snowflakes_depth-of-field.blend (2.2 MB)

There probably is a way to do it with the compositor, as well, since the compositor actually does have a blur node.

2 Likes

I feel like in this case, adding the blur afterwards in GIMP or Krita or Photoshop would be a lot easier. I really like your DOF solution, though, it’s super creative. If you swapped the gradient for a Transparent BSDF and set the render to have transparency, you could very easily use this as a brush (the snowflakes would paint and the background would not.)

1 Like