Skip to content

Latest commit

 

History

History
49 lines (29 loc) · 2.48 KB

File metadata and controls

49 lines (29 loc) · 2.48 KB

Hover Light

A HoverLight is a Fluent Design System paradigm that mimics a point light hovering near the surface of an object. Often used for far away interactions, the application can control the properties of a Hover Light via the HoverLight component.

For a material to be influenced by a HoverLight the Mixed Reality Toolkit/Standard shader must be used and the Hover Light property must be enabled.

Note

Up to two HoverLights are supported by default.

Examples

Most scenes within the MRTK utilize a HoverLight. The most common use case can be found on the MRTK/SDK/Features/UX/Prefabs/Cursors/DefaultCursor.prefab

Advanced Usage

By default only two HoverLights can illuminate a material at a time. If your project requires more than two HoverLights to influence a material the sample code below demonstrates how to achieve this.

Note

Having many HoverLights illuminate a material will increase pixel shader instructions and will impact performance. Please profile these changes within your project.

How to increase the number of available HoverLights from two to four.

// 1) Within MRTK/Core/StandardAssets/Shaders/MixedRealityStandard.shader change:

#define HOVER_LIGHT_COUNT 2

// to:

#define HOVER_LIGHT_COUNT 4

// 2) Within MRTK/Core/Utilities/StandardShader/HoverLight.cs change:

private const int hoverLightCount = 2;

// to:

private const int hoverLightCount = 4;

Note

If Unity logs a warning similar to below then you must restart Unity before your changes will take effect.

Property (_HoverLightData) exceeds previous array size (8 vs 4). Cap to previous >size.

See also