Skip to content

Commit

Permalink
Samples: standard shadow caster is sufficient
Browse files Browse the repository at this point in the history
  • Loading branch information
paroj committed Aug 29, 2024
1 parent 437e2e0 commit 2cea02a
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 38 deletions.
20 changes: 1 addition & 19 deletions Samples/Emscripten/media/sample.material
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,4 @@ material Examples/Rockwall
}
}
}
}

material PSSM/shadow_caster
{
technique
{
// all this will do is write depth
pass
{
fog_override true none
depth_bias -1 -1

rtshader_system
{
lighting_stage gbuffer depth
}
}
}
}
}
8 changes: 0 additions & 8 deletions Samples/ShaderSystem/src/ShaderSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -897,14 +897,6 @@ void Sample_ShaderSystem::applyShadowType(int menuIndex)
mTrayMgr->removeWidgetFromTray(mDirLightCheckBox);
mDirLightCheckBox->hide();

// Disable fog on the caster pass.
MaterialPtr passCaterMaterial = MaterialManager::getSingleton().getByName("PSSM/shadow_caster");
Pass* pssmCasterPass = passCaterMaterial->getTechnique(0)->getPass(0);
pssmCasterPass->setFog(true);

// Set up caster material - this is just a standard depth/shadow map caster
mSceneMgr->setShadowTextureCasterMaterial(passCaterMaterial);

// shadow camera setup
PSSMShadowCameraSetup* pssmSetup = new PSSMShadowCameraSetup();
pssmSetup->calculateSplitPoints(3, mCamera->getNearClipDistance(), mSceneMgr->getShadowFarDistance());
Expand Down
8 changes: 1 addition & 7 deletions Samples/Simple/include/Shadows.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ using namespace OgreBites;

// New depth shadowmapping
String CUSTOM_ROCKWALL_MATERIAL("Ogre/DepthShadowmap/Receiver/RockWall");
String CUSTOM_CASTER_MATERIAL("PSSM/shadow_caster");
String CUSTOM_ATHENE_MATERIAL("Ogre/DepthShadowmap/Receiver/Athene");

String BASIC_ROCKWALL_MATERIAL("Examples/Rockwall");
Expand Down Expand Up @@ -501,7 +500,7 @@ class _OgreSampleClassExport Sample_Shadows : public SdkSample

void updateDepthShadowParams()
{
auto mat = MaterialManager::getSingleton().getByName(CUSTOM_CASTER_MATERIAL);
auto mat = MaterialManager::getSingleton().getByName("Ogre/TextureShadowCaster");
auto pass = mat->getTechniques().back()->getPass(0);
pass->setDepthBias(-mFixedBiasSlider->getValue(), -mSlopedBiasSlider->getValue());
}
Expand All @@ -527,7 +526,6 @@ class _OgreSampleClassExport Sample_Shadows : public SdkSample
{
bool showSliders = false;
ShadowMaterial mat = (ShadowMaterial)mMaterialMenu->getSelectionIndex();
MaterialPtr themat;
if (mat != mCurrentMaterial)
{
switch(mat)
Expand All @@ -547,8 +545,6 @@ class _OgreSampleClassExport Sample_Shadows : public SdkSample
mSceneMgr->setShadowTexturePixelFormat(PF_DEPTH16);
mSceneMgr->setShadowTechnique(SHADOWTYPE_TEXTURE_ADDITIVE_INTEGRATED);

themat = MaterialManager::getSingleton().getByName(CUSTOM_CASTER_MATERIAL);
mSceneMgr->setShadowTextureCasterMaterial(themat);
mSceneMgr->setShadowTextureSelfShadow(true);
// Sort out base materials
pPlaneEnt->setMaterialName(CUSTOM_ROCKWALL_MATERIAL);
Expand All @@ -569,8 +565,6 @@ class _OgreSampleClassExport Sample_Shadows : public SdkSample
mSceneMgr->setShadowTexturePixelFormat(PF_DEPTH16);
mSceneMgr->setShadowTechnique(SHADOWTYPE_TEXTURE_ADDITIVE_INTEGRATED);

themat = MaterialManager::getSingleton().getByName(CUSTOM_CASTER_MATERIAL);
mSceneMgr->setShadowTextureCasterMaterial(themat);
mSceneMgr->setShadowTextureSelfShadow(true);
// Sort out base materials
pPlaneEnt->setMaterialName(CUSTOM_ROCKWALL_MATERIAL + "/PCF");
Expand Down
4 changes: 0 additions & 4 deletions Samples/Simple/include/Terrain.h
Original file line number Diff line number Diff line change
Expand Up @@ -595,9 +595,6 @@ class _OgreSampleClassExport Sample_Terrain : public SdkSample
subRenderState->setParameter("split_points",
static_cast<PSSMShadowCameraSetup*>(mPSSMSetup.get())->getSplitPoints());
schemRenderState->addTemplateSubRenderState(subRenderState);

mSceneMgr->setShadowTextureCasterMaterial(
MaterialManager::getSingleton().getByName("PSSM/shadow_caster"));
}
else
{
Expand All @@ -607,7 +604,6 @@ class _OgreSampleClassExport Sample_Terrain : public SdkSample
mSceneMgr->setShadowTextureConfig(2, 1024, 1024, PF_X8B8G8R8);
mSceneMgr->setShadowTextureSelfShadow(false);
mSceneMgr->setShadowCasterRenderBackFaces(false);
mSceneMgr->setShadowTextureCasterMaterial(MaterialPtr());
}

matProfile->setReceiveDynamicShadowsPSSM(static_cast<PSSMShadowCameraSetup*>(mPSSMSetup.get()));
Expand Down

0 comments on commit 2cea02a

Please sign in to comment.