4
$\begingroup$

I would like to create a particle system or hair in which the particles conform to the surface.

For instance, a particle system of a special object such as a long cylinder, which can be conformed to the surface of a sphere in random arrangements with paths that are randomized. I would like to arrive at something similar to this image:

enter image description here

Is this possible?

I thought about doing it via a particle system of bezier curves on a sphere and then applying a modifier to the curves, but I believe this would require doing it with a script and I haven't yet figured out how to do all of the scripting. Is there a simpler manner to do this?

I have tried creating a hair emitter with a empty force field sphere object (negative value for force at -1) and a collision sphere object, but the hair does not coalesce around the sphere. Instead I just get this:

It appears that the hair does not have segments which are allowed to bend.

Furthermore, I would like to have an object which will follow these paths created by the hair or emitter such as this:

Such that I can get a close up image of the interface such as this:

This code shows some of my difficulty in getting the particle system entities to be flexible and conform to a surface:

import bpy
import math

def reset():
    # Set to Object mode initially
    bpy.ops.object.mode_set(mode='OBJECT', toggle=False) 

    # Delete all objects in project at current
    for i in bpy.data.objects:
        bpy.data.objects[i.name].select = True
    bpy.ops.object.delete()

    # Delete all materials in curent project
    for i in bpy.data.materials[:]: 
        bpy.data.materials.remove(bpy.data.materials[i.name])

    # Set background to white
    world = bpy.context.scene.world
    world.horizon_color = (1,1,1)

    # Add a camera
    bpy.ops.object.camera_add()
    obj_camera = bpy.data.objects["Camera"]
    obj_camera.location = (10,-10, 8)
    obj_camera.rotation_euler = (math.pi/3, 0, math.pi/4)



reset()

bpy.ops.mesh.primitive_uv_sphere_add( \
    size = 1, \
    view_align = False, \
    enter_editmode = False, \
    location = (0, 0, 0))
ob = bpy.context.active_object
ob.name = 'Collision Sphere'
ob.show_name = True
col_sph = bpy.data.objects['Collision Sphere']
bpy.ops.object.modifier_add(type='COLLISION')

bpy.ops.mesh.primitive_uv_sphere_add( \
    size = 1, \
    view_align = False, \
    enter_editmode = False, \
    location = (0, 0, 0))
ob = bpy.context.active_object
ob.name = 'Emitter'
ob.show_name = True
em_sph = bpy.data.objects['Emitter']

bpy.ops.object.empty_add( type = "SPHERE", location=(0,0,0))
ob = bpy.context.active_object
ob.name = 'Force'
ob.show_name = True
force_sph = bpy.data.objects['Force']
bpy.ops.object.forcefield_toggle()
force_sph.field.strength = -1
bpy.ops.object.group_add()


bpy.context.scene.objects.active = em_sph
bpy.ops.object.particle_system_add()
psys1 = em_sph.particle_systems[-1]
psys1.name = 'Tubes'
psys1.use_hair_dynamics = True
pset1 = psys1.settings
pset1.name = 'TubeSettings'
pset1.type = 'HAIR'
pset1.use_hair_bspline = True
pset1.effector_weights.group = bpy.data.groups["Group"]
pset1.effector_weights.gravity = 0
pset1.effector_weights.apply_to_hair_growing = True

This gives just a spiky ball, without any bending of the hair. Any suggestions?

$\endgroup$
  • $\begingroup$ Are these shapes similar to snake / sperm with a head? Round bumps are part of tube or separate? Spheres or Hexagon? Are the shapes laying on the surface of the hexagon, or penetrating ? Will you need an even closer detail shot? Animated or static? Inter hexagon attachments are part of the requirement? $\endgroup$ – atomicbezierslinger Apr 30 '16 at 19:35
  • $\begingroup$ It would be ideal to be able to make these from any object. I have a long cylinder with randomly placed small spheres all over them, which I would like to use as the 'hair'. The hexagonal pattern of the large spheres isn't important to me, but it may be useful to others, it was just the image I found. I will be getting a closer image from this, at the interface of the sphere and air. $\endgroup$ – chase May 1 '16 at 7:01
  • $\begingroup$ If you have more directly related questions .... It may be useful for you to edit your question and show the progress you have made so far. Showing what the aspects that are successful for you and unsuccessful for you. $\endgroup$ – atomicbezierslinger May 1 '16 at 17:17
  • $\begingroup$ I added a script which is similar to what I have tried so far. It is an attempt which is based on the answer given below but shows that the objects do not bend under the force. I am still working on the flexibility issue as well as how to get objects to conform to the paths given by these particle systems. $\endgroup$ – chase May 3 '16 at 21:56
  • $\begingroup$ How is the progress? Please consider replacing your hair image if you have now produced a better one, closer to your goal. $\endgroup$ – atomicbezierslinger May 5 '16 at 23:37
6
$\begingroup$

The obvious answer would be to use the hair simulation.

Create a hair emitter object an empty forcefield object and a sphere collision object. On the hair emitter decrease gravity to 0, enable hair dynamics with a large step size (like 20+).

Place the empty with the forcefield and your sphere with collision enabled within the emitter object.

On the hair emitter hit "bake" in the hair dynamics tab. Like 20 frames should do for the particles to settle around the collision object.

You should get something like this:

enter image description here

Now just tweak the hair length and strand thickness and select a shader. Done

$\endgroup$
  • $\begingroup$ Awesome! Thanks! What if you want the hairs to have little spheres dispersed on them? $\endgroup$ – chase Apr 29 '16 at 15:25
  • $\begingroup$ Also, when I try this my hair does not bend. It simply reduces in length but still points directly outward. How do you get the hair to have a lot of flexible segments such that they will fold like that? $\endgroup$ – chase May 1 '16 at 7:06
  • $\begingroup$ Do you have B-spline steps? Also in the hair dynamics, you need to reduce "stiffness" and "mass" to make them bend. $\endgroup$ – AdamTM May 2 '16 at 9:43
  • $\begingroup$ PS: about little spheres. id make the duplicates (hair) real and then use a separate particle system to add the speheres using the hair object. BTW you can nest particle systems. i.e. you can have a particle system that uses an object that has another particle system, etc. Its just usually very CPU/RAM intensive. $\endgroup$ – AdamTM May 2 '16 at 11:12
  • $\begingroup$ I tried adding the B-spline steps and reducing stiffness and mass, but I'm still not getting the hair to change. I will post my steps in the question in order to make the process and what I may be doing wrong with it more clear. $\endgroup$ – chase May 2 '16 at 19:33

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.