Render TOP

From TouchDesigner 099 Wiki

Summary

The Render TOP is used to render all 3D scenes in TouchDesigner. You need to give it a Camera object and a Geometry object as a minimum.

The Geometry object needs to have a Material assigned to it. Materials can be pre-packaged ones like the Phong material, or they can be OpenGL GLSL shaders. All textures and bump maps in TouchDesigner materials are TOPs, i.e. files must be read in via Movie File In TOPs.

Rendering in TouchDesigner ties in nicely with compositing via the Render TOP and all other TOPs.

The Render TOP renders in many RGBA and single-channel formats, in 8-bit fixed-point up to to 32-bit floating point per pixel component.

It can render transparent surfaces correctly using Multi-Pass Depth Peeling. See below: Order Independent Transparency.

Multiple Cameras: The Render TOP is able to render multiple cameras (more quickly than separately) in a single node. You specify multiple cameras in one Camera parameter, and use Render Select TOP to pull out those camera results. This feature is even faster on GPUs that support Multi-Camera Rendering.


See also Rendering, all the articles in the Rendering Category and the Render Pass TOP.

NOTE: If you are doing non-realtime GPU-intensive renders (ones that take multiple seconds to render a single SOP), see the note in Windows GPU Driver Timeouts in the Movie File Out TOP.

PythonIcon.png renderTOP_Class

Parameters - Render Page

Camera(s) camera - Specifies which Cameras to look through when rendering the scene. You can specify multiple cameras and retrieve each camera image using the Render Select TOP.

Multi-Camera Hint multicamerahint - Helps the Render TOP optimize rendering when multiple cameras are used. Controls the Multi-Camera Rendering behavior for this node.

  • Automatic - The node will decide based on the GPU and setup if Multi-Camera Rendering can be used and enable it if possible. Currently Multi-Camera rendering works for 2D and Cube Map renders on supported GPUs. For 2D renders multiple cameras can not be rendered in a single pass if their 'Camera Light Mask' parameters don't result in the same lights being used in the scene. Use of Depth Peeling or Order Independent Transparency will also disable Multi-Camera rendering.
  • Off - Forces Multi-Camera Render to be disabled, so each camera is rendered one pass at a time.
  • X-Offset Stereo Cameras - Should be set only if the pair of cameras have transform/projection matrices that result in a difference only in the X-axis after being applied, as is the case for most VR headsets. Other differences between the cameras such as FOV, near/far plane etc will be ignored, and the values form the first camera will be used. This hint allows the TOP to run faster for this particular case, when appropriate hardware is available.

Geometry object - Specifies which Geometry will be included in the rendered scene. You can use Pattern Matching to specify objects using patterns. Example: geo* ^geo7 will render all Geometry components whose names start with geo except geo7.

Lights lights - Specifies which Lights will be used to render the scene. You can use Pattern Matching here as well.

Anti-Alias antialias - Sets the level of anti-aliasing in the scene. Setting this to higher values uses more graphics memory.

Render Mode rendermode - You can render different projections: normal 2D, Cube Map, Fish Eye (180), or Dual Paraboloid. The Cube Map renders 6 views as needed for environment maps in the Phong MAT and Environment Light COMP.

See also the Cube Map TOP and the Projection TOP.

Parameters - Advanced Page

Render render - Enables rendering; 1 = on, 0 = off.

Dither dither - Dithers the rendering to help deal with banding and other artifacts created by precision limitations of 8-bit displays.

Color Output Needed coloroutputneeded - This is an optimization if you don't actually need the color result from this pass. Turning this off avoids a copy from the offscreen render buffer to the TOP's texture. When anti-aliasing is enabled, turning this off will also avoid 'resolving' the anti-aliasing.

Draw Depth Only drawdepthonly - This will cause the render to only draw depth values to the depth buffer. No color values will be created. To make use of the depth buffer, use the Depth TOP.

Alpha-to-Coverage alphatocoverage - This is a feature that allows you to control how the anti-alias is resolved by using the pixel's alpha value. Say the anti-alias setting is set to 4x. This means that for each final pixel color, it will blend the color values of 4 pixels from the anti-alias buffer. When Alpha-to-Coverage is enabled, the alpha value controls how many pixel samples will be used to create the final pixel value. If your alpha value is 0.75, then 3 of the 4 pixels will be used. If it's 0.5 then 2 of the 4 pixels will be used.

