Notifications
Clear all

[Closed] Problem with Scrip Controller

Hi,
I have a problem with Script Controller:
in my scene I have about 1000 streetlights. When my car is near enough the light gets on and brighter and when the car is far away the light gets off again. So I use script controller for every light which reacts on the distance of the car. When I change the timeslider everything works fine, but if I render a sequence only the first frame works but the other will not.
Can anybody help??

5 Replies

It seems the light .enable property will not be updated during sequence rendering!!

A sample file can be downloaded here :

www.beyond-reality.de/Script_Controller_Problem.zip

the script is on a custom attribute.

Hey sfrey,

I have been working script controllers for the past year and sometimes it is hard to track down the error.

I looked at the file and my solution would be to put the script directly in the multiplier attribute and not in a custom one.
I put in the following code and it turned on and off both in the viewport and in the render.

=== script code ====

multValue = (1-((distance $Dummy01 $Fspot01)/190))*5

if multValue <= 0.001 then (
multValue = 0.0
)
else if multValue > 1.0 then(
multValue = 1.0
)
else(
multValue
)

=================

Instead of enabling / disabling a light, just work with the multiplier value. Hopefully this will be of some help.

one more thing, if you use the above code, make sure to turn the line on because in the test file, it is turned off.

  • bret

Thanks for the reply, but the problem is I need to turn on/off the light, because I have 1000 and when all lights are on 1000 shadowmaps will be calculated, even if the multiplier is 0. The rendertime rises from 1 min 30 sec to 13 min!!!
So I need to turn it off.

Based on what I’ve seen, I don’t think you can animate the enabling / disabling of a light. If you turn on autoKey and try turning it on / off, you’ll see that no keys are created.

Also, if you look at the light’s controllers, you’ll see no controller for on/off.

I could be wrong, but I came up with one avenue to explore.

After the sequence is set, using the multiplier script, you can create a .ms script to handle the rendering of the scene instead of max. Here is a script that when executed, will render out individual bitmaps with the light being turned on/off when needed. But you will have to then put the .bmp files back into an .avi. Also, look into the render settings to set more specific information, but that would be my solution.

  • Bret

for i=0 to 100 do (

sliderTime = i

if $Fspot01.multiplier > 0.1 then (

$Fspot01.enabled = true

)
else(

$Fspot01.enabled = false

)
render outputFile:(“c:\ est est” + (i as string) + “.bmp”) vfb:off

)

Thanks a lot, I thought about it too, but I cannot render over network. I have many scenes with many layers. So that’s not a solution.

My workaround is now to check in each scene which lights are going on and delete the others. So I have about 200 lights instead of 1000. This is the only solution, I think.