• Welcome to SC4 Devotion Forum Archives.

Let there be Light (in BAT)

Started by SimFox, June 12, 2008, 12:54:13 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

SimFox

this is a second tutorial I republish here from Forces of Light and the geometry of Shadows. Original was published on October 10, 2006

This is long overdue revival and expansion of my short note on different possibilities for LIGTHITNG and RENDERING stuff for SIMCITY.

Lets start with the LIGHT.

We see world surrounding us as a light cast by various light sources – natural like our very own star – SUN, or artificial – all sorts of lamps and bounced/reflected from object around us. So, naturally in the world of 3 D modeling same approach is followed to recreate the world. Given that all 3D is nothing more then imitation/simulation of the reality done through various tricks same is true to the light in 3D. 

If you look at any outdoor day scene, where does the light comes from? From Sun? Right, Sun, as naturally light emitting object, is producing something referred in 3D as a Direct Light. But not all light you see is such a direct light. If that would be the case then in the areas shaded from the sun there will be complete darkness. In reality that is not the case! This is due to the omnipresence of indirect light – one produced, or to be precise scattered by Atmosphere (sky) and all the objects around us. You'll probably also notice that this light has distinctly different properties then Direct Light, but these are beyond the scope of this article.

This lighting environment is recreated in BAT via something called Lighting Rig. This is simple collection of various lighting sources this different properties.

Lets' take a look at the default lighting rig that comes with BAT (either version of it). But this one is from GMAX BAT:

front view:


top view


We can clearly see two sets of light. The group on the left represents SUN. Lights in it have warm hues simulating the tones of the sun light in later afternoon. Lights grouped on the right provide "indirect" light of the sky. And naturally has bluish hues.




SUN1SUN2Sky/Shade1Sky/Shade2

n my personal opinion those have been selected not in a very best way, since they DO NOT quite match lighting scheme of the game engine itself. Coloring is not the only mismatch. There is even bigger and absolutely incomprehensible screw up – direction of the light in lighting rig doesn't match one in game. But for now we're going along the lines of the rig.

Complexity of the it's design is a heritage of times long gone when computers were slow and 3D software very green and is due to  if I may add, very poor quality result is due to the antiquity of its design dating years back. Another major problem with this rig is quality of shadows it generates. Lights in rig set to use ShadowMaps for that purpose. Result is shapeless blobs which have little in common with the objects that suppose to generate the shadow. This is a major reason behing simplistic box shape of most Maxis buildings and hard time battes have when they try something triangular etc.

But as time is going on, huge progress in computing power made much more realistic representation of the world around us possible . Also adaptation of BAT to work with 3ds Max – one of the most powerful off-the-shelf 3d package made the original lighting solution completely obsolete.

So let's try to create entirely new system that will utilize both software capabilities and raw computing power of present day CPUs.
To begin with let's clearly state our goal. What do we need? We need a system that would approximate natural outdoor lighting on a sunny /partially overcast day. To get there we need both direct light – Sun in our little fantasy, and indirect light of the sky. Most straight forward solution would be getting one Direct Light to be our sun and then Sky Light to be our sky. This is perfectly valid configuration, but it could still be improved upon to get setup even more simple and universal. Using Direct Light as our sun we are faced with one technical issue – falloff region of the light. We have to set it manually as default setting could be not big enough for some structures. Also elevation could be an issue for taller structures. Of course nothing preventing you from putting the sun several kilometers up but still there is a better, simpler and more elegant way to resolve this issue! Max at least starting from version 6 comes with something called IES Sun – you can find it in Photometric subsections of lights. It is basically same direct light but independent of Falloff and height limitations of regular Direct light. At the same place you'll find also IES Sky.


you'll find both IES Sun  and Sky in Photometric subsection of lighs section of Create menu

Ok let's start building our new Lighting Rig!

First let's create SUN. Just put IES Sun or Direct light at the place where main light of default rig was located. I would very much recommend you to go thorough all of the lights of the default rig as to get better idea what they were representing. This may help you to create some custom rigs that would be better equipped to deal with some particular situations you may face later. But for those not inclined to do so here is a set of valid coordinates. XYZ -474; -352; 575
Done that place the sky light into the scene. Again you have choice of either default Max's Skylight or Photometric one. I would suggest to go with photometric one as it offers some extra settings. You can place it anywhere in a scene as long as it faces directly down. 


This is what your ready Rig should look like

Having placed our light sources into the scene let take a look at their Intensity, Shadows and Color.



Default values for both IES SUN and IES SKY are very high and meant to be used with so called Logarithmic exposure set to exterior day scene. This is one way to equalize bright and shadow spots and deliver believable daylight system, but there are couple of problems with it. First one is by doing so you would have to accordingly increase the strength of all your NiteLites if you'll fail to do so you very well may simply not notice them after rendering. And second is that you most probably will not have access to those controls as installation of BAT4MAX highjacks PlugCFG line in 3dsmax.ini. There are ways around it but for now let just reduce intensity of our light sources. There aren't any ultimate values and I would encourage you to play with them to develop the sense of it, but here are some which you may use as a guidance – IES Sun 800-1000lx and IES Sky 0,04-0,05. Also I would recommend to set IES Sky to Partly Clouded, but do try other settings and see which one you find more appealing to you

callagrafx

Quote from: SimFox on June 12, 2008, 12:54:13 PM
And second is that you most probably will not have access to those controls as installation of BAT4MAX highjacks PlugCFG line in 3dsmax.ini.

Just copy the contents of the old PlugCFG folder into the BAT folder and hey presto, all the functionality returns.  :thumbsup:
The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it