I think many people have the same questions regarding the new compositor system, so here is a topic to ask about it.
First, I'm having troubles with some details in the fresnel nodes:
Code: Select all
compositor_node FresnelLastPass
{
//Make the reflection & refraction textures available so they can be used by materials
in 0 reflection
in 1 refraction
in 2 rt_renderwindow
target rt_renderwindow
{
pass clear { colour_value 0 1 1 1 }
pass render_scene { lod_update_list off }
}
}
From what I understand, the "connect FresnelRef FresnelLastPass" line connects the 0 and 1 outputs of the "FresnelRef" node to the 0 and 1 inputs of the "FresnelLastPass", I'm ok with that, but why is there a render scene?
Does this actually render the scene or is this just a "trick" to have the reflection and refraction textures ready before the scene is rendered ? Does this overwrite the previously declared render_scene node of the "SampleBrowserWorkspace"?
Let's say I would want to make it the old way: using compositor workspaces as I used render to textures before, I think I would have made 2 workspaces, one for the reflection and one for the refraction, doing something like this:
Code: Select all
compositor_node reflectionNode
{
in 0 reflection
target reflection
{
pass clear { colour_value 0 1 1 1 }
pass render_scene
{
//Filter underwater objects (optimization) and other stuff that shouldn't be reflected (vampires?)
visibility_mask 0x00000004
identifier 59645
overlays off
rq_last 94
lod_update_list on
//lod_bias 2.0
}
}
}
workspace FresnelSampleWorkspace
{
connect_output reflectionNode 0
}
Code: Select all
reflectionTexture = TextureManager::getSingleton().createManual(getUniqueID("reflectionTexture "), "ResourceGroup",
TEX_TYPE_2D, 512,512, 0, PF_A8R8G8B8, TU_RENDERTARGET);
renderTarget = reflectionTexture ->getBuffer()->getRenderTarget();
//Set up compositor, with the quick and dirty way
Ogre::CompositorManager2 *compositorManager = Ogre::Root::getSingleton().getCompositorManager2();
const Ogre::IdString workspaceName( "ReflectionRenderingWorkspace" );
compositorManager->createBasicWorkspaceDef(workspaceName,Ogre::ColourValue::BLACK);
Ogre::CompositorWorkspace* workSpace = compositorManager->addWorkspace(sceneManager, renderTarget, camera, workspaceName, true);
Another question with the cubemaping sample:
Code: Select all
CompositorChannel channel;
channel.target = tex->getBuffer(0)->getRenderTarget(); //Any of the render targets will do
channel.textures.push_back( tex );
Why is the channel.textures specified? The various compositor nodes never take an input texture,
Thank you for any answer, I'm very enthusiastic regarding Ogre 2.0 but this whole compositor stuff is totally changing my understanding of Ogre.