Get RAPTOR

Shader API

Read RAPTOR's baked light volume in custom shaders.

With Bakery, Bake settings → Probes → Volumes bakes a light volume for each model, which lights props and moving parts. Custom shaders can read this light through two include files.

Both are in RAPTOR's RaptorRender/Runtime/Shaders folder. Their paths, function names and global property names are supported.

RaptorVolume.hlsl

Reads the volume bound to the renderer being rendered.

FunctionReturns
bool RaptorVolumeBound()true when this renderer has a volume bound.
float3 RaptorVolumeSH(float3 positionWS, float3 normalWS)The baked light at a world position, facing a world normal.
float RaptorShL1(float L0, float3 L1, float3 n)One colour channel of the light for normal n, from its L0 and L1 terms.

RaptorVolumeGlobal.hlsl

Reads the volume around the camera, for effects without a renderer, such as fog. It also works in compute shaders.

Function or globalWhat it is
bool RaptorGlobalVolumeOn()true when a volume is bound around the camera.
float3 RaptorGlobalVolumeL0(float3 positionWS)The non-directional baked light at a world position. Zero outside the volume.
_RaptorGVolume0The volume texture.
_RaptorGVolumeMatrixWorld space to volume space.
_RaptorGVolumeInvSizexyz is one over the volume's size. w is 1 while a volume is bound.
Using it in a shader
#include "Assets/RAPTOR/RaptorRender/Runtime/Shaders/RaptorVolume.hlsl"

float3 Ambient(float3 positionWS, float3 normalWS)
{
    if (RaptorVolumeBound())
        return RaptorVolumeSH(positionWS, normalWS);
    return SampleSH(normalWS); // Unity's own ambient light
}

The include path depends on where RAPTOR is in your project. The Asset Store installs it to Assets/RAPTOR.