Wednesday, February 20, 2008

Soft shadows

I've added soft shadows to the engine. I use Percentage-Closer Soft Shadows (PCSS), described in this paper. It differs from regular PCF in that a "blocker-serach" step is used to approximate a shadow penumbra size. The estimated penumbra size is then used to control the filter size. It's not real penumbra shadows but it looks quite convincing.

Believe it or not, but until now my engine had no support for normal mapping. Now it does. The dynamic indirect lighting is also affected by the normal maps.
Time for the screenshots:


Note the green light that is reflected from the wall (not visible) onto the scene.

Soft shadows.


The scene is also lit by an enviroment map.

9 comments:

Anonymous said...

Wow !! Great work !

Anonymous said...

Just one question : does it run in real time (which FPS ?) ? However, respect for your work, I think we're now close to the global illumination era in games :)

Jonas Risbrandt said...

It's real-time or at least interactive:)

When the scene is static (only moving the camera), I get >60 fps. For dynamic scenes I get about 20-30 fps.

I doubt that this method would be practical in a game atm (other than simple games that is). For other applications like interior design etc., it's definitely practical.

However, I'm fairly convinced that we will see real-time GI in games quite soon. There is a lot of research going on in this field!

Anonymous said...

Yes, that's really exciting ! The graphics cards are getting really powerful ! For my small game engine, I'd like to implement a instant radiosity method. I've found a good paper, not well-known, that exposes a really simple technique with great results and great fps (although the photos showed only a Cornell box with a Stanford Bunny, I have to try the quality on larger scenes).

The problem is that it heavily uses texture lookups, and PS 2.0 are really bad at that (I've got a Radeon 9800 Pro, the best graphics card never created), so I'm gonna change my computer next month for my 18th years old :). A great HD 3870 I think :d.

About your technique, I think you talked (hum... is this verb irregular ? I don't remember) about cube maps, so I think the technique is similar to the one exposed in Shader X5 (this one : http://www.iit.bme.hu/~szirmay/ibld7_link.htm) ?

Jonas Risbrandt said...

If you're into instant radiosity, I also recommend Laine et al.'s work on Incremental Instant Radiosity for Real-Time Indirect Illumination.

My method is actually a variant of Nijasure et al.'s Real-Time Global Illumination on GPU.

Good luck with your own work!

Anonymous said...

Hej (är du inte svensk ?)

Thanks for the link, I know their work, very interesting ;)

About the Nijasure's work, I also know it, it seems the more powerful, but the quality of your screens is much more better than the quality in the paper :d

Jonas Risbrandt said...

Jo, jag är svensk :)

Ultrahead said...

Your engine looks amazing. Don't worry 'bout your FPS, there's always time for optimization ... a word that scares most programmers ;)

I found your blog yesterday so sorry for these (silly) questions (maybe the answers are in previous posts)):

1) As C# is your preferred language (mine too), are you using it to program your engine?
2) If yes, are you also using XNA? If so, I'm impressed.
3) If both yes, how are you handling GC? Did you test the engine on an XBOX360?

Jonas Risbrandt said...

Thanks!

1) I've been coding in everything from assembly to python, and of all those languages C# is my definite favourite:)
My engine is ~90% C# and ~10% C++/CLI = 100% .NET

2) I'm using XNA, but only as a rendering API. The engine is rendering API independent.

3) I use several common tricks to keep the GC under control. I use value types where appropriate and I use object pools to keep allocation of reference types to a minimium. I reguarly use CLR Profiler to make sure there are no allocations I'm not aware of.
This results in that during runtime of my engine, there is close to zero collections.

But no, I've not tested the engine on XBox360, since I don't own one :)