Polygon Depth Offset polygonoffset - This feature pushes the polygons back into space a tiny fraction. This is useful when you are rendering two polygons directly ontop of each other and are experiencing Z-Fighting. Refer to Polygon Depth Offset for more information. This is also an important feature when doing shadows.

Polygon Offset Factor polygonoffsetfactor -

Polygon Offset Units polygonoffsetunits -

Cull Face cullface - Front Faces, Back Faces, Both Faces, Neither. Will cause the render to avoid rendering certain polygon faces depending on their orientation to the camera. Refer to Back-Face Culling for more information.

# of Color Buffers numcolorbufs - Any shader you write can output to more than one RGBA buffer at a time. For GLSL 3.3+ you would use the layout(location = 1) specifier on an out variable in the pixel shader to write to the 2nd buffer. In GLSL 1.2 instead of writing to gl_FragColor in your shader, you write to gl_FragData[i] where i is the color buffer index you want to write the value to.

Allow Blending for Extra Buffers allowbufblending - Controls if blending (as enabled by the MAT common page setting) will be enabled for extra buffers beyond the first one. Often the extra buffers are used to write other types of information such as normals or positions, where blending wouldn't be desirable.

Depth Buffer Format depthformat - Use either a 24-bit Fixed-Point or 32-bit Floating-Point depth buffer (single channel image).

Override Material overridemat - This allows you to specify a material that will be applied to every Geometry that is rendered in the Render TOP. It is useful for pre-processing passes where we are outputting information about the geometry rather then lighting them and outputting RGB.

Depth Peel depthpeel - Depth peeling is a technique used as part of Order-Independent Transparency. This parameter enables rendering depth-peels, but without combining all the layers using blending to create order independent transparency. Instead is keeps all the layers separate and they can be retrieved using a Render Select TOP. Depth peeling is done by first rendering rendering geometry normally and saving that image and depth. Then another render is done but the closest pixels that were occluded by the previous pass are written to the color buffer instead. This can be done multiple times, each time peeling back farther into the scene. If you are rendering a sphere the first render will be the outside of the sphere, and the second peel layer will be the back-inside of the sphere.

Order-Independent Transparency orderindtrans - Helps to render transparent geometry in proper depth order. This eliminates the need to sort the geometry based on distance from camera. This process is multi-pass. For every pixel the closest surface is rendered in the first pass, the second closest surface second, up to the number of passes specified by the Transparency Passes parameter below. Turning this option on will disable some advanced features in the Render TOP, as well as anti-aliasing.

The feature is a pixel-based approach, not object-based. So its performance is not directly related to the number of objects, but rather how they are layered.

It uses a technique called Depth Peeling. First you render the normal frame. On your next render you peel away all of the pixels you saw in the first frame, and reveal the pixels underneath them. The next frame you do the same, peeling away the pixels you could see from the 2nd render. And so on. Once all of the renders are done, you re composite each layer Over the other, starting at the farthest back layer.

If you take a sphere for example, you'll need to do 2 passes, the first one for the front of the sphere, and then 2nd will be the inside of the sphere.

If you have 10 spheres, one behind the other. You'll need 19-20 passes to get the correct image.

If you have 10 spheres, each next to each other across the screen, you'll only need 2 passes.

In reality though you will only need 3-5 passes to get an image that's acceptable. It may not be 100% correct, but it'll look pretty close to correct.

Each pass is a full render, so each pass adds significant overhead.

Transparency/Peel Layers transpeellayers - Number of passes the renderer will use when Order Independant Transparency is turned on.

Display Overdraw overdraw - This feature visually shows the overdraw in the scene. Refer to the Early Depth-Test article for more information. In particular the Analyzing Overdraw section.

Overdraw Limit overdrawlimit - This value quantizes the outputted color value to some # of overdraws. Refer to the Early Depth-Test for more information.

Parameters - Crop Page

Crop Left cropleft - Positions the left edge of the rendered image.

