Mietze
Community Member

Posts: 412
Pleeease, don't let it crash!
|
 |
« Reply #20 on: February 15, 2009, 11:47:56 AM » |
|
Hi there, I think I will add some things to the library the next time. I've been into ESM (Exponential Shadow Maps) for a while and the result is quite nice. ESM is similar to VSM (Variance Shadow Maps), but don't suffer from light bleeding (instead, it suffers from shadow bleeding.. lol) and they don't require two channels per depth map. I'm not done 100% with my implementation, but .. see yourself:   The standard ESM is nice, but the shadow colors are far from constant. Shadow bleeding is also a problem. I modified the ESM algorithm a bit, to face this problems. Here is my version:  And filtered!  The filtered version has the problem that the different ARGB channels need to be filtered with a different kernel, since every channel represents a different depth level from the scene cameras view. I gonna focus this later 
|
|
|
|
|
Logged
|
|
|
|
Mietze
Community Member

Posts: 412
Pleeease, don't let it crash!
|
 |
« Reply #21 on: February 16, 2009, 04:33:44 PM » |
|
Here is the the good kernel scaled filterd ESM:  The HLSL code is very unoptimized at the moment, but I will adress this problem soon. By the way: This is only ONE 256px² RGBA-FP32 shadow map!
|
|
|
|
|
Logged
|
|
|
|
Toaster
Community Member

Posts: 332
|
 |
« Reply #22 on: February 16, 2009, 04:46:30 PM » |
|
This looks awesome!  I love how it looks and I cant wait to play around with directional soft shadows.  It looks like you get amazing FPS even with the blur and the shadows dont look bad for only 256 sized map. Good work!! -Toaster
|
|
|
|
|
Logged
|
|
|
|
|
Zaknafein
|
 |
« Reply #23 on: February 16, 2009, 06:27:56 PM » |
|
Fantastic stuff. ESM + PCSS PSSM (edit: oops, wrong acronymn) sounds like the best thing that can be done right now!
|
|
|
|
« Last Edit: February 16, 2009, 11:37:25 PM by Zaknafein »
|
Logged
|
|
|
|
Mietze
Community Member

Posts: 412
Pleeease, don't let it crash!
|
 |
