|
|
fig 1. A Shading Field with Lambert shader connected and two directional lights. rgbPP information is passed directly to the particle from the field. No expressions are used. | fig 2. Using a Sampler Info node connected to a Set Range node, Z-Depth information is passed to the particle's rgbPP attribute. |
A Shading Field samples Maya rendering and utility nodes and sends the resulting data into a specified attribute of the attached particle.
Since the shading field treats the particles the same way that Maya's renderer treats surfaces, you can use utility nodes such as Sampler Info to accurately map Z-Depth information into your particles, or use a Phong shader to add specular highlights to your particles.
Depending on the type of shading node you want to sample, the field needs different information. For 2D textures, it simply requires a UV value. For 3D textures, it requires a position in space. For materials and shading groups, it may require normal and tangent information.
Since
particles do not inherintly have any of these attributes, at least not hardware
rendered particles, you can either add them using pre-defined attribute names
or have the field calculate them for you using default settings. Use the table
below to understand which data the Shading Field needs to calculate the shader
and where it looks for the data.
Render
Data
|
Description |
Defaults To |
User
Defined As
|
samplePosition |
the
position in space that is currently being sampled |
position |
samplePosPP |
referencePosition |
if
sampling a 3d texture, this acts as a reference object for sampling |
position |
refPosPP |
normal (vector array) |
normal
of particle being sampled |
velocity |
normalPP |
tangentU (vector array) |
tangentU
of particle being sampled |
NONE |
tangentUPP |
tangentV (vector array) |
tangentV
of particle being sampled |
NONE |
tangentVPP |
uCoord (float array) |
U
value of particle being sampled |
parentU |
uCoordPP |
vCoord (float array) |
V
value of particle being sampled |
parentV |
vCoordPP |
To create a Shading Field through the GUI, select the menu item Fields -> Curve . This will create a Shading Field with the settings found in the Fields -> Shading -> Option Box window.The following behaviors for field creation also apply :
If you have one or more particle objects selected, they will automatically be connected to the Shading Field.
Shader
- The Shader attribute is used to make a connection from a shading node to the Shading Field. Only one attribute can be connected to this attribute. If you are connecting a Shading Group node such as a PhongSG or BlinnSG to this attribute, connect the Shading Group node's "usedBy[0]" attribute to this attribute. For all other shading nodes, connect the "outColor" or equivelant attribute.
Magnitude
- The magnitude value is used as a weighting between the current value of the particle and the new value. For example, if the current value of the attribute is <<0,0,0>> and the the new value is <<1,1,1>>, with a magnitude of .5, the new value for the attribute would be <<0.5,0.5,0.5>>. By setting the magnitude to a value less than 1, you can get smooth interpolations between the values that the field is returning.
The value of the magnitude is clamped internally to a range of 0 - 1.* If the magnitude is set to 0 and there is nothing mapped to MagnitudePP the field will not evaluate.
- MagnitudePP
You can use a custom float array attribute from your particle object as the magnitude value, thereby overriding the standard magnitude value of the field. This enables you to have per particle control of the magnitude of the field.
Enter the name of the attribute from your particle object that you want to use to control the magnitude. If the attribute does not exist, the field will not evaluate.
* If the magnitudePP of a particle is 0, it will not be evaluated and will keep its current value when the field is evaluated. This is useful for disabling the field's effect on an individual particle.
Out Color
This attribute holds the name of the attribute on the connected particleobject that you want the resulting outLuminance of your shading node to get mapped into. The attribute specified must be a float array attribute, not a vector array attribute.
Luminance = 0.3 * red + 0.59 * green + 0.11 * blue
This attribute holds the name of the attribute on the connected particle object that you want the resulting outTransparency of your shading node to get mapped into. This only applies to Materials and Shading Groups. The attribute specified must be a vector array attribute.
1. Evaluation of the field will not occur if :
2. If you want to connect a node to the Shader attribute that is a single float value, like the facingRatio attribute of a SamplerInfo node, create a multiplyDivide node and connect the facing ratio to it, and then connect the multiplyDivide node to the Shader attribute.
Assign Colors
Using Materials, 2D/3D Textures as well as Projections, you can intuitively add color to your particles based on the standard Maya rendering paradigms.
Add
Shading Information
Using a default Lambert shader and a simple expression, you can add shading
information to your particles as they move through their environment. Using
a Phong or Blinn shader, you can also add specular highlights to your particles.
Apply Camera Information
By connecting a Sampler Info node to the Shading Field, you can gain access to valuable data about your particle's position and orientation relative to the camera that you are looking through. This is very useful for getting information such as Z-Depth, Facing Ratio, and XY screenspace positioning.
Control Particle Behavior
Using 3D Textures such as Volume Noise or Crater, you can take the resulting color information and use it to dampen the velocity of your particles, or adjust the Mass of your particles based on the intensity of the texture. Or, emit particles where the specular color of a shader is very intense.