Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1] 2 3 4
  Print  
Author Topic: Cubic Shadow Mapping Sample SM 2.0  (Read 15422 times)
Toaster
Community Member
*
Posts: 378


WWW
« on: September 01, 2008, 02:44:37 PM »

I started this a little over a month ago off and on. I am now releasing it to the public. You can do whatever you want with it. Wink Although if you give me credit it would be nice.

This Sample includes Simple Cubic Shadow Mapping with normal/parallax/specular mapping with some simple physics. There is no PCF because I dont think PCF looks good unless you blur it. I also plan on adding multi lights sometime plus some VSM. I dont think I will release a multi light or VSM sample though.

Click to enlarge..

Click to enlarge..


EXE:
http://willhostforfood.com/users/toasterthegamer/Shadow%20Mapping%20Sample%20EXE.rar
SRC&EXE:
http://willhostforfood.com/users/toasterthegamer/Shadow%20Mapping%20Sample%20SRC.rar

Here's some of the vars and what there defaults are:
float lightrange = 500; //Light Range in Object Space
float pStrength = 0.01f; //Parallax strength.
float SpecMP = 0.3f; //Specular Multipler

You can edit them from your program or you can just edit the shader.

Edit from your program:
Code:
ShaderName.SetEffectParamFloat("lightrange or pStrength or SpecMP goes here", FloatVar)

I also use the Semantics for things like light position and light color as well as texture stuff. Smiley You will only have to pass a little data to the shaders. Really you should only need to send the depth map render surface to the shader.

I would like to give credit to arius for his depth shader and cubes! As well as credit to the author(Ehsan Miandji) of this article:

http://www.gamedev.net/reference/articles/article2457.asp

Thanks,
-Toaster
« Last Edit: September 01, 2008, 03:06:09 PM by Toaster » Logged

Visit my site at: Unknown Abstraction
Shargot
Customers
Community Member
*****
Posts: 166


WWW
« Reply #1 on: September 01, 2008, 03:05:07 PM »

links are not work (((
Logged

" width="130" height="45" border="0
aksoysoft
Community Member
*
Posts: 46


WWW
« Reply #2 on: September 01, 2008, 03:06:38 PM »

realy looks good but
links does not works
Logged

Toaster
Community Member
*
Posts: 378


WWW
« Reply #3 on: September 01, 2008, 03:06:48 PM »

Ah sorry had to reupload they should work now. Smiley
Logged

Visit my site at: Unknown Abstraction
Shargot
Customers
Community Member
*****
Posts: 166


WWW
« Reply #4 on: September 01, 2008, 03:11:43 PM »

yea sanx
Logged

" width="130" height="45" border="0
Shargot
Customers
Community Member
*****
Posts: 166


WWW
« Reply #5 on: September 01, 2008, 05:11:39 PM »

Very very very very cool ))) but How to make that shadows were more transparent? I tried to change an alpha in shader but it has not given effect
Logged

" width="130" height="45" border="0
Toaster
Community Member
*
Posts: 378


WWW
« Reply #6 on: September 01, 2008, 05:31:43 PM »

For more transparent shadows you will have to do something like..


Code:
float4 color = D0 * (color + ((Spec * Specular) * SpecMP));
OUT.color = sFactor * Color; //Then if you Change the sFactor alpha it should change(in theory)...

I think.. I am adding this now to the shader actually. I will release it once its done. Smiley

-Toaster
« Last Edit: September 01, 2008, 05:43:01 PM by Toaster » Logged

Visit my site at: Unknown Abstraction
Shargot
Customers
Community Member
*****
Posts: 166


WWW
« Reply #7 on: September 01, 2008, 05:47:27 PM »

