VrayLight multiplier 0

Hi,

I while back I asked why when a VrayLight’s multiplier was set to 0.0, it took the same time to render a scene as when the light was on, give or take.

In the newer versions Vlado fixed this and the render time now is much nearer the time I would expect from the scene with the lights deleted.

However, while the speed increase is much better, its not the same. Is there a way to completely remove the lights from the process when they are set to 0.0? Im being fairly picky as in my currect scene, the full lite scene is 1.50, with the lights deleted is 1.18, and with multi of 0.0 is 1.25.

I am only asking as while its a great inprovement, the seconds all add up on thousands of frames!

Thanks

for i in lights where classof i == vraylight and i.multiplier <= 0.0 do hide i

Running this will hide any vraylight which has a multiplier set to 0.0 OR BELOW

Change <= 0.0 to ==0.0 if you want to hide only the ones which are exactly 0.0

Thanks Lele,

Ill try to explain a bit more, as you have understood slighty differently what I am after.

I want to have a single path camera moving through a long tunnel, and as lights are past, Ill animate them to 0.0 (meaning they will be removed from the render process and therefore render quicker) I have found that a scene with 100+ lights even tho only maybe 10 are effecting the visible scene, will render much slower than when I turn the lights off as the camera passes them and they have no visual effect again. Sometimes the render saving is a lot.

I am basically asking while when the light is set to 0.0, it still has a little effect on render times compared to the light being hidden or deleted.

I think I explained a simple point a bit over complicated, but hope it makes semce now!

The script is very handle tho.

Thanks

Obviously there is always going to be some overhead if a light is set to 0.0 instead of just being off, the renderer is going to have to check all lights that are turned on to see what their multiplier is every frame or else it would never know if you turned it up again…

Instead of fighting this, I highly recommend that you find a better way to do what you want. I’d probably include a callback script that hides or turns off the light when the multiplier hits 0.

yeah, I was just being picky. Vlado has already sorted out the main problem that a light at 0.0 was taking the same time as a light on 50 say. I just wondered why there was still an overhead, which is in the render process not the setup of the file.

I like the idea of a script running that would turn off the lights when set to 0, and back on when above. Ill have to have a look for one!

Thanks

I don’t think you will find a script to that.

The script Lele offered is most of the way there just needs to be written as to be called at each frames render. We can probably get you going here, I don’t have time to do it right now but I will try to fit it in, unless someone beats me to it.

wicked, that would be a great help.

fn hideTheUselessLights = (
for i in lights where classof i == vraylight and i.multiplier <= 0.0 do i.on=off
)
callbacks.addScript #preRenderFrame "hideTheUselessLights()" id:#theLightHider

Run this, and it will turn OFF the lights (rather than hiding them) if they have a mult value <= 0, on a perFrame basis

callbacks.removeScripts id:#theLightHider

Run this one to stop it from doing it.

I’ve had a play with the scripe and it workd really well. I have tried to ammend it so that when you go to a point where the light has a positive mulitplier again, the light will be turned back on. BUT I cant!! Can you shed sone light Lele?

Thanks

run the other line, and then it’ll work, i guess.

ha ha, I have worked it out. I make a new script and run this

fn showTheUselessLights = (
for i in lights where classof i == vraylight and i.multiplier >= 0.01 do i.on=on
)
callbacks.addScript #preRenderFrame “showTheUselessLights()” id:#theLightShower

its all working v good!

A scripter is born :grin:

Ahah, glad of it 8)

ha ha, Im glad of it too! I love it! I am not mathematically minded, so I think Ill learn slow!

Scripting at this level is mostly pure lexical logic, so no fear of meeting hard maths anywhere.
As for the being slow, I wouldn’t count your first step as a slow one…
It’s taken me a good few years to get anywhere (from the first looks at the beast to actually managing anything marginally useful through scripting), and i wouldn’t call that “fast” :slight_smile:
So at the very least you’re in good company :wink: