4
$\begingroup$

Blender newbie here.

I've been looking into how to convert a 2D array of densities (currently I'm using an image) into a 3D volume scatter object. This would be done by rotating this object around the Y axis in 360 degrees with a step size and interpolating values between steps. Resulting object would be a cylinder shape with various density values, taken from the image (grayscale image, where brighter value corresponds to higher density). (in my scenario creating sort of a oblate spheroid cut in half, with higher densities in middle).

I have had some degree of success using the spin tool in edit mode and screw modifier for basic shapes, but I'm struggling to format my initial object in a way it would work well for those tools. I've also experimented with geometry nodes and shaders, where in shaders I can load my image onto a plane using texture coordinate and a mapping node, but it felt a bit awkward to use. My next idea was to try out geometry nodes using image texture -> map range -> volume cube nodes. If I understand correctly, I should be able to perform this revolve operation before making the volume cube.

So to sum it up - what's the best approach to loading an image in blender, revolving it around the y axis and obtaining a 3D volume, for which the density is taken from image intensity values?

Example input (in more complicated scenarios, the gray zone will be a gradient not a flat value) which should be rotated around the axis, where white part touches the edge of image:

example density map containing density values for 3d volume as a cross section of the right side

$\endgroup$
3
  • $\begingroup$ Could you add for example 2 profile images (90° from each other) so that we can try to work a solution ? $\endgroup$
    – Lutzi
    Commented Nov 6 at 11:58
  • $\begingroup$ @Lutzi: I understand that the achieved volume will be axisymmetric, by rotation of the provided image around the vertical (Y ?) axis. So a single image should be enough ? $\endgroup$ Commented Nov 6 at 12:11
  • $\begingroup$ @StefLAncien Oh you're right, I've read images plural. $\endgroup$
    – Lutzi
    Commented Nov 6 at 12:13

1 Answer 1

5
$\begingroup$

Volume density from revolving image

Workflow

It is actually quite easy to achieve. First let's state our prerequisites :

  • Image is grayscale : black is zero density, white is density of 1
  • Image should be square, in my case 1024x1024. I didn't test my solution for other image formats.
  • Image y-axis is aligned with object z-axis.

The idea is to convert the position (which is cartesian XYZ) to a set of cylindrical coordinates. Here is how we map the coordinates :

  • Image-side x-axis : is described by the distance to the object z axis. In our case, we look at the X and Y axis and compute the length of the vector.
  • Image-side y-axis : is simply the z-position of the object.

I won't go more into details, feel free to ask for clarifications if you don't understand something.

Nodes and blend file

Node tree to compute density from image

And here are 2 examples of texture and result.

Example 1 - Sphere

Sphere texture

Result with sphere texture

Example 2 - Glass

Glasse texture

Result with glass texture

$\endgroup$
1
  • $\begingroup$ Thanks, I had a feeling I was missing an easy solution. By modifying map range function, I can take non-square images as input and by setting "from min" to (0,0,0) the setup accepts the right side of cross section as mentioned in post rather than full cross section. $\endgroup$
    – Dot
    Commented Nov 7 at 5:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .