Shadow Problem

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
razmott

Post by razmott »

Hi !

I've just a remark; it has not worked since I install the nvidia driver. Before I had the asus one and it works fine with the same code.

I know you will advise me to reinstall them, but I'm on linux now.
razmott

Post by razmott »

Hi !

I have just a remark; it has not worked since I install the nvidia driver. Before I had the asus one and it works fine with the same code.

I know you will advise me to reinstall them, but I am on linux now.
GueZt

Re: Shadow Problem

Post by GueZt »

Sudi wrote:when i load like this the scene looks normal but when i uncomment the shadow line then the whole scene goes dark and the frame rate drops to 1 or even below. does anyone has a clue?
Remember, Stencil shadows in Irrlicht-DX performs two types of rendering
1st "drawStencilShadowVolume" and 2nd "drawstencilShadow".

drawStencilShadowVolume renders all shadow volume base on your mesh this will be put into stencil buffer.

After the shadow volume has been drawn, drawstencilShadow will be executed to render stencil buffer into the screen.

Now since you enable the stencil shadow option on your device
drawStencilShadowVolume will not be drawn if your shadow volume
is empty but the device already set the AutoDeptStencilFormat to
D3DFMT_D24S8 while without stencil it is set to D3DFMT_D16
I think this is causing your scene goes dark.

To test this create single node with shadowVolume if this node
is not visible your scene will get dark but if the node is visible
on screen the whole scene is normal with your node shadowed.

If you dont want to put addshadowvolume on your node, why enabling
the stencil buffer in the first place, doesnt make sense.

Or maybe put a control variable on your stencil buffer option.

e.g.

bool GShadow = true;

device = createDevice(EDT_OPENGL, dimension2d<s32>(config.x, config.y),
32,config.fullscreen, GShadow , false, receiver);


if( GShadow )
{
pnode->addShadowVolumeSceneNode();
}

Something like that or on your mesh loader module.

Im no expert, but this is my understanding of irrlicht stencilBuffer,
take a look at CD39Driver.CPP how this things work.
and most of forumers here knows irrlicht implementation
of stencil shadow are really slow.

GueZt
razmott

Post by razmott »

Hi !

Just a precision : we are using OpenGL (I think you were speaking about D3D).
Not that I've test with the example SpecialFX and I got the same problem.
GueZt

Post by GueZt »

I think OGL & DX in irrlicht has the same principle in rendering
stencil shadows, both of them implements "drawStencilShadowVolume "
and "drawstencilShadow".

Anyhow both of them are really slow.

GueZt
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

interessting now it works....i don't know why i actually didn't change anything.
But i think i will go without the stencilshadow....looks ugly and u can see shadows through walls.......
anyone a better idea for shadows? maybe a shadder?
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
GueZt

Post by GueZt »

I made some minor changes to speed up stencil buffer in irrlicht, but
its not fully complete, yet.

e.g.

TerrainNode->SetReceiveShadow(true);
TerrainNode->SetReleaseShadow(false);

ObjectNode->SetReceiveShadow(false);
ObjectNode->SetReleaseShadow(true);

smgr->SetShadowMaxDelayer(4);


Right now my terrain only receive a shadow and it will only
create a shadow volume every 4th calling from drawAll.

Currently irrlicht stencill buffer draw shadow on every
node reach by the shadow.

With this implementation i think will speed up things
because the shadow only cast on your selected node,
and will create volume shadow from mesh and other
stencil clearing stuff on the 4th loop.
Post Reply