From 71e18dac5a45281cb9d2803e979ec3ecf62e5419 Mon Sep 17 00:00:00 2001 From: Pavel Rojtberg Date: Wed, 28 Aug 2024 01:34:59 +0200 Subject: [PATCH 1/3] Docs: 14-Notes - document new 14.3 features --- Docs/14-Notes.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Docs/14-Notes.md b/Docs/14-Notes.md index 0ca2ac17287..44e2361735c 100644 --- a/Docs/14-Notes.md +++ b/Docs/14-Notes.md @@ -17,6 +17,8 @@ Since 14.1, `ACT_MATERIAL_LOD_INDEX` is available to implement multiple material Since 14.3, textures defined in compositor scripts can explicitly set the FSAA level, e.g. `texture myTex fsaa 4`. +Since 14.3, `float16` vertex elements are supported via the `VET_HALFx` types. Note, that `VET_HALF3` is not supported on D3D11 and D3D9 and is padded to `VET_HALF4` on loading there. + ### OgreUnifiedShader.h Sampler definitions now implicitly include the `uniform` keyword to support Vulkan; i.e. this will generate an error: @@ -87,6 +89,10 @@ The second argument of `RenderQueueListener::renderQueueStarted` now contains th A new spot light type `LT_RECTLIGHT` has been introduced along with the `setSourceSize` method, enabling the rendering of rectangular area lights. In order to process this light type in your shader, verify that the `spotlight_params.w` autoparam is equal to 2. Then, `spotlight_params.xyz` contains the light width in the view space, and `light_attenuation.xyz` contains the light height. +### Mesh & Task Shaders (since 14.3) + +The shader types `GPT_MESH_PROGRAM` and `GPT_TASK_PROGRAM` are now available, with support indicated by the `RSC_MESH_PROGRAM` capability. This functionality is provided in GL3Plus through the `GL_NV_mesh_shader` extension and in Vulkan via the `VK_NV_mesh_shader` extension. + ## Python The double `ImGui` namespacing in `Ogre.ImGui` enums was removed; e.g. `ImGui.ImGuiWindowFlags_NoTitleBar` is now `ImGui.WindowFlags_NoTitleBar`. @@ -166,3 +172,7 @@ Transform feedback outputs are now consistently named `xfb_position`, `xfb_uv0` Shader updates are required. On OSX, `texture2D` etc. functions are no longer implicitly upgraded to version 150 equivalents, explicitly `#include ` to get them. + +## Wayland support (since 14.3) + +Ogre can now run on Wayland in Linux if compiled with `OGRE_USE_WAYLAND=TRUE`. This is supported across all GL and Vulkan render systems, as well as the OgreBites SDL2 integration. \ No newline at end of file From fb11c03e7e61339a29a21acbfd584d6d1f7ab996 Mon Sep 17 00:00:00 2001 From: Pavel Rojtberg Date: Thu, 29 Aug 2024 02:20:42 +0200 Subject: [PATCH 2/3] 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())); From 623c054ccb74f4c95d246de23e964c7c8cb4416f Mon Sep 17 00:00:00 2001 From: Pavel Rojtberg Date: Thu, 29 Aug 2024 02:21:09 +0200 Subject: [PATCH 3/3] UnifiedShader: add dFdx, dFdy --- Media/Main/OgreUnifiedShader.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Media/Main/OgreUnifiedShader.h b/Media/Main/OgreUnifiedShader.h index e6e59a97f98..538f53392a4 100644 --- a/Media/Main/OgreUnifiedShader.h +++ b/Media/Main/OgreUnifiedShader.h @@ -50,6 +50,8 @@ vec4 textureCubeLod(samplerCube s, vec3 v, float lod) { return texCUBElod(s, vec #define mix lerp #define fract frac #define inversesqrt rsqrt +#define dFdx ddx +#define dFdy ddy float mod(float _a, float _b) { return _a - _b * floor(_a / _b); } vec2 mod(vec2 _a, vec2 _b) { return _a - _b * floor(_a / _b); }