Genome
RSS< Twitter< etc

<< Selection Modifiers

Select Faces By Camera

3ds Max provides a Graphite tool for selecting faces in an object based on their angle to the camera. In addition, the 3ds Max viewports and renderer support Backface Culling (single sided vs. double-sided faces).

Using Genome, one can implement a modifier that selects faces according to their Normal vector angle relatively to the Camera and optionally delete them to perform a kind of explicit Backface Culling. 

  • Create a Teapot with 32 segments.
  • Create a Camera looking at the Teapot (or press Ctrl+C in Perspective view to create one from view).
  • Add a Genome modifier, set to "Faces" Iteration mode.
  • Press the "Open Magma Editor" button.
  • Press Ctrl+[O] to create a new Output node, make sure it is set to FaceSelection channel.
  • Press SHIFT+[N] to create a FaceNormal inputChannel node.
  • Press [T] and [R] to create a ToWorld operator to convert the Normal from Object to World Space.
  • Switch the Transform Mode to "Normal" in the Properties rollout of the operator.

NOTE: The Transform nodes provide three possible modes - "Point", "Vector" and "Normal". "Point" is used for vertex positions and other points in space and transforms using the complete transformation matrix including the translation part. "Vector" omits the translation part, so that a vector will be rotated and scaled, but not translated. "Normal" only changes the orientation, but not the translation or scaling of the input vector.
It is vital to switch all transform nodes to "Normal" mode when working with a Face or Vertex Normal value in Genome, otherwise the results would be skewed and incorrect!

  • Press [T] and [P] to create a ToSpace operator to convert the Normal from World to a custom Space. 
  • Switch the mode to "Normal".
  • Pick the Camera as the custom space object.
  • With the ToSpace selected, press [C] and [B] to create a Breakout operator.
  • With the Breakout operator selected, press [L] and [S] to create a Logical Less operator.
  • Connect the Z output of the Breakout to the Less operator's first input (instead of the X). 

RESULT: We are now comparing the Z axis of the Normal in Camera space to 0.0. If the Z is less than 0, the Normal is facing away and the face will be selected.

Adding a DeleteMesh modifier will delete these selected faces, effectively culling the Backfaces!

Related Video: