THE GROUP - COMMAND RELATIONSHIP
Groups and commands are intrinsically connected. Commands actively apply settings on groups, and groups react (when directed) to a command's relationship to it. This relationship is first established by associating groups with a command. This is the concept of associated groups. Associated groups is a list of groups that is associated with a command. Within this list of associated groups there is one active group. The rest are called other groups.
Why is the distinction between active and other groups important? And how does that distinction happen?
The distinction is important because our intention is to render only one group (as a pass). In this case our intended render is only for the active group. Other groups are only there to supplement the render of the active group.
"Supplement? What do you mean?" Even though we want to render out only the active group there are instances where it is being affected by other elements in the scene that belong to another pass. For example a car going through a tunnel. If we wanted to render a car pass we still need the tunnel to cast shadows on to it, or still be visible in reflections. In this case, the car is the active group, and the tunnel is in the other group.
So now we understand why the distinction is necessary, how does Janus determine which is the active group, and which ones will be the other groups? Remember that a command's last element is the target group. This is the group 'intended for render'. If it finds this target group within its list of associated groups, it will consider that group to be the active group: this is the default behaviour. All other groups are considered to be 'contributing' group ('other groups' in Janus parlance). If a command does not find its target group then it will consider all of its associated groups to be other groups.
However, this is not the only way Janus find the active group. In fact, you can have as many active groups you want by assigning those groups directly as active groups.
This is the basic principle of the relationship between the command and the groups.
How Commands Work
The first thing a command type tries to find out is what the active groups are, and then what the other groups are. The second thing it tries to do is find out if the command is set for BG or FG. When it determines these, it will look up its user-defined setting and apply all supported properties onto the active and other groups. Here is an example of a pre-defined command type called BTY:
[BTY]
ACTIVE.BOTH.UBC=seen
OTHER.BG.UBC=unseen
This command type defines several parameters based on what kind of group it's processing (active or other) and the layer type (foreground or background). If you look at the first line below [BTY], it makes all active group items 'seen' in terms of the UnseenByCamera property in LightWave (e.g. switch off). 'BOTH' is specified, which means it applies to both FG and BG switches. Things become different when other groups are concerned. Other groups are switched to 'UnseenByCamera', which of course makes sense because we want only the active group to be visible while the other groups invisible.
Layer Types Explained
What is the importance of the layer type? Janus was created due to compositing requirements. These switches took form as BG and FG because it was important for some elements to be rendered so that they will composite properly if they were placed in certain layers in the compositing stack. Here is an example: the sphere is revolving around the box. In the first image is the composite. The second image is the box rendered as BG. The third image is the sphere rendered as FG using the BTY2 command type.
Composite
Background Layer
Foreground Layer (box rendered as Matte Object)
In the BTY2 command type, when the current render pass being rendered as an FG element it makes other groups into black matte objects so that if any of those objects obscure the element, it may properly do so. This makes it composite properly without additional work in compositing. (Note that the BTY2 command type is only an example; there are many other command types that behave similarly while achieving different ends)
Now all this talk about layer types being switches and command types can sound like over-technical babble. Nevertheless, what is important is to understand why those switches were made and, using the default Janus command types, it will be demonstrated how they all work efficiently in the tutorials.
Group Types
Like command types, group types are, for the most part, user-definable, although there are many pre-existing group types available in Janus. They essentially have the same kind of directives that command types have except that they do not dictate scene-related settings. Group types only encapsulate item-related parameters. But just like command types, group types can be made aware if they are being called on as the active group or other group. Here is an example of a group type definition:
[alphaBlack]
GLOBAL.UBC=true
GLOBAL.UBR=false
GLOBAL.UBF=false
GLOBAL.UBA=black
GLOBAL.CS=true
GLOBAL.RS=true
GLOBAL.SS=true
GLOBAL.MATTEOBJECT=false
GLOBAL.MATTECOLOR=0,0,0
GLOBAL.SUBPATCH=NOMINAL
OTHER.UBR=false
In this example, 'alphaBlack' is to make sure that the objects in this group is used as an alpha clipping mask for other elements. When run as an active group, it is unseen, because it was not designed to be shown. Only when it is run as an other group does its settings make more sense; it becomes visible, and its UBA (UnseenbyAlpha) flag is set to black.
Syntax rules for creating definition files for group types and command types is listed under Creating Your Own Group Types and Creating Your Own Command Types, respectively.
Override Priority
By design, settings 'trickle' down to the last override setting. This means that even if the command orders a group to invisible, if the group itself was issued a directive to keep itself visible it will remain visible. Furthermore, if the user creates a manual override for a group, the manual override will always have the last say.
The ranking, from lowest to highest authority is as follows.
Global Settings
Global Settings are the default settings that Janus uses. They serve as the base from which others derive their initial settings.
Command Types
Command types are the next in line, and they override Global Settings with their preset directives.
Subcommands
Subcommands are settings within a command and they override command types. Usually, subcommands are inputted by the user through the CMD field (but may also be inputted through a pre-set command type). Subcommands are the most common way to override scene-related settings. For example, if you have an NTSC resolution as your default, but want to decrease your resolution by half for, say, occlusion passes, you can use the subcommand MULTIPLIER to override your project default.
Run-Time Commands (applied as Separate or Combined)
Run-Time commands that are applied as separate or as combined commands append or replace the command with new subcommands.
Group Type
Group types apply a preset override to the group. A group type will override any command that shares its override parameter.
Group User Overrides
Group user overrides are manually applied through the Janus interface and is the last and final authority on how overrides are applied to the group.