Shadows and Pool game

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.
Post Reply
$L!M
Posts: 28
Joined: Thu May 04, 2006 1:21 pm
Location: Ukraine :)

Shadows and Pool game

Post by $L!M »

I'd like to make ball shadows on table... But if I'm using addShadowVolume... performance is very low :(.

Need advice how to make them in any other way...
Do you have any suggestions :?:
Blizzard
Posts: 71
Joined: Thu Apr 20, 2006 5:27 pm
Location: Italy

Post by Blizzard »

8) Hi

the solution that I have is not basically easy. I think you must use the direct3D

A pool table is a plase, so if you must project a shadow only on this plane you no need shadow volume but planar shadows (more light than shadow volume).

So you must build a Shadow matrix simply giveing the light direction and the ground plane with the method

D3DXMatrixShadow(D3DXMATRIX* shadowmat, D3DXVECTOR4* lightdirection, D3DXPLANE plane);

When you build the world matrix of the ball, multiply the world matrix for the shadow matrix and you have the new world matrix with the date to render the object as a shadow

To make the object black and blended with the table you must use the stenciling so each pixel of the shadow is rendered only a time!!

PROBLEM:
with planar shadows you can't render the shadow on the edge of the table because the shadow is not deformable
Everyone for the game and the game for everyone
$L!M
Posts: 28
Joined: Thu May 04, 2006 1:21 pm
Location: Ukraine :)

Post by $L!M »

Thank you
But i dont know how can i use native directx with irrlicht, so i can't make planar shadows :(.

What do you think about making quad plane with alpha channel material (circle) under the ball and placing it just a little above the table.
Then I'll move this object with ball.
If the ball under the light source i don't need to do any transformation with that shadow quad. If the ball just moving in X direction for example I just need to scale my quad X size and move it a bit in X direction.

In case when ball offset happens along 2 axis (X,Z) I need to scale my quad setscale(1.2,1,1) and then rotate it...

But it seems to me that this is not the most simple way...
I hope you'll help me guys :roll: !!!
Blizzard
Posts: 71
Joined: Thu Apr 20, 2006 5:27 pm
Location: Italy

Post by Blizzard »

8) Hi

yeah! I think you can do it.
In most of old games shadows are a transparent circle under the character. Your game contains spheres and this feature is good to make shadow as an alpha blended circle

Listen, If anyone don't say to you a better system to implement shadows, implement the system that you describe.
I'm too busy this week and if the next week I'm free, I try to implement a class to make automatically planar shadows and I release it on this forum so you can use it in your game but I don't promise nothing.

If you want to know how to use direct3D integrated with irrlicht you can see a code that I've released that implements the portals like prey... you can find it in the project announcement section

good luck for your game !
Everyone for the game and the game for everyone
$L!M
Posts: 28
Joined: Thu May 04, 2006 1:21 pm
Location: Ukraine :)

Post by $L!M »

Thanks for everything!!! :)
I hope you'll find the time to help me :roll: .
Post Reply