Jump to content

CK lighting limitations and just-in-time lighting scripts


Recommended Posts

I read that CK can only handle 4 shadow casting lights at a time. When there are more, it will use distance from and viewing angle to determine which shadow casting lights to turn off. Apparently, it's not very smart and causes lights to flicker on and off while the player can see them and sometimes it leaves lights you can't see anymore ON and disables a light in your view.

 

At first I was using lights without shadows and they were still flickering on and off. I assume there is a limitation for non-shadow_casting lights as well, though it's probably higher than 4. Can someone confirm and let me know the limit?

 

I found a modder's resource called just-in-time lighting.

https://sots-eye-candy.blogspot.com/2012/02/skyrim-ck-scripting-tutorial-dynamic.html

https://www.nexusmods.com/skyrim/mods/10361/?tab=files

 

It has two scripts, a LightingBallController and LightingBall script. I followed the tutorial but it doesn't seem to work. I originally renamed the scripts and the references in the code so I switched back to the originals just to make sure I didn't break it in the process of renaming. It doesn't seem to work either way. I also used a fresh save.

 

Has anyone used the scripts on SSE?

Edited by Guest
Link to comment
Share on other sites

Actually disregard my question and apologies for the double post. It appears I misunderstood your intent. I'm currently testing out the two already compiled scripts provided in the Nexus mods link along with Enhanced Lights and FX's. ELFX is a good mod to use when trying to show the problems with the 4 light limit, especially with the exteriors plugin. Riften in the daytime during a clear day is one of the best places to see it in action. While current testing is brief atm the scripts do appear to be functioning as I appear to not be having any flickering issues with the shadows cast by the buildings to your left as you enter Riften's main gate like one normally would when using ELFX.

Link to comment
Share on other sites

Yea, the PSC files have the source code and the PEX files are the compiled versions (1s and 0s).

 

When I load the cell, I am in the doorway. I put a LightingBallController there, which is attached to a single LightingBall, which is attached to 3 shadow casting lights. I have the SpecialCaseIsDoorTrigger toggled to TRUE. Those lights aren't the ones enabled. It's not working right. There are different lights enabled. I tried disabling SpecialCaseIsDoorTrigger and created a second LightingBall attached to a light outside of the view. The issue still occurred so I guess that rules that out.

 

I also tried setting all my lights to Initially Disabled and it still happens. I was thinking that other shadow casting lights might be enabled on the cell load, so some of the lights that are supposed to be enabled are being disabled since there is already another shadow casting light enabled.

 

I also have normal non-shadow_casting lights with Enable Parent set to the shadow casting lights so that the non-shadow_casting lights will be enabled when the shadow casting lights are disabled. From a distance, you can't see the shadow but at least you see the area being lit up. When you get close enough, it switches to the shadow casting lights and the shadows appear. That's the idea anyways. Sometimes the non-shadow_casting lights dont light up. Either there is limit on non-shadow_casting lights or the shadow casting lights are technically enabled so they are disabled.

 

If someone wants to look at it, I can upload my player home so you can see it first hand.

Edited by Guest
Link to comment
Share on other sites

I made my own script.

Scriptname _3blake7_NixManor_LightSwitch extends ObjectReference

_3blake7_NixManor_LightSwitch Property other_lightswitch Auto
ObjectReference Property light_1 Auto
ObjectReference Property light_2 Auto
ObjectReference Property light_3 Auto
ObjectReference Property light_4 Auto

Event OnTriggerLeave(ObjectReference akActionRef)
	
	if(other_lightswitch != None)
		IF(other_lightswitch.light_1 != None)
			other_lightswitch.light_1.Disable()
		ENDIF
		IF(other_lightswitch.light_2 != None)
			other_lightswitch.light_2.Disable()
		ENDIF
		IF(other_lightswitch.light_3 != None)
			other_lightswitch.light_3.Disable()
		ENDIF
		IF(other_lightswitch.light_4 != None)
			other_lightswitch.light_4.Disable()
		ENDIF
	ENDIF
		
	IF(light_1 != None)
		light_1.Enable()
	ENDIF
	IF(light_2 != None)
		light_2.Enable()
	ENDIF
	IF(light_3 != None)
		light_3.Enable()
	ENDIF
	IF(light_4 != None)
		light_4.Enable()
	ENDIF

EndEvent

To use it, you create two trigger boxes, then link them to each other, and each one to 4 or less lights. Position them right next to each other in a door way. When you leave the box, it disables the other box's lights then enables it's own lights. Pretty simple.

I still have the same problem! I enabled "Never Fades" and set the shadow casting lights to "Initially Disabled". Im going to trial and error some things to see if I can figure this out.

Edited by Guest
Link to comment
Share on other sites