Crop Right cropright - Positions the right edge of the rendered image.

Crop Bottom cropbottom - Positions the bottom edge of the rendered image.

Crop Top croptop - Positions the top edge of the rendered image.

Parameters - GLSL Page

The GLSL parameter page allows passing of TOPs (samplers) and uniforms into GLSL MATs in a global fashion, instead of having to bind them to each and every MAT in the system. This is useful for multi-pass techniques. If a MAT defines a sampler/uniform of the same name, the one in the MAT overrides the one in coming from the Render TOP.

Sampler Name sampler0-sampler4 - This is the sampler name that the GLSL program will use to sample from this TOP. The samplers need to be declared as the same dimensions as the TOP (sampler2D for a 2D TOP, sampler3D for 3D TOP).

TOP top0-top4 - This is the TOP that will be referenced by the above sampler name above it.

Exposed by the + Button, texture sampling parameters:

Refer to the Texture Sampling Parameters article for more information on the parameters exposed by pressing the + button. The parameter prefix for each of the parameters is top0 up to top4.

Uniform Name uniname0-uniname4 - The uniform name, as declared in the shader.

Value value0[xyzw]-value4[xyzw] - The value(s) to give the uniform.

Depending on how the uniform is declared, only some of the values of the 4 available per parameter are passes to the shader. For example, if the uniform is declared as a vec2, then only the first 2 values are passes to the shader, the other 2 are ignored.

Parameters - Common Page

Output Resolution - quickly change the resolution of the TOP's data.

  • Use Input - uses the input's resolution.
  • Eighth, Quarter, Half, 2X, 4X, 8X - multiply the input's resolution by that amount.
  • Fit Resolution - Resizes the input to the size specified in Resolution using the best possible match that does not crop any of the input. It will resize the image to be larger than the input resolution if a larger resolution is specified. It's a "fit inside", Aspect Ratio is maintained.
  • Limit Resolution - Limits the input to the size specified in Resolution using the best possible match that does not crop any of the input. It will NOT resize the image to be larger than the input resolution if a larger resolution is specified. It's a "fit inside", Aspect Ratio is maintained.
  • Custom Resolution - enables the Custom Res parameter below, giving direct control over res in the X and Y axis.

Resolution - enabled only when the Output Resolution parameter is set to Custom Resolution. Some Generators like Constant and Ramp do not use inputs and only use this field to determine their size. The drop down menu on the right provides some commonly used resolutions.

Use Global Res Multiplier - Uses the Global Resolution Multiplier found in Edit>Preferences>TOPs. This multiplies all the TOPs resolutions by the set amount. This is handy when working on computers with different hardware specifications. If a project is designed on a desktop workstation with lots of graphics memory, a user on a laptop with only 64MB VRAM can set the Global Resolution Multiplier to a value of half or quarter so it runs at an acceptable speed. By checking this checkbox on, this TOP is affected by the global multiplier.

Output Aspect - sets the image aspect ratio, which is the visible width vs height, independent of the pixel resolution. If the pixels are not square, the aspect ratio is not the resolution's width/height. Watch for unexpected results when compositing TOPs with different aspect ratios.

  • Input - uses the input's aspect ratio.
  • Resolution - uses the aspect of the image's defined resolution (ie 512x256 would be 2:1), whereby each pixel is square.
  • Custom Aspect Ratio - lets you explicitly define a custom aspect ratio in the Aspect parameter below.

Aspect - Use when Output Aspect parameter is set to Custom Aspect.

Fill Viewer - determine how the TOP image is displayed in the viewer.

  • Input - uses the same Fill Viewer settings as it's input.
  • Fill - stretches the image to fit the edges of the viewer.
  • Fit Horizontal - stretches image to fit viewer horizontally.
  • Fit Vertical - stretches image to fit viewer vertically.
  • Fit Best - stretches or squashes image so no part of image is cropped.
  • Fit Worst - stretches or squashes image so image fills viewer while constraining it's proportions. This often leads to part of image getting cropped by viewer.
  • Native Resolution - displays the native resolution of the image in the viewer.

NOTE: To get an understanding of how TOPs works with images, you will want to set this to Native Resolution as you lay down TOPs when starting out. This will let you see what is actually happening without any automatic viewer resizing.

