[SESI logo]

Houdini Development Toolkit - Version 6.5

Side Effects Software Inc. 2004

Render Output

General

When generating data for a custom renderer, the whole scene database can be queried through the IFD_Scene class. This class provides information about everything you should need for generating code for a renderer.

There are really two classes involved in generating data for a custom Renderer: IFD_Output and IFD_Scene. It may be useful to think of the IFD_Output sub-class as the class that knows how to talk to a particular renderer, and the IFD_Scene class as the class which knows how to find out information about the scene.

To add custom renderer output, you must create a sub-class of the IFD_Output class.


IFD_Output

IFD_Output is a pure-virtual base class. This means that there are some methods which must be over-ridden in the sub-class before it can be used. These methods are:
const char *renderer() const
This method simply returns an identifier for the type of output being generated. The name returned should be the same as the name in the table entry (IFD_Entry) which is used to define the output generator.
void getOutputFlags(IFD_OutputFlags &)
This method allows other classes to query what type of features are supported by this output generator. The parameters should be set to the correct values for the custom class. The parameters are:

renderImage
If the renderer does not output an raster image, this should be set to 0. For example, the Inventor Output does not render to an image.
renderMultiCPU
Reserved for future use.
renderMultiHost
Reserved for future use.
renderMultiFrame
This flag should be set if the Renderer uses the openMultiFrame() method. It basically means that the render output will support multiple frames in a single render.
renderScript
This flag should be set if it's possible to generate a script file for the renderer (i.e. a .rib file or .ifd file).
renderCommand
This should be set if the output is sent directly to a command.
renderFields
If the renderer supports rendering video fields of an image, this option should be set.
suggestedCommand
If the render supports direct output to a command, this parameter should be set to a "nice" default command. For example, RenderMan might use "render" or "prman".
There are only four additional methods of interest. These methods are used to open and close a render session. If a renderer is flagged as multi-frame, then the open multi-frame method is called. If it is not a multi-frame render, then the method is not called. (Tip: If you need to do some pre-processing before you start rendering frames, you may want to make the IFD_Output multi-frame to get this opportunity).

If the user has chosen to render on fields (and the renderer supports video fields), the doField() method is called. The second field (or full frame) is then rendered using doSingleFrame()

At the conclusion of rendering all the frames, the closeMultiFrame() method will be called only if the renderer was flagged as a multi-frame render.


IFD_Scene - Querying the Scene

When the IFD_Output sub-class that you've written is outputting to a renderer, it needs to find out information about the scene in question. The IFD_Scene class allows you to find out anything you want. When the IFD_Output sub-class is called to render a single image, an IFD_Scene class is passed in.

All of the methods in the IFD_Scene class take time as a parameter. This is used to evaluate the scene at a given time. Usually, the scene is only evaluated at a maximum of two times (once at the start of the frame, and once at the end of a motion blurred frame). However, this is not enforced, so if the renderer supports multiple motion blur samples, it can be done.

The four key methods are getNLights(), getNObjects(), getNGeometry(), and getNAtmosphere(). These methods allow you to query how many lights and objects there are in the scene. Note that geometry and objects are split. There will never be more geometry than there are objects, but it is possible to have more objects than geometry (instancing).

Light
These are light sources. Each light has certain parameters which may be queried by calling getLightParms(). Each light also has viewing parameters. Note that the getLightParms() is an overloaded function, one version takes IFD_LightParms, while the other takes IFD_CameraParms. This allows you to find out the field of view of a light source, or any other camera type parameters.
Geometry
These are simply a GEO_Detail, no more and no less. Each geometry entity will have at least one object (or atmosphere shader) which references it.
Atmosphere
The IFD_Scene interface supports multiple atmosphere shaders. Each atmosphere shader may also have a transform and geometry associated with it.
Object
An object is an instance of some geometry, combined with a transform and additional attributes. some of these attributes are shaders (surface, interior, displacement), reflection masks, etc. As well, each object has a material associated with it.
The simplest doSingleFrame() method might look like this: myOutput::doSingleFrame(IFD_Scene &scene, float now) { int nobjects; int nlights; int geometry_idx; nobjects = scene.getNObjects(now); // Find out how many objects nlights = scene.getNLights(now); // Find out how many lights writeHeader(); for (i = 0; i < nlights; i++) { outputLight(i, now); } for (i = 0; i < nobjects; i++) { geometry_index = scene.getObjectGeometry(i); outputObject(i, scene.getGeometry(geometry_index, now)); } writeTrailer(); } Note, that in this example, the instancing is defeated since geometry will be output for every object. There are also some missing functions (like outputObject()).


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