Deferred Rendering with hydrax,problems

nickG

10-06-2012 22:51:29

Hi
I try make hydrax surface with diferred renderer,but getting errors(can't create G-Buffer)
Later i'm publish log

technique

25-05-2013 15:10:20

I ran into the same problem using the Deferred Rendering Framework using Ogre 1.8 and Hydrax 5.1. This response might be to late for you - but it could be helpfull for someone else.

Hydrax should not be rendered using the Deferred Pipeline - it should use a Forward Rendering Pipeline. Therefor the GBufferSchemeHandler exists in the Deferred Framework. It inspects the passes of all materials and creates copies for deferred / forward rendering - if needed. What you have to do is to extend the existing inspecting mechanism to detect materials used by the Hydrax system.

Here is a solution which works - but its probably not the best way to do this.

In Hydrax::MaterialManager there are many defines for material names - all containg the substring "Hydrax". So we check for each material if it contains that substring and if so - we mark all passes for no deferred use.


Technique* GBufferSchemeHandler::handleSchemeNotFound(unsigned short schemeIndex,
const String& schemeName, Material* originalMaterial, unsigned short lodIndex,
const Renderable* rend)
{
// ADD THIS
bool isHydraxMaterial = false;
if(originalMaterial->getName().find("Hydrax") != std::string::npos)
isHydraxMaterial = true;
// END
[...]
for (unsigned short i=0; i<originalTechnique->getNumPasses(); i++)
{
Pass* originalPass = originalTechnique->getPass(i);
PassProperties props = inspectPass(originalPass, lodIndex, rend);

// ADD OR TO THE IF
if (!props.isDeferred || isHydraxMaterial)
{
//Just copy the technique so it gets rendered regularly
Pass* clonePass = noGBufferTech->createPass();
*clonePass = *originalPass;
continue;
}

[...]

}
[...]
}


Done!

Another solution would be to change the pass names generated by the Hydrax material generator to "no_deferred" for example - and use this hint in the GBufferSchemeHandler::inspectPass method to decide if a Pass should be rendered using the Forwarding Pipeline.