I have a scene were the map or “world” uses lightmaps, and the dynamic objects are using a direction light. If I don’t set the light mask for the map ,and the map uses the difflightmap technique. Does that dynamic light in the scene still affect the map even though it is using static lighting?
Some of my test appear to show that it is still affected.
I believe the static meshes are still affected. If I turn of shadows for the static meshes it helps, because the shadows are in the lightmaps. But like in another topic on the forums dynamic objects can no longer cast a shadow on the static mesh.
I feel like having the lightmaps is kinda pointless, because the dynamic lights are still affecting the static meshes.
Yes. As i said above you can’t have dynamic shadows on lightmapped meshes. You can hack out some shadows by baking indirect lighting only and use dynamic lights for direct lighting. It requires a bit extra work to sync light intensity/radius/color to match your lightmap.
Edit : Here’s how i did it. Only the GI and AO are baked , the direct lights are dynamic.
If you don’t want any dynamic object to cast shadows on your lightmapped level then nothing.
Hovewer this will look absolutely bad and unrealistic (the players will look like they’re floating in the air , physics driven dynamic objects won’t fit in the environment without shadows)
A lighmapped levels are completely useles because you loose : dynamic shadows , specular mapping , normal mapping , etc. If you don’t need dynamic effects then it’s fine , but if you want some of these effects then you must use the method i described in my previous post.
If you disable shadows the level will be still affected by your directional light.
I know if I disable the shadows for the static level, but still keep the one directional light, and use the baked shadows. Would this not cut some of the performance cost on the directional light on the level mesh.
Unfortunately that will ruin your baked shadows. Elements that were casting shadows in your lightmapping process won’t cast shadow by your directional light so the light will override all you baked shadows in the scene and your brighter areas will become even more bright (due the light’s additive pass)
The only solution is as i described above. Bake indirect lighting and use dynamic lights for direct lighting.
There are no other options in Urho right now. AFAIK unity suffers from the same problem.
Another options would be projectors but Urho currently does not support projectors. You can turn lights into some basic projectors but they will have some issues which pretty much makes them unusable in complex scenarios
I have no idea. Unfortunately i’m struggling with the same problem since the beginning so i absolutely understand what you feel… I did a lot of research about these things but there’s no clear answer. AFAIK older PS2 games had some basic volume shadows which were projected onto static scene by subtracting the shadow color from the pixels they affect. This method is really great because shadows doesn’t depend on light pass. Wherever you walk in your level , even in the darkest parts which are not reachable by any lightsources your chartacters/ dynamic objects will always cast shadows (since they are subtractive).
The problem is : I have no clue how to implement something like this. I’m still very unfamiliar with urho’s rendering pipeline. I wrote some basic shaders but for something like this we need someone who knows urho to it’s bones and knows exactly how and where are lights/shadows calculated.
The topic was already discussed long time ago and there were no solutions since then.
I’m not so sure that will work? It does not say if the mesh behind the character is using static lighting. When I get time I am going to try some of these ideas. Can you find me some more info on the shadow volumes you mentioned above. I believe in the documentary on Halo 2 they mentioned the pelican generating massive shadow volumes. If I can get just shadows for the character I would be okay with just that.
Yes it does. That is a lightmapped quake3 level. The only thing he should do is disable dynamic shadows on the level and it should work. The character would cast a subtractive shadow on the lightmapped level.
To implement something like this would require to rewrite the whole engine to it’s core so i don’t think anyone will do it.
Well all i can do is add some advice about this.(This is how i would do if i knew the engine)
Draw everything that is static (with all default urho passes no modifications needed)
Draw dynamic objects from your “shadows only light” point of view using a RTT with black color as background and a shadow color as the object diffuse.
Repeat this process for all your “shadows only lights” in the scene.
Transform these RTT’s into your camera’s current frame (Pretty much the same way as Urho’s light work) Use the depth buffer to project the RTT onto the scene using subtractive blending.
Draw dynamic objects.
This way static lightmaps should be untouched but still have projected shadows. I don’t know how to do something like this but maybe it is possible with some renderpath and built-in shader modifications.
EDIT : This could be a pretty fast process since you don’t need depth buffers for stage 2 and “shadow only lights” do not need to render the static scene which would be a extreme speedup…