Some Notes on Graphics Performance for 559 Assignments

Writing efficient graphics programs is an art - and one that we will barely touch on in class. To make things that are really complicated but still run well requires knowing some tricks.

This page has some notes on some of the basic concepts for achieving good performance. It is written in terms of THREE, but most of the “rules” apply generally. Learning this stuff is valuable because it is helpful for understanding how things work.

Most of the time, in CS559, what we want to do is limited enough that we don’t need to worry about performance too much. The graphics hardware is sufficiently capable that assignments run well without too much cause for concern. However, if you try to do something complex you can make things that will not run well. Especially because the grader might have a less capable computer.

Some general rules:

  1. Do all object creation before the animation loop begins.
  2. Only change things that should be changed.
  3. Move/change objects by transforming them, not by changing their vertices.
  4. Do not re-configure materials (change shaders) while things are running.
  5. Prefer a small number of objects (BufferGeometries) to lots of small objects.
  6. Be careful about having too many textures. Re-use textures as possible.
  7. Prefer a few bigger textures (an atlas) to many smaller ones. Put different textures together into a single image and select out the pieces that you need.
  8. Don’t make textures bigger than you need.
  9. Don’t make things more complicated than they need to be.