Scaled Vray lights - best way to fix for animation?

Hi All

I hope you can help me.

We are currently prepping a lot of old scene files for animation, and unfortunately they have all been made with Vray lights that were instanced and then scaled (using the 3ds max scale tool) to fit around non-uniform objects.

I discovered this was causing a lot of noise and flickering when rendered for animation.

When I re-made all the scene lights without any scaling the noise and flickering went away, however this very is a time consuming process, and I have a lot of scenes to work through!

Is there any way to reset the scale of the existing lights? I’ve tried to reset xform but this just resets to their non-scaled size, It’s also been suggested that use ‘Reset Scale’ in hierarchy panel, but I’m not sure if this would work…?

Thank you for your support;

Run this script:


for each in objects where classof each == VRayLight do (
    case each.type of (
        0: ( --Plane Lights
    adjustedLength = each.scale[1] * each.size0
    adjustedWidth = each.scale[1] * each.size1
    each.size0 = adjustedLength
    each.size1 = adjustedWidth
    each.scale = [1,1,1]
    )
        2: ( -- Sphere Lights
    adjustedRadius = each.scale[1] * each.sizeRadius
    each.sizeRadius = adjustedRadius
    each.scale = [1,1,1]
    )
        4: ( -- Disc Lights
    adjustedDRadius = each.scale[1] * each.size0
    each.size0 = adjustedDRadius
    each.scale = [1,1,1]
    )
    )
)​​

Presuming the scaling of the lights is uniform, it will multiply the length/width/radius of the VRayLight by the light’s X-scale and afterward reset the scale to 1.

Try it on a simple scene first.

EDIT: Added a UI. Check the attachment.
ResetXForm.7z (789 Bytes)

Thank you Aleksandar!

In this case most lights are instanced and non-uniform scaled. Here’s a modified version that also caters for that.

-- Fix Scaled Instanced VRay Lights
-- Select all scaled VRay lights and run this script

for obj in selection do
(​
-- Store current properties before making unique
currentScale = obj.scale
currentLength = obj.sizeLength
currentWidth = obj.sizeWidth

print ("Processing: " + obj.name + " - Scale: " + currentScale as string)
​
-- Break instancing
instanceMgr.MakeObjectsUnique #(obj) #individual

​ -- Apply scale corrections based on light type
case obj.type of
(
0: -- Plane light
(
obj.sizeLength = currentLength * currentScale.x
obj.sizeWidth = currentWidth * currentScale.y
)
​2: -- Sphere light
(
avgScale = (currentScale.x + currentScale.y + currentScale.z) / 3.0
obj.sizeLength = currentLength * avgScale
)
4: -- Disc light
(
avgRadius = (currentScale.x + currentScale.y) / 2.0
obj.sizeLength = currentLength * avgRadius
)
)

-- Reset transform scale
obj.scale = [1,1,1]
​
print ("Fixed: " + obj.name + " - New size: " + obj.sizeLength as string + " x " + obj.sizeWidth as string)
)

print "Completed! All selected VRay lights processed."  ​ 
```​​