AWS Thinkbox Discussion Forums

VRayLightMix and Tile rendering assembly issue

Hey all, I noticed some issues when using tile rendering and having VRayLightMix in the render elements.

When you have VRayLightMix in the render elements as I see in the “SubmitMaxToDeadline_Functions.ms”, the deadline is adding all of the lights from the scene in an array which then is used to generate the assembly config files for the tiles. This is not the correct way of doing this in my opinion because VRayLightMix Layer doesn’t show off lights or lights that are not visible (if you uncheck the hidden lights from the settings) and if the lights are instances it will show only one of the lights in the VRayLightMix Layer.

So I edited a bit the “SubmitMaxToDeadline_Functions.ms” to make sure the deadline gets the lights from the VFB VRayLightMix Layer.

				VRayLightMix:
				(
					-- VRayLightMix always outputs an Environment lighting pass and a Self-Illumination pass.
					-- It also writes a Lighting output pass for every scene light, regarding of its class and whether V-Ray supports it.
					-- The Lighting passes are named based to the Light objects' names.
					-- If two Lights have the same name, only one output is written with the contribution of just the last created light.
					-- If a name contains invalid characters like * or \, V-Ray will fail to save, so no need to clean them up here either.
					local theList = #("Environment", "Self_Illumination")
					
					-- Georgi Marinov EDIT [12.06.24] bug here. This code is adding all lights in scene but it should add only the lights from the lightMixLayer
					--for aLight in lights where classof aLight != TargetObject do appendIfUnique theList aLight.name 
					
					-- Georgi Marinov EDIT [12.06.24] This should fix the issue. Gets the lights directly from VFB
					vfbLayers = (vfbcontrol #getlayermgr)[1]
					for propertyName in vfbLayers.lightMixLayer.propertyNames do (
						lightNode = getNodeByName propertyName
						if lightNode != undefined AND classof lightNode != TargetObject do (
							appendIfUnique theList lightNode.name
						)
					)

					theList
				)-- end VRayLightMix
2 Likes

Hey, after some tests I’ve noticed that this solution will not work, because VRay updates lightMixLayer only when you press render.

What we do here is collect all the lights, then the instance, and create array “resulthInstances” which contains the instances except the last one (which you see in lightMixLayer ), then we remove them from the main array “theList” because they are not visible in the lightMixLayer. Also, we collect only lights that are not hidden.

If you notice any issues please let me know.

note:
This will work only if VRayLightMix render element group by is set to Instanced lights

VRayLightMix:
(
    -- VRayLightMix always outputs an Environment lighting pass and a Self-Illumination pass.
    -- It also writes a Lighting output pass for every scene light, regarding of its class and whether V-Ray supports it.
    -- The Lighting passes are named based to the Light objects' names.
    -- If two Lights have the same name, only one output is written with the contribution of just the last created light.
    -- If a name contains invalid characters like * or \, V-Ray will fail to save, so no need to clean them up here either.
    local theList = #("Environment", "Self_Illumination")
    
    -- Georgi Marinov EDIT [12.06.24] bug here. This code is adding all lights in scene but it should add only the lights from the lightMixLayer
    --for aLight in lights where classof aLight != TargetObject do appendIfUnique theList aLight.name 
    
    -- Georgi Marinov EDIT [14.06.24] This should fix the issue.
    sceneLights = #()
    resulthInstances = #()
    
    --here we collect all lights and their instances
    for lightNode in lights where superClassOf lightNode == light AND lightNode.isHidden != true do (
        appendIfUnique sceneLights lightNode
    
        InstanceMgr.GetInstances lightNode &rptInstances
        trueInstances = for n in rptInstances where (areNodesInstances lightNode n) collect n
        for l=1 to trueInstances.count-1 do (
            appendIfUnique resulthInstances trueInstances[l]
        )
    )
    
    -- clear instances from the sceneLights
    for i in resulthInstances do (
        lightInstancesIdx = findItem sceneLights i
        deleteItem sceneLights lightInstancesIdx
    )
    
    -- check if the light is ON, VRaySun do NOT have .on parameter we need to check if it is enabled and
    -- add the light name to the theList array
    for sLight in sceneLights do (
        if classOf sLight == VRaySun AND sLight.enabled == true then (
            appendIfUnique theList sLight.name
        ) 
        if classOf sLight != VRaySun AND sLight.on == true do (
            appendIfUnique theList sLight.name
        )
    )
    theList
)-- end VRayLightMix
1 Like
Privacy | Site terms | Cookie preferences