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 / Making Shadows

Author
Message
MRPdeveloper
13
Years of Service
User Offline
Joined: 28th Sep 2010
Location: Australia
Posted: 19th Jul 2011 12:36
Hey i want to create a function for making a shadow for a player not the enviroment.

My idea is to use SC_RayCast to determine where shadow needs to be then Mold a plain in the shape of the shadow creating the plain in Dark GDK.

I seen some examples where people create squares or plains in dark gdk using Memblocks. This is like what i want to do but i just want to create the plain in the shape of the shadow in real time.

Could anyone be able to help or point me in the right direction? thank you in advance
Dodga
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 19th Jul 2011 20:50
The best thing to do is use the built in shadow shader, just make sure you include the .fx file in the project folder. Making planes and shaping them to the shape of the ground is pretty impractical and not as simple as one might think.
MRPdeveloper
13
Years of Service
User Offline
Joined: 28th Sep 2010
Location: Australia
Posted: 20th Jul 2011 05:05
Thank you Dodga are you refering to dbSetGlobalShadow command. Becuase i used that before it does make a shadow but it lags the game completly and is not practicle i think. Is there a way around that which allows me to still use this command.

Becuase i original decided on making a flat plain its not placed on the enviroment just kinda sitting there if u run up a hill i understand half the plain will be not visible but thats fine

i just want the shape the corner like a matrix it sounds complicated but this is my first attempt at creating a decent shadow, Even Dark lights makes shadows but is not practicle for any game what so ever i try to use it and 90% of the time there is too many objects for the program to even make a shadow map let alone work.

I really want to make real time shadows from a spot like for example without using extra camera's etc. My only idea to make this happen is using ray cast and Matrix and shape a object in the shape of the shadow..

Is it possible for me to use DirectX 9 and call the DirectX 9 Function in Dark GDK which will make the shadow. Becuase i have seen multiple Examples on the internet about Shadows in DirectX 9
Dodga
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 20th Jul 2011 22:29
No I'm actually talking about dbSetShadowShading on. You have to make sure that stencilshadow.fx is in the project folder if you don't know where it is then do a search in the darkgdk folder for stencilshadow.fx then you have to set the parameters in the command. If you have a sphere that you want to be shaded use something like this:

dbMakeobjectsphere(1,30);
dbsetshadowshadingon(1, -1, 800,0);

// light 0 is the light that controls the light source for the shadow so position it above the object

Dbpositionlight(0,0,dbobjectpositiony(1),0);

Follow all the directions and this should give you nice shadows with good frame rates
MRPdeveloper
13
Years of Service
User Offline
Joined: 28th Sep 2010
Location: Australia
Posted: 21st Jul 2011 10:51
i did exactly what you asked and it looks amazing its exactly what i want but there is only 1 problem it lags so much i just want to have the shadow on a maximum of 6 people but i load it on 1 or 2 and it makes my Frame rate drop to 4. Is there a way i can use this and keep the Frame rate high?
Dodga
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 22nd Jul 2011 01:12
Okay, you have to enable the command to use the shader, make sure you have the stencilshadows.fx in the project folder and change the last paramater on the command to a 1:

dbSetShadowShadingOn(1, -1, 800,1);

That will speed it up ALOT.
MRPdeveloper
13
Years of Service
User Offline
Joined: 28th Sep 2010
Location: Australia
Posted: 22nd Jul 2011 01:36
I got it to make a shadow with plain or box using
dbSetShadowShadingOn(1, -1,800,1);
but when i try it with a model for example
dbLoadObject("model.x",1);
the shadow does not appear
Dodga
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 22nd Jul 2011 08:14
Can you paste the code you are working on? And make sure stencilshadow.fx is in the project directory.
Wolf4D
14
Years of Service
User Offline
Joined: 5th Oct 2009
Location:
Posted: 22nd Jul 2011 16:23 Edited at: 22nd Jul 2011 16:30
*jumping around and swinging lighting sticks*
Oh, wait, wait!
I was interested in built-in stencil shadows earlier, and I haven't received then good answers. So, if you fix the main problem with a speed, you'll meet another problem.
Your objects will drop ONLY ONE shadow. If you want to make 5 lights, there will be only one shadow (in DarkGDK).
The main issue of DarkGDK's shadows is loss, as I can understand, of one great command:

Quote: "
/It's from man of Dark Basic Pro:/
SET SHADOW LIGHT
This command will create and place a light in the static universe for the sole purpose of directing where the shadows should be cast from.
<...>
"

You will not find that command in DarkGDK headers.
And what shall we do?
Maybe, there is a way to use stencilshadow.fx as a regular shader. We can input some values in it like in any another shader, is not it?

Sorry for my bad English.
Dodga
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 22nd Jul 2011 19:30
For darkgdk the light that cast the shadow is light 0, all you have to do is move that around to change the light source. You cant have multiple shadows, but multiple objects will drop shadows. It looks pretty good if you do it right, the problem with other shadow shaders is that they require specific uv mapping so it makes it impractical to use on anything but a place.
Wolf4D
14
Years of Service
User Offline
Joined: 5th Oct 2009
Location:
Posted: 22nd Jul 2011 20:05 Edited at: 22nd Jul 2011 20:06
It's not fair
DB Pro users can do this with one hand /I mean, they can have multiple shadows very easy/
One day I made very complicated buffering system. This system move light 0 as a source of the shadow. It looked not so bad... but it was so heavy and ugly
There might be another way, I think.

Sorry for my bad English.
Dodga
14
Years of Service
User Offline
Joined: 12th Dec 2009
Location:
Posted: 22nd Jul 2011 23:57
I agree it would be nice if gdk was updated(the new update doesnt work properly which is unfortunate because it solved several graphical glitches, but added more to the pile). I do like GDK though, its so easy to just get going on a project without going through direct x setup, which is a pain.

One shadow is usually enough to make it look good though, especially if you light map the level and position light 0 in the relative position of the main light source close by, it will make the shadows look very realistic.

Login to post a reply

Server time is: 2024-05-23 19:57:02
Your offset time is: 2024-05-23 19:57:02