Mixing two Shadow Maps together with an Effect.fx technique

I’m sending the Shadow Map last when rendering my 3D world in another Shader, that is working with one Shadow Map so it should work sending the merged one too, that’s why I’m certain the problem lies within the code that I’ve shown you.

I got it working now, I changed things around and now it’s working.
But the sad part is that it’s taking too much FPS away I had around 98-100 before and with this approach I’ve got around 60-67 FPS, that’s not good. I knew it was going to be a load but not this much, I could certainly make the code more effective but mmm nope.

I have another approach which I’ve been trying to accomplish, but all in vain every try.
Would like to mix the two different light view matrices together within the Shader rendering both of them into one Shadow Map to gain speed that way but it seems I’m not able to rap my head around it.

Maybe some parts of your shader can be optimized, as well as the culling of objects if you have a huge amount.
What is the resolution of your shadowmaps ? Above 1024x1024 it can start being really slow.
A profiling could help you find where you loose speed.

My settings are for the moment…

const int cTa_Width = 1400;//1920;//1000;
const int cTa_Height = 800;//1080;//1000;

You’re right there might be plenty to do but I doubt that I will reach a point where it will be sustainable anyway, sadly. Maybe that I’m just too pessimistic for the moment because all the set backs, culling might be the key because I’ve not implemented it at all yet.

I’ve just tried to render two lights from within the Shader to one Shadow Map, that would just be something but my head is not enough. I just can’t do it, I’m stubborn but.
I’m afraid I’ll have to step down and continue to use the merging of Shadow Maps again, but my game is going to have several lights and if two are dragging the FPS down what will several do?? :open_mouth:

Am I missing something? I don’t get the point to mixing shadow-maps outside of directional shadow map cascades.

When used correctly shadow maps are just masks for each light’s pass. Combining multiple lights into one pass should just be binding their textures and setting up the uniforms for that particular combination.

No you’re not missing anything,
Please tell me more.

Regards, Morgan

What type of shadows are you trying to do? More importantly, are you using a sane resolution for your shadowmaps?

Shadow performance comes down to resolution and how many shadow casters you have to render. Unless you’re deviating from the canonical forward rendering loop then shadow receivers are pretty meaningless in the numbers.

Packing your shadowmaps on the GPU isn’t really going to get you anything. Samplers and texture fetches in an effect aren’t expensive enough to warrant the blitting.

If you are packing multiple directional shadow-casting lights into a single Effect then just include the appropriate additional samplers and techniques.

It’s really only cascading shadow maps that you have some sort of packed multiples of maps, but even then you use viewports into a single render-target for each of the cascades to render them. You don’t care about mips anyways since they’re shadow-maps and you want to use the more expensive filtering on those depth values.