| Performance / Quality tips

When using a renderer, it is important to know what kinds of algorithms that the renderer is implementing. Even the best renderer on the world can be made to crawl if parameters governing the rendering are not set correctly.

## Points primitive

Pixie's Points primitive has been optimized for lots of small particles, not small numbers of large particles. The renderer can actually deal with a couple of million tiny particles better than 100 large particles that cover the same screen area. Due to this design choice, Points can not be raytraced. If you want raytraced particles, you need to use Sphere.

Try to use Transparency Shadow Maps (TSM) in scenes with point clouds. This way you can get a more accurate transmission effect. You can also use a lower opacity while generating the TSM to make sure light penetrates more into the cloud.

## Raytracing curved surfaces

While raytracing on curved objects, you need to make sure the raytracing bias is greater than the tesselation error. Otherwise, you may get self-intersection artifacts. The raytracing bias is controlled by the Attribute "trace" "bias" [0.1] and the maximum tesselation error is controlled by Attribute "dice" "flatness" [0.1]. Note that if the tesselation error is too low, the tesselator will create lots of tiny triangles, slowing down the raytracer and using memory. You need to find the optimal number for your scenes. Note that this tip is valid whenever you're raytracing. This includes trace() calls inside shaders as well as global illumination passes.

## Indirectdiffuse / occlusion shadeops

indirectdiffuse and occlusion shadeops are used to approximate diffuse interreflection and the unoccluded fraction of the hemisphere at a point. The best way to use these shadeops is to perform 2 passes: the first pass computing the cache and the second one using the cache. See the Global Illumination section for more details.

## Curves primitive

Curves primitive has been optimized for rendering many thin curve segments (such as hair or fur) not for rendering think curves. Specifying many curves with a single RiCurves command is much faster than specifying each curve separately. Try to group your curves and pass them using a single RiCurves command as much as possible.

## Expensive shaders

Shaders that involve raytracing are typically expensive. The shading language commands trace, gather, visibility, transmission, indirectdiffuse, occlusion uses raytracing. In order to avoid unnecessary computation, you can consider the following options:

- Execute expensive commands only for the points that are being seen frontally:
  if (I.N < 0) {
  <expensive stuff>
  }
  Notice that this is not equivalent to setting the surface to 1 sided.
- In order to avoid the execution of the shader for invisible points altogether, you can switch to the raytracer:
  Hider "raytrace"

##