Shadows coordinates / mesh - question

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
Barts_706
Posts: 26
Joined: Tue Nov 01, 2005 1:20 am

Shadows coordinates / mesh - question

Post by Barts_706 »

Hi, long time no write.

I thought about using Irrlicht for this particular game design challenge:
http://lostgarden.com/2008/06/shade-gam ... lenge.html

As you can see, it is all about shadows. So, while I might try to implement separate calculations of the shadow zone in game, I would like to ask a question here:

- is it in any way possible to access shadow coordinates (in case of flat, planar shadow texture) or vertices (in case of volume shadow) via Irrlicht API?

In other words, would it be possible to write this game relying on Irrlicht to tell me where the shadow zones are?

I tried going through API, but I don't really see it. Perhaps someone could redirect me to appropriate example / tutorial / forum thread? I do not require to have this done for me, rather a pointer on what to search and perhaps information on whether this can be done easily or not really?

Thanks in advance.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Well when using irrlicht's standard shadow volume scene node you could look into the source code for that, there's probably a mesh buffer in the class which contains all the relevant information, though that's not exposed to the user, unless you edit the engine and recompile so that it is.

Note that the mesh has to be an animated mesh in order to cast a shadow (though you can probably force a non-animated mesh to be represented by an IAnimatedMeshSceneNode somehow).

You may want to look into the shadow mapping shaders in the projects forum... though i don't think they'd give you any useful information about the areas of shade they'd certainly give you better performance.

You could probably use matrix calculations to figure out areas of shadow though maybe...

Presumably the light source will be dynamic, moving about during the level? If not then you don't even need to know anything about the light or shadows themselves as you could just store the information on the shadow size and position in some way and read from that and just render the shadows nicely with a shader.
Image Image Image
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

I think this has nothing to do with shadows. Just shoot a collision ray against all building geometry towards the sun (Or maybe a few rays, like ten, going to a slightly offset position for a smoother area light effect.).

Oh right, please look at the Collision tutorial, number 4 last time I checked. This will show you how to shoot a ray and obtain a boolean results. Shadows are all about boolean results after all! Well preferably they shouldn't be but when it boils down to it even soft shadows are just a whole bunch of boolean results averaged together. Wait... didn't I start off saying this has nothing to do with shadows :?
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Yeah that sounds like a good approach, not too hard to implement, even for a beginner, and also will take care of a dynamic sun position and even dynamic objects.
Image Image Image
Barts_706
Posts: 26
Joined: Tue Nov 01, 2005 1:20 am

Post by Barts_706 »

Thank you kindly, gentlemen! I will try that.
Post Reply