0
$\begingroup$

I made a relatively huge landscape which has rocks scattered on it with a particle (hair) system. Then as I wanted to simulate some objects falling down a mountain I wanted to give the scattered stones (particles) also an rigidbody(passive) so the falling objects would collide more reallisticly with them and not only pass through them.

The problem is that the landscape is to big and the scattered rocks are to countless for efficiently running a rigidbody simulation. Therefore I simplified the landscape (unsubdivided) as a second mesh and used only the necessary part (boolean after particles in modifier stack) as a passive rigidbody. I couldn’t delete the original faces because that would change the distribution of particles in relation of the collider-mesh to the rendering-mesh. I discovered the particle-edit-mode which first appeared as the solution. The new problem here is with particle systems in general, that if you instance from collection, and give the second mesh (collider-mesh) a single user particle system, the seeds are different even if “pick random” is unchecked. That means I cant get the same rocks at the same position.

enter image description here

Deleted Particles in Partice-Edit-Mode to reduce the particles to the area needed for rigidbody-simulation: enter image description here

Seeds are diffrent in single-user particle systems: enter image description here

Has anyone an idea to fix that problem with the particle system or knows an alternative workflow that would accomplish my goal? Even on a reduced scale, the small rocks are to countless to do anything by hand or convert them to real meshes (facecount would rise in the 10-100 millions).

A question that came up with one possible solution is found here: How to get instanced object from particle system at location?

$\endgroup$
0
$\begingroup$

Found a makeshift solution via Python: Get transform of Instances and the corresponding instanced mesh and create a new mesh in a separate collection with the transform and mesh data of the instance.

Converting all Particles to a real mesh wouldn’t be possible because of face-count but creating new meshes for only those particles in the area of the rb simulation is doable.

import bpy

context = bpy.context

dg = context.evaluated_depsgraph_get()

    # objects that are spawned from particle system via collection as source
obj_cube = bpy.data.objects['Cube']
obj_colum = bpy.data.objects['Colum']
obj_ico = bpy.data.objects['Icosphere']
    # empty collection to spawn the new meshes to
new_collection = bpy.data.collections['SecondInstances']

counter = 0
for i in dg.object_instances:
    obj = i.object
    print(obj.name)
        #filter all objects that are not instances by is_instence
    if not i.is_instance:
        print("not an instance")
    else:
        print(f"Instance of {obj.name} at {i.matrix_world}")
        counter += 1

        if obj.name == 'Cube':
                #create new object and keep data (also modifiers) from right source object 
            new_obj = obj_cube.copy()
            new_obj.data = obj_cube.data.copy()
            new_obj.animation_data_clear()
                #set new_object transform from instance transform
            new_obj.matrix_world = i.matrix_world
                #move to seperate collection
            new_collection.objects.link(new_obj)

        elif obj.name == 'Colum':
            new_obj = obj_colum.copy()
            new_obj.data = obj_colum.data.copy()
            new_obj.animation_data_clear()
            new_obj.matrix_world = i.matrix_world
            new_collection.objects.link(new_obj)

        elif obj.name == 'Icosphere':
            new_obj = obj_ico.copy()
            new_obj.data = obj_ico.data.copy()
            new_obj.animation_data_clear()
            new_obj.matrix_world = i.matrix_world
            new_collection.objects.link(new_obj)

I will keep the question open for now, because maybe there is a better way and having real meshes is not ideal either and could be optimized?

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.