From BlenderWiki

Jump to: navigation, search

Optimization Ideas

Dump of things that come up during development, that we might want to look at in the future.

Camera

  • Can we avoid some normalize() calls here?
  • Ray differential computation
  • Some projection and view matrix elements are zero.

Triangle

  • Wald triangle would be more memory efficient
    • No need to store vertex coordinates for direct light sampling
    • No need to store face normal separately
  • Compute differentials from precomputed triangle
  • Store smooth normals only when used
  • Store quads instead of triangles

Light

  • Store CDF only for emitting faces
  • Sample according to light power or custom importance
  • Surface area computation shared with CDF
  • Surface area quick computation for uniform scale
  • Direct sampling of background
  • For instancing storage is much too big.

Vertex Attributes

  • Don't store vectors/colors in float4
  • Support uchar colors.
  • Convert CORNER to VERTEX attributes by splitting.

Shader Graph

  • Prune unused nodes for OSL
  • Constant folding
  • Test if direct use of default texture coordinate is faster
  • Optimize fresnel/ior conversion for fixed values

BVH

  • Triangle wastes quarter of storage
  • Leaf bounding box is unused
  • Object transforms don't need last row of matrix
  • Reduce register pressure by loading object transform row by row
  • SIMD optimization for CPU
  • QBVH for CPU

Classes

  • Members need to dereference each time

GPU

  • Path tracing termination could maybe keep going anyway as long as any thread in the warp is going.

Other

  • glDrawPixels does format conversion at least on Mac, with GL_BGRA we could avoid it.
  • We do a lot of push_back on vectors, this seems to be quick on mac/linux, but could be optimized
  • Diced patches could share vertices