Thứ Tư, 12 tháng 6, 2013

Wednesday In Shadow

Cloud Bound

I was planned a trip outside today but the clouds and rain conspired to keep me inside, and perhaps it was for the best.  I spent the morning reading up on various shadow mapping techniques as a refresher, then looked at some of the excellent world Evolved had done in DBP, and with a little rolling up of sleeves managed to create a prototype shader which employs cone based parallax rendering (thanks to Mark B) and shadow mapping (thanks to Evolved).  Here is an early video, which I sneaked past Rick, our QA guy:


As this is a first attempt there are some artefacts here and there, but I am happy that the technique is not too complicated to wrap my head around. I need my head clear for more challenges tasks that lie ahead.

Segment Art is hot on the heals of this coding work, so expect the video quality to jump up in the next few weeks :)

Evening Plan

It's late afternoon now and I'm quite buzzed at the prototype and just keep running it and wondering around. Once the buzz fades, my next task is to introduce an adaptation called Cascade Shadow Maps.  The premise is that instead of one all powerful texture holding the shadow for the entire world, I actually have four, with the first providing shadow for the entire world and the virtual camera sitting somewhere in orbit, while the forth shadow texture will be right up close to the centre of the player's head where we can produce much more detailed shadows that bears close scrutiny.  Of course all this produces a single global shadow, but it will be a great addition and absolutely necessary for outdoor scenes.

Brain Bursting Idea

In contemplating how best to handle point lights indoors, I hit upon a rather nice compromise which will allow hundreds of point lights but not drain the performance.  The performance drain comes from the fact that the typical omnidirectional shadow casting technique requires me to render outward from the light source in six different directions, every render cycle, to create dynamic shadows from a single point light. Multiply that by even a few lights and you are looking at screen shots, not refresh rates.

My plan is elegant in it's simplicity, which is to switch off the updates to these point light renders, but keep them in storage.  This way I can use the last known shadow render depth details when rendering the final lighting scene.  Only when an object passes by one side of the point light to I need to update, and only when the whole light moves do I need to update them all. Imagine them as real-time lightmapping textures that can instantly reflect changes in the scene, but when not updated are as fast as baked lights.  Neat or what!  Again, all theory, but will be a very cool way to solve the issue of many lights in a confined indoor scene that needs to cast many shadows.

For all the techniques I can research and dream up, it will always come down to performance and I am slowly coming to the concious conclusion that Reloaded should be targeted at next gen hardware. Gamers expect these advanced visual techniques, and who knows how long it will be before baked lights are a think of the past. Best to future proof Reloaded now while we're developing it, and leave that door open to lots of additional techniques that may rely on cube based shadow targets and deferred rendering methods.

Signing Off

It has been a day free of bugs, and much progress, so I could stop now and call today a roaring success.  Problem is, I am having too much fun, so with basic shadow mapping under my belt, time to try out a little cascading!

Không có nhận xét nào:

Đăng nhận xét