Home » Community » Forums » » An Example of Shadow Rendering in Direct3D 9
  Intel sponsors gamedev.net search:   
[Control Panel] [Register] [Bookmarks] [Who's Online] [Active Topics] [Stats] [FAQ] [Search]

Add Forum to Favorites |  Send Topic To a Friend | View Forum FAQ | Track this topic


 Last Thread Next Thread 
 An Example of Shadow Rendering in Direct3D 9
Post Reply 
quote:
People often make a big thing about so-called "soft shadows", where the edges around a shadow appear to blend smoothly between shadowed and lit. My statement that there is no in-between therefore sounds a little odd. The reasoning for this is actually very simple, soft shadows are a feature of very complicated (comparatively) global illumination systems - ones where they factor in the reflection and transmission of light as energy (ray tracing and radiosity are good examples). If you calculate a light as being able to reflect off surrounding surfaces, or to be emitted from area-lights you will get these blurred edges. At the time of writing this article, real-time dynamic global illumination is difficult if not impossible.

This is not entirely true. Any light source that is not of no size should give soft shadows, whether there is radiosity-like based lightning or not. Think of the sun, it is not a single point. It is a globe, and you can therefore se parts of it even when, for example, the center of it is hidden. So shadows given by the sun will be soft, not sharp and ending by the next fragment, like if suddenly the whole sun is hidden even while it was totally visible the last fragment.

Otherwise, nice article.

 User Rating: 1052   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Agreed with Jolle. Any area light causes umbra and penumbra. I'd have liked to show how it happens, but this requires doing some art, and I've stopped doing ASCII art for some time

If you have "Computer graphics: Principles and practice" (you should ), look-up "umbra"/"penumbra" in the index (I forgot where they explained it, actually).

And for those interested, there's been a paper (actually, 5 papers collapsed into one PhD thesis) published somewhere where the author actually did soft, real-time stencil shadows.
Real-time as in 50/60 fps on a low-poly model (700 polys or so). Although not good for use in games yet, it could be so in the future.

Also, "Kasper I-forgot-the-last-name" of peroxide.dk has done some "secret" research on this for his Master's thesis, and he's posted a couple of links to screenshots from the Era engine using the technique on the flipcode forums. You might want to check that out.

Muhammad Haggag

 User Rating: 1823   |  Rate This User  Send Private MessageView ProfileView Journal Report this Post to a Moderator | Link

The source doesn't compile on vc6. Have anybody made a version that does?

 User Rating: 1015    Report this Post to a Moderator | Link

Real-time Soft Shadows in a Game Engine
Posted by: Kasper Fauerby at 03:20

A master's thesis entitled "Real-time Soft Shadows in a Game Engine" can now be downloaded at the link below.

The thesis is available for download at our webpage at: http://www.peroxide.dk/tuts_c.shtml or as a direct link to the pdf: http://www.peroxide.dk/papers/realtimesoftshadows.pdf.

I downloaded and printed this thesis (118 pages)


 User Rating: 1025   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Jolle makes a good point, but, regarding some people's preoccupation with all soft shadows being "better"...

Long story short, in some cases, the geometric relationship between the light source, the shadow caster, and the shadow receiver will yield very hard shadows. This makes the added overhead of a soft shadow unappealing.

As an experiment, take a screen resolution photo of a friend standing in bright sunlight casting a shadow on a smooth surface. You will find that the penumbra of the shadow is maybe one pixel wide, maybe not even that depending on the photo. If you were recreating this in a game, a soft shadow effect would be at best wasted cycles and at worst incorrect looking.

As I sit here at my table, my ugly chandelier with small bulbs is casting many shadows, but each shadow is relatively "hard". If I was to recreate this scene, I would focus more on recreating the multiple shadows and less on making them soft.

 User Rating: 1015    Report this Post to a Moderator | Link

The ShadowVolume class, on this source code, is creating a volume as if the light was a directional light. How can I change this code to make it run as point lights?

 User Rating: 1024   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

sorry about resurrecting this article. But it's quite high on google so I thought I should put in my 22 cents. =)

You can achieve soft-edged shadows by 2 other ways without using image-processing (blurs) and thats jittering the pixels of the shadow (nvidia fx SDK has an example i think). Also by drawing a much larger shadow and reducing the alpha of the shadow volume by using an edge-finding algorithm.

 User Rating: 1061   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

All times are ET (US)

Post Reply
 Last Thread Next Thread 
Forum Rules:
You may not post new threads
You may post replies
You may not edit your posts
You may not use HTML in your posts
Jump To:
Administrative Options: