Hi,
I noticed (maybe a bug?) strange behaviour:
[ul]Steps to reproduce
[]I used main branch version 1.4.441[/]
[]Configure with 64bit, DX11 and Samples with “Visual Studio 12 2013” (happens also for 32bit)[/]
[]In sample 09_MultipleViewports, there is demonstration how to add and toggle shader effects for main viewport. If you try to apply the same renderpath to the secondary view (rearview mirror like) the secondary view goes black when an effect is enabled. Effect is correctly switched on for the main view[/][/ul]
This works correctly for DX9. I tried adding a new RenderPath object for secondary viewport, still the same behaviour. With DX9, I could use single RenderPath object for 4 viewports, toggle efects on it and I affected all viewports without problems.
Am I missing something with DX11 or is this a bug?
Bloom ON:
Bloom OFF:
Changes in code (MultipleViewports.cpp):
[code]void MultipleViewports::SetupViewports()
{
Graphics* graphics = GetSubsystem();
Renderer* renderer = GetSubsystem();
renderer->SetNumViewports(2);
// Set up the front camera viewport
SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraNode_->GetComponent<Camera>()));
renderer->SetViewport(0, viewport);
// Clone the default render path so that we do not interfere with the other viewport, then add
// bloom and FXAA post process effects to the front viewport. Render path commands can be tagged
// for example with the effect name to allow easy toggling on and off. We start with the effects
// disabled.
ResourceCache* cache = GetSubsystem<ResourceCache>();
SharedPtr<RenderPath> effectRenderPath = viewport->GetRenderPath()->Clone();
effectRenderPath->Append(cache->GetResource<XMLFile>("PostProcess/Bloom.xml"));
effectRenderPath->Append(cache->GetResource<XMLFile>("PostProcess/FXAA2.xml"));
// Make the bloom mixing parameter more pronounced
effectRenderPath->SetShaderParameter("BloomMix", Vector2(0.9f, 0.6f));
effectRenderPath->SetEnabled("Bloom", false);
effectRenderPath->SetEnabled("FXAA2", false);
viewport->SetRenderPath(effectRenderPath);
// Set up the rear camera viewport on top of the front view ("rear view mirror")
// The viewport index must be greater in that case, otherwise the view would be left behind
SharedPtr<Viewport> rearViewport(new Viewport(context_, scene_, rearCameraNode_->GetComponent<Camera>(),
IntRect(graphics->GetWidth() * 2 / 3, 32, graphics->GetWidth() - 32, graphics->GetHeight() / 3)));
renderer->SetViewport(1, rearViewport);
rearViewport->SetRenderPath(effectRenderPath); ////// ONLY ADD THIS LINE ///////
}[/code]