0
$\begingroup$

I am using dynamic paint to take slices as an image sequence through a prexisting mesh (also created in blender). For this I create a plane and set that as a canvas which passes through my mesh object outputting a cross section every frame. I have played around with the parameters (dissolve time = 1 etc) and the output is clearly doing something right but leaves me with holes within my mesh. Hopefully the images below will explain this better.

These images are for the first slice (easiest to get images for). Ive circled an example of the issue.

UPDATE: Blend file now included.

Here is the code which assigns dynamic paint parameters Xmax, Ymax and Zmax, specify the location of the canvas.

context = bpy.context
active = context.active_object

print('Setting Up Ballast Brushes')
    

bpy.ops.object.modifier_add(type='DYNAMIC_PAINT')
bpy.context.object.modifiers["Dynamic Paint"].ui_type = 'BRUSH'
bpy.ops.dpaint.type_toggle(type='BRUSH')

print('Setting Up Plane')

bpy.ops.mesh.primitive_plane_add(enter_editmode=False, align='WORLD', location=(0, 0, 0))
bpy.data.objects["Plane"].scale[0]=Xmax/2
bpy.data.objects["Plane"].scale[1]=Zmax/2
bpy.data.objects["Plane"].scale[2]=1
bpy.data.objects["Plane"].location[0]=Xmax/2
bpy.data.objects["Plane"].location[1]=0
bpy.data.objects["Plane"].location[2]=(Zmax/2)
bpy.data.objects["Plane"].rotation_euler[0] = 1.5708


print('Setting Canvas Parameters')

bpy.ops.object.modifier_add(type='DYNAMIC_PAINT')
bpy.data.objects['Plane'].modifiers["Dynamic Paint"].ui_type='CANVAS'
bpy.ops.dpaint.type_toggle(type='CANVAS')
bpy.context.object.modifiers["Dynamic Paint"].canvas_settings.canvas_surfaces["Surface"].surface_format = 'IMAGE'
bpy.context.object.modifiers["Dynamic Paint"].canvas_settings.canvas_surfaces["Surface"].image_resolution = 1000
bpy.context.object.modifiers["Dynamic Paint"].canvas_settings.canvas_surfaces["Surface"].use_antialiasing = False
bpy.context.object.modifiers["Dynamic Paint"].canvas_settings.canvas_surfaces["Surface"].frame_end = endframe2
bpy.context.object.modifiers["Dynamic Paint"].canvas_settings.canvas_surfaces["Surface"].use_dissolve = True
bpy.context.object.modifiers["Dynamic Paint"].canvas_settings.canvas_surfaces["Surface"].dissolve_speed = 1
#bpy.context.object.modifiers["Dynamic Paint"].canvas_settings.canvas_surfaces["Surface"].use_dissolve_log = False
#bpy.context.object.modifiers["Dynamic Paint"].canvas_settings.canvas_surfaces["Surface"].dry_speed = 1
bpy.context.object.modifiers["Dynamic Paint"].canvas_settings.canvas_surfaces["Surface"].image_output_path = str(path)
bpy.ops.object.editmode_toggle()
bpy.ops.uv.smart_project() #the actual unwrapping operation
bpy.ops.object.editmode_toggle() #exiting edit mode
bpy.context.object.modifiers["Dynamic Paint"].canvas_settings.canvas_surfaces["Surface"].uv_layer = "UVMap"

enter image description here enter image description here

$\endgroup$
3
  • $\begingroup$ File is not attached ... use blend-exchange.comand given code copy&paste into you Q. $\endgroup$ – vklidu Mar 1 at 13:13
  • $\begingroup$ Hi apologies, I was trying to add it, but the file is too large I think, Ive added the python code as a placeholder until I can get the blend file on here $\endgroup$ – MattC1990 Mar 1 at 13:15
  • $\begingroup$ Apologies for the delay @vklidu blend file now uploaded $\endgroup$ – MattC1990 Mar 1 at 13:27
1
$\begingroup$

You could simplified file to make it smaller ... just a Plane and one problematic stone, like that you could notice it works. So why it is not working in group? I would say for its overlapping geometry.

I can imagine that hole in place of crossing stones , but it happens just it is crossed somewhere. If you move stone behind it is fine.

You can try Remesh Modifier > Voxel > 0.001 m, before DP, but it would be very intensive calculation, but it worked ...

enter image description here

Or Separate stones by Loose parts set them Rigid Body (create a collision box) and let simulate for a few frames just to solve overlapping. Than merge them back into one object for DP.

$\endgroup$
4
  • $\begingroup$ Thanks, looks like this is a more serious issue with my grouped stones, im wondering if its because Im using group on many stones $\endgroup$ – MattC1990 Mar 1 at 13:59
  • $\begingroup$ The only one issue I can see is overlapping geometry, that you would have to solve. I edit answer if it will inspire you for some solution. $\endgroup$ – vklidu Mar 1 at 14:05
  • $\begingroup$ Thanks, I see what you mean about the remesh to voxel being intensive, im trying this now and it works, just takes a while. Ill try the rigid body option if I think this is taking too long $\endgroup$ – MattC1990 Mar 1 at 14:19
  • $\begingroup$ I tried also Remesh > Sharp > 7 > 0.99, but it generated some small things too. I would go by RB, because not only Remesh operation take a time, but also rendering is enormous long. Also I saw some faces (normals) are flipped. $\endgroup$ – vklidu Mar 1 at 14:40

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.