Shadow Mapping

Threads related to Google Summer of Code
Post Reply
peridexion
Google Summer of Code Student
Google Summer of Code Student
Posts: 8
Joined: Wed May 24, 2006 9:01 am
Location: USA

Shadow Mapping

Post by peridexion » Sat Jun 24, 2006 8:07 pm

Hi everybody,

I'm working on the shadow mapping project for the Summer of Code. My wiki is at:

http://www.ogre3d.org/wiki/index.php/SoC2006_Shadows

So far I'm still working on getting Ogre's custom shadow mapping system up and running. Hopefully this'll be fixed soon so I can get onto the interesting stuff (the stuff I'm actually experienced with ;)

As for community input, I'd also like to hear more about what custom shadow mapping variants people want to see. PCF, Variance Shadow Maps, etc.

People can also suggest variants for later based on changing the shadow map frustum. e.g., Plane Optimal, PSM, etc.

-- Hamilton
0 x

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19265
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 2
Contact:

Post by sinbad » Sun Jun 25, 2006 7:14 pm

Being new to Ogre you've been at a little bit of a disadvantage, especially in such a complex area, but it looks like it's all falling into place now :)

Personally I think regular PCF is a good place to start on the fragment end of the pipeline, and VSM is a good progression from that, although it does have precision issues. On the frustum end, I'm particularly interested by LiPSM and would love to see an implementation of that.
0 x

swx
Google Summer of Code Student
Google Summer of Code Student
Posts: 31
Joined: Sun May 21, 2006 4:03 am
Location: Sweden
Contact:

Post by swx » Sun Jun 25, 2006 8:47 pm

0 x

User avatar
Grom
Hobgoblin
Posts: 523
Joined: Fri Jan 06, 2006 6:35 pm

Post by Grom » Mon Jul 31, 2006 3:01 am

