Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1] 2
  Print  
Author Topic: Landscape Shadow-Mapping Demo (Sample)  (Read 23965 times)
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« on: December 04, 2006, 08:59:51 PM »

Download link : LandscapeShadowMapping.rar (VB.Net 2005 Project - 2.8 mb)

The shadow-mapping demo that I have been developing for two full months. It's finally done, and finally documented. I used Sandcastle to generate an HTML documentation for it too.
Compiled HTML Documentation : Documentation.chm (160 kb)

This release is not as modular, as well-made and as generic as the Bloom demo. Which means you can NOT just take it, fit in your app, call its Update/Render methods and have free shadow maps. It's not that simple.
Read the code, try to understand what motivated me to take the structure I took. Then rewrite the implementation in your own game engine. It won't work the first time around, but you'll get the best results that way.

Notice how many initialization-time settings and real-time settings you can set? They're here for a reason : it is impossible to render everything all the time. There needs to be an order of priority, what's important to render and what's not.
There is also heavy optimization in the code, and that's why it's fast. If you want similar performance, you have to replicate this optimization, and it's not easy in a real game setting.

All in all, shadow-mapping is definitely not as easy to produce as stencil shadows, but in the long run they're the better choice.

I plan to make a proper manual to this demo in some weeks, I can't guarantee when it'll be released. That is because there is much explaining to do about how it really works, some stuff that's a bit too dense for inline code comments. In the meantime, if you have *any* questions, please do ask!

Screenshots (which were already released in the In Development section) :




Enjoy! Smiley
« Last Edit: February 26, 2008, 12:30:03 PM by Zaknafein » Logged

BlindSide
Customers
Community Member
*****
Posts: 760


« Reply #1 on: December 04, 2006, 09:29:09 PM »

Cudos on the release Zak, very impressive work! It's been good fun watching this come along from the very start.

Hopefully we'll start seeing a shift toward shadowmapping within the community, given some time. It's a new technology that isn't quite as mature as stencils yet, but with more users comes more ideas, and sooner or later a very solid code base.
Logged
pizzayoyo
Customers
Community Member
*****
Posts: 1423


WWW
« Reply #2 on: December 04, 2006, 10:36:44 PM »

I too am excited for the possibilities that shadowmaps bring. I just tried out Zak's demo and it is incredible! I am getting great results at over 300 FPS, and his demo has around 50 rotating objects and a moving light source.

Once he does the full documentation I can't wait to *attempt* to bring this into my project... Great work!
Logged

JohnB
Customers
Community Member
*****
Posts: 183


« Reply #3 on: December 04, 2006, 11:43:07 PM »

Wow - that's really nice work Zak... and by 'nice' I mean 'totally fracking awsome'.

John B.
Logged
Mietze
Community Member
*
Posts: 415

Pleeease, don't let it crash!


WWW
« Reply #4 on: December 05, 2006, 11:39:43 AM »

Fantastic work, Zak! I guess we all agree that Zak should gain a free license for the stuff he offered the community :roll:
Logged

Check out my blog at www.e-studioz.de - The finest in gross trash Wink
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #5 on: December 05, 2006, 11:47:58 AM »

I already got free beta access... I couldn't ask for much more. Tongue
Thanks though!
Logged

WEst
Customers
Community Member
*****
Posts: 945

Daniel Martinek


WWW
« Reply #6 on: December 05, 2006, 12:54:05 PM »

Very impressive work,............... really extrem impressive work,................. omg, thats the best thing I've seen, .....................ever!!!

Also can't wait for BlindSides Omni-Light Version, I also tried to create shadow mapping a long time ago, but I never got it running.
Logged

Greetings

Daniel Martinek
Technical Director
23 Volts
Happy
Customers
Community Member
*****
Posts: 78


« Reply #7 on: December 05, 2006, 02:19:51 PM »

!!!

Thank you so much Zak, man... those stencils are good looking sometimes but they kill my fps on the old machines. :lol:

I ran this demo on a old fx5500 card first using stencils and I wasn't really inspecting Much but it was very laggy, choppy or whatever you call it.. Then I tried it with you're shadowmapping  and it ran pretty smooth.. This is a good update for those who have slightly outdated pc's.

results:
11-14 fps with stencils. :oops:
30-38 fps with shadowmapping. Cool

default settings on both..

my new upgraded pc ofcorse ran it 127-144 fps. :wink:

Well, I'm trilled, once again excellent work!  Later.
Logged
Waterman
Moderator
Community Member
*****
Posts: 1159


« Reply #8 on: December 05, 2006, 07:45:28 PM »

Good work!

I took a quick look at your code, appears to be well written. I spotted a few things that you will improve further on if you involve this shadowing technique into a production environment, but it's an excellent achievement to have packaged all bits and pieces into a functional yet isolated and self-contained entity.
Logged

