Jump to content
  • Advertisement
  • entries
  • comments
  • views

Shadow map progress

Sign in to follow this  


I'm going to be using 2 2048x2048 (!!) textures for all of the shadow maps in the city. One will be updated 3 times a second and will cover the entire city, assuring all parts of the city are shadowed. Another will be updated every frame and be focused around the player's view frustum, this will handle the character/vehicle models, and local city shadows. I call these the global and local shadow maps. I blend between them based on the distance from the camera.

I'm not sure if there's a name for this method of shadowing a scene in realtime but it seems to work quite well. There are some tricks and catches that I'm having to work into it...I'll detail all of that tommorow.

The game still runs great :-) The city. which gets drawn twice a frame, is held in static vertex buffers which are only updated when the player moves the camera 15 degrees, or a certain distance, so it's pretty optimized in that sense. Obviously I'm only rendering visible parts of the city to the shadow maps, or parts taht will cast a shadow into the view frustum.

I've got a lot of shaders to write now due to the different combinations of effects and states. I'm going to focus on the skinned model shader tommorow, and add shadow support to it. This will be interesting :-D

The game engine is essentially stripped down, and I'm re-writing almost every aspect of it. All for the better.

I've also FINALLY figured out how to export an animated .x file with vertex weighting out of 3D MAX 7...and succesfully load it into my game. So the character animations/models are now a lot smoother.

I'm tired of working for the day...I'm gonna play Battlefield 2 :-D (they have some pretty cool shadow maps in that game btw.)

Two small ingame screenshots showing the completly dynamic shadows:

Showing the resolution of "local" shadows on the character/vehicles.

I'll have a better update tommorow, with more progress.

- Dan
Sign in to follow this  


Recommended Comments

Ah, neat. I wonder how it will look like from the strategy view. Probably quite impressive. Those shadow ain't realtime though, three times a second isn't fast enough for a fully dynamic light (e.g. car driving by, swinging lamp), is it?

How did you get all those textures for you buildings and signs? Did you make them by yourself (photos)? If not, did you buy them somewhere?

Share this comment

Link to comment
I have two shadow maps...one is updated every frame, and is focused on the player's view frustum...it will handle character shadows, vehicles, local city shadows. Another is rendered over the ENTIRE city, and is used to assure every part of the city is shadowed, you can't tell that it's updated 3 times a second. Was it not clear from my description? :-( If not I'll rewrite it.

All the shadowing visible in those screenshots is updated 30 times a second, and is completly dynamic. The less frequently updated shadows are in the distance so you can't tell they're updated less frequently. The matrix mapping between the two is updated every frame, so you can't tell at all.

There is only one directional light in the scene, and the fact that I'm reusing the same city vertex buffers which only contain visible parts of the city, makes the whole process rather nice.

I fade out the larger low resolution city shadows as the distance to the camera decreases. And I shift to the local shadows. I'll post a video and some better screenshots later on...

A few of the textures I made myself from photographs, some I bought from websites around the internet.

Share this comment

Link to comment
Oh, okay. Sorry, I was a bit daft. I hadn't understood that you were rendering nearer shadows in the view frustrum more often. Stupid me. :-) Nice trick though, I hope combining the two shadow maps works out well.

Have you worked on the night mode as well? As far as I remember you implemented it before the major graphics engine rewrite so you'll probably have to redo a lot of things (?).

Share this comment

Link to comment
Very nice!

For those office windows; are those just a texture, or have you modelled the insides of buildings? If it's just a texture, does it still look as good as it does in that screenshot if you get close to the window?

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!