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
The MRTK/Standard shader supports up to two HoverLights
by default, but will scale to support four and then ten as more lights are added to the scene.
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
The HoverLightExamples scene also demonstrates usage of HoverLight
behaviors, and can be found at: MRTK/Examples/Demos/StandardShader/Scenes/
Advanced Usage
Only ten HoverLights
can illuminate a material at a time. If your project requires more than ten 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 ten to twelve.
// 1) Within MRTK/Core/StandardAssets/Shaders/MixedRealityStandard.shader change:
#if defined(_HOVER_LIGHT_HIGH)
#define HOVER_LIGHT_COUNT 10
// to:
#if defined(_HOVER_LIGHT_HIGH)
#define HOVER_LIGHT_COUNT 12
// 2) Within MRTK/Core/Utilities/StandardShader/HoverLight.cs change:
private const int hoverLightCountHigh = 10;
// to:
private const int hoverLightCountHigh = 12;
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 (24 vs 20). Cap to previous >size.