Skip to content

Latest commit

 

History

History
56 lines (36 loc) · 2.41 KB

File metadata and controls

56 lines (36 loc) · 2.41 KB
title description author ms.author ms.date ms.localizationpriority keywords
Proximity Light
Learn about the Graphics Tools proximity lights.
lolambean
lolab
05/05/2022
high
Unity, HoloLens, HoloLens 2, Mixed Reality, development, MRTK, Graphics Tools, MRGT, MR Graphics Tools, Standard Shader, Proximity Light

Proximity light overview — MRTK3

A ProximityLight is a Fluent Design System paradigm that mimics a "gradient inverse point light" hovering near the surface of an object. It's often used for near interactions, the application can control the properties of a Proximity Light via the ProximityLight component.

Proximity light UI example

For a material to be influenced by a ProximityLight, the Graphics Tools/Standard or Graphics Tools/Standard Canvas shaders must be used and the Proximity Light property must be enabled. The Graphics Tools/Non-Canvas/Frontplate and Graphics Tools/Canvas/Frontplate are also influenced by ProximityLights but in a slightly different fashion.

Note

Up to two ProximityLights are supported by default.

Advanced usage

By default only two ProximityLights can illuminate a material at a time. If your project requires more than two ProximityLights to influence a material, the sample code below demonstrates how to achieve this on the Graphics Tools/Standard or Graphics Tools/Standard Canvas shaders.

Note

Having many ProximityLights illuminate a material will increase pixel shader instructions and will impact performance. Profile these changes within your project.

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

// 1) Within GraphicsToolsStandardInput.hlsl change:

#define PROXIMITY_LIGHT_COUNT 2

// to:

#define PROXIMITY_LIGHT_COUNT 4

// 2) Within ProximityLight.cs change:

private const int proximityLightCount = 2;

// to:

private const int proximityLightCount = 4;

Note

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

Property (_ProximityLightData) exceeds previous array size (24 vs 12). Cap to previous size.

See also