Some quick notes on area lighting, fog and weather. This is going to be made into a better page later.
Lighting in NWN has become a bit more nuanced in NWN:EE. There is a better lighting engine as of 2020 and this improves the tile and dynamic lighting and how it interacts with things.
- Area general lighting (such as the "Sun")
- Per-tile lighting colours 1/2
- Per-tile "dynamic lights" such as torches. Note bug if changing dynamically:
- Dynamic lights (such as torch placeables, fires)
- Player lights
- Fog colours
Choosing an initial "Preset" in area properties
Day and Night Cycle Lighting
Sun and Moon
Fog (Clip distance)
User Lighting Settings
The Sun and Moon
The Sun and Moon are in fact the same thing. They just have different settings during the day and night in the lighting properties window.
The sun is in fact an in game MDL that generates light called gidy_sun.mdl
This mdl file is placed at coordinates x = 4000, y = 4500 and z = 7000. The radius of the light is 100,000 meaning it projects it fully over the area to generate shadows and light.
The mdl defines 2 light sources, it looks like one is for ambient light colouring of everything and one is to cast shadows.
If you remove the gidy_sun mdl by blanking it or removing the light definitions this will crash the game. You can "remove" the global sun by setting the radius to be low - eg; 1, instead of 100000.
Sun and Static Geometry Shadows
The sun is special since it is, apart from the player model, the only thing that can generate shadows on static geometry (tiles, and placeables set to static). We've tried applying this MDL to other things like placeables, visual transforming it into the sky etc, and sadly this doesn't do static geometry shadows. You can edit the MDL file to alter the amount of light and technically you can alter the position but you can't dynamically change the position (eg doing time of day shadows that shift).
You can attach the same effect (with an EffectVisualEffect transform of location) and see the sun shadows do work fine if rotated - since it follows the players facing sadly this also cannot be used to change the shadow geometry angle.
The way the sun and moon shadows work is dependant on the player having a light:
- If daytime
- If the sun shadows are enabled, use the sun only for static shadows
- If sun shadows are disabled, use the PC's light source (eg; interiors, their torch would light up geometry)
- If night time
- If the player has a light (eg; a torch) use that to cast static shadows
- Else if moon shadows are enabled, use the sun to cast static shadows
Subtopic on weather:
- Lightning (and effect on lighting)
- Wind effects on visuals
Missing Nwscript Things
Currently you cannot control the Sun/Moon Ambient/Diffuse options. You can't change the sun location (thus the shadow angles). You cannot get static shadows to show from anything other than the player or the sun mdl.