in teroy maybe.. but not in practice ((

Logged

" width="130" height="45" border="0
Shargot
Customers
Community Member
*****
Posts: 166


WWW
« Reply #8 on: September 01, 2008, 05:49:27 PM »

I will release it once its done. Smiley

-Toaster
I look forward
Logged

" width="130" height="45" border="0
Omnicrash
Community Member
*
Posts: 66


WWW
« Reply #9 on: September 02, 2008, 02:23:00 AM »

If you change sfactor alpha value, you will get actual transparent objects at the points where there is shadow Smiley.

Best way for 'transparent' shadows i would guess is to just add an Ambient color to the end result, or perhaps just make sfactor = ambient color.
Logged

aksoysoft
Community Member
*
Posts: 46


WWW
« Reply #10 on: September 02, 2008, 03:34:15 AM »

thanks Toaster very good project.
Cubic Shadow Map and Stencil Shadow performance difference.

89 FPS Stencil Shadow
292 FPS Cubic Shadow Map

« Last Edit: September 02, 2008, 11:16:52 AM by aksoysoft » Logged

Toaster
Community Member
*
Posts: 378


WWW
« Reply #11 on: September 02, 2008, 10:54:11 AM »

There seems to be a slight bug in my shadow mapping shader somewhere. Tongue

http://willhostforfood.com/users/toasterthegamer/ShadowBug2.jpg

I have been trying to fix this all night with no luck. This problem only seems to happen with this model but Arius's shadow mapping works fine on it. I think there's something wrong with the way I am grabbing the depth or something.  Hopefully I can fix this bug soon. Smiley

Here's some screenshots with shadow alpha.

Click here to enlarge.


Click here to enlarge.


aksoysoft: Is that picture stencil shadows vs shadow mapping?

-Toaster
« Last Edit: September 02, 2008, 10:58:17 AM by Toaster » Logged

Visit my site at: Unknown Abstraction
aksoysoft
Community Member
*
Posts: 46


WWW
« Reply #12 on: September 02, 2008, 11:23:21 AM »

yes its, sorry my english is bad
Logged

Toaster
Community Member
*
Posts: 378


WWW
« Reply #13 on: September 02, 2008, 05:27:50 PM »

Ah no problem. Smiley I created a blog cause it seems everyone else has one. Tongue

http://unknownabstraction.blogspot.com/

Check it out I added my final result for Simple Single Light Cubic Shadow Mapping. I will release the src and exe's here soon. I just have to clean up the code.

Thanks,
-Toaster
Logged

Visit my site at: Unknown Abstraction
jviper
Community Member
*
Posts: 2130

Discipline in training


« Reply #14 on: September 02, 2008, 07:09:56 PM »

Hello
For some reason this runs really slow on my system.
I get between 5 FPS - 17 FPS.
System:
Dell Insperon I6400
Intel CPU T2300 (Dual Core), 1.66 GHz 1.0 GB RAM
Windows XP Service Pack 3

ATI Radeon Mobility X1300

I guess mt system is already antiquated Sad
Logged

JAbstract.....Don't just imagine, make it happen!
Toaster
Community Member
*
Posts: 378


WWW
« Reply #15 on: September 02, 2008, 07:15:10 PM »

You shouldn't have that low of FPS. Tongue Not sure whats wrong. Press F5 to go fullscreen and see how it runs.

-Toaster
Logged

Visit my site at: Unknown Abstraction
jviper
Community Member
*
Posts: 2130

Discipline in training


« Reply #16 on: September 02, 2008, 08:06:06 PM »

In fullscreen it tops out at 19 FPS.
Occording to the profiler, the Viewport_Present takes 67 ms  Huh
The Render (292 Objects) takes 5 ms.
Logged

JAbstract.....Don't just imagine, make it happen!
Toaster
Community Member
*
Posts: 378


WWW
« Reply #17 on: September 02, 2008, 08:18:46 PM »

I know why its cause I set the AA to max(16X). Tongue Sorry about that if you recompile and change that you should get better results I think. I am going to reupload the sample with a better version of it soon and I will get rid of that. Smiley

-Toaster
Logged

Visit my site at: Unknown Abstraction
jviper
Community Member
*
Posts: 2130

Discipline in training


« Reply #18 on: September 02, 2008, 08:30:25 PM »

I had to also take the CubeMap RenderSurface you used for the depth to 256, when it was 1024. This along with turning the AA off gives me 38 FPS.
When I had the surface at 1024 with the AA on, I actually had a top FPS as 4 FPS. Taking the RS size down to 256 is what gave me the 17 FPS.
Logged

JAbstract.....Don't just imagine, make it happen!
Toaster
Community Member
*
Posts: 378


WWW
« Reply #19 on: September 02, 2008, 08:39:38 PM »

Wow. :/ um I really don't know why its running that slow. It shouldn't be running that slow.  Another thing you can try is..

Change this..
System.Threading.Thread.Sleep(100);
to this..
System.Threading.Thread.Sleep(1);

Might help other then that I dont know what to say.. Tongue What kind of FPS do you get in arius's shadow mapping sample?

-Toaster
Logged

Visit my site at: Unknown Abstraction
Pages: [1] 2 3 4
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks