Friday, July 18, 2008

MOSAIC feature ramblings - part 10

Part 10 - The Lights Setup tab and light export types:


The "Lights Setup" tab allows you to control different aspects of how MOSAIC exports lights. The exporter can handle Lamp, Area, Spot, Sun, and Hemi lights in much the same way that Blender does, making reusing existing scenes and creating new ones an easy task. MOSAIC's built-in light shader has built-in hooks to most of Blender's light controls, and have been designed to behave very similar to Blender's (When re-writing the built-in shaders I intend on enhancing this even further). For all lights the shader supports "Dist", "Energy", all "falloff" types, "Sphere", "No Diffuse", "No Specular" and light RGB color. If your renderer supports raytracing then MOSAIC's built in light and material shaders can use "Ray Shadow", "SpotSi", "SpotBl", "Soft Size", "Samples" and "Threshold" for soft raytraced shadows. For doing shadow mapping the shader supports "Buf Shadow", "SpotSi", "SpotBl", "Samples", "Bias" and "Soft". Also since Blender's Python API does not have hooks for light textures, there are several parameters in the light shader that can be manually set to use projection mapping and a few features not available in Blender.


Since MOSAIC handles shadow mapping with scene passes, setting a light to "Buf Shadow" does not create the shadow map or passes, in order to create the shadow map you need to use the "Enable Shadow Mapping" and "Enable Caustic Mapping" buttons in the "Lights Setup" tab.

Once clicked you'll be presented with a dialog that allows you to setup exactly how you want the pass created. This offers more control and fine tuning than Blender's built in shadow mapping is capable of (such as enabling deep shadows, fine tuning which objects are in the map, fine tuning shading rates and other optimizations, etc). It also allows you to directly manipulate the shadow pass since it's created as a Blender scene.

Once a pass is created then it is always preferred even if "Buf Shadow" is disabled or "Ray Shadow" is enabled, and you need to disable the "Enable Shadow Mapping" button to remove it.

Mapping controls and setup is a lengthy topic so I'll stop here and discuss it latter in another blog :)




Shadow Mapping LightsA few other things worth mentioning is that MOSAIC can export cube shadow maps for the Lamp type (same thing as a point light), orthographic shadow maps for the Sun type (same thing as a distant light), Hemi light types control constant ambient light and color, Spot light types work just like Blender's and finally Area lights which export a diffused wide cone spot light array. This last type (area light) simulate Blender's area light by building a grid array of diffused spot lights with the same shape as Blender's area light. It uses the area light's "SizeX" and "SizeY" for the "Rect" shape and the "Ray Shadow" "SamplesX" and "SamplesY" for the number of lights in the array. This works for both ray traced and shadow mapped lights and since MOSAIC is building the light array (instead of the shader) you can even use your own shaders on this light type. Also because MOSAIC is using the "Buf Shadow" settings for shadow map tweaking and because Blender only offers these controls for the spot light type, you'll need to switch the light to spot to tweak these controls and then switch it back when using non spot shadow mapped lights. You can now also use lights in dupli systems and particles as raytraced or shadow maps, although if you use them in particles you will need to parent the particle emitter to the light in order for MOSAIC to see it. I should also mention that caustic mapping is still experimental and at the moment it does not take the shape of the occluding objects into account, only the shape of the inverted shadow with an option to control its blur, color, intensity and add noise.

Now let's begin listing the controls, I'll break them down by group explaining what each group does and then outline each control in that group.

Navigation and RIBset management:Lights Setup
This group of controls is at the top of the tab and allows you to select available geometry objects, updating all controls and Blender selections accordingly. It also has controls for creating, deleting and selecting RIBsets for this tab.

Here's a breakdown of the controls in this group:

  • Select Light - This will show a list of available lights for selection, once selected it will update the current active object selection and all controls in this tab.

  • Select RIBset - This will show a list of available RIBsets for selection, once selected it will update all controls in this tab.

  • Create New RIBset - This will create a new RIBset from the current RIBset control settings and select it.

  • Delete This RIBset - This will delete the currently selected RIBset and select the DEFAULT RIBset.


Code management:
This group of controls is for attaching user created code fragments (text files with the "cf_" prefix in their names) to the beginning and end of different RIB blocks. As with the previous group, this group of settings is available in various configurations for all the remaining tabs.

Here's a breakdown of the controls in this group:

  • Light Archive - This menu allows you to specify whether the exported RIB code for lights is exported into separate RIB archives or inlined into the scene RIB.

  • Light Begin Code - This allows the insertion of custom code fragments into the beginning of the lights RIB archive before anything MOSAIC exports.

  • Light End Code - This allows the insertion of custom code fragments into the end of the lights RIB archive after anything MOSAIC exports.


Shader management:
This group of settings is available in various configurations for all the remaining tabs and is for selecting shaders for the selection.

Here's a breakdown of the controls in this group:

  • Light Shader - This will select a light shader for this light.
  • Notes - This will display a popup of any notes attached to shader fragments by the author (usually containing information about which Blender controls are used by this shader).

Pass utilities:
This group of controls is for creating specialty render passes related to this light.

Here's a breakdown of the controls in this group:

  • Enable Shadow Mapping - This will generate a scene and render pass entry for a shadow map for this light using the current scene as its beauty pass. There will be a future blog covering this in more detail latter.

  • Edit - This will pop-up the shadow map dialog for editing the shadow pass if it exists.
  • Enable Caustic Mapping - This will generate a scene and render pass entry for a caustic map for this light using the current scene as its beauty pass. There will be a future blog covering this in more detail latter.

  • Edit - This will pop-up the caustic map dialog for editing the caustic pass if it exists.


Options and attributes:
This group of controls is for setting object related options and attributes for this light.

Here's a breakdown of the controls in this group:

  • Use Light in Animations - This option allows you to manually take advantage of a "speed hack" in MOSAIC. This option can drastically improve export times in an animation for any light that is not animated. If enabled then MOSAIC will only export this light on the first frame of this animation and will then just re-use it without recalculating any of its data.

  • Use Transform - In many standard RenderMan shaders there are two techniques for passing the light's transform data to light shaders, by setting the light transform before calling the shader or by passing "to" and "from" parameters to the shader. For maximum compatibility MOSAIC and its light shader supports both methods. When enabled a transform will be setup before calling the light shader and "to" and "from" will equal (0,0,0) and (0,0,1) respectively, when disabled no transform will be used and "to" and "from" will equal the light positional data.

  • Light MBlur - This enables the motion blurring of the light's transform motion, that is the change in the objects position, rotation or scale.

  • frames - This specifies the number of frames to blur across.

    Note : MOSAIC begins the blur by this number before the current frame so blur lead to current frame.


Well, that's it for the lights tab... next up is the "Materials Setup" tab :)

Thanks for reading, WHiTeRaBBiT

No comments:

Post a Comment