Excluding objects from casting shadows with python?

Hi everybody,

I am not able to get this work. :-/
In my scene there are 2 lights: 1 hemi and 1 spot.
I want the spot to be shadow-only, that works fine.
Now I want to limit that shadow-spot to certain objects (the bike). And that’s where I am stuck. As you can see on the screen below, the tree is casting a shadow on the ground as well as on the bike. That is what I need to get off.
I tried to limit the light to the layer, I tried to put it in a group…
Any hint what I am missing here?

Thanks in advance,
Quen

p.s. I’m using 2.49b

Attachments



You need to activate the button “Layer” in the Lamp settings. Then move your bike in another layer as the lamp is. Hope it works.

Thanks for the hint.

This is really strange: it does work for the bike the way you described it. But I want to keep the bike shadow and remove the tree shadow. So I just moved the trees to another layer as the lamp is, but they still cast shadows! O.o
For a test, I appended the tree into a new, clean blend-file and there it worked. This is weird.

Ah found it finally…
I wrote a LOD script that uses the obj.visible prop to show and hide trees. When visibility is enabled this way, it does not seem to belong to a certain layer anymore. If I disable the script, it works :slight_smile:

Does anybody know, how to disable the shadow-cast or move the object to a certain layer via python?

By adding your object to the scene, you could do something like that:

newObj = sce.addObject(object, owner)

the owner object can you place in the layer which you want, so the new added object will be then in the same layer as the owner.

Thank you for your answer strub. I will try that tomorrow, leisure-time now :wink: