"Variance" Shadow, whats the point?

Hey,
As the 2.64 release is out now we all got excited about the new features in the BGE.
Though I love those additions Ive been wondering about the new “variance” shadows.
I tested them and I dont get what they are good for.

I am no “shadow expert” but as far as I know shadows are darker the closer they are to another object and they are brighter the further they are to another object.
“Variance” though does the exact opposit, so objects that are near to each other produce a brighter shadow.
That doesnt make sense and doesnt look realistic, so what is the point?

The shading did seem a bit backwards to me too, as you mentioned. I’m no lighting expert either, though.

Variance Shadow has a cool looking effect, but it’s not something I would consider using if I wanted more realistic shadows… especially in areas where the player’s attention is going to be drawn to.

Shadows are cast in a pretty weird way too, which shows details in the shadow that really shouldn’t be there. Like in this picture where Suzanne’s eyebrows cast shadows as if the mesh is transparent:
http://i.imgur.com/R7TGs.png

Perhaps it can be used for something else. I would be interested in hearing ideas about it.

Try lowering the Bias to around 0.5 and increasing the Bleed Bias to around 0.2. Play around with those figures to get the result you want.

Ex.

Variance shadow maps are actually quite cool. You can have pretty low resolution textures but still get pretty high quality shadows.

It’s important you tweak the Bias and Bleed Bias values.

Also, pull the shadows back so that they really turn to full effect. If they’re too close to the objects, their shadows turn sharp, like normal buffer shadows. I might be wrong, but I think the point is to have softer shadows, as well as higher quality shadows closer to the camera.

For the BGE, they are more close to other proprietary engines shadows, they are pretty cool,
z-buffer shadow looks like a dropped black texture lol, this one blend very soft, no fps impact.

As far as I know it does take up a bit more video memory but I could be wrong.

@ Piccobello and Riyuzakisan, you both are right.
In reality, the closer shadow to the object, the sharper dan darker it should be. Variance shadow just ‘act’ the opposite. I found this odd behaviour a while back, and i expected to see some… negative value in the setting. Or something else, to invert the shadow effect. Unfortunately i couldn’t find it, and i guess such feature doesn’t exist yet.

I hope developer could tell us what is the reason behind this. Although it’s not realistic, i still really like this variance shadow btw. This feature is really cool, sometimes i’ve even used it in my modelling process :D.

Dont like VSM, go use the old one that looks like a game engine from 2002.The dev has no reason to give any explanations.

Thanks for the input
I hope no one got me wrong, I really like “variance”. If it were possible to invert the effect they would give a quite realistic visual :slight_smile:

Actually, part of developing new code is explaining to users what your code does. Saying a developer has no duty to explain the best use of this shadow implementation is silly.

Well its easy to figure out by yourself, soft shadows,that all. Since this is not something complex,it doesent really require some extra explanations.

@m9105826 - Blender is open-source software, and so documenting the resulting behavior could be another person’s job - just update the Wiki with information on how to use the new feature (if anyone can update it).

@BlendingBGE - While I see what you mean, BlendingBGE, dConclusionman was asking for clarification on something he observed, which could be a bug, not explanation of how to use the feature. That behavior sounds familiar, and it does sound a bit off. He also said that he likes variance shadow maps.

In any case, perhaps Kupoman (one of the developers, if I recall correctly, who worked on variance shadow maps and sun shadows) would be interested in your question, dConclusionman.

Ok, so… a few years ago, from the perspective of an artist without programming knowledge, i did a little bit research about shadow in real life. In the middle of it, i found this article (just in case someone wants to know). And it’s pretty much explained what i wanted to know about shadow.

And here is some shadows i created with blender in the same scene, with the same light source: spot light. (I added a little bit environment lighting in the first image so the shadow not 100% opaque):


When i found out about variance shadow in BGE, i didn’t report it immediately, because:

  1. Personally, i don’t think it’s a big problem, especially compared to the other project the developer working on currently. So, i don’t want to disturb them with this insignificant issue.
  2. I still don’t have a real project yet, that desparately needs this issue to be fixed immediately.
    But since someone elses noticed this as well, and posted a thread, i guess is okay if i joined in.

Yeah, thanks SolarLune. I was confused about who was the one developed this feature, Kupoman or Moguri. Just in case he don’t read this thread, i hope i don’t disturb him too much if i PM him, while this thread is still alive.

Moguri worked on this part of the project, though I can tell you variance shadow maps work better with a much lower bleed setting than the default (which is for the simple shadow maps). I believe VSMs were added to provide a soft shadow, and they typically require a smaller texture to look good. Or they may have simply been added because Moguri was curious and felt like playing with shadows.

dConclusionman

I lowered the bias and increased the bleed bias, which had the biggest impact. As higher the bleed bias gets, as more the mentioned fading disappears.


And I want to say how much I love the variance shadows. It’s a great and really valuable contribution for the BGE.

Edit: Seems Kupoman was a bit faster with a possible solution

I implemented variance shadow maps partially as described here: http://www.punkuser.net/vsm/. As you can see, the shadows look similar. I think the lighting is more a result of the diffuse of the material affecting it (in other words, the light is lightening the shadow).

Also, it is generally more helpful to mention problems with features before a release.

@ Kupoman, thanks for the quick response.

@ JuicyVitamin, that’s a nice result.

@ Moguri, ok, i think i understand now. So, the object doesn’t block the light like in real life, and make the shadow close to the light source, got brighter. That make sense, thank you for explaining that.

Ahahah… yeah, sorry about that. You can see my reasons in my previous post. I just don’t want to bother you (and other developers) with insignificant issue, while you guys working on more important tasks, that’s all. Compared with the bugs some people reported, i think this is not a big problem.

I joined this discussion only because someone else started this thread. Other than that, i still can’t find any other issue/ bug to report, because i still don’t have a serious project with BGE. At least for now :yes:.

For best results decrease bias,increase bleeding.

Don’t increase bleeding too much though or you’ll get bleeding artifacts when you move the light away from the object. (flashlight parented to player is a good example, just look at an object and walk backwards while having the light pointing at it)

I think VSM has potential. Just make sure you find a good balance for the Bias and Bleed Bias values and you’re going to be fine.