• Welcome to SC4 Devotion Forum Archives.

Let There Be light custom lighting Rig for Bat4max setup utility

Started by SimFox, July 05, 2009, 01:43:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

SimFox




...and, preferably same across different versions of Max

Well, now there could be!


*beautiful model curtousy of JasonCW

What does it do?
"Let There Be Light" is a new approach to setting your scene in Bat4Max. It decouples
Cameras and Lights. Cameras are left where they were – in TB2_CameraLightingRig
file, while Rig Lights themselves will be created right in your scene.

Why such decoupling, you may ask?
There are several reasons. First one is to make sure that you have best setup possible
whatever you max version is. Utility shall automatically detect version of software you're
running and will built Lighting Rig from best available lighting  that your version supports.
At the same time it ensures high degree of "sameness" of the lighting across all version
of 3Ds Max. And it does it all in automated fashion, leaving out all that fiddling with files.
Just press one button and you're ready to go. Mind you, if you wanna get down and dirty
you can totally do so.

I've said across "all" versions, well, actually, the earliest MAX version which this utility
supports Max7. But this pretty much a non-issue, as I seriously doubt that n this day and
age anyone would still be using anything prior to that. In fact, it is strongly recommend not
to go below Max8, but preferred version is Max2008. If you can get it do! you'll have best
lights, best Mental Ray version, best modeling tools, best gamma correction and still full
compatibility with BAT4Max 2.6

Another reason for creating actual lights in the scene is to avoid some nasty artifacts that
are sometimes caused in FG (FinalGather – indirect illumination method used by Mental Ray)
by X-Reffed (located in external file) lights. Decoupling also allows to have only one Camera
Rig file instead of 4 as before. The fewer of them the smaller are the chances of some going
awry somewhere.

But why not to get rid-off the X-reff altogether?
Well there are few reasons. First one is that too much of the entire BAT is linked to it.
And although, in principle, it is possible it would re-quire a lot of work. On the other
hand there is one significant benefit of having cameras external to the scene. This way
you wouldn't be able to move them by accident. And that is a big plus, cause would it
happen you export will be screwed!

But wait, there is more!
This utility doesn't stop there. It sets you renderer to Mental Ray, turns Final Gather on,
set "normal" e.g. good for most situations and reasonably fast settings for it, Sets Gamma
Correction to ensure that you BAT is never blown out bright, or has pitch back spots in
corners. All those settings are Max version dependent and set automatically, yet if you
need you can go and manually edit any of them. So, no matter what version of max you're
running you gonna get right and best settings.

In addition to that LetTherBeLight does a bit of housekeeping in your scene too! In order
to keep it orderly and lights of the rig easily accessible (although it is not recommended
to fiddle with them) they are placed on new layer specially created, which, in turn, frozen
and hidden (naturally you can manually un-hide and unfreeze it). After all lighting is set up
utility will make you default Layer active again.

Unfortunately Autodesk – the maker of 3dsMax have some odd, inexplicable policy of
revealing different aspects of User Interface and Preferences settings to MaxScript one
piece at the time. As a result only people with Max 2010 (which is currently not supported
by Bat4Max) would have no need to do anything manually. Rest would have to turn Gamma
support in Preferences manually. But as I've said this would have to be done only once. Max
will save this setting and every time you open program it will be only default and Utility will
do the rest automatically.

Installation:


  • place z_SF_LtbL-CC.ms file in your 3ds Max ...\Scripts\Startup folder
  • replace ALL TB2_CameraLightingRig*.max files found in 3dsMax
    ...\gamepacks\BAT\scenes\CamLightRigs 
    and
    ...\gamepacks\BAT\scenes\startup with one supplied with this download
  • Start 3ds MAX and make sure you gamma support is turned on.

    You would have to do it manually since Autodesk - maker of 3dsMax has a very peculiar
    habit either not to expose some of the UI elements and controls to MaxScript, or, when
    finally deciding on doing so, making it happens one tea spoon per release. So, for instance,
    only in Max2010 all of the controls needed to be modified for Max2008 could finally be
    scripted. But don't despair, this is one time operation and not a difficult or time consuming
    one.

    Here is what you would need to do: click on Customize command in program menu and
    chose Preferences (the last option). Once there, go to the Gamma / Gamma and LUT tab
    and make sure that you settings are as follows:

    for Max 7


    for Max8-9:


    for Max 2008 and newer:

    * disregard any settings in the areas cover by blue on the illustrations, those will be
    dealt with automatically by utility for Max 2008 and newer users

  • Download also include GAMX Rig files. These are needed to ensure that what your
    LODS (exported into SC4Model by GMAXBAT absolutelly match your FSHs exported
    into SC4Modle by Bat4Max.


I have inspected Rigs floating about and those supplied in original BAT4Max (v2) and found
out that there are small - imperceptible to an eye, but still significant discrepancies at
camera positions and so on. This may result in various problems with models exported from
BAT4Max. Most notable of them is when parts of your model are missing or somehow
distorted. This is a result of LODs and FSHs being cut in different way. And this is a result
that calculations were made from differently set cameras.


So I urge you to replace RIG files in your GMAX installation with these included here: these
were set to match Rig file for BAT4Max 100%. You would have to replace same naed files in
...gmax\gamepacks\BAT\scenes\CamLightRigs
and
...gmax\gamepacks\BAT\scenes\startup folders
       

"Let There Be Light" usage
Once Max fully started you'll find new Roll-out titled "Let There Be Light" (it may be
rolled-up/closed) nested along all other Bat tools:


In the roll-out there are  four buttons:
Day
As name suggests pressing this button will create lights best suited to your particular
version of Max and also set the Gamma correction, Final Gather and Anti-Aliasing.

