ACDFSM (or the ultimate dynamic shadowmapping solution?)

Posted By: painkiller

ACDFSM (or the ultimate dynamic shadowmapping solution?) - 12/06/11 15:38

Some days ago I was browsing through Acknex Unlimited and I found this 2009 Summer Contest Entry by Martin Coumont (http://www.opserver.de/coni_users/web_users/pirvu/au/demo/zips/acdfsm.zip) and couldn't resist to share it with people here, as I'm sure some of you didn't know about it.

Approximate Cumulative Distribution Function Shadowmapping (ACDFSM) allows bassically dynamic shadowmapping for:

-Sun Light
-Pointlights
-SpotLights
-Up to 9 Lights at the same time.

I've searched for a long time for something like this and finally found it, I tested on A8 building a simple scene using ACDFSM and A8's HDR It and it worked perfectly.

Here are some screenshots:






Link for scene+source: http://www.mediafire.com/?l7kb4kq4kvyyptk



If you want to use it I've prepared it so you just have to copy the folder "ACDFSM" to you project folder and add these lines to your code:

Code:
#define PRAGMA_PATH "ACDFSM";
#include "acdfsm_main.c"



then start them:

Code:
init_shadows(1,1,7);



You can easily add lights using the included my_pointlight and my_spotlights dummy models, as they will get automatically assigned their action and you can set them up in WED in seconds.


Thank you very very much Martin Coumont!!
Posted By: the_clown

Re: ACDFSM (or the ultimate dynamic shadowmapping solution?) - 12/06/11 16:05

Hm, sounds pretty good.... I tried the demo, had to uncomment your HDR activation etc though cause I use A7... apart from that, however, as this resource is from 2009 I suppose it shouold work flawlessly under A7, yet I get an "Invalid Name" error with the combiscene.fx files when opening the test level.
Posted By: painkiller

Re: ACDFSM (or the ultimate dynamic shadowmapping solution?) - 12/06/11 16:13

Originally Posted By: the_clown
Hm, sounds pretty good.... I tried the demo, had to uncomment your HDR activation etc though cause I use A7... apart from that, however, as this resource is from 2009 I suppose it shouold work flawlessly under A7, yet I get an "Invalid Name" error with the combiscene.fx files when opening the test level.


yes, I also get those warnings when I open it in WED, don't worry, that's because the name of those files is too long and WED doesn't read them, but when you run the game it will work fine
Posted By: the_clown

Re: ACDFSM (or the ultimate dynamic shadowmapping solution?) - 12/06/11 16:26

Makes sense. The demo itself works fine. Without having read through the code yet, can any mesh be used for the light models or does it have to be like the example ones?

EDIT: I tried to add a) another pointlight and b) another spotlight by just copying+pasting the existing ones; with two spotlights, I got an fps loss of about 50 percent. Have you tried it with more than two lights yet?
Posted By: painkiller

Re: ACDFSM (or the ultimate dynamic shadowmapping solution?) - 12/06/11 16:33

Originally Posted By: the_clown
Makes sense. The demo itself works fine. Without having read through the code yet, can any mesh be used for the light models or does it have to be like the example ones?

EDIT: I tried to add a) another pointlight and b) another spotlight by just copying+pasting the existing ones; with two spotlights, I got an fps loss of about 50 percent. Have you tried it with more than two lights yet?


you can use any mesh, of course, but it will be invisible unless you write your own function. I added those dummy models because they get assigned automatically their actions and you can see the direction the spot will have.

About adding more lights, note that I set a resolution of 2048 for that spotlight (default value is 256), so if you add lot of lights with that huge resolution the performance will be really poor.
Posted By: the_clown

Re: ACDFSM (or the ultimate dynamic shadowmapping solution?) - 12/06/11 16:41

Ah, I see; Cool, looks like you found a excellent shadowmapping solution. Strange that it wasn't very popular till now.
Posted By: 3run

Re: ACDFSM (or the ultimate dynamic shadowmapping solution?) - 12/06/11 16:51

Thank you mate, I should give it a try laugh Is it fast?
Posted By: HeelX

Re: ACDFSM (or the ultimate dynamic shadowmapping solution?) - 12/06/11 16:57

Hm, it runs very slow here and I would like to know where I can change the settings for it? The code looks like lasagna on meth.

For example, what mean the parameters start, mode and amount? How can I control the resolution of the targets?
Posted By: painkiller

Re: ACDFSM (or the ultimate dynamic shadowmapping solution?) - 12/06/11 17:04

Originally Posted By: HeelX
Hm, it runs very slow here and I would like to know where I can change the settings for it? The code looks like lasagna on meth.

For example, what mean the parameters start, mode and amount? How can I control the resolution of the targets?


You can tweak sun shadows in acdfsm_main.c at lines 59-69.
Every other light sources are managed directly in their actions in WED through their skills, there you can set their color, range, arc and resolution

start means activate them and should be 1, mode I'm not sure but should also be always 1, amount is the max number of lights it will manage at the same time, set it from 1 to 7

Originally Posted By: 3run
Thank you mate, I should give it a try laugh Is it fast?


I you don't use lights with huge resolution It should be fast.
In my pc I get 33 fps with the test level, If I set the spotlight resolution to 256 then I get more than 100 fps
Posted By: Ch40zzC0d3r

Re: ACDFSM (or the ultimate dynamic shadowmapping solution?) - 12/06/11 17:05

Its good but it laggs like hell bro...
Posted By: Pappenheimer

Re: ACDFSM (or the ultimate dynamic shadowmapping solution?) - 12/06/11 17:32

Am I the only one with A8 getting an undefined identifier error for "mtl_hdr"?
Posted By: Ch40zzC0d3r

Re: ACDFSM (or the ultimate dynamic shadowmapping solution?) - 12/06/11 18:13

You need to update to newest version bro wink
Posted By: 3run

Re: ACDFSM (or the ultimate dynamic shadowmapping solution?) - 12/06/11 23:12

My PC is very old, with GeForce 6600 256 mb, it's slow as hell... I get terrible shadows with 1-2 fps... With some strange artifacts, like shadow lines on the ground...

The best and the fastest shadows I've seen are the one from old Shade-C beta version. Shadows from sun, I get stable 60 fps on my old PC.
Posted By: Ch40zzC0d3r

Re: ACDFSM (or the ultimate dynamic shadowmapping solution?) - 12/11/11 17:10

I didnt know that shade-c have shadowmapping shocked
How the hell activate it? I couldnt find a real function in manual...
© 2024 lite-C Forums