addshadowvolumescenenode and stencil buffer conflicts.

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!

addshadowvolumescenenode and stencil buffer conflicts.

Postby lvgeng » Fri Jun 09, 2017 7:27 am

In my project I use stencil buffer to mask the entire rendering zone, as follow,

cpp Code: Select all
IAnimatedMeshSceneNode* meshOneModel = sceneManager->addAnimatedMeshSceneNode(mesh);
meshOneModel->setMaterialFlag(EMF_LIGHTING, true);
meshOneModel->setMaterialFlag(EMF_NORMALIZE_NORMALS, true);

cpp Code: Select all
glStencilFunc(GL_NEVER, 0x1, 0x1);
videoDriver->draw2DRectangle( video::SColor(255,255,255,255), core::rect<s32>(0,0,200,200) );

It appears that the shadow is generated using stencil buffer so there is a conflict. The entire zone masked by the stencil buffer is shadowed so the brightness is quite low. Is there any way to make shadows work properly while I am using stencil buffer?

PS: I know that the stencil buffer is at least 8 bits, so is it possible for me to use part of it to mask the rendering zone, while not affecting the stencil shadows?
Posts: 38
Joined: Fri Aug 14, 2015 4:35 pm

Return to Advanced Help

Who is online

Users browsing this forum: Exabot [Bot] and 1 guest