Blog! Team! Forum! About Apricot! Press! Gallery! Development! Yo Frankie! Apricot Open Game Project mee!
Apr 26

Where there’s light there ought to be shadows

icon1 res | icon2 Crystal Space, Development, Screenshots | icon4 04 26th, 2008

Lighting things is pretty well covered in Crystal Space* right now; multiple lights can be rendered in one pass, and materials can have the usual assortment of properties such as normal maps, specularity maps etc. giving shiny visuals. However, for a truly convincing environment you also need shadows.

Crystal Space actually supported stencil shadows for a while, but they’re not with out issues: the algorithm inherently can’t support any transparent textures, and extra care must be taken by the artists to produce “closed” models, otherwise the shadows will mess up. Also, the Crystal Space implementation has some issues: they need some effort to set up and animated meshes are not supported.

Thus I implemented shadow map support. Without going into too much technical details, they can support binary transparency (aka alpha test), don’t need special care for the models (just throw anything at them and it’ll look as it should), and due simpler implementation, they work on animated meshes in Crystal Space. Within the render manager framework they can easily be utilized by either using a stock render manager with shadow support or some lines of code in custom render managers.

Now some screenshots on how they look in that well-known small test level:

Shadows test, distant
Shadows test, from a distance

Shadows test, close-up Shadows test, close-up Shadows test, close-up
Some close-ups

Shadows also work on somewhat larger levels:

