Control colour and transparency of particles by age generated from a texture map
Article needs peer review
Question
I would like to be able to control the particle colour and transparency but through Particle age. In this specific case, the initial particle colour is derived from a TextureMap property, but when I turn on the Override Particles-RGB parameter from the Particle_Color PPG, the colour of the Particle_Gradient setting affects all the particles. In other words, what I would like to achieve is to have the initial particle age emission derived from the TextureMap property, and to control the particles? transparency and gradually mix with other texture maps and/or colours in the course of the animation.
How can this be done?
Answer
Basically, a new particle shader tree must be created that will enable you to simultaneously mix between two (or more) texture maps and/or colours, while being able to modulate the gradient within each texture mapped emission, and control the particles' transparency property. Follow this recipe in order to achieve the desired results:
Scenario I: mixing one texture map with one or more colours
- From the Explorer view, expand the Cloud- Particle Cloud-Particle Type list folder, and select the Ptype node.
- Open a Render tree view (use the 7 supra key), and update the view.
- Proceed by loading the following Particle shaders from the RT-Nodes-Particle menu:
- Get color (the actual name displayed on the shader node is: Particle_color).
- Get scalar (the actual name displayed on the shader node is: Particle_scalar).
- Mix2colors or Mix8colors.
- Particle_Shape and Particle_Billboard (or any combination of the Blob, Sphere, or Sprite, depending on the scene's requirements).
- Note: in this example, you do NOT need the Particle_Gradiant shader.
- Connect the following shaders this way:
- Connect the Particle_color into the Mix2/8colors-Base_color parameter.
- Connect the Particle_scalar into the Mix2/8colors-Weight parameter.
- Connect the Mix2/8colors shader to the Particle_Shape's input.
- Connect the Particle_Shape shader to the Particle_Billboard's input, and finally the Particle_Billboard shader to the PType-Renderer parameter.
- The shader tree should look like this:
- Open the Particle_scalar PPG, and change the Output option to Age:
- Leave the Particle_color parameters intact, as activating either the RGB or Alpha parameters will override the texture map and thus defeat the purpose of this effect.
- Open the Mix2/8colors PPG. All that needs to be done at this stage, is to modify the Layer 1-Color- RGBA parameters in order to mix with the colours stemming from the texture map:
- The RGB values will control the colour you wish to add to the mix.
- The A (alpha) value will control the transparency of the entire particle colour effect: zero = full transparent and 1.000 = full opaqueness.
- Now, should you want to mix and add more colours over the texture map, activate other layers from the Mix2/8colors PPG. But here is the twist. To be able to mix with the other Layer RGBA colour values, simply modify the Layer's (e.g. Layer 2, Layer 3, etc?) Weight-RGB parameter: RGB values set to zero = no contribution, and RGB values of 1.000 = 100% colour saturation. Remember NOT to connect the Particle_scalar shader into the Weight parameters of Layers other than Layer 1. Doing so will hinder the ability to mix between the colours coming from the Mixer, and making the control of the transparency rather confusing, as you might discover it ends up accidentally taking this route:
- Also, remember to update the particle simulation every now and then, especially after making modifications to the Mixer's RGBA parameters, as, although you might be updating the render region, you might not see the results you are expecting.
Scenario II: mixing multiple texture maps with one or more colours
- From the Explorer view, expand the Cloud- Particle Cloud-Particle Type list folder, and select the Ptype node, and open a Render tree view (use the 7 supra key), and update the view.
- Proceed by loading the following Particle shaders from the RT-Nodes-Particle menu:
- Gradient</I> (the actual name displayed on the shader node is: Gradient).
- Get scalar (the actual name displayed on the shader node is: Particle_scalar).
- Get vector (the actual name displayed on the shader node is: Particle_vector).
- Shape (the actual name displayed on the shader node is: Particle_shape).
- Proceed by loading two Image lookup shaders from the RT-Nodes-Map lookups menu.
- Connect the following shaders this way:
- Connect the Gradient into the Particle_shape-input parameter.
- Connect the Particle_scalar into the Gradient-input parameter.
- Connect the first Image_lookup shader into the Gradient-color1 parameter.
- Connect the second Image_lookup shader (Image_lookup1) into the Gradient-color2 parameter.
- Connect Image clips into the respective Image_lookup-tex parameters.
- Connect the Particle_vector shader into the respective Image_lookup-coord parameters.
- The shader tree should look like this:
- Open the Particle_scalar PPG, and change the Output option to Age
- Open the Particle_vector PPG, and make sure the Output option is set to UVW (do NOT turn on the Vector Overrides parameters).
- Open the Gradient shader PPG, and go to the Alpha Gradient tab:
- To control the overall gradient effect, simply scrub the desired markers along the Alpha Gradient bar;
- To control the transparency, simply modify the value field located immediately below the Alpha Gradient bar; with the default alpha gradient marker arrangement, a value set to zero will represent 100% full transparency, and 1.0 will represent 100% full opaqueness.
Important Note: There is one main caveat to remember, as this effect will only work with Nurbs surfaces used as particle emitters, as the texture space is in UVW (polygons not supported in this case).
Applies To: XSI 3.0.1 on NT,Win2K
Posted: 4/4/2003
Categories: Simulation | Texturing | Tutorials | Simulation Knowledge Base | Texturing Knowledge Base