Maxis Nite
Pressing this one will remove any existing rig Lights from your scene, and create lighting
setup for truNite with Maxis levels of illumination (game defaults) as with day scene it will
also take care of Gamma Correction, Final Gather and Anti-Aliasing

Darker Nite
Same as one above, but this time the illumination levels will be corresponding to the much
darker night. The matching mode will be available shortly.

Delete Rig Light
This will delete Rig (and only Rig) lights from the scene. In addition it will also remove any
first 3 Xreffed Scenes you may have. This is handy when you either changed your setup,
or got file from someone else and it has already X-ref to the rig or anything else in that
persons computer. This may cause all sort of weirdness and clearing this mess is a way to
go. If you have more then 3 I guess you really need them and know what you're doing...
Anyway utility will let you know of this situation through pop-up message.

Pressing any of the first three buttons will also set Mental Ray as your current render,
naturally. Utility created Final Gather and Anti-Aliasing settings are the best averages in
a sense that they would be a good option for most of the situations. However sometimes
you may have a particularly challenging model, like that marvel form JasonCW already shown
on a comparison picture in the beginning of this message.

The dense and thin grill of the façade is a very touch cookie for renderer. In order to get
past some nasty artifacts both Final Gather and particularly Anti-Aliasing Settings would
required to be upped, and very much so... So, why not to set them in the first place in such
a way that everything will always looks great! Well because of the rendering time! getting
such a challenging spots resolved may result in rendering time many times greater than with
"default" settings, even 10 times! And most of the models will not require it.

Utility also does a spot of "good housekeeping" to keep your scene clean and clutter free.
It will create new layer for the lights it creates, place them there, Hide and freeze this layer
and return to your default one afterwards.



Naturally you can go and manually un-hide/un-freeze them if you would choose to.

I hope that this will introduce you to the usage of Layers in Max. They are as useful as ones
in Photoshop and may be even more so as the number of objects in Max scene is normally
above and beyond what most of people will ever have in Photoshop or even Illustrator. Yet
people seem to be content to keep everything on same layer, making finding and isolating
need object a truly Herculean task.

There is a common misconception that grouping object somehow makes things better.
Actually just opposite. You don't have easy and direct access to object in groups, Group,
in itself, is a new object, just cluttering your scene database even more. After all groups
are still there for legacy support ONLY, so that if anyone would decide to open today a
scene made in early versions of max (way before amx7 (!)) he would be able to... That's it
there is no more use of them really...

Layers is that way to keep you scene organized!


Know Issues:
X-Reffed Cameras
As always, with every silver lining there is nasty dark cloud upon it... Since much of the
operations of the bat4Max as well as additional utilities, such as this one or, for instance,
Preview are linked to the cameras their absence from the scene could cause errors that
would require (depending on Max version), even restart of the program to get everything
to work fine.


This nasty situation could come about when utility has to quire the camera rig (X-reffed
scene) but can't do so. Here is one example of such troublesome situation:

say you are working on a very complex scene and to make your life easier you use
ISOLATE SELECTION command – a very useful tool in MAX, btw.  And while you are
in such an isolated mode click on Preview button. Script, in order to set render camera,
will quire X-reffed scene, but, or strangeness!!! Max for some reason not simply hides it
as rest of the geometry, but actually removes it temporary! When you exit the Isolation
mode the scene will be returned to where it belong, however. But for now Script tries
and fails to located X-Reffed cameras. As a result you gonna get MaxScript error and
BAT scripts will stop to work.


But don't you get too worry. This ONLY affects MaxScript and not your actual work.
Would you run into such troubles, stay calm, safe your work and simply restart Max.

Sameness
I've spent days if not more fiddling with settings in order to get them to match as close
as possible, but since we are dealing with quite big changes (under the hood) from one
version of Max to another the 100% sameness isn't really possible if advantage to be taken
of new features. Mind you keeping to old stuff would make it 100% same either. So it is
best match I could accomplish. I'm sure it is a good approximation that will ensure BATs
from different creators will not conflict with each other as some of them do nowadays.

There are some issues to consider when you're working, though. Gamma compression
utilized in Logarithmic Exposure control prior to Max9 has a very strong saturation
amplifying effect, just take a look at eh flower bed in front of that beautiful white building
on the picture in th beginning of this messageit  see how flowers are much more saturated,
almost glowing on the Max8 rendering, another problematic spot is the pink bit on the top
roof. In Max9 this problem had been "resolved". Max went totally overboard in opposite
direction making Log Corrected bitmaps way too desaturated, so much so, that it just
incompatible with previous versions. Luckily there is a legacy mode that this utility is, well,
utilizing. This way the picture from Max 7 to 9 will look pretty much identical. Well, one from
Max7, depending on the model, may be slightly darker in the inner corners.

Anyway those trouble spots  were left there intensionally to show possible issues and are
easily corrected by desaturating somewhat texture (as in case of flower bed, or NOT
applying any color-correction (as many used to do to make it look a part) to your textures
in the first place. Lighting and gamma controls provided by "Let There Be Light" will take
care of it.

Another issue is Anti-Aliasing and Final Gather effectiveness. It is (as you can plainly see
form same picture) much better in Max 2008 than Max8. So, I strongly recommend to get
Max2008 - your best choice for BAT at the moment.

That's it!
Have fun with this and I hope more wonderful creation will be flowing from you to us all!

Here is, once more, DOWNLOAD LINK

If you run into some problems, or have found some errors or mistakes in the files please let
me know

PS
since this is an external script it will be compatible with any version of Bat4Max that
supports truNite


You can post your questions and comments here or on Simtropolis
or simply PM me

11.07.2009 13:30 CET
download link had been updated with new version of script that fixes the problem that has been identified and described here.

Please re-download and re-install (only need to re-install the z_SF_LtbL-CC.ms file)

sorry for inconvenience.