Viewer Smoothness - This controls pixel filtering in the viewers.

  • Nearest Pixel - uses nearest pixel or accurate image representation. Images will look jaggy when viewing at any zoom level other than Native Resolution.
  • Interpolate Pixels - uses linear filtering between pixels. This is how you get TOP images in viewers to look good at various zoom levels, especially useful when using any Fill Viewer setting other than Native Resolution.
  • Mipmap Pixels - uses mipmapfiltering when scaling images. This can be used to reduce artifacts and sparkling in moving/scaling images that have lots of detail. When the input is 32-bit float format nearest filtering will always be used, regardless of what is selected in the menu.

Pixel Format - format used to store data for each channel in the image (ie. R, G, B, and A). Refer to Pixel Formats for more information.

  • Input - uses the input's pixel format.
  • 8-bit fixed (RGBA) - uses 8-bit integer values for each channel.
  • sRGB 8-bit fixed (RGBA) - uses 8-bit integer values for each channel and stores color in sRGB colorspace.
  • 16-bit float (RGBA) - uses 16-bits per color channel, 64-bits per pixel.
  • 32-bit float (RGBA) - uses 32-bits per color channel, 128-bits per pixels.


  • 10-bit RGB, 2-bit Alpha, fixed (RGBA) - uses 10-bits per color channel and 2-bits for alpha, 32-bits total per pixel.
  • 16-bit fixed (RGBA) - uses 16-bits per color channel, 64-bits total per pixel.
  • 11-bit float (RGB), Positive Values Only - A RGB floating point format that has 11 bits for the Red and Green channels, and 10-bits for the Blue Channel, 32-bits total per pixel (therefore the same memory usage as 8-bit RGBA). The Alpha channel in this format will always be 1. Values can go above one, but can't be negative. ie. the range is [0, infinite).
  • 8-bit fixed (Mono) - Single channel, where RGB will all have the same value, and Alpha will be 1.0. 8-bits per pixel.
  • 16-bit fixed (Mono) - Single channel, where RGB will all have the same value, and Alpha will be 1.0. 16-bits per pixel.
  • 16-bit float (Mono) - Single channel, where RGB will all have the same value, and Alpha will be 1.0. 16-bits per pixel.
  • 32-bit float (Mono) - Single channel, where RGB will all have the same value, and Alpha will be 1.0. 32-bits per pixel.
  • 8-bit fixed (RG) - A 2 channel format, R and G have values, while B is 0 always and Alpha is 1.0. 8-bits per channel, 16-bits total per pixel.
  • 16-bit fixed (RG) - A 2 channel format, R and G have values, while B is 0 always and Alpha is 1.0. 16-bits per channel, 32-bits total per pixel.
  • 16-bit float (RG) - A 2 channel format, R and G have values, while B is 0 always and Alpha is 1.0. 16-bits per channel, 32-bits total per pixel.
  • 32-bit float (RG) - A 2 channel format, R and G have values, while B is 0 always and Alpha is 1.0. 32-bits per channel, 64-bits total per pixel.
  • 8-bit fixed (A) - An Alpha only format that has 8-bits per channel, 8-bits per pixel.
  • 16-bit fixed (A) - An Alpha only format that has 16-bits per channel, 16-bits per pixel.
  • 16-bit float (A) - An Alpha only format that has 16-bits per channel, 16-bits per pixel.
  • 32-bit float (A) - An Alpha only format that has 32-bits per channel, 32-bits per pixel.
  • 8-bit fixed (Mono+Alpha) - A 2 channel format, one value for RGB and one value for Alpha. 8-bits per channel, 16-bits per pixel.
  • 16-bit fixed (Mono+Alpha) - A 2 channel format, one value for RGB and one value for Alpha. 16-bits per channel, 32-bits per pixel.
  • 16-bit float (Mono+Alpha) - A 2 channel format, one value for RGB and one value for Alpha. 16-bits per channel, 32-bits per pixel.
  • 32-bit float (Mono+Alpha) - A 2 channel format, one value for RGB and one value for Alpha. 32-bits per channel, 64-bits per pixel.