Ever wondered what needs to happen before you can interact with a plant in a narrative adventure? If so, you are in luck! Today, I’d like to walk you through the process of creating of a single asset for Privacy.
Perhaps the most obvious and visible element of each asset is the 3D model. In this case it is a lovely model of a Monstera deliciosa, which I purchased and then cleaned up for use in real-time rendering. Below is the finished model in MODO, my 3D editor of choice.
Next up are the model’s texture and materials, which together define the look of the model when it is rendered by the engine. My engine employs physically-based rendering (PBR) and requires at least three different textures per material:
- A base texture that defines how the material responds to diffuse light if it is a dielectric or the color of the specular reflections if the material is a metal. Also stored in the base texture is the opacity to control which parts of the material are opaque, translucent or invisible.
- A normal map to create the illusion of small surface details when light falls on the model
- An attributes map, which contains various properties of the material that are important for shading: metallic (how metal-like is this material?), roughness (how rough or smooth is it?), transmittance ;(does light pass through?) and ambient occlusion (are there areas where light cannot reach?)
With purchased models, the textures often require the most amount of work. Quite often, the models that work best for my game are delivered without PBR textures or setups that aren’t compatible with my engine. To achieve the look I am after, I often end up purchasing models intended for architecture visualizations (“arch viz”) and those are often tailored to offline rendering setups that are quite different from what my engine needs.
In the composite below, for example, you may notice there is quite a bit of specular light (the white reflections) baked into the base texture. For the best results in game, I’ll need to paint out those reflections at some point.
Once the model is textured, the next phase is to setup the collision. For this particular asset, collision is fairly straightforward: there is a small box wrapped tightly around the pot and the stool to prevent the player from walking through the plant – since that tends to destroy the illusion of the plant being a real object. The larger red box is a generous interaction volume, which helps the player script identify the plant as an object that can be interacted with.
A script is attached to the asset to control what happens when the player interacts with it. For this plant, I am using the Describe script. When the player interacts with a Describe asset, Hubert (the house A.I) will say something about the object. He may offer up a clue to help the player unravel the story, provide more insight into his own character or simply provide some encyclopedic knowledge about the object, as any obedient A.I. would.
Optionally, the script may also trigger music, sound effects or animations related to the object.
Almost there! The final step in bringing the asset to live is sound. First, I’ll need to decide which sound effects are appropriate for the asset and write the lines, if any, that Hubert will speak when the player interacts with the asset. In this case, Hubert has three different lines:
- “A Monstera, though I am uncertain what species it is”
- “It’s a Monstera deliciosa, most likely“
- “Did you know they call this plant Costilla de Adán, or Adam’s ribs in Spain?”
Before Hubert can speak, we first need to record those lines with Anthony, who provides his voice.
Once the sound recordings have been properly edited in Logic, I import them into FMOD Studio to create the associated sound events and control things like 3D placement, the real-time mix and effects like reverb.
Information from the sound banks created in FMOD Studio feeds back into the interactions script, which determine when and how Hubert speaks from the names of the sound events. Similarly, sound effects and music cues will play at the right time because of how they are named. Using asset names to control behavior like this is a bit error prone and I would definitely not recommend it for larger scale projects, but there is one incredible advantage for a solo developer like me: setting up stuff is very, very fast!
And there we have it: one asset ready to be placed into the game!
Now I just need to repeat all of the above steps for about a thousand times over to create everything I need to fill out the game. Oh, and I also need to build the rest of the house, the garden and the surrounding lands...