I guess "Initially Disabled" takes effect BEFORE the game engine randomly turns on lights.

 

I added an OnInit to disable all shadow casting lights listed in a FormList. You only need to set the FormList property for one, the rest can be left as default. You do need to set the PlayerREF, just hit Auto-Fill for it.

 

Here is the updated code:

Scriptname _3blake7_NixManor_LightSwitch extends ObjectReference

Actor Property PlayerREF Auto
_3blake7_NixManor_LightSwitch Property other_lightswitch Auto
ObjectReference Property light_1 Auto
ObjectReference Property light_2 Auto
ObjectReference Property light_3 Auto
ObjectReference Property light_4 Auto
FormList Property AllShadowLights Auto
 
Event OnInit()
	IF(AllShadowLights != None)
		INT TotalLights = AllShadowLights.GetSize()
		WHILE TotalLights
			TotalLights -= 1
			ObjectReference SelectedLight = AllShadowLights.GetAt(TotalLights) As ObjectReference
			IF(SelectedLight.IsEnabled())
				SelectedLight.Disable()
			ENDIF
		ENDWHILE
	ENDIF
EndEvent

Event OnTriggerLeave(ObjectReference akActionRef)
	IF(akActionRef == PlayerREF)
		IF(other_lightswitch != None)
			IF(other_lightswitch.light_1 != None)
				other_lightswitch.light_1.Disable()
			ENDIF
			IF(other_lightswitch.light_2 != None)
				other_lightswitch.light_2.Disable()
			ENDIF
			IF(other_lightswitch.light_3 != None)
				other_lightswitch.light_3.Disable()
			ENDIF
			IF(other_lightswitch.light_4 != None)
				other_lightswitch.light_4.Disable()
			ENDIF
		ENDIF	
		IF(light_1 != None)
			light_1.Enable()
		ENDIF
		IF(light_2 != None)
			light_2.Enable()
		 ENDIF
		IF(light_3 != None)
			light_3.Enable()
		 ENDIF
		IF(light_4 != None)
			 light_4.Enable()
		ENDIF
	ENDIF
EndEvent

That seems to work. I might change the approach up a little so you only need 1 box per door way instead of two.

 

LightingBall and LightingBallController will probably work if you add the OnInit from my script.

 

I guess this is unique to SSE?

Edited by Guest
Link to comment
Share on other sites

i think there may be another "limit" with non shadow casting lights. i have a test scene setup, with 4 balconies, with lights on 4 floors. some of the no shadow lights are turning off, but turn on randomly based on viewing angle, like shadow casting lights. i checked the radius of the lights and there is NOT more than 8 lights hitting the mesh (and if there was, there would be artifacts, it wouldn't completely disable).

 

after i pinpoint this last issue, ill write up a guide or update the creation kit wiki. the only information i found during my search was the 4 shadow light limit.

Link to comment
Share on other sites

NON SHADOW LIGHT

 

my scene has four stories of balconies, with lights on each floor and the player is on the first floor looking up and can see all the lights on each floor. when i load the scene, some of the non-shadow lights are disabled. but i know it isn't a limit, because i had over 80 non-shadow lights on with all of them working perfectly. i also know it's not too many lights, more than 8, shining light on the same mesh. when you have more than 8 hitting the same mesh, the light is still ON, it just causes artifacts, messed up shadows.

 

I found the "# of lights" option for the render window. It appears the lights ignore the light radius on the z-axis. The meshes turn red even though there is only one light with a radius touching it.

Edited by Guest
Link to comment
Share on other sites

  • 3 months later...

Hi, I just read this topic, and you made a good job!

 

I'm a modder for Fallout 4, I'm making a dynamic lights & shadows overhaul mod.

 

Now I'm adding shadow-casting light sources in exterior scenes.

 

At first , I put more than 4 shadow-casting light sources in a quite small exterior scene (Fallout 4--Wicked Shipping & Abernathy Farm, these 2 scenes are very near locations).

 

Finally, Each scene has about over 8 shadow-casting light sources, and a lot of original light sources----which I didn't delete.

 

Starting FO4 testing my mod, at very beginning ,all looked normal and perfect in two scenes--- lightings and shadows are perfect, FPS shuts slightly.

 

BUT, when I fast travel within some scenes ,then go back to these two scenes, weird things happen!

 

When fast travel back to these two scenes, a lot of lights (sometimes ALL lights) DO NOT work!

 

BUT, when I look thru scope of weapons, I can still see the lights on and casting perfect shadows! ..WTF.

 

When I run close to light sources ,the lights " Automatically" light up!....OMG

 

I really don't konw how these happening....

 

Is it the Fallout 4 Engine limits?

Your scripts could fix these bugs?

Edited by raidenfrank
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...