Some of you may have noticed that the NWmax exporter plugin by default sets the ambient and diffuse setting of all materials (and consequently, all objects) to pure white (rgb value of 255,255,255). OldManBeard's excellent CM3 utility also features an option that allows to do this for you in bulk operation. And finally, it's the setting on most of Bioware's own models.
But why is this?
In the following, I'll try to make a case for why these settings are in fact more or less always preferable, and in this process, explain what these settings actually do.
First of all, a little heads up on a technical aspect. Often, instead of referring to the rgb (colour) settings in terms of three times 0-255 values that you have in 3DSMax/Gmax (e.g. 255,255,255), I'll use the way it's used in the model format itself, where each colour channel is set by a value from 0 to 1 (e.g. "1 1 1" or "0.5 0.5 1"). It means more or less the same though, except 1 is 255, 0.5 is 127 and 0 is 0.
Also, for several of the examples, I will use the following texture, containing all shades of grey from entirely black to pure white:
This allows us to objectively assess how the lighting affects our objects.
About lighting in NWN
Generally, there are three forms of lighting in NWN. Two are set by area settings, namely the area diffuse light and area ambient light. I'll explain how they behave in turn:
- Area ambient light differs from the other forms of light in that it is always applied equally to all parts of an object (even what faces downwards).
- Area diffuse light is directional, always coming from the north east and high above the area. It illuminates the parts of a model that face directly toward the lightsource the most, and gradually less as the angle to the lightsource increase. Parts that are facing away from the lightsource won't receive any illumination at all.
- The third kind of light is the dynamic light that is mainly generated from effects in game, including items emitting light worn by the player or a NPC. Beyond the fact that the lightsource is centered on a specific object within the game, the dynamic light otherwise behave in the same way as the area diffuse light.
The following image shows the different types of lighting as they are rendered in game:
However, the perceived lighting on the specific rendered model is further determined by the individual model objects ambient and diffuse settings (specified in the material editor in 3dSMax/Gmax). The ambient setting works as a modifier on how much the area ambient light will light up the object, whereas the diffuse setting both determines how much the area diffuse lighting and the dynamic lighting generated in game will light up an object. As already mentioned, in the raw model ASCII file the object settings allows for ambient and diffuse from 0 0 0 to 1 1 1, each number representing one colour channel (red, green, blue), and in 3dSmax/Gmax, the settings range from 0 to 255. These settings work as basic modifiers - an ambient setting of 127, 127, 127 will make area ambient light only apply half as much on the object as the area ambient light will apply on objects with a setting of 255, 255, 255 (as 127 is halfway along the 0 to 255 range).
When NWN calculates the lighting perceived by the player, all three types of light are adjusted by the model object ambient/diffuse settings as explained above, then afterwards added on top of each other to determine the final lighting of an object. If we disregard colouring for now, we can simply refer to the light generated in percent: at 100%, the texture on the object will render without any darkening (i.e. as it appears in an external editor, such as Photoshop). An important point to note here is NWN will never overbright, meaning that it'll never brighten a texture beyond 100% - if the ambient, diffuse and dynamic lighting with object modifiers combines to more than 100%, it'll still only be illuminated to 100%. This also mean that even beyond 100% combined lighting, darker part of a texture will never appear lighter than they are on the texture itself.
Practical implications - illumination and darkening
The first implication of how lighting in NWN works is that when you texture an object, you should always design your texture so that it reflects how the object looks when fully illuminated since NWN will never brighten the texture for you. But conversely, this also means that for either type of lighting in NWN on it's own (area diffuse, ambient or dynamic lighting) to be able to fully illuminate the texture, it is necessary to have both ambient and diffuse settings on the object set to 1 1 1 (i.e. 255, 255, 255 in 3DsMax/Gmax). Refer to the following image:
The objects that has a setting of 0.5 0.5 0.5 in an area with either solely diffuse or ambient lighting (even if pure white), it's brightest part will only be a mid-toned grey. The same applies for dynamic lighting, which (as mentioned above) has the consequence that the object will never be able to be fully illuminated by dynamic lighting in areas that have the torch lit only setting (area ambient and diffuse set to none).
It may at times perhaps be tempting to use a setting lower than 1 1 1 if you actually wanted to darken the texture on your object. However that will in turn have the consequence that in areas that contain both area ambient, area diffuse and perhaps even dynamic lighting, chances are that the darkening effect you are relying on is lost. This is especially problematic since it would make your object react differently to varying lighting conditions compared to other NWN objects, both making it seem inconsistent and unrealistic, as it would seem to take more light to fully illuminate the object.
Additionally, darkening an object by using settings lower than 1 1 1 will be a very brute form of making a texture appear darker as it basically works as a simple modifier equally applied all over the texture. It'll seem more muddled and flat, lacking in nuances and detail (you basically just narrow the range of light as seen on these histograms). There are much better ways of darkening a texture using programs like Photoshop or Gimp, first of all allowing you to make certain features of a texture remain bright when it makes sense, but also to do a more gradual, adaptive darkening that reduce the sense of flattening by preserving some highlights.
The following is an example of creating a darker variant of the flesh golem by lowering the ambient/diffuse settings compared to making a new texture:
It might seem minor, but if you pay close attention you should be able notice that there's more nuances in the textures of the flesh golem to the right. The changes I did here are also very simple and could be even better tailored - all I did was toy with the lightness/contrast settings.
Using model ambient/diffuse to adjust the colour of an object
Another thing you may have considered to use the object lighting settings for is to change the colour of an object. But again it's easy to argue that the drawbacks surpass the benefits (the only two benefits are in fact slightly less work and not having to load an additional texture into video memory, but the latter should be negligible with the amount people have today). On the other hand, when you try to change the colour of an object by modifying the lighting settings, you will again apply it as a modifier to the entire texture evenly, generating a flattening effect - and additionally, it will always entail some general darkening of the object. This is because you can only reduce how much light from a certain channel applies to the object, and not increase the amount of light from other channels to compensate.
The following is an example of trying to create more flesh-like variations of the flesh golem, to the left by changing the model ambient/diffuse settings, and to the right by editing the texture:
You should hopefully be able to notice that the texture golem on the left appears both darker and much more flat.
Using the ambient/diffuse settings to recolour a model is additionally problematic because you again risk losing the effect when the object is seen under a combination of several types of bright light:
Notice how it's now turning somewhat green again.
Conclusion
All this may seem a bit technical, but the simple conclusion is that no matter whether you want to darken or change the hue of a model, it is always preferable to do so by editing the texture rather than the lighting settings on the model objects. The only exception is when you deliberately want an object to appear somehow unnatural. Otherwise, you will both make the model texture seem more "flat" and the model much darker than other NWN models under varying lighting circumstances.
Granted, Bioware have themselves at times used editing the model object lighting settings to darken models, but it is assumable to reduce the amount of different textures used. This is much less of an issue today (read: not an issue at all).
In some cases, it may also often seem a rather minor difference whether you darken using editing the texture or the model, but then again, it's not that much different in terms how much work it entails - and if you are to do something, you might as well do it right.
And finally, if you feel your model is too bright when viewed in game and consequently seem a bit flat, it is quite possibly simply because most of the default lighting settings in NWN are rather bright. Try to lower them a bit manually, especially the ambient setting, and you should notice that the objects appear more lively and better shaded - both your own and Bioware's default.
As closing remark, I hope you enjoyed reading this and that some of you even found it useful. Please leave any comments, questions, corrections and concerns below '>
Modifié par Zarathustra217, 06 mars 2014 - 01:29 .