A suite of tools that use a spline that has controls for position, rotation, and width/height. Early versions of these tools were used in Momentum for some of the tracks and for all of the movers. Includes:
- Spline Mesh Builder
- Creates a mesh by extruding an arbitrary cross section along the spline. Supports both cylindrical projection and triplanar uv projection.
- Spline Mover
- Moves an object along the spline.
- Spline Prefab Instancer
- Instances prefabs along the spline.
Triplanar Standard shader:
Acts like Unity’s Standard shader, but projects and blends UVs in object-space. Also correctly projects tangents and supports GPU instancing, allowing for per-instance variety without adding per-instance draw calls.
Uses a distortion map to gently sway. The sway affects the normal slightly, and can be affixed so the root of the leaf group doesn’t also sway Also supports GPU instancing. Notably, this means that frequencies of individual leaf groups can be randomized, so they don’t sway in unison.
Momentum World 1 background implementation:
Just going dive into the implementation of the background for a bit. (The actual modeling, rendering, and compositing warrants posts of their own.)
The goal in this stage was to create a series of subtle animations that made the city feel a little less static, but not by too much. The things I added were:
- Animated ocean
- Tron-style little cars on some of the roads
- A clock
- Windows flickering
To begin, in order to render all this out, what I did was to create a secondary camera to render just the background, then I tied its rotation and FOV to that of the main camera, but not its position. So the background ends up looking gigantic, even if it really isn’t.
What I would like to do on a future project, given the opportunity, is instead of having no background camera movement, have scaled down movement with a to-scale miniature version of the play environment. In theory, it should look like infinite view-distance. The effect might be improved by using the depth buffer to blend between the main render and the background render in an effect shader.
The Animated ocean is simply a large quad with a highly reflective material and a bumpmap whose uv offset is changed over time. The trick is masking the edges of the ocean. There’s a partially transparent cube that covers up parts of the ocean quad. This cube uses the same texture as the skybox, and is lined up with it.
Similarly, the cars use a mask to simulate depth, covering them when they go behind a building. They move by way of a 1st degree spline mover that follows a scaled down version of the roads. Beyond that, they’re just an empty object with a trail mesh generator modified to always have normals that point up. The clock hands are placed in that same scaled down space, aligned with the cube map. The birds are also pretty similar to the cars, only they aren’t masked, and use a 3rd degree spline to move.
The flickering windows effect uses a double alpha-blended shader. One of the alpha masks is a noise texture whose uv coordinates are animated; The other mask matches a subset of the windows.