Forum Coordinators: RedPhantom
Poser - OFFICIAL F.A.Q (Last Updated: 2024 Nov 24 8:11 pm)
The simplest trick is PZ2 pose files. You can see several different methods in some of my scene sets:
http://www.sharecg.com/v/40425/gallery/11/Poser/Route-66
http://www.sharecg.com/v/47342/gallery/11/Poser/Arcade-Hotel
http://www.sharecg.com/v/65517/gallery/11/Poser/1940-Homette
In each, look for the LampOff and LampOn pose files.
My python page
My ShareCG freebies
Nails60 posted at 11:04PM Wed, 14 March 2018 - #4326098
If you mean so that you move the switch and this turns the light on or off I've seen a tutorial doing this using dependent parameters. I can't remember whether it was here at rendo or on youtube, but if you can find it it should show how it's done.
Just messed around with this method, and I think it's what I'll use. I can't believe it was this easy! Just never occurred to me that this could be done with lights.
Bumping this because I've hit another snag.
I've got three separate light control props for three different light areas, which is what I want. And for the most part, they work. They're set up so that by default, all the lights are on, and dialing them to 1 turns the lights off.
The problem is, once I dial them off, they won't turn back on if I dial them back to 0. Even CTRL+Z doesn't do the trick. I can't understand it.
The dependent parameters system (using "valueOpKey" statements) sometimes has that problem. It won't reset to zero or won't start at zero.
Try using the older valueOpAdd system, generally known as ERC.
Assuming your prop is called LightSwitch, and it includes a master parameter dial called LightsOn. You want the illumination of the Light to be 1 (or 100%) when the master parameter dial is set to 1,
Here's the code that would go inside the Intensity parameter of the light itself:
valueOpDeltaAdd
_NO_FIG_
LightSwitch
LightsOn
deltaAddDelta 1.0
```The 1.0 is a proportion, which in this case is 1 because the parameter dial and the Intensity both go to 1.
If you wanted the Intensity to max out at 0.4, the deltaAddDelta would be 0.4.
My python page
My ShareCG freebies
A more elegant method would be the "valueOpTimes" function which would even provide you with a dimmer, as well as avoiding the other problems.
First, make sure the light's intensity is set to 1 (=100%)
Then modify the code like this: (lines starting with // are comments and must not be added to the code)
// look for your light and go to the "channels" section:
channels
{
// groups declarations...
// and some variables follow...
// ...
// you are looking for THIS:
kdIntensity KdIntensity
{
name INTENSITY
initValue 1 // default value, set this to 1 !
// some more lines of code, ignore...
// ...
keys
{
k 0 1 // make sure the second number is 1 which equals 100% brightness
}
interpStyleLocked 0
// now add these four lines, directly below the interpStyleLocked 0:
valueOpTimes
_NO_FIG_
LightSwitch // *internal* name of your light switch prop
LightsOn // *internal* name of your light dial
}
// more code, ignore...
}
When the "LightsOn" dial is at 0.0 the light is OFF.
When it's at 0.5 the light is at 50% brightness, and ON
When it's at 1.0 the light is at 100% brightness, and ON
When it's at 1.5 the light is at 150% brightness, and ON
etc.
Maximum flexibility, ease of use.
Cheers!
K
Thank you for the suggestion, Karina! But unfortunately, I ran into the exact same problem when I tried it out: dial the lights up to 1, they're on; dial them back to 0, off; dial back up to 1, still off.
The key system is looking like the only viable option based on a small test I did. I wish I had a cheat sheet for that so I wouldn't have to redo it manually (it's over 80 lights).
Now this is really strange, because my method should work under any circumstances.
My only guess is that there are some dependencies in your document that somehow went bonkers.
Make a backup of your file, delete ALL dependencies that you can get hold of (use Poser for this), save it and then try to apply the code lines that I've suggested above to your document (in PoseFileEditor if you have!).
One of the main problems with lights is that if they do have a preset value in the lights parameters themselves,you may get weird results with "valueOpDeltaAdd" if you don't calculate the "deltaAddDelta" correctly!
Even with "valueOpKey" it may become complicated if you don't set all keys (esp. min and max values to the correct values, and it even becomes harder because the curve from one key to the next is interpolated as a bezier curve ~~~ by the program, which may oveshoot or undershoot the correct values for any settings in between.
_In short, you're about to open a can of worms here! _
Especially if you don't eradicate all the other (probably wrong) dependencies that you already have in your document.
Karina
That's the thing, I start with a new scene each time, so there shouldn't be any "leftovers" to worry about. And I've looked at the curves each time and it's always been a straight line.
I did just now get the Times thing to work on a test setup; I had been using negative values to control the dial, since I had removed the ERC control. So I guess that was the problem there. I need to link the ERC control to the Times setup, then?
I also have some lights that have to be set to 10%, since there are so many of them. Could that be messing something up?
You're right, negative values can be problematic esp. if you don't do the maths correctly (minus times minus equals plus, remember) So better avoid negative values at all.
To start with, create all your lights with a strength of 1(100%), then hook them to your main "light switch" by the four "valueOpTimes" lines as shown in my previous post.
After that you can switch all your lights on or off with your "light switch" (which, of course, is only a master dial in your control prop)
If you've come to this point and made sure that it works OK, then you can set individual lights to individual brightnesses as you wish (in the lights' individual settings). The light strength (or on/off) will still be controlled by the master dial because 10% of 100% light is 10% light, 10% of 10% light is 1% light, and 0% of all that is ALWAYS 0% light, thus, DARKNESS :)
That's the advantage of the "valueOpTimes" method because you don't have to fiddle with "valueOpDeltaAdd" numbers which are relative to the individual setting and can easily produce even negative values...
LATER:
After you've made yourself familiar with this method you can even add more "master control" dials to control groups of lights individually, e.g."all lights on left" or "all lights from above" etc.
The possibilities are endless, and it's so easy once you've understood the method. Unfortunately you can't do this directly in older Poser versions, so you must do it by directly editing the scene file as shown in my previous post. IT COULD work in Poser11 because from what I've read about it you can now also add "valueOpTimes" operators from within P11. But as said, I don't know.
Good Luck!
Karina
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
Is there a way of using a prop or something to control whether a light (or even multiple lights) is on or off? I'm creating basically a stage prop with a few different light sets/regions, and I'd like the option for users to be able to control each of them individually and easily. I'm guessing if this is possible it'd involve Python.