« Reply #24 on: February 17, 2009, 02:36:56 PM » |
|
Hehe ya, those abbrevations are confusing I did some testing of the whole stuff with different kernel sizes of the blur filter compared to different shadow map sizes. The result is .. as expected:  A 1024px² shadow map is a bad choice, if you want some uber blurriness. In addition, you gain the best performance (who'd expect that?) with low-resolution shadow maps, saving a lot of samples per (blur) pass. The 512px2 map is also doing very well at performance's view. Overall, low-resolution shadow maps suffer from filtering artefacts (as my kernel scale can't help there). In other words: The higher the resolution, the lower the artefacts count, but the higher the kernel size, the higher the shadow bleeding. Though we have: Shadow Bleeding ~ Kernel Size Artefact Count ~ Shadow Map Size So it's up to you to find a good balanced middle. But who cares about great performance, when the graphical result sucks? My favourites are: Performance + Blurry = 9x9 kernel + 256px² shadow map Performance + Sharp = 5x5 kernel + 512px² shadow map But see yourself: Klick 4 Big Overall, I think this single page here in the TV3D forum is a very valueable source for everyone who wanna implement his own ESM core. And for the lazy ones: Stay tuned until I release a new sample + source  Btw: Don't care about the FPS in the screenshots. I penetraded my print key for a while  For some reason it doesn't work the first times (??) EDIT: sh**... just realized, that I had 16x Anti Aliasing enabled while testing.. Add ca. 300fps per result to get non-AA performance.. 
|
|
|
|
« Last Edit: February 17, 2009, 03:06:58 PM by Mietze »
|
Logged
|
|
|
|
joshendy
Community Member

Posts: 20
|
 |
« Reply #25 on: February 18, 2009, 12:01:13 AM » |
|
Wow Mietze you dont stop do yah  Great looking shadows! In my opinion I think the 9x9 kernel + 512px² shadow map looks wicked. Will this new technique you're using allow multiple spot/point lights in the scene which cast shadows?
|
|
|
|
|
Logged
|
|
|
|
|
Gamecode
|
 |
« Reply #26 on: February 18, 2009, 07:01:09 AM » |
|
aaagrr i need this in VB6 for my game 
|
|
|
|
|
Logged
|
aiR Captains - RC aircraft project TV65
|
|
|
|
SylvainTV
|
 |
« Reply #27 on: February 18, 2009, 07:13:29 AM » |
|
Good job Eichi ! Can we integrate it to the next tv version ?  ( I wish we could )
|
|
|
|
|
Logged
|
|
|
|
|
Zaknafein
|
 |
« Reply #28 on: February 18, 2009, 11:37:38 AM » |
|
Hey by the way... 33x33 kernel size?? How the hell did you achieve that? The best I could do was 17 samples in my latest Gaussian Blur implementation.
|
|
|
|
|
Logged
|
|
|
|
Mietze
Community Member

Posts: 412
Pleeease, don't let it crash!
|
 |
« Reply #29 on: February 18, 2009, 01:31:54 PM » |
|
Good job Eichi ! Can we integrate it to the next tv version ?  ( I wish we could ) Sure! It' be a real pleasure to me!  Hey by the way... 33x33 kernel size?? How the hell did you achieve that? The best I could do was 17 samples in my latest Gaussian Blur implementation.
Its a pure pixel shader and SM3 makes it possible. Though, the blur shader REALLY sucks, but I'm outta ideas how to optimize it.. yet. I hope you could grab me on IRC, maybe you have an idea about it.
|
|
|
|
|
Logged
|
|
|
|
|
Gamecode
|
 |
« Reply #30 on: February 19, 2009, 01:17:53 AM » |
|
Good job Eichi ! Can we integrate it to the next tv version ?  ( I wish we could ) yes yes sylvain 
|
|
|
|
|
Logged
|
aiR Captains - RC aircraft project TV65
|
|
|
lovetv3d
Community Member

Posts: 140
|
 |
« Reply #31 on: March 04, 2009, 02:08:36 AM » |
|
AddActorToSceneBoundingBox why?
|
|
|
|
|
Logged
|
Sorry for poor English
|
|
|
Mietze
Community Member

Posts: 412
Pleeease, don't let it crash!
|
 |
« Reply #32 on: March 05, 2009, 11:26:14 AM » |
|
AddActorToSceneBoundingBox why?
Heh? Its not in there! 
|
|
|
|
|
Logged
|
|
|
|
|
Shadowsong
|
 |
« Reply #33 on: March 10, 2009, 02:13:53 AM » |
|
The answer is: no. Custom shaders override the internal ones, but normal mapping and parallax stuff is very trivial and widely spread over the internet Smiley Ok just for getting it right, I can't use internal specular lighting when I use any custom shader (like this shadowmapping shader), right?
|
|
|
|
|
Logged
|
|
|
|
|
SylvainTV
|
 |
« Reply #34 on: March 10, 2009, 04:42:51 AM » |
|
Yep unfortunately!
|
|
|
|
|
Logged
|
|
|
|
Toaster
Community Member

Posts: 332
|
 |
« Reply #35 on: March 31, 2009, 12:46:03 PM » |
|
Just yesterday I started adding this to my project. First thing I wanted to do was rewrite some parts since I wanted it to adapt better to my program. I also wanted to add support for Actors as well as landscapes which I easily did. I use the shadows in screenspace so I don't have to worry about outputting the correct color I can just use TV's lighting. Then in a combining Postprocess I simply do FinalColor = Color * Shadows; This allows me to apply a 9 tap Gaussian blur to the shadows as well. I do have a bit of a problem with light bleeding but its not really a concern of mine. Anyways here's what I have so far: http://img17.imageshack.us/img17/825/pssmshadowmapping.jpghttp://img15.imageshack.us/img15/3221/actorshadows.jpgI added the bounding box of the landscapes/actors to your scenes bounding box. I also render the actors with their own custom shader. Now everything looks pretty great but im running into problems with the splits and with the actors self shadows. Its rather hard to describe so I made a video of it. You can watch the video online here: http://tinypic.com/player.php?v=10qkitv&s=5or you can download here: http://www.megaupload.com/?d=3DX93FR1I've tried changing the far plane of the shadows but no matter how big or small I make it I still get the same effect. I also tried tweaking some of the other values but I cant seem to fix it. I was wondering if you had any ideas as to why this might happen? As for the actors self shadows they just simply do not exist they cast but they don't receive. Thanks for any help and thanks for making such a wonderful shader!  -Toaster
|
|
|
|
|
Logged
|
|
|
|
Mietze
Community Member

Posts: 412
Pleeease, don't let it crash!
|
 |
« Reply #36 on: March 31, 2009, 01:22:32 PM » |
|
Try to tweak your depth bias that is causing the self shadowing artefacts. If there are no self shadows on actors, then the bias is way to high. The actor disappearing on the landscape is due to the light cameras distance to the center of the frustum split. Try increasing the PSSM.ExtraDistance property to increase the distance. Thanks for any help and thanks for making such a wonderful shader!  The shader was the easiest part, believe me  PS: Eh.. and btw: adding actors the a scene bounding box doesn't make as that sense, does it?
|
|
|
|
« Last Edit: March 31, 2009, 01:24:56 PM by Mietze »
|
Logged
|
|
|
|
Toaster
Community Member

Posts: 332
|
 |
« Reply #37 on: March 31, 2009, 03:02:31 PM » |
|
Thanks I was able to fix the split issue. I set the extra distance to 200. I was trying to use linear depth to fix some of the aliasing on the landscape but I ended up just using a custom landscape shader so I could set the bias different. Actors wont receive shadows no matter what bias though. I've tried everything from 1f to .0000001f no luck. I don't know maybe you can take a look at the actor shader? http://www.nomorepasting.com/getpaste.php?pasteid=25369I probably missed something or did one little thing wrong.  Thanks for all the help so far!  -Toaster
|
|
|
|
|
Logged
|
|
|
|
Mietze
Community Member

Posts: 412
Pleeease, don't let it crash!
|
 |
« Reply #38 on: March 31, 2009, 03:31:58 PM » |
|
So shader looks good so far. The only thing that could be one error source is that the semantics WORLD and VIEWPROJECTION are used two times. Maybe TV3D will only fill the first one (so the light matrices are broken afterwards). Do the actors receive shadows from other objects? Or are the self shadows the only stuff missing?
|
|
|
|
|
Logged
|
|
|
|
Toaster
Community Member

Posts: 332
|
 |
« Reply #39 on: March 31, 2009, 03:45:40 PM » |
|
hmm okay I got rid of the other WORLD and VIEWPROJECTION just using one now that was bad coding I just did it fast wanted it to work. lol Still no shadows on actors and I put the actor under the landscape and he renders white.
-Toaster
|
|
|
|
|
Logged
|
|
|
|
|