Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Shadows and animated models

Author
Message
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 26th Sep 2009 08:04
Hi,
I don't know how to get shadows from animated models.
I suspect that I can acomplish this task with the use of shaders (stencilshadowbone.fx) but I don't know how
Thanks
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 29th Sep 2009 09:36
I tried to get shadows but I had success only with static objects:



Do I have to do additional setup?
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 29th Sep 2009 13:22
Haven't tried animated objects myself, but I think that 'stencilshadowbone.fx' must be in the project folder.

Also I think that the other way of dbSetShadowShadingOn must be used, that would be something like:



So it uses the .fx file.
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 29th Sep 2009 14:05
Thank you Morcilla for your reply

Quote: "...I think that 'stencilshadowbone.fx' must be in the project folder."

I tried with no success.

Quote: "
dbSetShadowShadingOn ( nCaster, -1, 1000.0f, 1 );
"

I am getting a linker error:
error C2660: 'dbSetShadowShadingOn' : function does not take 4 arguments
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 29th Sep 2009 20:12
Make sure you have latest DGDK installed...
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 29th Sep 2009 20:24 Edited at: 29th Sep 2009 20:25
I did upgrade from this link:

http://forum.thegamecreators.com/?m=forum_view&t=155716&b=22

and from the post of Mike Johnson on 12th Aug 2009 22:41

As far as I know there is no newer upgrade
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 29th Sep 2009 21:53
put this at the top of your code (before the void "DarkGDK ( void )"):


Games are like life, they should never stand still.
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 30th Sep 2009 07:48 Edited at: 30th Sep 2009 07:48
I am not getting linker errors but I am not getting shadows also!
Here is my code:
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 30th Sep 2009 18:01
You dont need to load the "stencilshadowbone.fx" effect, DarkGDK does that automatically when you call dbSetShadowShadingOn. It also takes care of generating the shadow meshes and edgemaps and projecting the shadowmeshes for rendering.

You need to make sure that the stencilshadowbone.fx is in your project's root folder, and in the same folder as your EXE when you run outside of Visual Studio, and you also need to have stencilshadow.fx in the same folder, i believe you need to have them both for shadows to work correctly on hardware.

If you have called the command and you dont see shadows, it means there is a problem with the shader, or that it hasnt been found/loaded.

A last thing to keep in mind with GDK shadows is that they are ONLY cast by LIGHT 0 ( ZERO ), you can have multiple shadows by setting up render targets and rendering multiple passes repositioning light 0 each pass to emulate multiple casting lights. Also, GDK stencil shadows are pretty slow, even when they are calculated on hardware, its calculating the actual shadowmeshes on the CPU, just the rendering is being done with a shader

If it ain't broke.... DONT FIX IT !!!
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 30th Sep 2009 22:53 Edited at: 30th Sep 2009 22:54
Quote: "...and you also need to have stencilshadow.fx in the same folder..."

I missed this point, in my last Code Snippet. Now it works.
Thank you very much for all these detailed information.
I am wondering about other engines how they do the calculations of stencil shadows?
Using the Dark GDK, should I set a limit for the number of casters? If yes, what is the limit for a 3 years old PC?
I intend to build a game with a few animated models per level.
I want to have up to 500 tris per model but I believe that the secret of a nice looking game, are the shadows and the many 2D effects
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 1st Oct 2009 06:51
GDK only have 1 shadow casting light. The only way to have more than 1 is, like I said in my above post, to setup a batch of render passes to render the scene to a render target, repositioning the single shadow casting light each time, and then blending it together at the end for the effect of multiple shadow casting lights. Doing that though is very cpu intensive and will slow your program down considerably, making the use of other effects or shaders very difficult.

You could look at other shadow casting methods aswell, depending on what your scene is meant to look like etc, you may want to have a look at shadow mapping techniques, using shaders.

If it ain't broke.... DONT FIX IT !!!
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 1st Oct 2009 12:14
All the GDK resources that I found for shaders in shadow mapping, are limited to shadowing in a small area and not in the whole scene.I am not interested for many lights. I want only shades in an outdoor scene from a global ambient light. I believe that things are getting easier for indoor places.
Because I am totally inexperienced in shaders I am wondering if I can find a shader for making shadows in the whole scene and having another one shader for making the scene brighter. Do these shaders the rendering faster?

Login to post a reply

Server time is: 2024-10-01 14:33:56
Your offset time is: 2024-10-01 14:33:56