Texture-based Importance Sampling Blueprint nodes - how to use ?

I have UV mapped mesh (plane) and I have a grayscale (RGB) texture that fits right over the mesh. I’d like to sample the textures and place static mesh cubes over the plane, based on that texture (nothing goes where texture is black; less cubes go where it’s gray, let’s say 0.1 - 0.5, and more cubes go where it’s white, let’s say 0.5 - 1).

I tried messing with Make Importance Texture and Importance Sample BP nodes, but I can’t quite wrap my head around it.

Can someone please explain how can I achieve the above using Texture-based Importance Sampling ?

Thanks beforehand

Just got this to work so here’s what I did:

The node is totally independent of any mesh material or UV you might be using, and simply represents a map in world units that outputs x and y values in the 0-1 range. (If you use World Position as UV in a material you get a good idea of the actual scale the texture is using)

-make sure the texture is RGBA8, so set the compression to ‘Vector Displacement Map’ (I used a PNG image. Not sure if sRGB on/off affects it)

-The ‘Rand’ input is for the ‘Random Sobol Cell 2D’ node output (using other random generators doesn’t work well)

-Use the ‘index’ output of your ForLoop as the ‘index’ input of the Sobol Cell 2D

-if you only have one cell you can leave the other Sobol Cell 2D inputs alone

-use the total number of instances you want as the ‘Samples’ input

-the ‘intensity’ input is the threshold of the value you want to use, from 0 to 1 (didn’t do much for me)

-the ‘sample position’ output is your x and y value, make sure you scale it, it only outputs 0-1 (so if you want a 1x1 meter patch for instance, multiply the sample position by a 100 etc.)

-the ‘sample size’ value seems to be just the value of the texture, again form 0-1, useful for driving things like size of the mesh for instance. Both it and the ‘sample intensity’ seem to be opposite of the texture, so I had to invert them with a lerp node so that white was 1 and black was 0 (could be just me)

Scaling the value is what made this usable, the other thing was using the Sobol Cell 2D as Rand input. If you have a mesh underneath you could simply scale the values to the corresponding size of the mesh or terrain or whatever to use them together.

Hope this helps until we get proper documentation!

Sorry, I figured it out (RyanB helped out on Twitter), but forgot to post about it here because I ended up not using the concept. Although thanks anyway!

Can you post what you figured out here ? I need the same help as you, trying to make a grid map civ5 style

1 Like

4 years and we still don’t have a proper document. I still wonder what the OP figured out.