Variance Shadow Mapping

Posted By: Slin

Variance Shadow Mapping - 01/16/08 22:10

Okay I decided to upload the current version as meantioned in the thread in Showcase 1.
If you have any questions please ask, but I can´t promise, that I can help you.

Read the ReadMe.txt and have a look on how I integrated the shadows. I would love to see someone going on with them and using them in a project. Why not post some screenshots here on how they are looking in your level

You can download the files here:
http://files.filefront.com/VSMSun+Project+V1/;9447947;/fileinfo.html

Have fun!
Nils Daumann


Edit: I forgot to mention that you need at least A7.07 Comm to use them.


Posted By: Excessus

Re: Variance Shadow Mapping - 01/16/08 22:22

Well done! It's really cool to see more and more advanced effects being realized in 3dgs. Great job, and thanks for sharing.
Posted By: RobH

Re: Variance Shadow Mapping - 01/17/08 00:36

Wow, thanks for contribution it. It is very good and looks professional.
Posted By: mpdeveloper_B

Re: Variance Shadow Mapping - 01/17/08 04:20

wow, i was watching your project for a while, and i like it, it's a shame i have a6
Posted By: Puppeteer

Re: Variance Shadow Mapping - 01/17/08 06:11

Is A7.07 already downloadable?
I can't find it..

EDIT: Found the beta ^^
Posted By: ello

Re: Variance Shadow Mapping - 01/17/08 07:36

thank you very much for your efforts and for sharing!
Posted By: ulf

Re: Variance Shadow Mapping - 01/17/08 11:25

nice work! however i still have problems like artefacts on both the models and the terrain. there is almost no viewing angle where it looks okay at some angles it looks very bad.

have a look at the screenshots, maybe they help to eliminate the problem. gfx card is a geforce 7600 GS.

http://www.ackbytes.com/upload/shot_0.jpg
http://www.ackbytes.com/upload/shot_2.jpg
Posted By: Pappenheimer

Re: Variance Shadow Mapping - 01/17/08 14:31

ulf's screenshots show quite exactly what I've got.

It is a pity, considering your effort!
A pioneer's work can't always be a success!
Posted By: Slin

Re: Variance Shadow Mapping - 01/17/08 14:44

Thanks for your comments.
You are free to improve the shadows use a bias for the depthcomparison and choose a higher depthmap depth (instead of 16bit floatingpoint per channel 32 bit fp per channel, 12222 -> 14444) It looks much better than but needs a strong hardware... (the higher shadowmap resolution and pixeldepth caused the first demos to have such really hard displayingproblems on "older" hardware)
Posted By: mpdeveloper_B

Re: Variance Shadow Mapping - 01/17/08 15:49

what exactly is the rendering process, and would it be possible to port to A6
Posted By: Slin

Re: Variance Shadow Mapping - 01/17/08 17:18

There are three views at the suns position facing the camera with different arc values. Each of them renders a depthmap.
There is an other view placed at the same position as camera having always the same parameters. The objects in this view are rendered with a shader which compares their "real" distance to the light for each pixel using always the depthmap with the highest resolution possible for it. If the "real" depth is bigger than the one safed in the depthmap, it is a shadow and is rendered in a dark grey otherwise it is rendered white. This is then combined per postprocessing with the image rendered by the camera and then displayed.
This is basicly how it works. I also blur the shadowmap which has the smallest arc to get softer shadows near to the camera. This is all combined with keeping the square of the depth in the depthmaps which is used for the variance part...

That is basicly how it works.
It could also be done with A6 comm and render to texture.
Posted By: frazzle

Re: Variance Shadow Mapping - 01/17/08 19:55

Thanks for putting this in the UC Nils, I'll see what happens if I cut done the conditionals thus I need to think of a way to handle the different depth maps off course

Cheers

Frazzle
Posted By: not_me

Re: Variance Shadow Mapping - 02/15/08 04:32

now you say its possible with a6 comm and r2t dll? if so how?
Posted By: Slin

