Shadow performance!

Hi! I got a problem! I need to make nice game scene, but for that I must reduce shadow bias. However, if I do, it get’s a bug with a lot of tiled strips on flat faces(IDK why, but few of Minecraft shaders got the same). So when I set it to variance shadow, it disappears. Altternative is to increase shadow size from 512 to 4096. Now I got question- which shadow got better performance- 512x variance or 4096x simple?

I have had this too and that might come from the latest versions of Blender that are still full of bugs… Normally it only appends if your light source is perpendicular to the surface, you always have this problem wherever you put your light ?

Not always- it is according to light angle(if it is more than 140d it starts) in spotlights, but in variance or higher resolution it fixes. Actually, I wanted to use sun once, but I found out so it doesn’t cover all the map with shadows- just a small rectangle(like 20x20)

No, this phenomenon doesn’t come from the latest versions of Blender. It’s a problem seen in many games and 3D applications. The effect seems to be known as a moire pattern, but I’m not sure on that.

Anyway, try messing around with the shadow bias and other settings. Not sure which has better performance, but 4096 seems really high for simple shadows. Are you sure they need to be that large? Couldn’t you also lower the shadow size to get better looking shadows?

EDIT: You’re not trying to shade an entire map, right? Generally, you should attach the sun lamp to the camera (vertex parented if your camera’s going to rotate) and adjust the shadow size to be as large as you need it to be.

  1. Tiled script caused by shadow bias - too big object.
  2. 4096 is huge. I’ll use 256 and parented light as SolarLune said.
  3. Bake shadow for static objects.

Well, if my sun/spotlight is moving? I want my lamp to be swinging. Sun should have day-night cycle… Anyway, I found a good setup for spotlight and the idea for the parented sun is quite good. But I still want to know- which shadow works better- variance 512 or 215 or simple 2048 or 4096?

You can’t always bake your lighting, but if you can, it can be a pretty good idea.

Why don’t you test it? Unlimit the FPS, make sure you don’t have other things pulling on the CPU (physics, logic), and do tests with a large number of shadow-enabled lamps.

Try to increase “near” value of lamp

I would vote for baking shadows as well. It all depends on what your goals are:

Unless a dynamic day/night cycle is absolutely vital to your game’s mechanics it probably doesn’t need to be there. How long is your day? How long do you expect your player to be in your world at any given time?

And if you are using a dynamic day/night cycle, is it vital to have accurate projection of shadows? Would a simple change in ambient lighting, coupled with baked AO, be enough to convey the effect?

Just because your game takes place in a world which has real-time shadows, doesn’t mean your game NEEDS real-time shadows.
Just because every next-gen AAA title has real-time shadows doesn’t mean your game needs real-time shadows.
Real-time shadows are not by default ‘better’ than static/baked/no shadows by any means.

Now, don’t get me wrong…I’m a huge fan of real-time dynamic day/night lighting and all that (it was the only thing that kept me going through Gothic 4…ugh…), and I’m not trying to tell you to just forget about shadows. But you should seriously consider if it’s a feature you need, or a feature you want. If you don’t need it, it may not be worth the time and work to have it.

If you find you do need them, be prepared for a lot of tweakage and fiddliage in order to get it to look decent. And don’t expect to get results much better than decent.
Also, I have a .blend file or two where I’ve attempted a similar system. I could share them, if they would help.

((sorry to sound so harsh. I will go have my coffee now…))

Well. For me it sounds easier to have dynamic shadows than baked. Of course, they decrease performance. However, if I use variance and 256 sized shadows, they still look good as inside shadows, but outside shadows requieres at least 512 to look good!