Hello,
I'm sorry, but my problem with objects which shouldn't receive shadows is still existent. So I tried to modify Irrlicht directly by just adding a second renderpass for solid objects (after the one which draws the shadowvolumes!) and succeded somehow. Of course I had to add a "bool IsShadowReceiver" to the ISceneNode, so I have to say "node->SetShadowReceiver(true)" if I want my object to receive shadows, otherwise it's drawn after the shadow volumes.
As I'm not a real programmer my solution has still problems: the shadows now have some strange flickering (a screenshot here wouldn't suffice, one can see it only in motion). Perhaps somebody who works at the engine knows why.
Regards,
shogun
Objects not receiving stencilshadows
You're right ...
Here's my modificated CSceneManager.cpp:
That's it. "SolidShadowReceiverNodeList" and "SolidNonReceiverNodeList" are just two core::array<DefaultNodeEntry> Arrays, the old "SolidNodeList" is deleted. "IsShadowReceiver" in includes\ISceneNode.h works like IsVisible, so it's not needed to post it.
Here's my modificated CSceneManager.cpp:
Code: Select all
// ...
u32 CSceneManager::registerNodeForRendering(ISceneNode* node, E_SCENE_NODE_RENDER_PASS time)
{
// ...
switch(time)
{
// ...
case ESNRP_SOLID:
if (!isCulled(node))
{
if (node->isShadowReceiver())
SolidShadowReceiverNodeList.push_back( node );
else
SolidNonReceiverNodeList.push_back( node );
taken = 1;
}
break;
// ...
case ESNRP_AUTOMATIC:
if (!isCulled(node))
{
// ...
// not transparent, register as solid
if ( 0 == taken )
{
if (node->isShadowReceiver())
SolidShadowReceiverNodeList.push_back( node );
else
SolidNonReceiverNodeList.push_back( node );
taken = 1;
}
}
break;
// ... etc. ...
void CSceneManager::drawAll()
{
// ...
// render default objects, receiving shadows
{
CurrentRendertime = ESNRP_SOLID;
SolidShadowReceiverNodeList.sort(); // sort by textures
for (i=0; i<SolidShadowReceiverNodeList.size(); ++i)
SolidShadowReceiverNodeList[i].node->render();
Parameters.setAttribute ( "drawn", (s32) SolidShadowReceiverNodeList.size () );
SolidShadowReceiverNodeList.set_used(0);
}
// render shadows
{
CurrentRendertime = ESNRP_SHADOW;
for (i=0; i<ShadowNodeList.size(); ++i)
ShadowNodeList[i]->render();
if (!ShadowNodeList.empty())
Driver->drawStencilShadow(true,ShadowColor, ShadowColor,
ShadowColor, ShadowColor);
ShadowNodeList.set_used(0);
}
// render default objects, not receiving shadows
{
CurrentRendertime = ESNRP_SOLID;
SolidNonReceiverNodeList.sort(); // sort by textures
for (i=0; i<SolidNonReceiverNodeList.size(); ++i)
SolidNonReceiverNodeList[i].node->render();
Parameters.setAttribute ( "drawn", (s32) SolidNonReceiverNodeList.size () );
SolidNonReceiverNodeList.set_used(0);
}
// ... etc. ...