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.
| Function | Returns |
|---|---|
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 global | What 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. |
_RaptorGVolume0 | The volume texture. |
_RaptorGVolumeMatrix | World space to volume space. |
_RaptorGVolumeInvSize | xyz is one over the volume's size. w is 1 while a volume is bound. |
#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.