Light and Layers

If you feel like you're up to the challenge of building your own Ages in Blender or 3ds Max, this is the place for you!

Light and Layers

Postby dendwaler » Sun Oct 10, 2010 12:17 pm

A (Sun) light normally effects the lightning in the whole world.
In Blender is an option that to let it have only effect in the same layer as where the light is in.
I want to make use of this option and want to exclude the sunlight inside closed buildings, but I don't succeed nor see any difference in Plasma.
May be I do something wrong but I wonder
Is this option supported in PyPRP?

if not, is there a known workaround?
Those wonderfull Worlds are called " Ages" , because that is what it takes to build one.

Image

Watch my latest Video Or even better..... watch the Cathedral's Complete Walkthrough made by Suleika!
User avatar
dendwaler
 
Posts: 879
Joined: Mon Jun 22, 2009 10:49 am
Location: Nederland

Re: Light and Layers

Postby D'Lanor » Sun Oct 10, 2010 3:06 pm

Nope, PyPRP does not support that. If you want to control which materials are affected by a light you have use light groups.

And (as you probably know already) if you want to limit the effect of a light on the avatar you use soft volumes.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: Light and Layers

Postby DanTheMystFan » Sun Oct 17, 2010 12:35 pm

If you're interested, I have modified my own PyPRP copy to assign lights to objects based on any group an object has in common with a light. In prp_DrawClasses.py, replace this:

Code: Select all
            # Only add lights for this icicle if we are not "SHADELESS"
            if not mat.mode & Blender.Material.Modes["SHADELESS"]:
                if not lightGroup == None:
                    # if a lightgroup is set, use those lights, else use all lights in the page....
                    for pllamp in lights:
                        for lobj in list(lightGroup.objects):
                            dataname = lobj.getData(True) # First param sets return of name only
                            if str(pllamp.data.Key.name) == lobj.name or str(pllamp.data.Key.name) == dataname:
                                mylights.append(pllamp)

with this:

Code: Select all
            # Only add lights for this icicle if we are not "SHADELESS"
            if not mat.mode & Blender.Material.Modes["SHADELESS"]:
                for group in Blender.Group.Get(): #get list of groups
                    if obj in list(group.objects):
                        #current object is in current group
                        for pllamp in lights:
                            if (not pllamp in mylights):
                            #go through all lamps not already appended
                                for lobj in list(group.objects):
                                    if str(pllamp.data.Key.name) == lobj.name or str(pllamp.data.Key.name) == lobj.getData(True):
                                        mylights.append(pllamp)


EDIT: One other thing--if you've installed PyCo, you have to delete all the .pyc files in the PyPRP directory before this change will take effect.
The other thing you should know is that by default, *no* lights will affect any objects--you'll have to put all of your outdoor objects in a group with your sun and your indoor objects in a group with your indoor lights.
Also, as was mentioned, this won't affect avatars--you'll have to use SoftVolumes for that.

EDIT2: One other thing I should add--if your sun(or, for that matter, any of your other lights) doesn't animate at all, you should probably just use vertex painting to simulate the effect.

EDIT3: Unlike the current code, my code uses the groups under "Objects and Links," NOT lightgroups.
User avatar
DanTheMystFan
 
Posts: 24
Joined: Sat Aug 09, 2008 9:42 am

Re: Light and Layers

Postby dendwaler » Tue Oct 19, 2010 11:12 am

Thx for sharing this code!
I am going to play with it next week and hopefully i can benefit from it.
Those wonderfull Worlds are called " Ages" , because that is what it takes to build one.

Image

Watch my latest Video Or even better..... watch the Cathedral's Complete Walkthrough made by Suleika!
User avatar
dendwaler
 
Posts: 879
Joined: Mon Jun 22, 2009 10:49 am
Location: Nederland


Return to Building

Who is online

Users browsing this forum: No registered users and 3 guests

cron