Skip to main content
Version: 10.0

Depth Rim Lighting

Depth-based Rim Lighting is a rim lighting effect that creates a constant-size rim in screen space, meaning the rim has a more constant size, unlike traditional rim lighting.

This effect relies on the Depth Buffer/Depth Texture being active in the scene. Since this has some computational overhead, it's not always active. Some worlds will not have this enabled, and some will have it disabled.

To forcibly enable the depth buffer from an avatar, a reliable method is to add a realtime directional light to the scene, which will trigger the depth texture to be updated. A prefab called DepthGet is included in the Poiyomi Shaders package.

Requires Depth Buffer

In order to use Depth Rim Lighting, you will need to place the DepthGet Prefab found in the Assets/_PoiyomiShaders/Prefabs on your avatar.

Make sure to only enable the depth buffer when you need it! This can be a performance hit, and it's not always necessary.

Normal To Use

  • Type: Dropdown, Options: Pixel/Vertex

Normal to use for the depth rim light effect. Pixel uses the normal of the pixel after all normal maps have been applied. Vertex uses the normal from the mesh itself.

Rim Type

  • Type: Dropdown, Options: Two Samples/Four Samples/Eight Samples

How many samples to use for the depth rim lighting. This will determine what details appear in the rim as drawn by the Depth Buffer.

Shape Control

Width

  • Type: Float, Range: 0.0 - 1.0

How wide the rim should extend from the edge.

Sharpness

  • Type: Float, Range: 0.0 - 1.0
    • Conditional: Requires Binary to be disabled.

How sharp the edge of the rim should be. Generally, at higher sharpness, the rim will appear in less areas.

Depth Threshold

  • Type: Float, Range: 0.0 - 1.0

The amount of threshold depth to use.

Binary

  • Type: Toggle

Enables the usage of Binary to control the shape's sharpness.

info

If Binary is enabled, it will disable Sharpness

Fixed Size Threshold

  • Type: Float

Sets a fixed size threshold to use for the shape control.

Min Distance

  • Type: Toggle

Minimum distance to use for the shape size.

Max Distance

  • Type: Toggle

Maximum distance to use for the shape size.

Light Direction

Method

  • Type: Dropdown, Options: NdotL/Rim Dot Light

What light direction method to use for how the depth rim lighting is treated with lighting direction.

Map to Light Direction

  • Type: Float, Range: 0.0 - 1.0

Sets the mapping to the Light Direction to a specific amount.

Mix Attenuation

  • Type: Float, Range: 0.0 - 1.0

How much to mix the light direction attenuation.

Mix Ramped Light Map

  • Type: Float, Range: 0.0 - 1.0

How much to mix the ramped light map with the light direction.

Masking

Mask

  • Type: Data Texture (sRGB = Off)

Mask texture slot to mask the depth rim lighting to appear in only the specified areas of the UV.

Channel

  • Type: Dropdown, Options: R/G/B/A

If a Mask texture is used, this should select which color channel in the texture to use for the Mask.

Color

Use Base Color

  • Type: Float, Range: 0.0 - 1.0

How much to incorporate the base color into the rim color. At 0, only the Rim Color will be used. At 1, only the base color of the mesh will be used.

Light Color Mix

  • Type: Float, Range: 0.0 - 1.0

How much to mix the rim color with the light color. The light color scaled to this value is multiplied with the rim color.

Rim Color

  • Type: Color

Base color of the rim.

Color Brightness

  • Type: Float, Range: 0.0 - 10.0

How bright should the rim color appear.

Emission

  • Type: Float, Range: 0.0 - 20.0

How much emission the rim should exhibit.

Blending

In most application, choosing one blend mode to use will be sufficient.

Replace

  • Type: Float, Range: 0.0 - 1.0

How much to replace the base color with the rim color.

Add

  • Type: Float, Range: 0.0 - 1.0

How much to add the rim color to the base color.

Screen

  • Type: Float, Range: 0.0 - 1.0

How much to blend screen the rim color to the base color.

Multiply

  • Type: Float, Range: 0.0 - 1.0

How much to multiply the rim color with the base color.

Unlit Add

  • Type: Float, Range: 0.0 - 1.0

How much to add the rim color to the light intensity (base pass only).