Adding randomness to identical models
The first recipe we’ll tackle in this chapter will deal with instances of a 3D model. You might have heard about this type of asset, as they are a common feature in many different 3D content-creation packages. We use the name instance to refer to the identical copies of an asset that get scattered throughout a scene, taking advantage of a feature of our graphics cards that allows us to render these copies much faster than if we were dealing with unique individual objects. This can be a very powerful technique for increasing performance, especially when we work with assets that appear multiple times in a level: vegetation, props, modular pieces, or other similar assets. Having said that, dealing with identical models doesn’t necessarily mean that we want them to look the same; we sometimes want a certain variation to occur, if only to break up any apparent visual repetition across the level.
In this recipe, we will explore a simple...