Skip to content

Commit

Permalink
refac: move CSM back to percentage-based
Browse files Browse the repository at this point in the history
  • Loading branch information
hoffstadt committed Jan 25, 2025
1 parent c755c3c commit 0328ddc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions extensions/pl_renderer_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1618,16 +1618,16 @@ pl_refr_generate_cascaded_shadow_map(plRenderEncoder* ptEncoder, plCommandBuffer
const uint32_t uCascadeCount = iMode == 0 ? ptLight->uCascadeCount : 1; // probe only needs single cascade

const float afCascadeSplits[4] = {
iMode == 0 ? ptLight->afCascadeSplits[0] : ptSceneCamera->fFarZ, // use whole frustum for environment probes
iMode == 0 ? ptLight->afCascadeSplits[0] : 1.0f, // use whole frustum for environment probes
ptLight->afCascadeSplits[1],
ptLight->afCascadeSplits[2],
ptLight->afCascadeSplits[3]
};

for(uint32_t uCascade = 0; uCascade < uCascadeCount; uCascade++)
{
float fSplitDist = afCascadeSplits[uCascade];
ptShadowData->tCascadeSplits.d[uCascade] = afCascadeSplits[uCascade];
float fSplitDist = afCascadeSplits[uCascade] * ptSceneCamera->fFarZ;
ptShadowData->tCascadeSplits.d[uCascade] = fSplitDist;

// camera space
plVec3 atCameraCorners2[] = {
Expand Down
2 changes: 1 addition & 1 deletion sandbox/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ pl_app_load(plApiRegistryI* ptApiRegistry, plEditorData* ptEditorData)
gptEcs->create_environment_probe(ptMainComponentLibrary, "Main Probe", (plVec3){0.0f, 3.0f, 0.0f}, &ptProbe);
ptProbe->fRange = 30.0f;
ptProbe->uResolution = 128;
ptProbe->tFlags = PL_ENVIRONMENT_PROBE_FLAGS_REALTIME | PL_ENVIRONMENT_PROBE_FLAGS_INCLUDE_SKY;
ptProbe->tFlags |= PL_ENVIRONMENT_PROBE_FLAGS_INCLUDE_SKY;

// gptEcs->create_environment_probe(ptMainComponentLibrary, "Probe0", (plVec3){9.0f, 2.0f, 3.0f}, &ptProbe); ptProbe->fRange = 7.0f;

Expand Down

0 comments on commit 0328ddc

Please sign in to comment.