View Full Version : overlapping shadows in Maya

08 August 2012, 12:45 AM
Hi, im doing some lighting in Maya, and trying to master depthmap shadows.
I have several spotlights directed towards different locations and made a lighlinking system. What i have found is a challenge is overlapping shadows, like in the attached image

The Image (

I have read something about overcoming this by editing it in the postproduction and photoshop, etc. But im just wondering if that is the common way of doing it?? I just thought it seemed strange that its not possible to make it perfect inside Maya....

Thanks for answers, i appreciate them

08 August 2012, 02:13 AM
Assume that's sun light, you'll only have 1 sharp shadow from the sun. The sky itself will reflect light on your object from every direction, producing very very soft shadow. You can mimic it by using lots of lights with high filter size value. Look at this script for example.

08 August 2012, 09:05 AM
thank you, but mayb i didnt explain my problem well. The reason for the overlapping shadow is that i have several spotlights from the same direction, making the sunlight. And each spotlight is pointed at different smaller areas (because if i only use one spotlight for depthmap shadows it would create inaccurate shadows). So the overlapping comes from me linking several spotlights to different models.

Hope this is clearer

08 August 2012, 10:26 AM
Hi Xetil. Sorry if I misunderstood.

I'm still trying to imagine the lighting you're going for. You said it's a sun light, I don't understand why you have lights shining from different direction. What was 1 light doing that you said was inaccurate?

08 August 2012, 08:54 AM
Well, the different lights arnt coming from different directions, but i have different lights with the same rotation (so they are coming from the same direction to mimic the sun).
My scene was pretty big, so if i tried to make depthmap shadows for the whole scene, with only one light, the shadows did not become accurate. So i read that if i focus several lights on different parts of the scene, the shadows will be better. This is why i linked lights to different parts of the scene, and why the shadow overlapping happens.

08 August 2012, 09:16 AM
I see. I've been trying out a few things but haven't found a way to merge shadows.

I think for this particular scene it might be better to use 1 directional light with raytraced shadows. If you want to try it with spotlight and depthmap shadow, I think you will still get better result with 1 light. Position it further away, narrow down the cone angle and set depthmap resolution a bit higher, like 2048

08 August 2012, 04:53 PM
increase the resolution of your shadow map using an infinite light, don't go using multiple lights, and for a sun don't' go using a spot light unless you plan to pull it really really far away

08 August 2012, 10:45 PM
Thanks for answers. Thing is, im not expert in lighting. But i read that spotlights can save render time when using depthmap (because it uses a smaller area in the scene or something like that, rather than directional light), and in the case of making sunlight, it has to be far away. However that also causes problems with the shadow, wich forced me to place multiple spotlighs for smaller areas.

I have only one spotlight far away (with no shadow), while all the other lights are directed to smaller parts, making this a really bad way to do it? Does it matter alot on rendering time, etc, for example?....Im just trying to learn some good techniques. Raytrace will be next im sure, but for now i want to know what depthmaps are about :)

Thanks again, i appreciate your answers alot!

I will however try some of your tips as well..

08 August 2012, 02:21 AM
Generally you'll want only 1 light acting as the sun which cast sharper shadow (high resolution, low filter size). And multiple lights acting as the sky, each not so bright and cast very soft shadow (low-mid resolution, high filter size.)

Take a look at this as an example of multiple light acting as sky light.

08 August 2012, 10:35 AM
thank you:) Ill do some more trying

mr Bob
08 August 2012, 03:50 AM

Sun = 1 light, normally directional expect to render a 4k map plus on large scenes . You can merge deep shadow maps, you just need to have the tools to do it. Im not sure they are open and freely available.


08 August 2012, 10:59 AM
If you are going to use a spot light for the sun and want to use a depth map then before increasing the resolution of the map bake your depth map out to a location and switch off auto focus if its on. Then play around with the focus till you see that the depth map has the object(s) you are lighting as large in size as possible . This will ensure you have the maximum resolution for the object shadows. That's all I have to add apart from that everyone else covered almost everything.
All the best

08 August 2012, 02:29 PM
1. As everybody else also mentioned. This is not the best way to go for sunlight. You must be able to decide which shadow technique to use in different situations. Depth map is not always the answer.

2. In your render, the lights ARE coming from different angles. You can see the wooden roof shadow is going downward on the wall beneath it. But the shadow from the left wall is going on the right wall! and the shadow from the bottom door frame is going upward! This means the shadows are not parallel, as it would be with the sun.
I know the spot lights have the same rotation settings, but they are probably too close to the building to look like they are coming from the same source. It's ok if the spot lights don't share the same rotation angle, but cheat and make them cast shadow in the same direction.

3. The idea to break down the sunlight into different spot lights works well if your objects are far away from each other and not over lapping like this. You should use a single spot light for this whole building, and another one for a next building.

08 August 2012, 10:26 PM
thanks alot for answers

CGTalk Moderation
08 August 2012, 10:26 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.