I can only work on this on weekends, and only partially.
Good news, I fixed the problem. I missed it last time because Vulkan was masking it with "no terrain shadows", but GL3+ was going full "terrain shadows".
Note that OgreHlmsPbsTerraShadows.cpp is a file that you have to copy to your own repo, so you need to update sr3/src/Terra/Hlms/PbsListener/OgreHlmsPbsTerraShadows.cpp accordingly.
I also found a few other problems that came from your Ogre.log:
Code: Select all
Compiler error: invalid parameters in GpuBlendlMapper.compositor(4): RTV rt_outputcannot be overriden because it comes from an input. Create a duplicate instead
Compiler error: invalid parameters in GpuBlendlMapper.compositor(26): RTV rt_outputcannot be overriden because it comes from an input. Create a duplicate instead
Compiler error: invalid parameters in GpuBlendlMapper.compositor(48): RTV rt_outputcannot be overriden because it comes from an input. Create a duplicate instead
Compiler error: invalid parameters in GpuBlendlMapper.compositor(70): RTV rt_outputcannot be overriden because it comes from an input. Create a duplicate instead
That happens because you have this:
Code: Select all
compositor_node Terra/GpuBlendMapper
{
in 0 rt_output
rtv rt_output
{ slice 1 } // draw to slice 1
target rt_output
{
pass render_quad
{
material Terra/GpuBlendMapper
}
pass generate_mipmaps
{ }
}
}
This would be valid if rt_output was a local texture, but it's an input. And unfortunately we don't support modifying autogenerated RTVs from an input.
I believe it should be this (note that slices start from 0, slice 1 means to write to the 2nd slice):
Code: Select all
compositor_node Terra/GpuBlendMapper
{
in 0 rt_output
rtv myRtv
{
colour rt_output
depth_stencil rt_output
slice 1 // draw to slice 1
}
target myRtv
{
pass render_quad
{
material Terra/GpuBlendMapper
}
pass generate_mipmaps
{ }
}
}
Next error: You have:
Code: Select all
hlms roadMudWet pbs : road
{
diffuse_map roadMud.jpg
roadAsphalt_spec2.jpg
diffuse 0.7 0.7 0.7
specular 0.3 0.3 0.2
}
I believe the correct material definition is:
Code: Select all
hlms roadMudWet pbs : road
{
diffuse_map roadMud.jpg
specular_map roadAsphalt_spec2.jpg
diffuse 0.7 0.7 0.7
specular 0.3 0.3 0.2
}
Next error: Please run in Debug mode. When launching stuntrally3 (not the editor) I get this assert:
Code: Select all
stuntrally3: ../../OgreMain/include/OgreNode.h:681: const Ogre::Matrix4& Ogre::Node::_getFullTransform() const: Assertion `!mCachedTransformOutOfDate' failed.
Hooking a debugger I see that the object in question triggering the error is "skymesh".
You shouldn't modify SceneNodes (or AABBs) in listeners because SceneManager::updateAllTransforms has already been called.
But if you do (which can happen if you need to move a Camera or the Sky) after you're done with your modifications you can call node->_getFullTransformUpdated(). See documentation.
Next issue: Please apply this patch for Vulkan support.
Code: Select all
diff --git a/src/Terra/Terra2.cpp b/src/Terra/Terra2.cpp
index 0501df3..3e7f132 100644
--- a/src/Terra/Terra2.cpp
+++ b/src/Terra/Terra2.cpp
@@ -198,6 +198,14 @@ namespace Ogre
// sceneMgr->destroyCamera( camera );
#endif
+ RenderSystem *renderSystem = pTerra->mManager->getDestinationRenderSystem();
+ renderSystem->endCopyEncoder();
+ BarrierSolver &barrierSolver = renderSystem->getBarrierSolver();
+ ResourceTransitionArray resourceTransitions;
+ barrierSolver.resolveTransition( resourceTransitions, texture, ResourceLayout::Texture,
+ ResourceAccess::Read, 1u << GPT_FRAGMENT_PROGRAM );
+ renderSystem->executeResourceTransition( resourceTransitions );
+
//^^ todo: for GetTerMtrIds tire ter surf ..
// texture->writeContentsToFile("blendmapRTT.png", 0, 1); //** ter test blendmap
}
diff --git a/src/common/AppGui_UtilMem.cpp b/src/common/AppGui_UtilMem.cpp
index c2b5901..8ab6e70 100644
--- a/src/common/AppGui_UtilMem.cpp
+++ b/src/common/AppGui_UtilMem.cpp
@@ -167,7 +167,14 @@ void AppGui::MinimizeMemory()
Root *root = mGraphicsSystem->getRoot();
RenderSystem *renderSystem = root->getRenderSystem();
VaoManager *vaoManager = renderSystem->getVaoManager();
- vaoManager->cleanupEmptyPools();
+ try
+ {
+ vaoManager->cleanupEmptyPools();
+ }
+ catch( UnimplementedException & )
+ {
+ // Ignore. Vulkan doesn't implement this (yet?).
+ }
}
#if 0
diff --git a/src/editor/Render2tex.cpp b/src/editor/Render2tex.cpp
index cb3b7dd..5ff90d6 100644
--- a/src/editor/Render2tex.cpp
+++ b/src/editor/Render2tex.cpp
@@ -150,7 +150,16 @@ void App::CreateRnd2Tex()
r.nd = mSceneMgr->getRootSceneNode()->createChildSceneNode();
r.nd->attachObject(r.hr);
r.nd->setVisible(false);//pSet->trackmap);
- } }
+ }
+
+ RenderSystem *renderSystem = mSceneMgr->getDestinationRenderSystem();
+ renderSystem->endCopyEncoder();
+ BarrierSolver &barrierSolver = renderSystem->getBarrierSolver();
+ ResourceTransitionArray resourceTransitions;
+ barrierSolver.resolveTransition( resourceTransitions, r.tex, ResourceLayout::Texture,
+ ResourceAccess::Read, 1u << GPT_FRAGMENT_PROGRAM );
+ renderSystem->executeResourceTransition( resourceTransitions );
+ }
}
// backgr cover prv cam meh-
Next error: Building on Debug is broken for me on Ubuntu. I fixed it with this patch:
Code: Select all
diff --git a/src/common/AppGui_Util.cpp b/src/common/AppGui_Util.cpp
index cbdd74d..d128a3b 100644
--- a/src/common/AppGui_Util.cpp
+++ b/src/common/AppGui_Util.cpp
@@ -104,7 +104,7 @@ void AppGui::UpdSelectGlow(Ogre::Renderable *rend, bool selected)
Hlms *hlms = datablock->getCreator();
if( hlms->getType() == HLMS_PBS )
{
- assert( dynamic_cast<MyHlmsPbs*>( hlms ) );
+ assert( dynamic_cast<HlmsPbs2*>( hlms ) );
HlmsPbs2 *myHlmsPbs = static_cast<HlmsPbs2*>( hlms );
uint32 hash, casterHash;
myHlmsPbs->CalculateHashFor( rend, hash, casterHash );
diff --git a/src/common/HlmsPbs2.h b/src/common/HlmsPbs2.h
index afd894d..6f8f23b 100644
--- a/src/common/HlmsPbs2.h
+++ b/src/common/HlmsPbs2.h
@@ -36,7 +36,7 @@ public:
HlmsPbs2( Ogre::Archive *dataFolder, Ogre::ArchiveVec *libraryFolders );
~HlmsPbs2() override;
- const static size_t selected_glow = 123;
+ constexpr static size_t selected_glow = 123;
void CalculateHashFor( Ogre::Renderable *renderable, Ogre::uint32 &outHash, Ogre::uint32 &outCasterHash )
{