[SESI logo]

Houdini Development Toolkit - Version 6.5

Side Effects Software Inc. 2004

Geometry

Particles

Basic Functionality

A particle system in houdini is represented as a linked list of particle vertices with a specified behavior. GEO_PrimParticle is the base class. It contains several public methods, the most significant of which are:
  • GEO_ParticleVertex *appendParticle(GEO_Point *pt)
  • void deleteParticle(const GEO_Point *pt)
  • void deleteParticle(GEO_ParticleVertex *vtx)
    Append or delete a particle. The added GEO_Point can be shared among the particle system's vertices. The GEO_ParticleVertex objects, however, are unique.

  • int getNumParticles() const
    Find the number of particles (GEO_ParticleVertex objects) in the system.

  • GEO_ParticleVertex *giveBirth()
    Resurrect a particle or give birth to a new one.

  • void deadParticle(GEO_ParticleVertex *vtx)
  • void deleteDead()
    Move a dead particle to the list of dead particles, or delete all dead particles.

  • virtual const GEO_Vertex &getVertex(unsigned idx) const
  • virtual GEO_Vertex &getVertex(unsigned idx)
    Retrieve a particle given its index. We return a reference to the base class.

    GEO_ParticleVertex *iterateInit() const GEO_ParticleVertex *iterateNext(const GEO_ParticleVertex *v) const GEO_ParticleVertex *iteratePrev(const GEO_ParticleVertex *v) const GEO_ParticleVertex *iterateFastNext(const GEO_ParticleVertex *v) const GEO_ParticleVertex *iterateFastPrev(const GEO_ParticleVertex *v) const
    Navigation methods for the particle system. The fast methods do not check if v is a nil pointer.

  • GEO_PartRender &getRenderAttribs()
  • const GEO_PartRender &getRenderAttribs() const
    Retrieve the particle render information. See the description of GEO_PartRender below.

  • A particle can be rendered in many ways. The geometry to be used at rendering time is given by GEO_PART_TYPE and is stored in a GEO_PartRender object within the particle system itself. Here are the predefined geometry types a particle can be rendered as:

    Geometry Type Description
    GEO_PARTICLE_SPHERE Render as spheres
    GEO_PARTICLE_CIRCLE Render as oriented circles
    GEO_PARTICLE_LINE Render as lines
    GEO_PARTICLE_TUBE Render as open (uncapped) tubes
    GEO_PARTICLE_TUBEC Render as capped tubes
    GEO_PARTICLE_TUBES Render as rounded tubes

    The geometry type is not the only rendering parameter available to you. The Class GEO_PartRender contains a host of methods that control other rendering attributes such as particle size and motion blur:

  • void setSize(float radius)
  • void setBlurTime(float bt)
  • void setType(GEO_PART_TYPE t)
  • void setMotionBlur(int onoff)
  • void setSphereNormals(int onoff)

  • float getSize() const
  • float getBlurTime() const
  • GEO_PART_TYPE getType() const
  • int isMotionBlur() const
  • int isSphereNormal() const

  • Class Instantiation

    The class GEO_PrimParticle is abstract, which means it cannot be instantiated. To build a particle system, use the class static ::build() method defined in GU_PrimParticle. This method requires a pointer to the primitive container (GU_Detail) and a number of particles. Automatic creation of GEO_Points is optional. By default, a GEO_Point is created for each particle.

    Here is an example of how to build a particle system with 4 particles rendered as rounded tubes and motion blurred. We also define a particle drag factor of one:

    GU_Detail gdp; GU_PrimParticle *partsys; GEO_ParticleVertex *part; float one = 1; if (partsys = GU_PrimParticle::build(&gdp, 4)) { part = partsys->iterateInit(); do { // Initially all particles spring from (3,1,1): part->getPos().assign(3, 1, 1); } while (part = partsys->iterateFastNext(part)); partsys->getRenderAttribs().setType(GEO_PARTICLE_TUBES); partsys->getRenderAttribs().setMotionBlur(1) partsys->getRenderAttribs().setBlurTime(0.03); partsys->getRenderAttribs().setSize(0.05); gdp.addPointAttrib("drag", sizeof(float), GB_ATTRIB_FLOAT, (const void *) &one); } Always check the result of the ::build() method for failure. A particle system will not be created unless given valid parameters.


    Table of Contents
    Operators | Surface Operations | Particle Operations | Composite Operators | Channel Operators
    Material & Texture | Objects | Command and Expression | Render Output |
    Mantra Shaders | Utility Classes | Geometry Library | Image Library | Clip Library
    Customizing UI | Questions & Answers

    Copyright © 2004 Side Effects Software Inc.
    477 Richmond Street West, Toronto, Ontario, Canada M5V 3E7