Shadows on large WIP level
(Ignore the missing textures etc. Focus on the shadows 😉

Some implementation details: Parallel-Split Shadow Maps on top of a plain normal shadow mapping. (You can see the shadow maps displayed for debugging purposes in the lower left corner of the shots.) The”soft” shadows you see are actually provided by the NVidia hardware – so real soft shadows is still something left to be done.

* Well, render manager branch.

30 Responses

  1. amoose136 on

    wow that looks great! Can that be animated? Can’t wait to see soft shadows!

  2. Felix Kütt on

    looking good, fellows, looking good. 🙂

    now id love to see if and/or how much progress has been on crystalblend(or w/e) and etc. xD

    would love a little screen recorded video even, if its not too much to ask. :3

  3. loken on

    Damn, that looks great!

    Keep up the great work guys!

  4. Christiaan Bakker(AniCator) on

    Sweet. (h)
    I own a NVIDIA video card but some soft shadow samples would be nice.

  5. Alexander Ewering on

    Nice. That’s actually how it’s been done in Far Cry…

    And shadows for moving objects will be done how? Using the regular CS shadows?

  6. Alexander Ewering on

    BTW: A limitation of this is of course that the movement of scenery (plants, trees) won’t be reflected in the shadows, which is a bit disappointing, because more recent games (Crysis comes to mind) can do this…

  7. youaresomean on

    Alex: Why should moving meshs not show up in the shadow map?

    Maybe you are mixing up shadow mapping with lightmaps?

    Provided by the Nvidia HW means Percentage-Closer Filtering?

    Stencil shadows are a dead end. I am not aware of any recent titles using it (the last was doom3).

  8. Alexander Ewering on

    youaresomean: I always thought that shadow maps were pre-generated, so I am probably confused. So, they’re generated on the fly by using a light as a camera and then projecting its view onto the surfaces as shadows?

  9. youaresomean on

    Alex: Yes, the scene is rendered from the lights point-of-view storing the scene-depth values in some kind of buffer (“render target”/”fbo”…). This buffer is then projected onto the scene in the camera’s POV and the depth values are compared to determine shadowed/non-shadowed pixels.

  10. Alexander Ewering on

    youaresomean: Thanks. I always thought that exactly that was what DOOM 3 was doing. I’m not sure what’s the difference between stencil shadows and shadow maps then, because stencil shadows essentially have the same RESULT. I should do some reading 🙂

  11. rubicon on

    It looks really good.
    I’m just curious what my (not so new) ATI-Card will say….

  12. lohborn on

    These look great but they bring to mind a question I have had. Does CS support AA? If it does, could you show some pictures with it enabled. If it doesn’t, that would the one really important feature to make the game look professional, but I assume it would be a big deal to implement. So eh, it still looks good without.

  13. Alexander Ewering on

    lohborn: I could be wrong *again* ;), but afaik, getting FSAA is merely a question of setting a certain flag in the graphics card. (It is like that, at least, with NVidia based cards.)

  14. Kirado on

    looking good.. is it possible to filter the shadows with some gaussion blur?

  15. Andrew Fenn on

    Wow, that looks awesome! I hope moving shadows also gets into the game.

  16. Anthoni_c on

    Yall should use the texturing style of Team Fortress 2.

  17. horace on

    will you additionally use some kind of static (global illumination) light mapping?

    when will there be a post about brecht’s shader node system? 🙂

  18. res on

    horace: CS’ static lighter currently doesn’t do GI. So at least from that perspective static lighting would be pointless.

    Kirado: not easily.

  19. ron on

    how are u doing multiple lights in single pass?.

    You should integrate it with ambient occlusion from blender,at least for the terrain.

    also what are minimum requirements.i hope all this runs on my crappy 7300 :>.

  20. horace on

    i just asked because i hope that blender’s light baking features get improved. 🙂

  21. Francisco Ortiz on

    Very interesting… Alexander and youaresomean talked about a subject confuse to me: the difference between stencil shadows and shadowmaps. I also need to do some reading! 😉

  22. horace on

    stencil shadows are geometry based. the silhouette edges of models as seen from the light get extruded to form a shadow volume and the faces of this extrusion get rendered (taking the z-buffer of the scene into account) into the stencil buffer.

    shadow maps are image based. a depth map seen from the light gets rendered and then projected onto the geometry where the distance to the light can be compared.

  23. Francisco Ortiz on

    Hey Horace, thankx for the type!

  24. NathanKP on

    I think that the shadows look really impressive, and I only hope that the game runs well on the average hardware available on the market these days.

    NathanKP – Inkweaver Review

  25. Alexander Ewering on

    NathanKP: I don’t think “impressive” is quite the right word, they’re slightly worse than in Far Cry (which is 4 years old). But they’re work in progress… In turn, the shadows in CRYSIS *DO* look impressive 🙂 Of course, that game doesn’t run on average hardware, but hey.. 🙂

  26. Anonymous, because I fully expect to be flamed. on

    This is still work in progress ehhhh right? IMHO, this looks like graphics from an average studio in 2003. Is open source game dev really this primitive at the moment? before you flame me, which I expect someone to do, This is an honest question, I don’t mean insult by it. I think the blender team is great, I just don’t think Crystal Space is the right way to go, I think we should concentrate on building more powerful game engines from scratch, like Unreal3 cryengine2, ect, it’d take longer yes, but it’d fruit far better results. I hope I see something like that in the next blender game project, if there is one.

  27. Alexander Ewering on

    Anonymous: Exactly my opinion. Of course, this is work in progress, so one should be careful about premature comments and expect things to get better (and try to motivate the team instead of complaining all the time 🙂

    However, saying that everything is spectacular when it clearly isn’t *yet* is also the wrong way to go.

  28. Alexander Ewering on

    (Just to give an impression of what I mean: this is roughly “state of the art” currently:

    I don’t expect a small half-dozen-people team to produce a title like this, but then, don’t say you are going to produce a ‘state of the art’ game, because frankly, I think this is impossible given this budget and manpower.

  29. horace on

    the budget of GTA IV was 100 million dollars and they had a staff of 1000 people. 🙂
    crysis had a budget of about 30 million dollars.

    how are open source projects supposed to compete with that manpower? a free and open sourced unreal3 engine wouldn’t give much advantage over crystal space either.

    some people seem to have way too high expectations.

  30. Alexander Ewering on

    Indeed. That’s why I said I don’t expect a “state of the art” game from this project at all. I just wanted to convey that it’s dangerous to propose “state of the art” as the plan (as Ton did in the initial Apricot announcement), because that’s simply not possible. It’s easier with a movie (like Peach), because with a movie, the lack of budget and people can simply and fully be compensated for with an arbitrarily shorter length.