Things should be described as simply as possible - but not simpler [A. Einstein]
Mietze
Community Member
*
Posts: 415

Pleeease, don't let it crash!


WWW
« Reply #9 on: December 07, 2006, 04:39:54 AM »

Ya, his code is very clean. I've never liked VB, but i love to find gimmicks like:

Quote
Static Rnd As New Random(1337)
(Util.vb, p. 74)

 :lol:  :lol:  :lol:
Logged

Check out my blog at www.e-studioz.de - The finest in gross trash Wink
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #10 on: December 07, 2006, 08:20:53 AM »

Haha! Glad someone noticed.  :lol:
Logged

AriusMyst
Guest
« Reply #11 on: February 09, 2007, 12:44:04 PM »

Host is down, use this one instead: http://azazeldev.org/zak/LandscapeShadowMapping.rar
Logged
Norb
Customers
Community Member
*****
Posts: 90


WWW
« Reply #12 on: February 21, 2007, 10:00:32 AM »

Zaknafein, just want to say thanks for this example.  It really is a great start for me to see some of the more advanced features of the engine.  I'm more of an AI, architecture coder and my weakness is graphics.  So thanks for taking the time to create such an informative chunk of code.  Now I just have to convert it to C++  Cheesy

Norb
Logged

zwiglm
Customers
Community Member
*****
Posts: 129


« Reply #13 on: February 23, 2007, 05:36:33 AM »

hiho

I'd like to port this demo to .Net C#.
I don't like to install VB.net either, but for a better chance of reading... is there a capable text-editor that can do VB syntax highlighting?

cheers,
martin
Logged

Cheers,
Martin
WEst
Customers
Community Member
*****
Posts: 945

Daniel Martinek


WWW
« Reply #14 on: February 23, 2007, 06:54:44 AM »

Google for "Notepad++" it's a really good texteditor with Syntax-Highlighting for many languages.
Logged

Greetings

Daniel Martinek
Technical Director
23 Volts
zwiglm
Customers
Community Member
*****
Posts: 129


« Reply #15 on: February 23, 2007, 07:08:17 AM »

Thanks for the help.

I already found ConTEXT
Logged

Cheers,
Martin
Norb
Customers
Community Member
*****
Posts: 90


WWW
« Reply #16 on: March 26, 2007, 11:25:24 PM »

I really needed a good Shadow Mapping example in C++ so I converted this demo.  I thought that there may be others in the same boat so I posted it for download:

http://www.norbsoftware.com/Downloads/ShadowMap.zip
http://www.norbsoftware.com/Downloads/LandscapeShadowMapping.rar
http://www.norbsoftware.com/Downloads/Documentation.chm

This code is a C++ conversion of Zaknafein's Landscape Shadow Mapping demo from the TV3D forums.  There is no original code of my own, just a conversion of his demo for those of us that still work in Visual C++ 6.0

All thanks should go to Zaknafein for providing us with an alternate solution for shadows, especially when we have a lot of objects on the terrain

NOTE: you will have to fix a bug in tv_types.h to make this work.  I've submitted the bug to the team so it should be fixed in the next build.  The functions of cTV_3DMATRIX expect the structure to be inited to 0, so just add the following to the constructor and you'll be OK.
 
    cTV_3DMATRIX()
    {
      memset( m, 0, sizeof m );
    }
 
To run this code just put the ShadowMapping folder where you installed his VB demo.  You'll have to change the locations of the TV3D files to fit your machine.

NOTE: The profiler code does not really work nor does most of the display debug text.  I also didn't really test the filtering modes and they probably don't work either.
Logged

GD
Customers
Community Member
*****
Posts: 384


« Reply #17 on: March 27, 2007, 11:37:38 AM »

Thank you both guys!

One question, would it be possible that shadow falls on other meshes than just terrain?
Logged
Zaknafein
Customers
Community Member
*****
Posts: 2940


WWW
« Reply #18 on: March 27, 2007, 11:50:45 AM »

That would require a shader applied on all meshes. You can't really project a shadowmap on meshes with TV3D built-in stuff...
I had looked into that when I started working on shadows, but left it unfinished to focus on landscape shadowmapping. Might get back into it sometime... but you already have a strong basis to try it yourself.
Logged

zwiglm
Customers
Community Member
*****
Posts: 129


« Reply #19 on: April 18, 2007, 09:41:12 AM »

Since the shadow-shader topic came up again, i'll ask my newbie question:

@zak:
in your tutorial you mention that one has to adapt it to one's own code. does that go for the shader itself too?

cheers,
martin
Logged

Cheers,
Martin
Pages: [1] 2
  Print  
 
Jump to:  

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