Filling volume with items

Some times during the modelling process the problem of filling some volume with number of items occurs. For example it may be a jar with coffee grains, sugar bowl with pieces of sugar, bag of jewels, box with screws and nuts, a bowl of candy, and many others.

Jar filled with items
Jar filled with items

All this can be made manually. Creating some copys of items and filling voulume with arranging them in a random order. However this approach much time and efforts to control that the items do not overlap with each other and with the walls of the filled object. To simplify our work we can use the Rigid Body tool – solid-state simulation in Blender.

For a start we have a jar and a few items to fill it:

Jar with items to fill it
Jar with items to fill it
  1. Place items above the bank neck, so that they do not overlap.
  2. Multiply them to amount necessary for filling:
    1. Add the Array modifier to each item.
      1. Set:
        1. Relative Offset
          1. X = 0
          2. Z = 4 – set the value that each item copy can rotates without intersections with other copyes and other objects.
        2. Set the amount needed to fill the required volume:
          1. Count = 40
Placing items under jar
Placing items above jar neck
  1. Apply Array modifier for all three objects.

After applying Array modifier item copys are merged into a single mesh. It is necessary to divide them into separate meshes: in edit mode break all vertexes by closed profiles.

  1. For each set of items copyes:
    1. tab
    2. p – By Loose Parts
    3. tab

Each of the divided objects origin remains in the same place – on the first object from which array begins. Place origins to items geometric center.

  1. Select all filling objects.
    1. In the T-bar
      1. Tool
        1. Transform
          1. Set Origin
            1. Select Origin To Center Of Mass
Correcting items origin
Correcting items origin

To make some initial chaotic lets slightly rotate items:

  1. All items should be selected.
    1. Select in the menu:
      1. Object – Transform – Randomize Transform
    2. In the T-bar set the range within the items can be rotated with random angle:
      1. Randomize Rotation
        1. X = 90
        2. Y = 90
        3. Z = 90
Adding to items randomize rotation
Adding to items randomize rotation

It remains to solidfy all the objects in scene. During the simulation, copyed items will fall into the jar, so set them the active solid status. The jar does not move and is an obstacle for active bodies – set the passive solid status to it.

  1. For items:
    1. All of them should be selected.
      1. In the T-bar
        1. Physics
          1. Rigid Body Tools
            1. Add / Remove
              1. Add Active
Setting active rigid body to items
Setting active rigid body to items
  1. Select the jar
    1. In the T-bar
      1. Physics
        1. Rigid Body Tools
          1. Add / Remove
            1. Add Passive
Adding passive rigid body to jar
Adding passive rigid body to the jar

All is ready, start simulation.

  1. Open TimeLine window and press Play animation.

If all the objects, the jar and filling items, are too small (measured in centimeters), simulation can reckons with errors – filling items will fall through the jar walls. In this case, scale all objects, increase them by 10 times, run simulation, and decrease them back by 10 times.

After simulation finish all items will be backfilled into the jar. For more uniform items mixing you can vary locations and rotation angles of items above the jar neck.

To save the position of items after the simulation and leave the timeline:

  1. In the T-bar
    1. Physics
      1. Rigid Body Tools
      2. click Apply Transformation
Finished filling simulation
Finished filling simulation
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments