Home » 3D, Download, XSI

Postlight

15 February 2007 87,039 views 3 Comments

Pass Technical Information

If for some reason you don’t wish to use the PostLightPhong shader then there follows a complete discussion on how to manually create the pass yourself. You might find it helpful to review this information even if you are going to use the PostLightPhong shader.

Color Pass

The color pass is the base color of your object. This is represented by the color input in the standard Phong shader.

Note that the Post Light FXTree plug-in does not have an input for an ambient color pass. Therefore for Post Light purposes, you should make sure that whatever is plugged into the Phong’s color input, is also plugged into your ambient color input as well (this also applies if you are using the PostLightPhong shader). Otherwise, Post Light’s output will not match the rendered output if you have any ambient lighting present.

The easiest way to generate a color pass is to override the bump map input of your material node with a vector share set to (0,1,0). Turn off all your lights in the pass,and add a new infinite light pointing straight down with the intensity set to 1.0 and the color set to white. (I saw this tip in a post by Alan Jones on the Softimage XSI list).

Note: It is beneficial to output a proper alpha channel with this pass, since Post Light ignores any pixels with zero alpha for performance reasons.

Specular Pass

This corresponds directly to the color of the Phong shader’s Specular Color. If your Phong shader has no nodes plugged into this input, then it will just be a constant color for that material.

Roughness Pass

This corresponds to whatever is plugged into the Specular Decay input of the Phong shader.

Since this value tends to be much greater than 1.0 (the default is 50 for the Phong shader), you must make sure that the output image format of your render pass is a floating point format, e.g. TIFF floating point. Otherwise the Specular Decay will not go above 1.0 and your Post Light render will be too glossy.

Normal Pass

This pass needs to output the world space normals of the objects in the scene. This pass is the most important one to get right in order to match the final render.

One way to produce a normal pass is to use an Environment node with an input of a Vector State node set to output the normal vector. You can then make your objects 100% reflective, turn off ray tracing, and you should get the correct result.

You must modify the output of the Vector State node in order for it to work correctly. Without adjustment, the XYZ components of the Vector State node will be between -1.0 and 1.0. We need to re-map this into normalised color space which is between 0.0 and 1.0. You must therefore do the following:

  1. Plug the output of a new Vector State node into a new Vector-Vector math node.
  2. Set the Vector-Vector math node to “Vector Input1 + Vector Input2” and set the Vector2 input to (1,1,1).
  3. Plug the output of the Vector-Vector math node into another new Vector-Vector math node.
  4. Set the new Vector-Vector math node to “Vector Input1 x Scalar Input1” and set the Scalar input to 0.5.
  5. Plug the output of the new Vector-Vector math node into a new Vector to Color conversion node.
  6. Add an Environment node and plug the output of the Vector to Color node into the tex input.
  7. Finally, plug the output of the Environment node into the Environment input of your material.

Your tree should look something like this (I’ve renamed the nodes to describe what they do for more clarity):

(Technically, you should also use a Vector Conversion node to convert the normal from internal space to world space, but you’ll find in practice that it doesn’t make a difference).

If you wish to use this technique for extracting the normals within a pass, then you need to create an override for the Environment input of the materials within a partition. You can then open the override in the render tree and follow the steps above. You’ll also need to override the reflectivity and set the reflectivity mix color and scale to 1.0.

This method will automatically extract any bump maps that you plug into the Material’s bump input. However, you may experience problems if you generate your bump anywhere else within the render tree (for example, enabling bump within a procedural texture), since you may have to override their effect to be able to render the object as 100% reflective.

Position Pass

Finally, the position pass is simply a Vector State node set to Intersection Point, plugged straight into the Material’s surface input via a Vector to Color conversion node.

As with the Roughness pass (see above), it is very important to make sure that your render output is set to a floating point format, since the position output will usually be outside the 0.0 to 1.0 range.

Generating the passes

If you’ve decided not to use the PostLightPhong shader, you need to manually create the passes yourself. Some of these passes can be easier to generate than others, but they can usually be done by using the partitions and overrides system, providing you have constructed your materials in a particular way (usually as a result of careful planning and knowing the limitations of the system).

You might be tempted to create a new scene file for generating a particular pass. However, this should be avoided since it goes against the general workflow philosophy of XSI, and it can mean a lot of extra work should you decide to make any changes to the original model. A better solution (if you really need to) is to create a new object within the scene, since the dependencies can be kept “live” so that any changes are propagated across automatically.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

3 Comments »

  • Adam Seeley said:

    Hi, Any idea if this works in Xp 64 bit Soft 2010/2011/2011 sp1.

    Thanks,

    Adam.

  • AndyN (author) said:

    Hi Adam,
    That’s a good question. I can’t see a reason why not, but it would need to be recompiled and I’m afraid I don’t have access to a Windows 64bit machine.

    It could only support phong based lighting models so it didn’t catch on as it probably wasn’t flexible enough for most pipelines. Anyway, as a result, I haven’t kept it up to date.

    Sorry!

  • Moykul said:

    Brilliant tool! Thank you so much!

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.