hey man how's it coming with this project? I am very interested in it, and have begun looking into doing PCF shadows myself. I posted over here, but I'm not getting a very good response so far. :(
0 x

peridexion
Google Summer of Code Student
Google Summer of Code Student
Posts: 8
Joined: Wed May 24, 2006 9:01 am
Location: USA

custom shadow maps

Post by peridexion » Mon Aug 14, 2006 8:58 pm

Hi, sorry, I was caught up with getting my coding done and neglected to check the message board. I've posted a (late) reply to your linked thread. I can also post the shaders I'm using, but they may take a bit of explanation (which I'm currently writing up).

-- Hamilton
0 x

peridexion
Google Summer of Code Student
Google Summer of Code Student
Posts: 8
Joined: Wed May 24, 2006 9:01 am
Location: USA

end of program

Post by peridexion » Mon Aug 21, 2006 5:41 pm

Well, I've committed my samples, engine code, and shadow readme to my branch of the repository.
0 x

User avatar
Praetor
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3335
Joined: Tue Jun 21, 2005 8:26 pm
Location: Rochester, New York, US
Contact:

Post by Praetor » Mon Aug 21, 2006 8:52 pm

I can't wait to check it out. I've really been looking forward to this.
0 x

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19265
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 2
Contact:

Post by sinbad » Tue Aug 22, 2006 9:26 am

For anyonw who want's to play with this, the branch name is 'soc06-shadows'.
0 x

User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel

review of project

Post by Assaf Raman » Tue Aug 22, 2006 12:56 pm

I had a first look at your work.

First of all I want to say -nicely done and I really liked your paper. :)

here is a screen shot of your demo project:
Image

Did you notice the hole in the shadow? (I circled it in red)

:?: How can you configure\fix the demo\shadow so it won’t show this hole?
0 x
Watch out for my OGRE related tweets here.

User avatar
flyswat
Gnoblar
Posts: 19
Joined: Thu Mar 16, 2006 8:49 am

Post by flyswat » Tue Aug 22, 2006 1:02 pm

Well it looks like its a hole in the model as well.
0 x

User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel

Post by Assaf Raman » Tue Aug 22, 2006 1:05 pm

You are right. My mistake.
0 x
Watch out for my OGRE related tweets here.

User avatar
Assaf Raman
OGRE Team Member
OGRE Team Member
Posts: 3092
Joined: Tue Apr 11, 2006 3:58 pm
Location: TLV, Israel

banding artefacts

Post by Assaf Raman » Tue Aug 22, 2006 1:15 pm

:?: What about the banding artefacts that occurs from certain angles?

Image Image
0 x
Watch out for my OGRE related tweets here.

User avatar
Praetor
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3335
Joined: Tue Jun 21, 2005 8:26 pm
Location: Rochester, New York, US
Contact:

Post by Praetor » Tue Aug 22, 2006 1:18 pm

You will probably have to play around with the depth offset to get the proper image. The best would be a non-constant offset, but it usually is a manually-tweaked parameter that you need to play with the get it just right.
0 x

User avatar
skatehead
Halfling
Posts: 83
Joined: Tue Mar 07, 2006 2:53 pm
Location: Australia
Contact:

Post by skatehead » Wed Aug 23, 2006 6:53 am

well done!
ive always wanted to see texture shadows with self shadowing in ogre
0 x
ImageImageImageImage

peridexion
Google Summer of Code Student
Google Summer of Code Student
Posts: 8
Joined: Wed May 24, 2006 9:01 am
Location: USA

Post by peridexion » Fri Aug 25, 2006 5:51 pm

Thanks.
Yes, the previous responses have been correct. There is a gap in the ogre model that causes some seeming artifact.

As for depth biasing, there are two parameters you can play with. One is exposed in the materials script as uDepthOffset. This effectively gives a push of uDepthOffset units in the z direction (in eye space coordinates).

The other parameter is in the custom shadow caster fragment program shader.
float depthval = postProj.z + (0.5 * dzlen)+ (uDepthOffset * ddepth);
You can change the 0.5 to something else. This affects how much offset you add that depends on the "depth slope." The depth slope is a measure of the uncertainty in the depth value you computed. If you use too large a number though, you may see specks of light bleeding through to the floor. This is because for polygons that are almost edge on to the light, the depth slope is nearly infinite (well, a very large number). So to fix this you could clamp the value you add.
I've just put a basic equation there, but I'm sure you could imagine more fancy ones that trade off the values according to your application's needs.
0 x

LordSteiner
Kobold
Posts: 36
Joined: Wed Aug 30, 2006 2:37 pm
Location: Bavaria, Germany

Post by LordSteiner » Wed Aug 30, 2006 4:30 pm

Do you have any issues compiling the current HEAD revision of the soc06-shadows branch? I get tons of linker errors with 5 unresolved externals in OgreMain: DefaultShadowCameraSetup::getShadowCamera, ctor and dtor, PlaneOptimalShadowCameraSetup::getShadowCamera and dtor.
This affects only the soc06-shadows branch (debug and release). The 'normal' HEAD compiles without errors.
0 x

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19265
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 2
Contact:

Post by sinbad » Wed Aug 30, 2006 5:36 pm

There is only one HEAD. You should check out the soc06-shadows branch in its entirety (cvs -z3 up -CAPd -rsoc06-shadows).

Note that if you're not using VC8, not all the project files will be up to date, you might need to add some new source files to the project files for your platform. This will be addressed officially when the branch is merged into HEAD.
0 x

LordSteiner
Kobold
Posts: 36
Joined: Wed Aug 30, 2006 2:37 pm
Location: Bavaria, Germany

Post by LordSteiner » Thu Aug 31, 2006 11:07 am

I used the (outdated) VC7 project files :oops:

Thanks for the quick reply.
0 x

peridexion
Google Summer of Code Student
Google Summer of Code Student
Posts: 8
Joined: Wed May 24, 2006 9:01 am
Location: USA

DirectX flicker

Post by peridexion » Wed Sep 13, 2006 7:15 am

To get rid of the flickering shadows under DirectX when using the plane optimal algorithm, you have to do choose to allow double precision computations. DirectX defaults to choosing single-precision for you, despite declaring variables of double type.

You can fix this in the ogre.cfg file:
Floating-point mode=Consistent

After this, the numerical linear system solver can operate properly.

-- Hamilton
0 x

Post Reply