Re: Variance Shadow Mapping - 02/15/08 15:27

Quote:

now you say its possible with a6 comm and r2t dll? if so how?



It is, but it is quite a bit of work for which I don´t have the time at the moment. I´ve got some plans for further shadowdevelopement, but at the moment I have to gain some more math skills and a better knowledge of directx.
I am working on it, but it will take quite a bit of time. But then I hope that it´ll work for A6 as well. And also that it will run on more systems, without problems.
At the moment I am trying to get this working...: http://www.cg.tuwien.ac.at/~scherzer/lssm/index.html

I don´t know how the whole thing will turn out, if it ever will


But if you want to convert the code to c-script, you will have to replace the stages feature and the viewmaterials, through materialevents and a viewaligned quad...
Posted By: WretchedSid

Re: Variance Shadow Mapping - 02/18/08 15:21

Hey, das gefällt mir echt gut. Leider hab ich ein kleines Problem. Die Kamera befindet sich in meinem Spiel ca. 6000 Quants von den Objekten entfernt und auf die Entfernung wird kein Schatten mehr gezeigt. Jetzt hab ich die Modelle runterskaliert und die Kamera näher an die Objekte gebracht, aber da treten ein paar unschöne neben Effekte auf ( http://www4.picfront.org/picture/erN6FSvqfJc/img/Shadow.png ). Gibt es eine Möglichkeit eines der Probleme in den Griff zu bekommen? Ich bin absoluter Noob in sachen Shadern, also bitte nicht mit Fachlatein erschlagen.
Posted By: mpdeveloper_B

Re: Variance Shadow Mapping - 02/18/08 18:13

Quote:

Quote:

now you say its possible with a6 comm and r2t dll? if so how?



It is, but it is quite a bit of work for which I don´t have the time at the moment. I´ve got some plans for further shadowdevelopement, but at the moment I have to gain some more math skills and a better knowledge of directx.
I am working on it, but it will take quite a bit of time. But then I hope that it´ll work for A6 as well. And also that it will run on more systems, without problems.
At the moment I am trying to get this working...: http://www.cg.tuwien.ac.at/~scherzer/lssm/index.html

I don´t know how the whole thing will turn out, if it ever will


But if you want to convert the code to c-script, you will have to replace the stages feature and the viewmaterials, through materialevents and a viewaligned quad...




wow, it's nice to know that, i would try to do it, but right now i don't have time for it
Posted By: Pappenheimer

Re: Variance Shadow Mapping - 02/18/08 18:23

Konstruiere das Haus mit einem Dachüberstand!

Slin hat den Shader programmiert, so gut er konnte, und hat damit schon einige Erfahrung. Wenn er gewußt hätte, wie es besser geht, hätte er es bereits entsprechend programmiert.

Jede Modifikation an dem Shader wird zu kompliziert sein, als dass man es als Neuling verstehen kann, würde ich aus meinen Beobachtungen schließen.
Posted By: Slin

Re: Variance Shadow Mapping - 02/18/08 19:01

Quote:

Hey, das gefällt mir echt gut. Leider hab ich ein kleines Problem. Die Kamera befindet sich in meinem Spiel ca. 6000 Quants von den Objekten entfernt und auf die Entfernung wird kein Schatten mehr gezeigt. Jetzt hab ich die Modelle runterskaliert und die Kamera näher an die Objekte gebracht, aber da treten ein paar unschöne neben Effekte auf ( http://www4.picfront.org/picture/erN6FSvqfJc/img/Shadow.png ). Gibt es eine Möglichkeit eines der Probleme in den Griff zu bekommen? Ich bin absoluter Noob in sachen Shadern, also bitte nicht mit Fachlatein erschlagen.




Versuch dein Level mal im Verhältnis zum unskalierten Cbabe-Modell zu bauen. Dann hast du das Größenverhältnis mit welchem ich die Schatten nutze.
Dein "Problem" kenne ich, habe aber bisher nur eine Vermutung worann es liegen könnte und es bisher nur durch vorsichtige Lichtquellenplatzierung und relativ großem Bias weniger sichtbar machen können.
Posted By: Scorpion

Re: Variance Shadow Mapping - 02/20/08 22:38

Es liegt doch dadran, dass jeder Texel der Shadowmap eine gewisse Größe hat. Wenn jetzt eine Fläche ziemlich steil zur Lichtquelle steht, werden natürlich weniger Texel für das speichern der Entfernung benutzt. Sodass der Wert dann an dieser Fläche manchmal gleichgroß, manchmal größer ist als die Entfernung. Die Striche kommen daher, dass immer nur die Kanten der einzelnen Texel ausreichen um es beleuchten...der Rest nicht.

Es sollte wahrscheinlich schon reichen einen gewissen toleranzwert zu setzten, in dem dann noch Schatten herrscht. Habe mich aber noch nicht näher mit diesem Shader beschäftigt und stelle hier nur Vermutungen an.


PS: Als ich versucht habe den Shader in ein eigenes Projekt einzubinden, sind alle Objekte, bis auf die mit Alphachanel unsichtbar geworden :S Naja, wird wohl mein Fehler sein...
Posted By: croman

Re: Variance Shadow Mapping - 02/28/08 16:23

Great work Slin.

Can you please post a really small tutorial on how to implement those shadows in other project. How to, for example, get this stuff working with a single model in very simple level. I and other people would really appreciate it.

Can you do that, please? Thanks in front.
Posted By: Slin

Re: Variance Shadow Mapping - 02/28/08 16:34

Where is your problem on implementing them?
It shouldn´t be too hard but I haven´t looked into those for some time now...
If you have a special problem, just ask but I am not going to write a tutorial about the implementation, because of so many other things I have to do and because I don´t consider these shadows very good. They are much to slow with gamestudio...
Posted By: croman

Re: Variance Shadow Mapping - 02/28/08 16:46

Sorry. I figuered it out. But thanks anyway. They are slow, you're right and they look a bit strange. When my camera is looking at model from sun direction(angle) the shadow looks smooth, but otherwise not. And there are many artefacts on terrain. Some little black cubes...

Do you have a solution for that maybe?
Posted By: Slin

Re: Variance Shadow Mapping - 02/28/08 16:50

read my previous posts in this thread
Posted By: croman

Re: Variance Shadow Mapping - 02/28/08 16:56

yeah, i tried that. they look good when my camera.pan = sun.pan. but when this is not same than my shadows are really pixelized (really low res)

can you explain that or you maybe have a solution for that?
Posted By: ventilator

Re: Variance Shadow Mapping - 02/28/08 20:49

slin's shadows (which are great for learning even if they aren't perfect - thanks for sharing!) use a similar idea but i think with pssm the splitting scheme is more sophisticated which will lead to better results:
http://www.coniserver.net/ubbthreads/showflat.php/Cat/0/Number/819786/an/0/page/0#Post819786
but there is no example for gamestudio yet. i didn't get my try to work yet.
Posted By: 3run

Re: Variance Shadow Mapping - 07/10/09 18:45

Please can any one reupload it?! Link is DEAD X-P
Posted By: Ch40zzC0d3r

Re: Variance Shadow Mapping - 02/28/12 13:14

Oh please reupload this frown
WTH all links are down? Shit on filefront!
Posted By: jane

Re: Variance Shadow Mapping - 02/28/12 15:03

Auf Slin's Files-Seite findest du direktdownloadlinks:

http://blog.slindev.com/files/

unten bei * codes

ShadowCollectionV3.zip

und

SunShadowsV1.7z
Posted By: Ch40zzC0d3r

Re: Variance Shadow Mapping - 02/28/12 16:45

Dankeschön laugh
Posted By: Aku_Aku

Re: Variance Shadow Mapping - 03/09/14 18:20

I started the Main.c and the program run.
But i got only very light picture that formed a wall from bricks,
and nothing more happened.
Is there any action in the application what i can start?
© 2024 lite-C Forums