Skip to content
Zach Kinstner edited this page Nov 2, 2016 · 4 revisions

A renderer module provides components and prefabs for drawing items and cursors (and sometimes, entire interface modules) with a particular visual style.

Overview

Location

All renderer modules are contained within the /Assets/Hover/RendererModules folder.

Components

The module's components are responsible for controlling any custom meshes, colors, transitions, animations, or other effects. These components typically customize the standard renderer-related graphics, but may also implement entirely new visuals or behaviors.

Prefabs

Each renderer module also provides various prefabs. Each prefab represents a complete "renderer unit" for a particular element, pre-configured with all the components and structures needed for visualizing that element.

Renderer module prefab names use the format: Hover{Module}{Element}{Shape}Renderer-{Style}. For example, the "Alpha" module's prefab for an arc-shaped button, in its default style, would use the name "HoverAlphaButtonArcRenderer-Default". The available element types are Button, Slider, Tick (for Sliders), Cursor, and Idle. Most renderer modules provide only a default style, but the developer can create new prefabs with their own style variations.

Element Updaters

The item and cursor "updater" components provide properties for specifying these prefabs, and the "updater" immediately instantiates the prefab (maintaining the prefab reference) into the scene. Once the prefab is placed into the scene, it can be modified individually (for example, a particular button may need a red background).

Vertex Coloring

Renderer modules typically apply vertex-colored materials to the renderer's mesh components. This allows all meshes to use the same material, while still allowing meshes to be colored independently. By sharing the same material, Unity can draw these meshes together, in a single draw-call, via dynamic batching.

Modules

Alpha

The "Alpha" renderer module provides support for transparent materials. This is useful for certain visual effects (for example, a slightly see-through menu interface) and for transition animations (for example, a menu panel fades into view).

This module contains components that control a renderer's alpha values, its sorting layer, and its sorting order. Components for this module are located in the Hover.RendererModules.Alpha namespace.

Transparent materials can cause rendering issues in various scenarios (notably, when there are depth-sorting conflicts with other transparent materials). For this reason, support for transparency is present in the "Alpha" renderer module, rather than being included with the core renderer components. The module's "sorting" properties allow total control over the rendering order; see this video for details.

Opaque

The "Opaque" renderer module provides support for applying non-transparent vertex colors to a renderer's mesh components. This module is much simpler than the "Alpha" module, since opaque materials do not need special control over alpha values or the depth-sorting order.

Components for this module are located in the Hover.RendererModules.Opaque namespace.

Clone this wiki locally