From fb11c03e7e61339a29a21acbfd584d6d1f7ab996 Mon Sep 17 00:00:00 2001 From: Pavel Rojtberg Date: Thu, 29 Aug 2024 02:20:42 +0200 Subject: [PATCH] Samples: standard shadow caster is sufficient --- Samples/Emscripten/media/sample.material | 20 +------------------- Samples/ShaderSystem/src/ShaderSystem.cpp | 8 -------- Samples/Simple/include/Shadows.h | 8 +------- Samples/Simple/include/Terrain.h | 4 ---- 4 files changed, 2 insertions(+), 38 deletions(-) diff --git a/Samples/Emscripten/media/sample.material b/Samples/Emscripten/media/sample.material index ab318477f26..9afd3e26a5e 100644 --- a/Samples/Emscripten/media/sample.material +++ b/Samples/Emscripten/media/sample.material @@ -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 - } - } - } -} +} \ No newline at end of file diff --git a/Samples/ShaderSystem/src/ShaderSystem.cpp b/Samples/ShaderSystem/src/ShaderSystem.cpp index 20e11c9e733..b72b2e4dfc9 100644 --- a/Samples/ShaderSystem/src/ShaderSystem.cpp +++ b/Samples/ShaderSystem/src/ShaderSystem.cpp @@ -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()); diff --git a/Samples/Simple/include/Shadows.h b/Samples/Simple/include/Shadows.h index a1b39a6650e..3258e25db55 100644 --- a/Samples/Simple/include/Shadows.h +++ b/Samples/Simple/include/Shadows.h @@ -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"); @@ -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()); } @@ -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) @@ -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); @@ -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"); diff --git a/Samples/Simple/include/Terrain.h b/Samples/Simple/include/Terrain.h index 79e6c2ed5ad..9fed2f5e848 100644 --- a/Samples/Simple/include/Terrain.h +++ b/Samples/Simple/include/Terrain.h @@ -595,9 +595,6 @@ class _OgreSampleClassExport Sample_Terrain : public SdkSample subRenderState->setParameter("split_points", static_cast(mPSSMSetup.get())->getSplitPoints()); schemRenderState->addTemplateSubRenderState(subRenderState); - - mSceneMgr->setShadowTextureCasterMaterial( - MaterialManager::getSingleton().getByName("PSSM/shadow_caster")); } else { @@ -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(mPSSMSetup.get()));