Tuesday, October 9, 2012

Realtime Shadows

I decided to give dynamic shadows a quick try. I used a shadow map with percentage-closer filtering to smooth shadow boundaries. The results are quite fast and smooth. The main trick was to run the shadow evaluation on the vertex shader. I realized I had enough vertex density for consistent results. The shadow interpolation between vertices would make the shadows even smoother.

Here are the results.

 

If you wait to the end of the video you will see there is some kind of mysterious object rising from the ground. This is unlike anything you have seen in my videos before. It certainly means something, a sign of things to come...


29 comments:

  1. This looks way too great! I wonder if you're making something like an ancient sivilication or something :P

    Funny thing, now that you added ambient sounds (plus bobbing, if it's not the ground that's bumpy :D ), the whole thing seems much more atmospheric.

    Any chance you are going to speak about those LOD changes soon?

    ReplyDelete
    Replies
    1. No comments for now... but the LOD changes are going to stay that way I'm afraid.

      Delete
    2. That's a bit bummer... but I guess you have a good reason for that :)

      Delete
    3. I don't know if you made some tweaks to the LOD transitions since the last set of vids where it was discussed, but they don't bother me quite as much in this one -- so kudos for finding a good balance :)

      I still will hope for an option where My PC rig could have a 15 GB install and somehow obviate most of the LOD/download traffic though. I.e. keep it light for light powered hardward, but flexible to take advantage of true power, if available! :)

      Delete
    4. How many CPU cores in your PC? That may be the key number ;)

      Delete
  2. When I saw the stone I must think at "2001: A Space Odyssey" :)

    ReplyDelete
    Replies
    1. Now that is the mother of all WTF endings...

      Delete
    2. I was staring at the screen blankly for the entirety of the ending... I think I was being brainwashed... It really felt like a dream, in the sense that afterwards, the only thing I can remember about it, was that it was really WTFish, and a baby...

      Delete
  3. I certainly hope there will be some sort of sandbox element... I know you've said that it will only be a world building tool, but the stone makes me think of historical or mythical civilization, and I have always been interested in the science of how civilization was started, the growth of technology, and trade... in fact, I am building a very simplified version of this for a game I am creating.

    ReplyDelete
  4. Now then, let's speculate about the object coming from the ground: It appears to be man(or whatever race(s) inhabit that world) made, it seems to be made of a different type of stone than inhabits the local area (It's darker than the rocks which litter the ground), hence it would have to have been shipped there somehow. It being a heavy stone (Presumably), it would have to be of some importance. The carvings in it seem as sophisticated as normal wall-art for decently advanced people, or decently impressive art for primitive people. Hence, I will deduce that it is either a religious site for a primitive people, or a strange flat column of a sophisticated ruin =D.

    (Yes, I tend to over-analyze things =3)

    ReplyDelete
  5. I was thinking something a bunch more mundane: a sign-post.

    The grass sounded great, but the boots on stone felt off. Also, either the camera is very low, or those trees are huge (that sort of tree doesn't seem like the type to have meter high roots).

    ReplyDelete
    Replies
    1. Agreed. Either the viewer was a small woodlands creature, or the grass blades were too thick (and the carpeting was too level for overgrown grass at waist height or higher). The stone would look correct at just about any scale, and the trees could go either way.

      Delete
  6. Is it just me, or are the trees kind of... Well, to me they seem oddly far apart, regularly spaced, and of a uniform height. Maybe that's how some forests are, but it feels off compared to the Midwest USA forests I'm used to. Is there anything to this impression?

    ReplyDelete
    Replies
    1. You are right about this. More diversity is needed.

      Delete
    2. I'm not sure if it's that the trees are too far apart, more that the space between the trees needs to be filled with bushes and shrubs. In the majority of the forests I've been in you can rarely see more than 100m or so in a horizontal direction and most of the time it's more like 30m.

      Delete
    3. Well, just search for forest in Google images, and you will find heaps of forests with their trees spread out, I would say the exception would be a forest which is planted, or (sub-)tropical. But that is just a 2 minute observation without any actual research.

      Delete
    4. I'm sure you will find forests in Google that you thought the would not be possible to exist.

      Problem with synthetic reality is that it must look more real than reality. To put it in another way, what's real is not the goal, rather what we will perceive as real.

      In this sense I acknowledge this forest is flawed as some of the comments say. If someone points it out, it is really an issue. It does not matter if a similar forest exists in reality.

      Anyway this video was about the shadowing. I haven't addressed any of the real issues about the forest's variety in colors, sizes, etc. Also lack of under growth, even distribution of grass, fact that grass does not grow under trees, lack of butterflies, deer, gnomes, etc.

      All these comments really help, so please keep them coming.

      Delete
    5. Oh right, the shadow (Got distracted by all the other stuff going on >.>), So, is the shadow actually related to the foliage? Or is it just a random pattern which will appear in forested areas?

      Delete
    6. Yes, I use the crown blobs to cast the foliage shadows (you can see these blobs in earlier pictures). I saw that using the branch and leaves billboards was too noisy.

      Delete
    7. I completely agree, using the crown blobs is a great way to simplify and have it reflect the trees.

      Also, I was distracted by the video and forgot all about the shadowing... That is by far the best compliment your shadows could have, because they DIDN'T make me think of them, they just "looked right".

      The shadow on the monolith also looked great. Thanks for adding in a little "man-made" geometry into the forest, I can't waits to run across a ruin someday!

      If this is realtime (I'm assuming that means the light's direction can change in game, and cast oblique changing shadows based on realtime geometry), this is so much better than being stuck with pre-baked shadow maps!

      I'm so excited for this progress, CONGRATZ!

      Delete
    8. Right, this could have day/night cycles with no problem now. Or really long shadows in arctic zones.

      I still miss the mood and richness of the radiosity solution. I am looking into that as well. A realtime radiosity solution for the ambient light may be within reach.

      Delete
    9. Realtime radiocity would be stellar!

      If not, perhaps a hybrid would make sense, and/or utilizing the realtime light map's results to inform the locality and intensity of how much of the existing radiocity to let bleed into the render...

      But since this is in the vertex shader I'm not sure if that would work... I'm sure you'll think of something, either way what you did here was a huge breakthrough.

      Delete
  7. I've been following for well over a year now I'm sure! It keeps looking better and better! Keep it up! and can't wait to see what's next!

    ReplyDelete
  8. I wish you would post news every day! I know you probably have a life though, so don't force it :)

    Shadows are looking great!

    ReplyDelete
  9. Like Jonathan above, I didn't really notice the shadows until I looked for them. But will they work with the tree canopy moving in the wind?

    ReplyDelete
    Replies
    1. Yeah, same question here, it propably would look a bit off if the trees are moving in heavy wind but the shadows would not.

      I guess they do not move as the wind only affects the leaves right now and not the crown blob.

      Delete
    2. Yes, you guys are right. I could add some noise to that portion of the shadow. The thing is, if there is not much wind, the amplitude of the oscillation may be still smaller than the penumbra area. That means you would only really notice the shadow does not move if the wind is too strong.

      Delete
  10. I just finished reading the whole blog from start to end. Your work is incredible!
    One thing came to mind - are the algorithms you use for all this deterministic? E.g. if you happen to lose data for some reason (and have existing users that rely on it, or upgrade to better detail at some point in the future), would you be able to re-generate existing environments?
    And for that matter, do you happen to have some favorite generated places that you remember and come back to visit? :)

    As for the talk recording, to assure you'll get good audio just use your phone's voice recorder app and put it in your shirt pocket, and if video comes with bad audio you can just swap it with the one you recorded ;)

    ReplyDelete
    Replies
    1. It is fully deterministic, results are always the same assuming the input and the algorithms have not changed.

      There were a few places I liked and kept going back to them. After changing the code they are now gone forever.

      Thanks for the suggestion on recording audio. There are two problems with that: I don't own a cellphone, I do all my presentations shirtless.

      Delete