wow, its been a confusing couple of days with a few bugs that just don't seem to be right in the renderer. Note that all this worked fine back on 1.9
It will be difficult to show code as to what's happening as we have a large code base, but i will describe the best i can.
So i have a 3 main topics in this thread:
1) Strange bugs happening when using multiple workspaces and scene managers.
I have several workspaces each with their own sceneManager. Everything is under 1 Ogre::Root as you would expect but i have tried to seperate all of them completely with their own workspace, scenemanager and renderwindows to work with.
Here is what workspace is used for:
- Main window : This is our main WYSIWYG rendering window , it uses Items and all supporting 2.1 techniques.
- Mesh Editor : This is a second workspace and uses a second sceneManager. This uses a v1 pipeline of entity but uses datablocks
- GUI Editor : This is a third workspace and uses a third sceneManager. This is used to display only LibRocket only and no meshes
- v2 ManualObject : A manual object is used to generate a line bounding box around meshes (one that does not adhere to AABB but OABB) in the main rendering window.
When a second editor is opened e.g. mesh or gui with new workspace, then the manualobject ceases to be rendered again in the main renderer but does not crash.
However, if you have a manualobject inside each workspaces scenemanager, then it renders fine in all of them...
- In the Mesh editor; if opened as the second workspace has a strange batching sort of issue. If i add 2 seperate v1 entities with their own nodes. If the second entity has an old v1 skeleton, then it attaches the previous created entity onto the character which then follows a bone and resets the material to that of the mesh. It looks as if it becomes a submesh. Strange... I can provide meshes where necessary.
- In the GUI editor if opened as the second workspace, it has an issue with the librocket port where activating the main workspace will sometimes clear the librocket screen on the gui workspace. Just wondering if this is to do with the renderSystem->functions()
I will be making a simpler demo tomorrow that hopefully will show the same bugs and will record a video if possible, but i just had to ask and wondered if anyone had any clues to fixing this especially since this is
possibly an untested case of 2.1 where multiple workspaces with seperate sceneManagers are used.
2) Creating a workspace, adding entity, set material and write rendertarget to file. Clear up workspace after.
How can i update a workspace in the same frame to show the scene on an rendertarget when writing it to file.
I currently have to call renderOneFrame to get the rendertarget to show it correctly before writing otherwise it comes out as a black image; but if rendered the frame after it shows the model correctly.
Here is my compositor node for passing the render texture:
Code: Select all
Ogre::CompositorNodeDef * ThumbnailGenerator::getCompositorNode(std::string nodeDefName, Ogre::uint32 visFlag, Ogre::uint8 firstRQ, Ogre::uint8 lastRQ )
{
Ogre::CompositorManager2 *compositorManager = Ogre::Root::getSingleton().getCompositorManager2();
Ogre::CompositorNodeDef *nodeDef = NULL;
// First create a compositor node that will render the RTT as we need
if (!compositorManager->hasNodeDefinition(nodeDefName))
{
Ogre::CompositorNodeDef *nodeDef = compositorManager->addNodeDefinition(nodeDefName);
//Input channels
nodeDef->addTextureSourceName("texture", 0, Ogre::TextureDefinitionBase::TEXTURE_INPUT);
nodeDef->setNumTargetPass(1);
{
Ogre::CompositorTargetDef *targetDef = nodeDef->addTargetPass("texture");
targetDef->setNumPasses(2);
{// Create the clear pass
Ogre::CompositorPassClearDef *passClear = static_cast<Ogre::CompositorPassClearDef*>(targetDef->addPass(Ogre::PASS_CLEAR));
passClear->mColourValue = Ogre::ColourValue(0.0, 0.0, 0.0, 1.0); // Set the target background colour
}
{// Now add the render scene pass and disable all overlays from being rendered.
Ogre::CompositorPassSceneDef *passScene = static_cast<Ogre::CompositorPassSceneDef*>(targetDef->addPass(Ogre::PASS_SCENE));
passScene->mIncludeOverlays = false;
}
}
//Output channels
nodeDef->setNumOutputChannels(0);
}else{
nodeDef = (Ogre::CompositorNodeDef*)compositorManager->getNodeDefinition(nodeDefName);
}
return nodeDef;
}Code: Select all
Ogre::String ThumbnailGenerator::GenerateMeshThumbnail(Ogre::String meshName, Ogre::String filePath, Ogre::String fileName, int iconSize)
{
// Create render target texture
// Create new scenemanger, camera, entity and lights
// ======================================================================================================================
// Render To Image and save to file
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(filePath, "FileSystem", "EditorThumbnails");
Ogre::CompositorNodeDef *comNodeDef = getCompositorNode("Thumnail_Mesh_RenderNode");
Ogre::CompositorWorkspace* comWorkspace = createThumnailWorkspace("Thumnail_Mesh_Workspace", "Thumnail_Mesh_RenderNode", thumb_SceneMgr, renderCamera, renderTexture);
// Render the frame to fill the rendertarget. --- |||| Need better method for this
Ogre::Root::getSingletonPtr()->renderOneFrame();
// Write the contents of the render target to file.
renderTarget->writeContentsToFile(filePath + "/" + fileName);
// Clean up - Remove workspace, entities, lights, camera, scenemanager etc...
}3) Changing a reflection texture of pbs HLMS is changing the SkyPostProcess...
When changing a reflection texture on some pbs materials, the SkyPostProcess material also gets written to somehow..
Also SkyPostProcess does not work in DirectX11 HLSL. Shows as black background.
Anyway, Thanks again for your time
Edit: Added 1 extra thing at the bottom

