Home Technical Talk

Tutorial: Billboards, or, "Not sprites, but close enough"

Coexistence
polycounter lvl 7
Offline / Send Message
Coexistence polycounter lvl 7
Also at HansonArtIndustries.com

I had a hard time finding information on how to make these, so I made a tutorial for ya'll.

Billboards are objects that rotate to face the viewer, much like sprites. However, unlike sprites, billboards generally only rotate around their Z-axis, meaning they won’t tilt up or down, only left to right. The behavior is coded in the vertex shader. For UDK, this means the WorldPositionOffset in the material.

I have a material function for this behavior that I have used many times. It was an important component of my trees in Fall Mill as well as the grass.

billboardMat.jpg

The switch at the beginning is for use on foliage. The foliage tool groups clumps of static meshes into what are called Foliage Actors. When used on foliage, the ObjectWorldPosition node will return the position of the Foliage Actor, not the positions of each mesh. This means that groups of your foliage will all return the same value. This can be useful for things like altering colors for some clumps but not in others, but if used for the billboard behavior, the meshes will all rotate around the centers of their foliage actors, and you’ll have plants travelling along the ground.

The ObjectPivotPoint function, which comes with UDK, will return the pivot points of each individual static mesh. The catch is that it is not compatible with the pixel shader, meaning it can only be used in the WorldPositionOffset; it cannot be used to calculate color or lighting information like Diffuse or Specularity.

The Custom node performs an Atan2 function, and must be coded by hand. The code is shown at the top left.

The result is then plugged into the WorldPositionOffset in the material.

billboardMat_02.jpg

billboardSS.jpg

Replies

Sign In or Register to comment.