Friday, July 11, 2008

MOSAIC feature ramblings - part 4

Part 4 - The MOSAIC Utilities tab and shader fragments:

The "MOSAIC Utilities" tab is a collection of useful utilities for managing tasks that would be difficult to do by hand. This includes things like copying MOSAIC settings from object to object, batch managing of Blender text files, batch managing of render passes and scenes, and the creation and management of shader fragments. Before describing these utilities however I need to discuss a little about two things, shader fragments and render passes.

From the previous blog we've learned that shaders are simply text files that are compiled and used by the renderer, but in order for the renderer to use them it must be told how. In RIB files this simply involves calling the name of the shader with parameters that control different aspects of the shader, this is really no different then selecting a material in Blender (shader) and then adjusting its controls (shader parameters). Shader fragments in MOSAIC are nothing but RIB shader calls put in a Blender text file with a special extension in the name (see MOSAIC Settings "Fragment Filters" to see what they are). These files can be made by hand in Blender's text editor but as we'll see later it's far easier to use the "Generate Shader Fragment" utility instead ;)

Render passes is simply a technique of re-rendering a scene with different settings or setups to generate data to be used by the final "beauty" pass render (which is different then Blender's render layers). This poses a few problems with the exporter because there are many potential techniques that require some level of hand tweaking outside of automation. To get around this problem MOSAIC is using linked object scenes as render passes. Linked object scenes in Blender are simply copies of a scene with all object linked to the original, this way changes made in one scene affect the other. MOSAIC manages these scenes in the "Project Setup" tab which I will discuss in the next blog.

What I want understood for now is that render passes are scenes with special entries in the "Project Setup" tab, also note that unless you're doing advanced custom work most basic render passes can be generated for you by MOSAIC :)

OK, now onto the utilities, I'll list them like previous blogs but will expound on several more than usual.

Update Built-in Shaders/Frags:
MOSAIC automatically generates several built-in shader sources and fragments for the default shading system. This system allows MOSAIC to work "out-of-the-box" with Blender's material, light, and world settings. You can see these shaders and fragments by browsing Blender's text editor after starting MOSAIC. These files must always exist (since they are the defaults) and are automatically created if they don't exist or were deleted, however they are left alone if they already exist or are modified.

This works great unless you're opening an old project with old built-in shaders or accidentally damage them. Instead of having to select and delete the old ones by hand in the text editor (a real pain if you also already have a ton of custom shaders and fragments) you can simply click this to update all built-in shaders and fragments automatically.

Copy Properties:
This simple utility allows you to copy the MOSAIC settings from the active object to all other selected objects of the same type. So for instance if you select everything in the scene but the active object is a light then its settings are copied to all other lights in the selection but no geometry, etc.

Note : If you didn't already know, Blender allows multiple selections of objects but there is always one "active" selection that is usually visually a little lighter.

Clear Properties:
This utility does the opposite of the previous, it removes MOSAIC settings from all objects in the selection. It also doesn't care what the active object is, but just simply uses all objects in the selection. One special feature of this utility is if nothing is selected then it will remove all settings from everything in the entire project (including scenes), this is a great way to quickly reset an entire project.

Reload Texts:
Blender's text editor allows you to create text files but also allows you to load them from the file system. This is the common method you would use for loading shader source files to be used and distributed in your blend project. When texts are loaded in Blender it maintains a path to were the original file is. This utility uses that information in all text files in Blender's text editor to reload them from the originals (if they still exist). This is really handy if you've loaded shader sources generated by a shader utility (such as SLER or that you are still editing externally. The process would go: tweak shader in the external editor, preview it, like it, click "Reload Texts" in MOSAIC, render our preview in Blender, continue over again, etc.

Save Texts:
This is the opposite of the previous utility. Instead of loading all Blender text files from their originals, it saves all Blender text files TO their originals (if they exits). This would be for the opposite process of editing and rendering text files in Blender but using them in an external utility.

Generate User AutoPass:
I'll cover render passes and autopasses in more detail in the next blog, but for now I'll just say this lets you build custom passes that you need MOSAIC to partially maintain for you. This utility will not only generate the scene with appropriate extensions, it will also add a render pass entry in the "Project Setup" tab for you.

Remove Pass:
In certain animation projects it's possible to have a pass with a lot of render pass entries. This can become a pain if you want to remove a scene and have to find and remove all the render pass entries. This utility will automatically remove a scene as well as all render passes entries that use it.

Cleanup Passes:
This utility aids in removing "orphaned" passes, this may happen if you change the name of an object or light and remove the old entries in the passes list but forget to remove the scene. This will remove any autopass scenes that do not have any entries in the render pass list effectively cleaning unused scenes in the project.

Generate Shader Fragment:
This utility is the corner stone to managing shaders in MOSAIC. Its job is to find shaders in your setup and turn them into shader fragments that you can then edit and attach to your project through MOSAIC. When you click this your will see a list of available shaders to generate a fragment from, this list is generated from two sources:

  • Lists all .sl shader source files it finds in the Blender text editor.

  • Lists all compiled shader files it finds in all enabled shader libraries (discussed in previous blog).

You can also select "MANUALLY ENTER" at the top of the list to type the name of a shader that you know is already available on the console from global system variables (most render packages have the standards setup by default).

Note : By enabling and disabling shader libraries, you can limit this list to just the group you want, however be sure to re-enable those libraries or their shader won't work. Once you select a shader MOSAIC will call the package's shader info binary to get a list of its parameters to generate a shader fragment from. If there's a problem you should check the console to see what caused the problem.

Shader Parameters:
This utility allows you select available shader fragments for editing and preview. To use this utility simply click the drop down menu and select a shader fragment to edit (notice that built-in shaders are always available). Once selected the parameters for the shader will show below the menu, you can also use the row of buttons to right of the selection as follows:

  • "R" allows you to reload the shader fragment (if you are editing it by hand in Blender's text editor).

  • "C" will create a new shader fragment from the current (the new fragment will be automatically selected when you finish).

  • "X" will delete the current shader fragment.

  • "P" will generate and render a special preview of the current shader selection and settings. Before previewing a dialog box will popup giving you a chance to tweak the preview scene.

Below these you will see a series of controls allowing you to select the type of shader, its name and its notes. Notes allow you to place notes in the fragment that can be seen throughout the rest of MOSAIC's interface anywhere that shaders are selected, this makes it easier to quickly remember how a shader works for the artists. Every row after that are the shaders parameters. Each row has the following controls:

  • "Use" allows you to disable this parameter from the fragment, this can be handy if you have an old renderer that doesn't like the syntax of this line (such as BMRT).

  • "TW" stands for "Token Wizard" and allows you to select from a list of available MOSAIC tokens based on shader type and parameter type. Tokens allow you to "hook" a Blender GUI control into this parameter. Each token name begins with a prefix that describes where it is in Blender's interface such as "World" or "Mat" and tries to use the exact name that Blender uses for that control. Depending on the token selected you can also set the texture channel and adjust Blender's control range into other ranges (such as adjusting a 0.0-0.1 range to 0-10 range). You can also just select "Shader Default" at the top of the TW menu and the wizard will return the value the shader author intended for default (a great way to safely reset a parameter).

    Note : The token discussion can get very lengthy so I'll cut it off here but I will elaborate eventually when I re-write the Wiki ;)

  • The parameters class.

  • The parameters type.

  • The parameters array allows you to specify an array of settings such as [2].

  • The parameters name.

  • The parameters value. This is where any generated tokens will go, your also welcome to hand type or adjust any tokens here as well as type just straight values.

    Note : This is just a text field so you'll need to type the value "exactly" as its needed in RIB including adding [] brackets, this is so any parameter syntax is possible.

Well that's it for the settings tab, as usual it was a lot longer then I figured but hopefully informative. For the next post I'll discuss using the "Project Setup" tab and render passes ;)

Thanks for reading, WHiTeRaBBiT

No comments:

Post a Comment