Foundation
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions | Variables
LightBVH.hpp File Reference
#include <Core/Container.hpp>
#include <Core/Logging.hpp>
#include <Math/Math.hpp>
#include <Math/Quantize.hpp>
#include <algorithm>
#include <bit>
#include <cmath>
#include <cstdint>
#include <numbers>
#include "GPUScene.hpp"

Go to the source code of this file.

Classes

struct  LightBVHOptions
 
struct  LightBVHNode
 
struct  GSLightBVHNode
 
struct  LightBVHStats
 
struct  LightBVHBuild
 

Typedefs

using LightBVHRefitLevel = GSOffsetCount
 

Enumerations

enum class  LightBVHSplitHeuristic : uint32_t { Equal = 0u , BinnedSAH = 1u , BinnedSAOH = 2u }
 

Functions

bool LightBVHNodeIsLeaf (LightBVHNode const &node)
 
uint32_t LightBVHNodeRightChild (LightBVHNode const &node)
 
uint32_t LightBVHNodeLightCount (LightBVHNode const &node)
 
uint32_t LightBVHNodeLightOffset (LightBVHNode const &node)
 
void LightBVHNodeSetAABB (LightBVHNode &node, float3 const &aabbMin, float3 const &aabbMax)
 
void LightBVHNodeGetAABB (LightBVHNode const &node, float3 &aabbMin, float3 &aabbMax)
 
void LightBVHNodeSetInternal (LightBVHNode &node, uint32_t rightChildIdx)
 
void LightBVHNodeSetLeaf (LightBVHNode &node, uint32_t lightCount, uint32_t lightOffset)
 
uint16_t PackLightBVHExtent (float extent)
 
uint32_t PackLightBVHConeDirection (float3 direction)
 
float3 UnpackLightBVHConeDirection (uint32_t packed)
 
GSLightBVHNode PackLightBVHNode (LightBVHNode const &node)
 
LightBVHNode UnpackLightBVHNode (GSLightBVHNode const &packed)
 
uint32_t GSLightTypeCPU (GSLight const &light)
 
bool IsDistantLightType (uint32_t type)
 
bool IsFiniteLightType (uint32_t type)
 
bool HasLightEmission (GSLight const &light)
 
float ComputeLightProposalWeight (GSLight const &light)
 
void ComputeAnalyticalLightBounds (GSLight const &light, float3 &aabbMin, float3 &aabbMax, float3 &center, float3 &coneDirection, float &cosConeAngle)
 
LightBVHBuild BuildLightBVH (Span< GSLight const > lights, Span< GSEmissiveCluster const > clusters, LightBVHOptions const &options, Allocator *alloc)
 
bool ValidateLightBVH (LightBVHBuild const &bvh, Span< GSLight const > lights, Span< GSEmissiveCluster const > clusters, String *outError=nullptr)
 
bool LightBVHRunBuilderSelfTests (Allocator *alloc, String *outError=nullptr)
 

Variables

constexpr float kLightBVHInvalidCosConeAngle = -1.0f
 
constexpr uint32_t kLightBVHMaxDepth = 64u
 
constexpr uint32_t kLightBVHLightCountBits = 4u
 
constexpr uint32_t kLightBVHLightOffsetBits = 31u - kLightBVHLightCountBits
 
constexpr uint32_t kLightBVHMaxLightsPerLeaf = 1u << kLightBVHLightCountBits
 
constexpr uint32_t kLightBVHMaxLightOffset = 1u << kLightBVHLightOffsetBits
 
constexpr uint32_t kLightBVHLeafBit = 1u << 31
 
constexpr float kLightBVHMinSunAngularRadius = 1e-4f
 

Typedef Documentation

◆ LightBVHRefitLevel

Enumeration Type Documentation

◆ LightBVHSplitHeuristic

enum class LightBVHSplitHeuristic : uint32_t
strong
Enumerator
Equal 
BinnedSAH 
BinnedSAOH 

Function Documentation

◆ BuildLightBVH()

LightBVHBuild BuildLightBVH ( Span< GSLight const >  lights,
Span< GSEmissiveCluster const >  clusters,
LightBVHOptions const &  options,
Allocator alloc 
)

◆ ComputeAnalyticalLightBounds()

