Procedural Animation Workshop 07: POP Network and Particle Rendering In Houdini, POP NETWORK is a “particle network”, which provides the basic functionalities of a particle system, plus some additional features. Therefore, if you want to have a simple particle system, you can use the PARTICLE; if you want to have more controls and more options, you can use the POP NETWORK. In this week, we will look at the basic of POP NETWORK. The basic of POP NETWORK Let’s start from the file example_01_POPNET_start.hipnc. First, replace the PARTICLE with a POP NETWORK: A new POP NETWORK is an “empty” particle network: it has nothing. We have to doubleclick it to go into it, and then construct a particle network there. We will look at some basic OPs inside a POP NETWORK (they are called POPs): the SOURCE, FORCE, DRAG, COLLISION, and ATTRACTOR. SOURCE: Go inside the POP NETWORK, and add a SOURCE, which specify where the particles should be emitted from: You may find that SOURCE also provides additional options for emitting particles, such as “emit from the center of faces”, or “emit from the volume of the given geometry”. This means “use the first input of the POP NETOWRK”; i.e. in our case, the SPHERE. Prepared by Kam Wong/Dick Thung (SCM, CityU, 2011) 1 Procedural Animation Additional remark: in case you want to generate fixed number of particles at frame #1, there is a trick: This means at frame#1… generate 100 particles… and don’t keep on generating particles. FORCE: Let’s connect the SOURCE with a FORCE, which is similar to the “Force” parameters in PARTICLE, but with more options on controlling the randomness: Constant force option Force’s randomness options DRAG: Let’s also connect a DRAG, which add a default “drag” to the particles, to make the result looks much closer to a simple PARTICLE: Note: the order of OPs inside a POP NETWORK is not that important. The calculation of particle’s movement will base on all the OPs exist in the network, up to the OP with the blue flag turned on, but not on their ordering. COLLISION: In PARTICLE, we can provide collision objects through the second input. In POP NETWORK, we need to add a COLLISION: Prepared by Kam Wong/Dick Thung (SCM, CityU, 2011) 2 Procedural Animation This means using the 2nd input of the POP NETWORK as the collision object. You can choose the “collision behavior”. Note that you may have more options than a simple PARTICLE. It also means that you will have more choices on setting the collision behavior: say, one COLLISION OP for a tube with behavior “Bounce on Collision”, and attach another COLLISION OP for a grid with behavior “Die on Collision”, etc. This is a simple example: Connect a GRID (with y-center equals to 8) to the 4th input of the POP NETWORK. And create a second COLLISION OP: This means using the 4th input of the POP NETWORK. Try to specify “Bounce on Collision” for the tube, and “Die on Collision” for the grid. Prepared by Kam Wong/Dick Thung (SCM, CityU, 2011) 3 Procedural Animation ATTRACTOR: In PARTICLE, we can provide METABALL + FORCE through the third input. In POP NETWORK, we need to add an ATTRACTOR: This means using the 3rd input of the POP NETWORK, assume your METABALL + FORCE are plugged into the 3rd input. The above POP NETWORK more or less simulates the basic functionality of a simple PARTICLE OP. From now on, we will look at some additional features of a POP NETWORK. Using POINT as force Besides using METABALL + FORCE, we can use POINT to convert points into a force. For example, we can convert a TORUS’s points as an attractive force for particles: Force radius. Smaller radius makes the force more localize. Force magnitude. Positive means attractive force. Then in the POP NETWORK, we still use an ATTRACTOR. Moreover, you may be interested to play with the ATTRACTOR’s parameters: Each point force attracts one particle only. Particle will stop at the attractor point. An interesting effect that we can create using this idea is so called “particle goal”: attract particles to a location. This is shown in the next exercise. Prepared by Kam Wong/Dick Thung (SCM, CityU, 2011) 4 Procedural Animation Exercise 1: PARTICLE GOAL (using ATTRACTOR) You are given the file exercise_01_start.hipnc: 1. 2. 3. 4. 5. Replace the PARTILCE with a POP NETWORK. Go up one level, and use FILE to load the given geometry totem.obj. Convert the given geometry into a POINT force. Connect the POINT force into the POP NETWORK, and attach one more ATTRACTOR to your particle network to deal with this POINT force. Fine-tune the parameters (say, the POINT force radius and magnitude) to create the following effect (animation will be shown during the class): Particle rendering COLOR of particles Let’s try an additional feature in POP NETWORK: how about controlling the color of particles? Say, we want to assign the “younger” particles to red color, and the “older” particles to black color (like a fire)? Add a COLOR to your particle network, and adjust the parameters as: Click this icon, and set a color Prepared by Kam Wong/Dick Thung (SCM, CityU, 2011) 5 Procedural Animation $LIFE is an internal variable for each particle; it equals to 0 when the particle has just born, and equals to 1 when the particle is nearly die. Click this icon, and set a color Putting “$LIFE” here means the horizontal axis of the color ramp uses the “life” of the particle: just born particle uses the color at the left-most side; nearly die particle uses the color at the right-most side. The “old” particles are in black color. The “young” particles are in red color. You may also need to “shorten” the life of particles to make the result more obvious. There are some other possibilities of using this COLOR OP. Here are a few examples: Example 1: based on particle velocity: You can give whatever expression here. In this example, I used $VX, $VY and $VZ, which are the internal variable of each particle: its x-velocity, y-velocity and z-velocity. Prepared by Kam Wong/Dick Thung (SCM, CityU, 2011) 6 Procedural Animation Example 2: grab color from an image: I can prepare a whatever image under the /img category. This means taking a color from that image. Parameter U is the horizontal position on the image, and V is the vertical position (both from 0 to 1). I used $VX and $VY again, but you can use other expression for these two parameters. Prepared by Kam Wong/Dick Thung (SCM, CityU, 2011) 7 Procedural Animation Render particles as sprite By default particles are rendered as sphere; but most visual effect are done by rendering particles as “Sprite”. Sprites are rectangular surfaces which are always facing to the camera, and usually with a texture mapped: Particles rendered as “butterfly” sprites Step 1) Let’s continue on this simple example: with a TORUS as the SOURCE, an upward FORCE, a DRAG, a COLOR (this is optional), and also add a SPRITE: Turning the “Scale” on will gives the sprite a default size. You can give an expression here. (You can also turn on the “Rotate” parameter and give an expression to control the sprite’s rotation.) Step 2) To render particles as “Sprites”, we have to create 2 “shaders”: Sprite Procedural: this is a “geometry shader”, which tells Houdini that the particles should be rendered as sprite, not sphere; and A Surface Shader: this surface shader tells Houdini what material should be applied onto the sprite. Basically any surface shader will works, but I prefer to choose one that have the texture mapping feature (because usually we want to map texture onto the sprite). Since the Decal material from the material palette provides a surface shader with texture mapping feature, we can start from it. Prepared by Kam Wong/Dick Thung (SCM, CityU, 2011) 8 Procedural Animation So, let’s drag a Decal material from the material palette to the /shop area: Drag a Decal material to this area Now go back to the /shop level, and assign the follow parameters to the Decal material: Remove the parameter in the Texture Map. It is because a decal texture map will not use the particle's color... ... instead, we will use Color Map, which can use the particle's color and alpha. Set the parameter to use the default image (a butterfly) provided by Houdini. You can try other images later. Moreover, personally I don’t like specular highlight appear on sprites… Next step is to create a Sprite Procedural shader: Select the vm_geo_sprite1 shader, and assign the follow parameters: Prepared by Kam Wong/Dick Thung (SCM, CityU, 2011) 9 Procedural Animation Tell Houdini to use the particle’s color and alpha during render. This step tells Houdini which attributes will be passed from the particles to the surface shader. Note that Houdini tries to match attribute by attribute name. Luckily, in the POP NETWORK the color and alpha attributes are called “Cd” and “Alpha”, where in the surface shader Decal these attributes are also called “Cd” and “Alpha”. Step 3) Lastly, go back to /OBJ, and select the object. Assign the two materials to the object. Take a render to see the result. Assign Decal material Assign Sprite Procedural Prepared by Kam Wong/Dick Thung (SCM, CityU, 2011) 10 Procedural Animation Remark: about texture alpha One problem of the Decal material is that the alpha of texture is not used. As a result, your sprite will have a rectangular shape in the alpha channel, which is not desired in most of the case. If you want to make use of the texture alpha, you have to double-click the Decal material to go inside it, and then make a few connections: Prepared by Kam Wong/Dick Thung (SCM, CityU, 2011) 11 Procedural Animation Using image sequence for sprites You are given several “smoke” textures (in the folder cloud): cloud_0.png to cloud_5.png Now, you can replace the default.pic by the “smoke” texture cloud/cloud_0.png we provided. However, if all particles use the same image, the result will be too regular. As we have six different “smoke” images, we can select an image from the six images, based on the particle’s ID (the $ID variable in particles). However, in the basic surface shader we cannot access the particle’s ID. So we have to use another method to deal with this. The solution is: we create an extra attribute in each particle, which stores the texture name that it should use. Therefore, each particle has its own texture name stored, and the name will be passed to the basic surface shader (through the geometry shader). First, we need to find out what is the parameter name of the “Base Color Map” parameter, because our particle attribute should use the same name. Select the material, place your mouse over the “Base Color Map” label of the material, and wait for a second. You can see this on the screen: We found that it is called baseColorMap. So, in the particle system, we can use ATTRIBCREATE to create an extra attribute for each particle, and the attribute should be named baseColorMap. The type of this attribute should be string, because we are going to use it to store a filename. Then we can construct the texture name using any particle attributes; say, we may use the $ID of the particles: Prepared by Kam Wong/Dick Thung (SCM, CityU, 2011) 12 Procedural Animation Note that I put down $HIP/cloud/cloud_`$ID%6`.png. The back-tick ` in the string tells Houdini to evaluate the calculation, and put the result into the string. The $ID is the particle’s ID; and $ID%6 is the remainder of $ID / 6: which is always within the range [0-5]. Lastly, don’t forget to add the name baseColorMap in the “Mantra: Sprite Procedural” shader (i.e. the vm_geo_sprite1), to tell Houdini that this attribute should also be passed to the material’s surface shader: (Note: every time you changed the particle’s parameter, you may need to rewind and replay the scene in order to update those parameters.) Prepared by Kam Wong/Dick Thung (SCM, CityU, 2011) 13 Procedural Animation Exercise 2: SPRITE rendering Continue on the previous example, try to: (1) Make the “younger” particle having a smaller sprite size; and “older” particle having a larger sprite size. (2) Make the “older” particle more transparent (hint: using COLOR POP again, but this time set the parameters under the Alpha tab). (3) You are given the following three sequence of sprites: Letter Sequence 0 … letter.0.0.tga to letter.0.35.tga Letter Sequence 1 … letter.1.0.tga to letter.1.35.tga Letter Sequence 2 … letter.2.0.tga to letter.2.35.tga Try to use the particle $ID to pick a letter sequence (i.e. among letter.0, letter.1 and letter.2), and use the particle $LIFE to pick a frame from that letter sequence. Hint: you may find this expression useful: int($LIFE*35) which returns an integer in the range from 0 to 35, because $LIFE is in the range [0,1]. ** Week 07 END ** Prepared by Kam Wong/Dick Thung (SCM, CityU, 2011) 14
© Copyright 2026 Paperzz