So, I was able to reproduce the issue in the "MainDemo" example of Colibri. It appears to be even trickier than expected. When I just added Colibri on a separate node it didn't crash so I continued to dig and realised it happened when I load a v1 mesh with vertex animation, convert it to v2 and display it, with Colibri on a separate node, with shadows on!
If there's no shadows it works, if Colibri is on the same node it works, if mesh is loaded in v2 directly it works (but it doesn't contain vertex animation).
Now for the code :
Code: Select all
bin/Data/Main.compositor | 186 ++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 160 insertions(+), 26 deletions(-)
diff --git a/bin/Data/Main.compositor b/bin/Data/Main.compositor
index 0c3db09..a1cf494 100644
--- a/bin/Data/Main.compositor
+++ b/bin/Data/Main.compositor
@@ -1,39 +1,173 @@
-
-compositor_node RenderingNode
+compositor_node_shadow ShadowMapShadowNode
{
- in 0 renderWindow
+ technique pssm
+
+ texture atlas 4096 4096 PFG_D32_FLOAT
+ texture tmpCubemap 1024 1024 PFG_R32_FLOAT cubemap depth_format PFG_D32_FLOAT
+
+ num_splits 3
+ pssm_lambda 0.95
+ //0000 0000 2048 2048
+ shadow_map 0 atlas uv 0.00 0.00 0.50 0.50 light 0 split 0
+ //0000 2048 2048 2048
+ shadow_map 1 atlas uv 0.00 0.50 0.50 0.50 light 0 split 1
+ //2048 0000 2048 2048
+ shadow_map 2 atlas uv 0.50 0.00 0.50 0.50 light 0 split 2
+
+ technique focused
+ //2048 2048 2048 1024
+ shadow_map 3 atlas uv 0.50 0.50 0.50 0.25 light 1
+ //2048 3072 2048 1024
+ shadow_map 4 atlas uv 0.50 0.75 0.50 0.25 light 2
- target renderWindow
- {
- pass render_scene
+ target atlas
{
- load
- {
- all clear
- clear_colour 0.2 0.4 0.6 1
- }
- store
- {
- colour store_or_resolve
- depth dont_care
- stencil dont_care
- }
- overlays on
+ pass clear
+ {
+ colour_value 1 1 1 1
+ }
}
- pass custom colibri_gui
+ shadow_map_target_type directional
{
- // True is the default value since 99% of the time
- // we want to append ourselves to the previous pass.
- skip_load_store_semantics true
+ shadow_map 0 1 2
+ {
+ pass render_scene
+ {
+ rq_first 0
+ rq_last 110
+ }
+ }
+ }
- profiling_id "Colibri GUI"
- aspect_ratio_mode keep_width
+ shadow_map_target_type directional spot
+ {
+ shadow_map 3 4
+ {
+ pass render_scene
+ {
+ rq_first 0
+ rq_last 11
+ }
+ }
+ }
+
+ shadow_map_target_type point
+ {
+ shadow_map_repeat 3 4
+ {
+ target tmpCubemap +X : cubemap_target_shadow {}
+ target tmpCubemap -X : cubemap_target_shadow {}
+ target tmpCubemap +Y : cubemap_target_shadow {}
+ target tmpCubemap -Y : cubemap_target_shadow {}
+ target tmpCubemap +Z : cubemap_target_shadow {}
+ target tmpCubemap -Z : cubemap_target_shadow {}
+
+ shadow_map
+ {
+ pass render_quad
+ {
+ material Ogre/DPSM/CubeToDpsm
+ input 0 tmpCubemap
+ }
+ }
+ }
}
- }
+}
+
+compositor_node SceneRenderingNode
+{
+ // rt0 is used to render the scene, rt1 is created now and will be used in next nodes (Lensflare, Distortion, VolumetricClouds, ...) like in Postprocessing.compositor from Ogre samples
+
+ texture rt0 target_width target_height PFG_RGBA8_UNORM_SRGB
+ texture rt1 target_width target_height PFG_RGBA8_UNORM_SRGB
+ texture depth_buffer target_width target_height PFG_D32_FLOAT
+
+ // @todo See Tutorial_ReconstructPosFromDepth from Ogre for a possible optimization, by copying the depth buffer instead of reading from it
+ rtv rt0
+ {
+ depth depth_buffer
+ }
+
+ target rt0
+ {
+ pass render_scene
+ {
+ load
+ {
+ all clear
+ clear_colour 0.3 0.3 0.3 1
+ }
+
+ //lod_update_list off //Turn Lod off?
+ shadows ShadowMapShadowNode
+ visibility_mask 0x1
+ overlays off
+ rq_first 0
+ rq_last 11
+ }
+
+ pass render_scene
+ {
+ lod_update_list off
+
+ //Render Overlays
+ overlays off
+ rq_first 252
+ rq_last 254
+ }
+ }
+
+ out 0 rt0
+ out 1 rt1
+ out 2 depth_buffer
+}
+
+//Performs the final pass: Takes the temporary textures (created in SceneRenderingNode)
+//and copies it to the actual RenderWindow
+compositor_node FinalComposition
+{
+ in 0 rt_output
+ // Take input texture #1 and use the local name "rtN" for reference in this scope
+ in 1 rtN
+
+ target rt_output
+ {
+ pass render_quad
+ {
+ load { all dont_care }
+ //Ignore the alpha channel
+ material Ogre/Copy/4xFP32
+ input 0 rtN
+ }
+
+ pass render_scene
+ {
+ skip_load_store_semantics false
+ lod_update_list off
+
+ //Render Overlays
+ overlays on
+ rq_first 254
+ rq_last 255
+ }
+
+ pass custom colibri_gui
+ {
+ skip_load_store_semantics true
+ // Colibri doesn't have load/store semantics.
+ // It appends itself to the previous pass'
+
+ profiling_id "Colibri GUI"
+ }
+ }
}
workspace ColibriGuiWorkspace
{
- connect_output RenderingNode 0
+ //Connect last node's output #0 to FinalComposition's input #1
+ connect SceneRenderingNode 0 FinalComposition 1
+
+ //Connect RenderWindow to FinalComposition's input channel #0
+ connect_output FinalComposition 0
}
Code: Select all
Examples/MainDemo/ColibriGuiGameState.cpp | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/Examples/MainDemo/ColibriGuiGameState.cpp b/Examples/MainDemo/ColibriGuiGameState.cpp
index ef37b3f..e89b0da 100644
--- a/Examples/MainDemo/ColibriGuiGameState.cpp
+++ b/Examples/MainDemo/ColibriGuiGameState.cpp
@@ -118,6 +118,34 @@ void ColibriGuiGameState::createScene01( void )
Ogre::Window *window = mGraphicsSystem->getRenderWindow();
Colibri::ColibriManager *colibriManager = getColibriManager();
+ Ogre::SceneManager *sceneManager = mGraphicsSystem->getSceneManager();
+
+ Ogre::Light *light = sceneManager->createLight();
+ light->setType(Ogre::Light::LT_DIRECTIONAL);
+ light->setDiffuseColour(1.0f, 1.0f, 1.0f);
+ light->setSpecularColour(1.0f, 1.0f, 1.0f);// color of 'reflected' light
+ light->setPowerScale(2.0f);
+ light->setAttenuation( 149.6f*40.0f, 1.0f, 0.0f, 0.0f);
+ light->setCastShadows(true);
+ sceneManager->getRootSceneNode()->createChildSceneNode()->attachObject(light);
+ light->setDirection(Ogre::Vector3::NEGATIVE_UNIT_X);
+
+ Ogre::MeshPtr v2Mesh = Ogre::MeshManager::getSingleton().getByName("BE2_ReverseThrusterV2");
+ Ogre::v1::MeshPtr v1Mesh;
+ if (!v2Mesh) {
+ Ogre::v1::MeshPtr v1Mesh = Ogre::v1::MeshManager::getSingleton().load("BE2_ReverseThrusterV1.mesh",
+ Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
+ Ogre::v1::HardwareBuffer::HBU_STATIC,
+ Ogre::v1::HardwareBuffer::HBU_STATIC);
+ v2Mesh = Ogre::MeshManager::getSingleton().createByImportingV1("BE2_ReverseThrusterV2",
+ Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
+ v1Mesh.get(), true, true, true, true);
+ }
+
+ Ogre::Item *thrustReverser = sceneManager->createItem(v2Mesh);
+ Ogre::SceneNode *thrustReverser1 = sceneManager->getRootSceneNode()->createChildSceneNode(Ogre::SCENE_DYNAMIC, Ogre::Vector3::ZERO);
+ thrustReverser1->attachObject(thrustReverser);
+
const float aspectRatioColibri =
static_cast<float>( window->getHeight() ) / static_cast<float>( window->getWidth() );
colibriManager->setCanvasSize( Ogre::Vector2( 1920.0f, 1920.0f * aspectRatioColibri ),
And you can download the mesh, it's material file and texture here :
https://we.tl/t-KI6PWw7kFF
Thank you