void ComputeAnalyticalLightBounds ( GSLight const &  light,
float3 aabbMin,
float3 aabbMax,
float3 center,
float3 coneDirection,
float &  cosConeAngle 
)

◆ ComputeLightProposalWeight()

float ComputeLightProposalWeight ( GSLight const &  light)
inline

◆ GSLightTypeCPU()

uint32_t GSLightTypeCPU ( GSLight const &  light)
inline

◆ HasLightEmission()

bool HasLightEmission ( GSLight const &  light)
inline

◆ IsDistantLightType()

bool IsDistantLightType ( uint32_t  type)
inline

◆ IsFiniteLightType()

bool IsFiniteLightType ( uint32_t  type)
inline

◆ LightBVHNodeGetAABB()

void LightBVHNodeGetAABB ( LightBVHNode const &  node,
float3 aabbMin,
float3 aabbMax 
)
inline

◆ LightBVHNodeIsLeaf()

bool LightBVHNodeIsLeaf ( LightBVHNode const &  node)
inline

◆ LightBVHNodeLightCount()

uint32_t LightBVHNodeLightCount ( LightBVHNode const &  node)
inline

◆ LightBVHNodeLightOffset()

uint32_t LightBVHNodeLightOffset ( LightBVHNode const &  node)
inline

◆ LightBVHNodeRightChild()

uint32_t LightBVHNodeRightChild ( LightBVHNode const &  node)
inline

◆ LightBVHNodeSetAABB()

void LightBVHNodeSetAABB ( LightBVHNode node,
float3 const &  aabbMin,
float3 const &  aabbMax 
)
inline

◆ LightBVHNodeSetInternal()

void LightBVHNodeSetInternal ( LightBVHNode node,
uint32_t  rightChildIdx 
)
inline

◆ LightBVHNodeSetLeaf()

void LightBVHNodeSetLeaf ( LightBVHNode node,
uint32_t  lightCount,
uint32_t  lightOffset 
)
inline

◆ LightBVHRunBuilderSelfTests()

bool LightBVHRunBuilderSelfTests ( Allocator alloc,
String outError = nullptr 
)

◆ PackLightBVHConeDirection()

uint32_t PackLightBVHConeDirection ( float3  direction)
inline

◆ PackLightBVHExtent()

uint16_t PackLightBVHExtent ( float  extent)
inline

◆ PackLightBVHNode()

GSLightBVHNode PackLightBVHNode ( LightBVHNode const &  node)
inline

◆ UnpackLightBVHConeDirection()

float3 UnpackLightBVHConeDirection ( uint32_t  packed)
inline

◆ UnpackLightBVHNode()

LightBVHNode UnpackLightBVHNode ( GSLightBVHNode const &  packed)
inline

◆ ValidateLightBVH()

bool ValidateLightBVH ( LightBVHBuild const &  bvh,
Span< GSLight const >  lights,
Span< GSEmissiveCluster const >  clusters,
String outError = nullptr 
)

Variable Documentation

◆ kLightBVHInvalidCosConeAngle

constexpr float kLightBVHInvalidCosConeAngle = -1.0f
inlineconstexpr

◆ kLightBVHLeafBit

constexpr uint32_t kLightBVHLeafBit = 1u << 31
inlineconstexpr

◆ kLightBVHLightCountBits

constexpr uint32_t kLightBVHLightCountBits = 4u
inlineconstexpr

◆ kLightBVHLightOffsetBits

constexpr uint32_t kLightBVHLightOffsetBits = 31u - kLightBVHLightCountBits
inlineconstexpr

◆ kLightBVHMaxDepth

constexpr uint32_t kLightBVHMaxDepth = 64u
inlineconstexpr

◆ kLightBVHMaxLightOffset

constexpr uint32_t kLightBVHMaxLightOffset = 1u << kLightBVHLightOffsetBits
inlineconstexpr

◆ kLightBVHMaxLightsPerLeaf

constexpr uint32_t kLightBVHMaxLightsPerLeaf = 1u << kLightBVHLightCountBits
inlineconstexpr

◆ kLightBVHMinSunAngularRadius

constexpr float kLightBVHMinSunAngularRadius = 1e-4f
inlineconstexpr