Monday, November 17, 2008

Aqsis/Air Depth-Mapped Occlusion using multiple light rigs

Hey gang :-)

The short version of this post...

I decided to do a 35 second video demonstrating multiple Depth-Mapped Occlusion maps using Aqsis :-D

Here's the low quality YouTube version...


Or you can download a 25meg high quality version here: http://www.dreamscapearts.com/Public/MultiOccDemo.mp4

The long version of this post...

I noticed a post last week over at Aqsis asking how to use multiple occlusion maps in large scenes or animations. This is something thats has crossed my mind several times while designing MOSAIC's render pass system but not something I've actually tested. Since the BBB shader work is going to be a lot of work and I've needed a little distraction (not to mention just wanting to use MOSAIC at least a little) I decided to do a little 35 second movie using multiple occlusion maps :-D For those of you who don't know ambient occlusion lighting is simply indirect ambient lighting usually from hemispherical directions such as the sky. In RenderMan there are several ways of achieving ambient occlusion depending on your renderer such as irradiance caching, photon mapping, point clouds (usually with in combination with other techniques), depth-mapped occlusion, and plain old light arrays. Depth-Mapped Occlusion is a technique specific to Air and Aqsis similar to a light array however the depth maps are combined into a single file and the file is fed into a shaderop that uses the depth data to figure occlusion shading on the surface. I'm particularly interested in this technique because I'm looking into very, very high resolution renders on a farm that require highly "parallel" techniques, that is the image is broken into many tiles but the tiles can't be rendered until the support data is calculated but usually only by one computer holding up the whole farm. With Depth-Mapped Occlusion each depth pass can be distributed to the farm so the entire farm can contribute to the occlusion data as well as rendering tiles which is more "parallel" in nature ;-)

I decided a good simple scene to demonstrate multiple maps would be a fly through of a city scape broken into blocks with a central subject. The objects of the scene would then be attached to groups and multiple occlusion passes would be generated filtering for each group. The reason large scenes need to be broken down into multiple occlusion maps is because of there scale, it becomes impractical to use a single really high resolution occlusion map for everything (to long to calculate not to mention file sizes). Its also beneficial to break them up for greater controls, such as baking the occlusion maps on the first frame in the background and only calculating occlusion for animation on the subject in the foreground, ect.

As a result of doing this project I've added several new features as well as tweaked several things in MOSAIC, however they are currently only in my developer copy and won't be available to CVS until I finish the shader work :-( Some of the things done for this project are:
  • Added the ability to use the "Enable Occlusion Mapping" utility in the "Scene Setup" tab to generate occlusion passes with user defined names.
  • The occlusion passes are now using the pass names for the outputted occlusion file so the user can know what its name will be for the shader parameter.
  • Made each occlusion rig in the occlusion passes unique so they can be edited separately, before MOSAIC only expected one occlusion pass for each beauty scene so the rigs where all the same :-s
  • Added the occlusion specific controls in the occlusion utility dialog to the "Scene Setup" tab so the occlusion setting can be edited form within the pass (since the occlusion utility can't be used for user named passes after there generated).
  • Added the ability to hide groups of controls in MOSAIC with toggles in the GUI so I could hide the automap controls to make the Scene Setup tab less cluttered
With these modifications its now possible to use any of the autopass utilities to generate custom user defined passes that can later be edited directly by hand, such as a env map pass thats used for multiple objects or a depth map pass used for multiple lights... the only drawback to doing it this way is the shader parameters have to be hand edited since MOSAIC uses the pass names to figure out how to hook pass display data to tokens in shaders :-s

To setup this project I created a plane and used the "discombobulator" script to quickly subdivide and extrude it into a city block. I then instance the block 3 times to create 4 side by side city blocks, each assigned to a different object group. I then created a cube and stretched it into a tower and instanced it twice to create 3 towers in the middle of the city and placed 3 instanced suzanne heads atop each tower, assigning the towers and heads to another group. Next I gave each city block a unique material and used a single unique material for the towers and suzannes shared (this is because each group will need separate occlusion file entries applied to the surface shader of each material). Then in I ran the "Enable Occlusion Mapping" dialog 5 times from the main scene, changing the "Pass Name" and assigning a different object group to the "Select Group" filter for each object group. I named the passes City1.om, City2.om, City3.om, City4.om, Suzannes.om using the object group for each. Once each pass was generated I them switched to each scene and adjusted the occlusion rig to properly surround the objects filter to each pass. Next I used the shader editors "C" button to copy the standard built-in ss_MOSAICsurface shader fragment into 5 new fragments called ss_City1, ss_City2, ss_City3, ss_City4, ss_Suzannes. Then I selected each fragment in the editor and changed the "OccMap" parameter of each from the standard <GetOccMap_S> token to the name of each occlusion file, the occlusion file names are created from the name of its pass with the frame number appended... so for the pass City1.om and its shader ss_City1 on frame one then the parameter should be "[ F1City1.om ]" or if you wanted to do animation you could use the frame token "[ F<#>City1.om ]". Finally I selected each of the 5 materials assigned to the objects and selected the appropriate suface shader for each, such as selecting the material for the first city block and selecting ss_City1 for its surface shader, ect. Then of course I added animation, motion blur, dof and intro-outro graphics to the video sequencer :-D

Anyway heres some screen shots of the basic setup:

the complete beuty scene...





















here the City1.om occlusion rig...





















here the City2.om occlusion rig...





















here the City3.om occlusion rig...





















here the City4.om occlusion rig...





















here the Suzannes.om occlusion rig...





















If anybodies wants to mess with this yourselves you can download the complete project here: http://www.dreamscapearts.com/Public/MultiOccDemo.zip

This zip contains the intro/outro graphics, blend file for Blender 2.48a and a developer copy of MOSAIC pre-loaded in the text editor (WARNING this developer copy of MOSAIC has broken texture support as it is not complete yet and you should NOT overwrite your own copy of MOSAIC with this one!!). To render the project execute the text copy of MOSAIC in the text editor, click "Render Animation" to render out all shadow, occlusion and animation passes (this took 4 days straight on my Core2 Duo 2.8 duel core 8gig ram). Once all frames are rendered into the /tmp/MultiOccPass folder then in Blender click ANIM to composite all tif frames, insert intro/outro and compile them into a mp4 in /tmp ;-)

Thats it... thanks for reading,
WHiTeRaBBiT

MOSAIC progress report on BBB related changes

Greetings all,

The good fellows over at Aqsis have put forth a rather daunting challenge... to render at least a frame if not a small animation of the Blender Foundations "Big Buck Bunny" movie. At first I wasn't very keen on the idea but after considering it for a while I decided it would be the perfect project to really push MOSAIC's integration with Blender and its ability to efficiently export a large animation. Most of the work over the last few months have been related to getting MOSAIC and Aqsis capable of rendering BBB but because of the nature of MOSAIC's RenderMan design and its goals to do all things non-renderer specific these improvements will benefit all RenderMan renderer's using MOSAIC :-)

One of the first big challenges required rewriting key sections of MOSAIC to better handle large scenes and objects with large amounts of data. In particular MOSAIC was dying a horrible death when exporting large numbers of particles, hair strands or high density meshes. The problem was MOSAIC was storing all generated RIB archives in memory before writing to file, now MOSAIC generates and exports the RIB one line at a time (managing archive interactions through open file handles) thus file size is now only limited by the OS. I've also optimized many areas of MOSAIC related to instancing and RIBset passes making occlusion map animations as well as much larger scene animations possible (or at least not as painfully slow as before).

One of the next big challenges has been dealing with the painfully slow export times in Python when dealing with millions of strands of hair :-( I'm still planning experimenting with Python wrappers in the near future to squeeze faster export directly out of MOSAIC, although I'm not keen on complicating compilation and installation of MOSAIC for the user. A far more RenderMan like way of dealing with the problem is to use DSO's (dynamic shared objects) for generating any procedural like object such as hair. A DSO is C library object that can be dynamically loaded and executed by the renderer. These DSO's are capable of accessing the render state as well as calling functions from within the render and can use this information to generate and return RIB code to be rendered (such as growing hair on another object). The advantages of this approach are huge not only because MOSAIC doesn't need handle these large amounts of data but also because neither does the RIB files. This is a big deal for render farms since several hundreds of megs for a single hair RIB for a single character for a single frame will kinda slow down traffic on the network for a large animation :-s The down side to DSO's is they have to be properly compiled to use (something non-programmers will be intimidated by) and often times they call on renderer specific functions making them often times non-universal to other renderer's (unless carefully designed). In either case I have added a new series of controls so that code fragments can now be attached to individual particles systems and geometry materials indices's as well as a toggle to determine if the code fragment "replaces" the exported RIB. So in the case of the BBB hair problem you just make a code fragment to call a hair DSO, select the body mesh of the character and finally attach the code fragment to the particles system (toggling "R" on to not export any hair from MOSAIC). Chris (c42f) over at Aqsis is in the process of writing an excellent hair DSO that will eventually mimic enough of Blender's hair behavior to properly render several of the hairy characters, although I think it may be useful for grass or other such things with tweaking and maybe some modifications :-)

There are also several new modifications related to the DSO stuff mentioned previously. The exporter now always export particle and geometry RIB into a cache file that is always generated regardless of the archiving type of the object. This was originally done so DSO's that require a RIB of the geometry are always guaranteed one, but has several side benefits such as improved export times of motion blur and more efficient sharing or geometry data throughout the export system :-) The geometry cache RIB path/file name can be returned in a code fragment using the new <GeometryCache_S> token and particles cache RIB path/file name can be returned using the new <ParticleCache_S> token. Also there are some improvements to the token system for more flexibility in the returned token string. Originally the tokens were only designed for return values inside shader calls that are always in square brackets but this isn't very useful when in a code fragment. Now its possible to leave the type off to return a straight value or use the "_Q" type to return a quoted value. So for instance <Test_F> = [ 1.0 ], <Test> = 1.0, <Test_Q> = "1.0". Another big new feature added to help with DSO's in MOSAIC is the inclusion of what I'm calling Python tokens. A Python token is just a token including the name of a Python text loaded in Blender that writes RIB text into a global variable tokenReturn that MOSAIC then places in the export stream. So if you made a Blender text called "test.py" and put tokenReturn = "[ \"Hello World!\" ]" in it and then created a fragment and put a token <test.py>, then "Hello World" would be placed in the RIB that the fragment was attached to. This is mainly helpful for accessing data in Blender through Python that MOSAIC doesn't have a token for, such as accessing a control for a parameter to a DSO that MOSAIC doesn't have, it could also be very handy for procedurally generating RIB with python in Blender (although if doing something intense it would be better to use a DSO).

There are a few small changes made to MOSAIC to help with managing larger more complex projects. The "Generate Shader Fragment" utility now only lists shader source files instead of all shader sources and library shaders. This is because when dealing with a lot of shaders the menu was becoming to large to use. Instead I've added a "Fragment" button to each shader library in the "MOSAIC Settings" tab that allows you to create fragments for only those shaders in each library. This has not only the advantage of making the menus smaller but makes it possible to deal with shaders in logical groups. I've also added a "list all tokens" utility that will generate a text file called "tokens.txt" in Blender that automatically lists all MOSAIC tokens grouped according to there datablock and type using there full format, this is not only handy for seeing what tokens are available outside the shader editor but is great for copy/pasting tokens into code fragments ;-) I've also had to make several changes to how MOSAIC interprets dupli systems, in particular how it manages dupli groups conected to empties. This is important to how Blender manages content linked to external libraries in large projects and such.

Another big problem is how to deal with complex characters with multiple materials applied to the same mesh. Since standard RiSpec doesn't have a method for dealing with this in the past MOSAIC just separated the mesh where each material is applied however this process is slow to export and when dealing with SDS it is still required to export the entire mesh for each material (using hole tags so curvature matches between materials) making for very large RIB file sizes. MOSAIC now supports three different methods for separating materials using a control called "Material Set Mathod" located in the Geometry tab, the first two methods will work with all renderer's however the most efficient and elegant method will only work in Aqsis or Gelato, heres a breakdown of the pros and cons of each:

Separate Geometry
Separates the geometry per material either using Os 0/1 values for polygons or hole tags for SDS.
PROS:
  • the only benefit of this approach is it guarantees that all renderers and shaders will work with multiple materials.
CONS:
  • Since the geometry is copied for every material this can produce massive project sizes- Since the geometry is re-processed for every material this can be very slow to export
  • All that data ends up needing to be loaded into the render which consume large amounts of memory and will render slowly

Multipass Materials
Calls the cache with read archives per material using a user parameter in the geometry to adjust Os values in the shader per face.
PROS:
  • Requires the geometry only be processed once greatly increasing export times
  • Produces far less overall RIB size since geometry's only used once (unless datablock is set to "Inline Code")
CONS:
  • Requires that all shaders be modified to recognize the geometries user parameters, however this only effects polygons (particles are still separated)
  • Depending on the renderer still consumes large amounts of memory for each copy of the mesh per material
  • Still very slow to render since each material has a complete mesh even if its not visible per material

Layered Materials
This elegant approach will only work in Aqsis or Gelato and uses the user parameter in the geometry to shade or skip each face in a chain or layered shaders.
PROS:
  • Only requires the geometry to be exported once, so exports fast
  • Only requires the geometry to be loaded into the renderer once, so uses less memory
  • Only requires one geometry for all materials, so renders faster
CONS:
  • Will only work in Aqsis or Gelato
  • Requires all shaders be modified to recognize the geometries user parameters, and unlike the previous method will mess up both particles and geometry shading if not.

The last method required adding Aqsis/Gelato style layered shading support to the internal structure of MOSAIC so it was a small step to add user control of layered shading to materials. MOSAIC is using the concept of "chaining" Blender materials together to create layered shading for surface and displacement shaders. How this works is fairly straightforward, open up the materials tab and select the material you want to be the "root" material in the chain then select a material with "Next Material Layer" menu to link to, then goto that material and select another material to link to, so of so forth... All materials in a chain are exported together into each materials archive separately so multiple objects can intercept different parts of the chain.
You can also use the "Surf Output Variables" and "Disp Output Variables" to specify surface and displace output variables to use for the current materials shaders. If more then one variable is entered (separated by spaces) then separate connect calls are chained together for each so for example...

if Material.001 "layer1" used "a1 a2 a3" and called Material.002 and
if Material.002 "layer2" used "b1 b2 b3" then MOSAIC would export
ConnectShaderLayers "surface" "layer1" "a1" "layer2" "b1"
ConnectShaderLayers "surface" "layer1" "a2" "layer2" "b2"
ConnectShaderLayers "surface" "layer1" "a3" "layer2" "b3"

Also note that you can have varying numbers of parameters per control and can use None selections to disable export of certain shaders in a chain (such as only building a displace chain, or skipping a surface shader in a long chain).

Here's a simple example using all these features together. In particular this is demonstrating combining highly refined or integrated shader (such as MOSAIC's integrated shaders to Blender) with fast customized shaders (such as procedural shaders). This in my mind is a key benefit of layered shading because you don't have to re-create the shaders for every new surface (such as having to be sure every new shader can use occlusion, or env maps, or SSS).




At this point in development I'm finally at the point that I've begun to work on re-writing the built in shaders for more complete support of Blender's material system. I'm currently working on adding support for multiple layered textures using some if not all blending modes and UV layers. This is important because currently I can export the characters geometry into RenderMan (even using linked libraries) but without layered textures, alpha and layered UV's it won't be possible to get accurate renders of the charaters :-( The trickiest part wont be putting this together but getting the top 5 RenderMan renderer's compiling the shaders without problems :-s
Anyway I'm hoping this will only take a few weeks to do and if all goes well I also hope to add some fancy techniques such as better SSS support for skin and faked soft shadows using depth maps (should be considerably faster then raytracing).

Thanks for reading, WHiTeRaBBiT

Thursday, November 13, 2008

Unexpected archive from the past

While surfing the net tonight I ran across an old article that was archived on some server somewhere in the vast cyberspace. It caught my eye since I actually used to read this publication as a child so I clicked the link from Google and was reminded at how much time has changed the computer industry. Sometimes we forget the "good ol' days" and even I have to remind myself of this. Recently I was sort of griping about my "old" 1.6 Ghz system with 512 MB RAM running Linux, this page tonight kind of snapped me back into shape and despite it's shortcomings this little system built from spare parts isn't that bad....

For a little chuckle check this out.

http://www.atarimagazines.com/compute/issue135/88_Start_your_own_carto.php

Sunday, October 19, 2008

Linked from Blender.org

Today I got a nice message from ZanQdo, aka Daniel Salazar from Blender.org.

Hi, just added a link to http://www.blendertorenderman.org/ in the rendering section of this page

http://www.blender.org/features-gallery/features/

I'm impressed with your blog, keep up the great work

cheers
So now when you click on the Renderman (RIB) link in the features of the Rendering section, it goes directly to here. This is a first! To be on the Blender.org site is another breath of accomplishment, even though I had nothing to do with the code itself. Nonetheless I think our voice has just gotten a lot stronger. We will see what happens.

Thursday, October 16, 2008

HAIR!!




















The developers of Aqsis and MOSAIC have recently been working very hard on correctly exporting Blender fur to Renderman and the results are paying off very well. One of the major issues with Blender and Renderman is that the particle system in Blender is difficult to work with and up until recently had been impossible. Since Blender's fur system is based on particle data there was only the ability to export a general description of the fur to the RIB file but no way to actually control the fur. This makes for some ugly fur, let alone hair.

Now there is a way to export Blender fur using guide hairs! A lot of it comes from a custom DSO that handles the generation of the hairs based on the guide splines, so it's not so much a part of MOSAIC but the script does make calls to it using fragments associated with a particular shader assigned in Blender. There is also work to allow the layered shader function of Aqsis (note: Aqsis is the ONLY RiSpec renderer capable of this, not even PRMan can do this!!), so this allows for even more interesting work.

One of the projects in the works is some talk about rendering the entire Big Buck Bunny short using Aqsis as the render engine with little modification to the scenes. However that is only a rumor and not set in stone. hehe.

To view the topic posts on the Aqsis site click HERE.

Wednesday, October 08, 2008

Blender to Renderman is now a domain!



Google is awesome, simply put.

This blog is now www.blendertorenderman.org!!!

This morning I was checking this out on Google, the ability to have the blog as an actual domain name, which honestly is easier to remember than the blogspot URL that has been in action for most of the year. Best part is that the blogspot URL will redirect to the .org address so there is no need to completely redo any posts or links made in the past. That is awesome!

Plus it cost only $10 a year!

Blender To Renderman has been upgraded, tell your friends and family!

Saturday, August 16, 2008

Blender Renderman Artist Tools Downloadable ISO soon





This is a new approach to the spread of this project to the rest of the world. Tenzin and I have discussed the compilation of a downloadable ISO of the tools we use and are developing and call it BRAT - short for Blender Renderman Artist Tools. This was about 4 months ago, and after a brief moment of real life issues can continue to work on this. Soon there will be an ISO for Blender and Renderman.

The first will be an early release with tools, shaders, resources and such to test it's functionality and to test how easy to implement into an existing CG pipeline. All you need to do is just install the software and shaders and you are ready to go. So far it is almost ready for final release, just need to tie things up and give it a test run on fresh install of Windows before unleashed to the world and tested on Linux. There should not be any issues with Linux, the first pipeline using the current versions was being built on 64 Studio, a 64 bit Linux distro, and it worked just fine.

The next part of my project will create an installer of some sort that will setup the required programs, libraries and plugins to run pretty much out of the box without having to install and configure each and every one by hand. A pipeline setup tool for lack of a better term. That will be a bigger project that might not be seen until the end of the year.

More details will be outlined later, but expect this to be available for download early to mid September of this year (next month).

Wednesday, July 23, 2008

MOSAIC feature ramblings - part 12

Part 12 - Mapping utilities tutorial:


This post represents the last of the MOSAIC feature ramblings series and will focus on actually building and rendering a simple scene using mapping.
In particular this tutorial will focus on the following tasks:


  • Build a basic scene in Blender highlighting RenderMan setup

  • Prepare shaders via materials

  • Set up MOSAIC

  • Set up an occlusion map pass

  • Set up an environment map pass

  • Set up a shadow map pass

  • Set up a caustic map pass

  • Set up camera DOF

  • Add, build and use RenderMan shader sources and fragments

  • Tweak RenderMan settings

  • Tweak shaders via MOSAIC's GUI



This tutorial will specifically target MOSAIC's mapping utilities to create advanced rasterization techniques, because of this I will be using Aqsis for this tutorial (since it's a pure REYES renderer). Before we begin be sure you have at least Blender 2.46, Aqsis 1.4 and CVS mosaic.py 1.39 or newer.

If you're impatient and, like me, just want to see the scene, you can download it here:http://www.dreamscapearts.com/Public/mapping.blend

Also the first image is the final render, so you can use it as reference for building your scene ;)

Building the scene


To start off with, we will need to build a scene in Blender keeping in mind a few details related to how MOSAIC and RenderMan work. To save a little time instead of outlining every step of this I'll just explain what's in the scene and show some scene shots. I'm assuming a basic knowledge of Blender if we're using external renderers :)

Here's what's in the scene, look at the pictures to the right for the layout:


  • 1024x1024 UV test grid image saved as a tif.

  • 1 mesh plane Scale 13.7x13.7, double sided, UV unwrap, with unique material.

  • 1 mesh Suzanne Scale 2.1x2.1x2.1, double sided, smooth, SDS mod with unique material.

  • 4 instances (alt d) Suzanne Scale 1x1x1, double sided, smooth SDS mod with unique material.

  • 1 standard spot light, energy 1.2, color RGB 1.0,0.9,0.8.

  • 1 standard camera with 35mm lens.


Now that we have the basic components and layout of the scene let's setup the RenderMan related settings. To start off with we need to assign the large Suzanne to a group, this is because later on we will assign it to caustic pass by itself.

Preparing shaders via materials


Next let's quickly outline the material settings:

For the plane use standard material :
  • Col RGB=1,1,1,

  • Amb=1 (sets occlusion),

  • Spec=0,

  • create image texture using tif image, disable map to Col, enable map to Disp, and set its Disp slider to 0.477 (this tells MOSAIC to use texture for micropoly displacements).

For big central Suzanne use standard material :
  • Col RGB=0.098,0.665,0.544,

  • Ref=0.709,

  • Spec=2,

  • Hard=309,

  • Amb=0.607,

  • RayMir=1,

  • Mir Fresnel=1.2,

  • IOR=1.3,

  • Transp Fresnel=2.0.

For the instanced Suzannes use standard material :
  • Col RGB=0.617,0.617,0.617,

  • Spec=0.184,

  • Hard=215,

  • Amb=1,

  • enable "Subsurface Scattering";
  • Scale=1,
  • IOR=1.3,
  • Error=0.05,
  • Col RGB=1,0.791,0,
  • Front=0.8,
  • Back=1.


One thing to note about the big Suzanne's material is you'll notice that we're setting the ray mirror and transp settings even though we're not enabling Ray Mirror and Transp. This is because if MOSAIC sees an environment map enabled on an object it will use its material's ray mirror and transp settings on the map as if it were raytraced. This allows more advanced control such as fresnel over the environment map. If an environment map is enabled you will need to first disable it before being able to use raytracing even if you enable the "Ray Mirror" and "Ray Transp" toggles (maps take precedence since they involve render passes to MOSAIC).

Just for a nice effect let's also enable some fog. Go to Blender's world material settings and set the HorRGB color to 0.289,0.542,0.817. Also enable "Mist" and set "Dist" to 30. The other default settings should work but you may want to play with them to get other effects :)

Finally we need to setup the camera for DOF by switching on the camera's Limits and adjusting the Dof Dist (yellow cross) so that it's near the front of the big Suzanne. This will tell MOSAIC where the focal point for the DOF will be.

Setting up MOSAIC


Now that we have the camera, lights, objects and materials setup now it's time to setup MOSAIC. Before we begin be sure to go to the "MOSAIC Settings" tab and make sure you have "Aqsis" selected in the preset menu.

In the previous posts I briefly mention the mapping utilities and several buttons related to this, let's describe this in a little more detail.

The mapping utilities collectively are just a series of buttons throughout MOSAIC interface that allow you to create and edit map related render passes. You can find these button connected to the thing they make a map for, such as occlusion maps with scenes, environment maps with objects, shadow and caustic maps with lights. Once clicked , you will be presented with a dialog that allows you to setup how you want the map to be generated and how you want its contents updated. When complete MOSAIC will generate a render pass entry in the "Project Setup" tab and a scene to use as the pass using the name of the object and a special extension as its name (such as lamp.sm, see post 5 for details). Once the pass is created the button for the utility will be pressed in (letting you know at a glance if the pass already exists), if you click on the utility button again the scene and all its render pass entries will be removed. You can click the "edit" button next to the utility buttons to edit an existing pass without destroying its contents. The mapping dialogs have a set of controls that are standard for all dialogs and some that are specific to the map type.

Here are some of the standard ones:

  • SizeX/Y - These are standard controls for all utilities and adjust the width and height of the map.

  • Use Shaders - This is standard for all utilities and if enabled the shaders for the scene are used in the pass. This should be turned on if the map needs to see displacement mapping or surface shader related transparency (for deep shadows, etc). This is best left off for faster render times unless needed.

  • Use Preview - This is standard for all utilities and if enabled the pass will use the framebuffer display (will popup a render window). This should only be enabled if you wish to see the passes render output.

  • Degrees/Scale - This is standard for all utilities and has different meaning depending on the object type. If this is an environment or point shadow pass then this controls the seams for the cube mapping, if this is a sun lamp then this is orthographic scale (usually good to start a 9 or so), if this is a spot light then it does nothing (lens determined from spot size). In the case of occlusion mapping this does nothing because the occlusion rig uses spot lights.

  • Shading Rate - This is standard for all utilities and sets the shading rate for the pass. This is by default set very high for lower quality but faster rendering (which is usually OK for support passes), set this lower for higher detail and higher for faster render times.

  • Group - This is standard for all utilities and combined with the other filter settings control how the generated pass is built from the beauty pass. MOSAIC creates the pass from the current scene which becomes the passes beauty scene, the filter settings at the end of all utility dialogs tell MOSAIC what to use from the beauty scene. Depending on the pass type, some of these controls are always forced to certain values and some are available to the user. This one (group filter), is the most commonly used and just tells MOSAIC to build this pass only from objects contained in the specified group.


Now that we've covered a little about how mapping utilities work let's use them to setup the passes for this scene.

Set up an occlusion map

Let's start by going to the "Scenes Setup" tab and pressing the "Enable Occlusion Mapping" button. The default setting for this should be fine.

Just in case you were wondering, here are what some of the controls do:

  • Hemisphere - This is exclusive to occlusion mapping and controls whether the occlusion rig is a hemisphere or a full sphere. MOSAIC does occlusion mapping by creating a mesh in the pass and dupliverting a spot light to it, thereby making a dome light rig.

  • Rig Segment / Rings - This is exclusive to occlusion mapping and controls the number of segment and rings used in the occlusion rig. The higher these numbers the more lights are used in the rig.

This will produce an occlusion map that Aqsis will use to calculate occlusion.

The occlusion color is set by the world's HorRGB color and its intensity is controlled by each material's Amb slider, just like Blender.









































Set up an environment map

Next click on the big Suzanne and let's give her an environment map!

Once you've clicked on the big Suzanne go to the "Geometry Setup" tab and click the
"Enable Environment Mapping" button.

Unlike last time instead of using all defaults enable the "Use EnvDOF" toggle and set
"fstop" to 600.

This will produce a glossy like reflection by using DOF to make objects further away
blurry (in this particular scene it's not very visible so could be skipped).









































Set up a shadow map

Next click on the light and go to the "Lights Setup" tab and press the "Enable Shadow
Mapping" button. The default settings should be fine for this, but note if we weren't
wanting displacements in shadows we could cut render times by disabling "Use Shaders".

Set up a caustic map

We also want to click "Enable Caustic Mapping" for this light but instead of using all the defaults set "Group" to "Group" (or whatever group you assigned the big Suzanne to
earlier).

We need to do this because by assigning a group to the filter, this pass will only use
objects in that group, in this case that's just the big Suzanne.

Since we only want caustics for that one glass object then this works well, if you were to
add more glass objects with caustics you would just assign them to the same groups.

Set up camera DOF

Finally the last thing we need to setup is the camera.

Click on the camera and go to the
"Cameras Setup" tab.

Enable the "Use DOF" toggle and
set the "fstop" to 240.

This tells the renderer to use DOF
and MOSAIC will set the focal point
to the camera's Dof Dist setting.

At this point we can now render a
basic scene but you'll probably
notice that the environment map
renders get "eyesplits" errors and
overall the rendering is slow.


Also the scene lacks the interesting procedural displacements.

Adding, building and using RenderMan shader sources


Let's go ahead and play with some RenderMan procedural shaders :) If you've installed a full version of MOSAIC you will have a folder in the installation called "shaders", let's use a couple of the shaders in there. In Blender setup a window to the "Text Editor", click "File" and browse to MOSAIC's "shader/displacements" folder and load two shader sources: "dented.sl" and "bubbly.sl". When shader sources are loaded into Blender's text editor MOSAIC can use them automatically, but in order to use them in the project we need shader fragments. To do this go to the "MOSAIC Utilities" tab and click "Generate Shader Fragment". Once clicked, select the "dented.sl" and "bubbly.sl" one at a time to automatically generate shader fragments for those shaders. Once shader fragments have been generated then you can select them in the "Shader Parameters" menu to manually edit them (and of course you can now use them in the "Materials Setup" tab).

Now that we have shader fragments let's edit them so they look like my example. Select "ds_bubbly" in the "Shader Parameters" menu and edit the following (including the square brackets):

  • Kd = [ -0.15 ]

  • bubsize = [ 0.5 ]

For the "ds_dented" the default values will be fine. Now that we have tweaked our shader values let's apply them. Select the big Suzanne and go to the "Materials Setup" tab (make sure this really is the material for the big Suzanne). Change the "Displacement Shader" entry to "ds_dented", this will apply the dented shader to this material which is applied to the big Suzanne. Next select one of the instanced smaller Suzannes, go to the material setup tab and change the "Displacement Shader" entry to "ds_bubbly". This will apply the bubbly shader to this material which is applied to all the instanced Suzannes.

That's it for using shader sources, very easy :)

Tweaking RenderMan settings


At this point everything should begin looking like the example render I've provided, but you're probably getting errors on the environment passes and things are a little slower than they should be, so let's look at optimizing this scene for RenderMan :)

Eyesplits happen when geometry passes through the eye plane of the camera (it helps to think of this as the near clip visually), when this happens the renderer has to continue to dice and split the geometry into finer pieces to create a clean edge. How many times this happens is controlled by the "eyesplits" control in the "Scenes Setup" tab, but you want to be careful because eyesplits are very slow and can usually be avoided. One of the first things to look for when getting eyesplits is whether the camera is too close to any geometry, when rendering environment maps the camera is placed at the center of where the object is (which is usually very close to other objects). To correct this one of the simplest things to do is decrease the DisplaceBound setting. The DisplaceBound setting basically extends the bounding box of an object to make extra room for displacement shaders, this is necessary because RenderMan renderers are really sensitive to the bounding box since it's used to determine how far to calculate the shaders. The bounds have to be manually adjusted because the renderer has no way of knowing how far the displacements are passing outside the bounds box. By default MOSAIC uses 0.100 for all objects which is actually very large (I did this so all displacements would work for beginners).

So, I said all that to say this, to remove the eyesplits error for the environment map and increase overall render performance change the "DisplaceBound" settings in the "Geometry Setup" tab for each object to these:

  • plane = 0.010

  • big Suzanne = 0.010

  • smaller Suzannes = 0.030

Another small tweak that can help performance depending on your machine and memory is to increase the "bucketsize" in the "Scene Setup" tab to 32. This determines how large each render bucket is and will usually use more memory the larger it is but render each bucket a little faster (up to a point).

Tweaking shaders via MOSAIC's GUI


Finally one of the last areas I want to discuss for tweaking the scene is manual shader parameters.

The built-in shaders that come with MOSAIC have several parameters that have no where to hook into Blender's interface.

One thing to keep in mind when tweaking these are that they are global in scope, this is because the same shader fragments are usually used by everything in the project (this is possible because tokens allow each object to pass different settings through the same fragment).

One way around this would be to copy the built-in fragment and apply it to the individual objects you wanted.

Here's some parameters on "ls_MOSAIClight" I've tweaked to improve the caustic effect by coloring, smoothing and adding a little procedural noise:

  • CausticAlpha = [ 0.7 ]

  • CausticColor = [ 0.0 1.0 0.6 ]

  • CausticSamples = [ 256 ]

  • CausticBlur = [ 0.12 ]

  • noisefreq = [ 1.5 ] (this turns on noise)

















Well that's it, thanks to everybody who's encouraged me to continue writing these blogs (it's been a lot of work).

Also a big thanks for everyone who's played a part in making MOSAIC better, it's absolutely amazed me how people's ideas, encouragements and bug reports have made MOSAIC far better then I ever planned :D

Thanks for reading, WHiTeRaBBiT

Saturday, July 19, 2008

MOSAIC feature ramblings - part 11

Part 11 - The Materials Setup tab and raytrace attributes:


MaterialsThe "Materials Setup" tab allows you to control different aspects of how MOSAIC exports Blender materials.

MOSAIC uses Blender materials as the place to apply RenderMan shaders and attributes related to surface shading, in particular you can apply surface, displacement, interior volume, exterior volume and area light shaders as well as both integer and string based raytrace attributes.

Since MOSAIC exports all material associations to geometry including multiple materials per object and datablock, there is a wide range of possibilities.

Traditionally RenderMan shaders are applied to individual objects, but with MOSAIC you can apply shaders to materials and assign multiple materials to portions of the same mesh allowing much more complex setup and rigging. The exporter automatically separates the mesh into different objects to be shaded, when using an area light shader the geometry is placed with the light declarations before any other geometry (area light shaders are for true geometry based illumination and is not the same as the area light type which is only a light array).



The "Materials Setup" tab also has a set of attribute menus for setting the material's raytracing behavior. In RenderMan you can use these attributes to define whether a surface is visible to specular (shadows), diffuse (occlusion) and photons (caustics). There are two forms of these settings with varying support by different renderers, the older string type and the newer integer type (see your renderer's documentation for detailed instructions on how these attributes work). MOSAIC uses your renderer preset selection (in "MOSAIC Settings" tab) to automatically setup all new material settings to use the type best suited for your renderer. By default all options are on so you can immediately begin using raytraced shadows, occlusion and caustics :)

Since MOSAIC provides tokens that can hook Blender controls to shader parameters (see "Shader Parameters" in the "MOSAIC Utilities" tab) the built in shaders automatically use the most common Blender material controls. At the moment only the most important controls are linked, and not all of them behave the same as Blender... but after this series of blogs my next big project is to add almost all light, material and world controls into the shader system with near identical behavior :)

Here's a list of which material controls are currently hooked to the default shaders:

  • Halo (this will turn all geometry including hairs into point clouds)

  • HaloSize (this not only controls point size but also the base width for hairs)

  • Add (this controls hair tip width relative to base width)

  • HaloPuno (if enabled MOSAIC attempts to export normals for hairs to create ribbons)

  • Shadeless

  • Shad A

  • Col RGB

  • Spec RGB

  • Mir RGB

  • A (Alpha)
  • Ref

  • Spec

  • Hard

  • GR: (light groups do not use "Exclusive")

  • Tralu

  • Amb (this controls both hemi light and raytraced and mapped occlusion)

  • Emit

  • Ray Mirror (this will enable raytraced reflections but if "Enable Environment Mapping" is enabled on any object using this material it will be used for reflections regardless of this toggle)

  • RayMir (this controls both raytracing and environment maps)

  • Fresnel (this controls both raytracing and environment maps)

  • Ray Transp (this will enable raytraced refractions but if "Enable Environment Mapping" is enabled on any object using this material it will be used for refractions regardless of this toggle)

  • IOR (this controls both raytracing and environment maps)

  • Fresnel (this controls both raytracing and environment maps)

  • Sub Surface Scattering (this enabled a depth map based sss effect therefore it's recommended you use this with shadow mapped lights, however you can manually adjust the SSSWidth parameter for ls_MOSAIClight to get similar result with raytracing)

  • Scale (adjusts the SSS strength)

  • Radius R

  • Radius G

  • Radius B

  • IOR (adjusts the sss map blurring)

  • Error (adjusts the sss map bias)

  • Scattering color

  • Col

  • Tex

  • Front

  • Back

  • Also the world "Ambient Occlusion" toggle enables a non cached raytraced occlusion using the worlds HorRGB color (mapped based occlusion is enabled in the "Scene Setup" tab independently of this toggle.

The surface shader also support texture channels. All "map to" channels are currently supported and work similar to Blender with one exception, only one texture of each channel type can be used for each material (I intend on changing this to match Blender's behavior by using arrays of texture names in the future). Something else to keep in mind with textures is that MOSAIC only supports the "image" texture type not any of the procedurals (that's what RSL is for), and that when loading an image you should probably stick with .TIFF since most RenderMan systems have problems with anything else. Also remember to use the "Texture Export Options" in the "Project Setup" tab to disable any textures you're not using.

Here's a list of which material texture controls are currently hooked to the default shaders:

  • UV (only uses this coordinate type, any other is default to primitives type)

  • ofsXYZ

  • sizeXYZ

  • All "Map To" channels supported

  • Col

  • Nor

  • Disp (controls displacement map height)

That covers most of the high points of the materials tab so let's go ahead and list its groups and controls:

Navigation and RIBset management:Materials Setup
This group of controls is at the top of the tab and allows you to select available cameras, 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 Material - This will show a list of available materials for selection, once selected it will update 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:

  • Material Archive -This menu allows you to specify whether the exported RIB code for cameras is exported into separate RIB archives or inlined into the object RIB.

  • Material Begin Code - This allows the insertion of custom code fragments into the beginning of the material block before anything MOSAIC exports.

  • Material End Code - This allows the insertion of custom code fragments into the end of the material block after anything MOSAIC exports.


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

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

  • Surface Shader - This allows you to select a surface shader from a list of available system or loaded shaders.

  • 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).

  • Displacement Shader - This allows you to select a displacement shader from a list of available system or loaded shaders.

  • Int Volume Shader - This allows you to select an interior volume shader from a list of available system or loaded shaders. Volume shaders are similar to atmosphere shaders but for filling volumes of space.

  • Ext Volume Shader - This allows you to select an exterior volume shader from a list of available system or loaded shaders. Volume shaders are similar to atmosphere shaders but for filling volumes of space.

  • Area Light Shader - This allows you to select an area light shader from a list of available system or loaded shaders. Area light shaders are for turning geometry into true area lights, but are only supported by a few renderers and usually require special shader ops.


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

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

  • transmission - Is this material visible to transmission rays (casts shadows)? This control uses both the new integer style (on or off) and the older string style (sets how shadows cast through material such as "transparent", "opaque", "shader", "Os").

  • specular - Is this material visible to rays created by trace() (receives shadows)? This control uses both the new integer style (on or off) and the older trace command.

  • diffuse - Is this material visible to color bleeding and occlusion (new integer style)?

  • photon - Is this material visible to photons such as caustics (new integer style)?

  • camera - Is this material visible to the camera (new integer style)?

  • Shading Model - Which shading model to use when scattering photons (newer style)?

  • transmissionhitmode - How is opacity for transmission rays determined?

  • specularhitmode - How is opacity and color for specular rays determined?

  • diffusehitmode - How is opacity and color for diffuse rays determined?

  • camerahitmode - Allows you to control culling of geometry behind camera's visibility.

  • Use Material 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 material that is not animated. If enabled then MOSAIC will only export this material on the first frame of this animation and will then just re-use it without recalculating any of its data.

  • Flip "U" Tex Coor - This allows you to manually flip the exported "U" UV value for this material (handy when certain image formats are working but inverted in the U direction on your renderer).

  • Flip "V" Tex Coor - This allows you to manually flip the exported "V" UV value for this material (handy when certain image formats are working but inverted in the V direction on your renderer).

  • Shader MBlur - This enables the motion blurring of the material's parameters. This is particularly helpful for blurring displacement animations (if your renderer supports this).

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

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


Well, that's it for the materials tab... next up a deeper explanation of using the mapping utilities :)

Thanks for reading, WHiTeRaBBiT

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

Thursday, July 17, 2008

MOSAIC feature ramblings - part 9

Part 9 - The Geometry Setup tab and geometry export types:


GeometryThe "Geometry Setup" tab allows you to control different aspects of how MOSAIC exports geometry objects.

The terminology of the tab can be a little confusing, by "geometry" I'm referring to any Blender object that contains mesh, surface (patch), curve or particle data (I plan on adding blobbies later on).

Something else to keep in mind is that Blender handles this in two parts, the object (container) and the geometry data (datablock), even though MOSAIC's GUI is showing both in one tab.

MOSAIC follows this structure by exporting the object RIB and geometry data RIB separately, this allows efficient sharing of geometry datablocks by multiple objects. This is why you'll see two archive methods and multiple code begin/end menus in the tab.

This topic represents the absolute heart of MOSAIC's export code and I could discuss this in fine detail for weeks, so instead let me try to summarize which geometry and its data can be exported:


Mesh and SDS modifier geometry
  • Double/single sidedness

  • Object/per face smoothing

  • Object/per face solid (flat)

  • Per vertex colors

  • Per vertex UV coordinates

  • Per face normals

  • multiple materials per object

  • multiple materials per face

  • SDS edge creasing

  • Export of all modifiers (be careful about type and ordering)

Particles
  • Multiple particle systems per object

  • Export of Hair, Emitter and Reactor types

  • Supports child particles

  • Showing and hiding the emitter geometry

  • Hair, point, object, group and billboard visualizations

Surfaces (aka in RenderMan as patch)
  • Multiple patches per object

  • Multiple material code is in place but Blender does not support yet

  • Support for both "Uniform" and "Endpoint" UV knots

  • Support for control point "Weights"

Curves
  • Currently ONLY supports Bezier curves (natively supported by RenderMan)

  • Multiple curves per object

  • Multiple materials per object

  • Supports "extrude" for creating ribbons

  • Supports node "tilt" parameter for ribbon control points

  • Uses nodes "radius" parameter to further tweak per node extrude

  • Support for cyclic curves (periodic, some renderers don't support this)

Dupli Objects
  • Support for DupliFrames, DupliVerts, DupliFaces, and DupliGroups

  • Support for dupli lights and cameras

  • Support for shadow mapping on dupli lights (basis for occlusion rigging)

  • Duplis make automatic efficient use of RIB archives

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:
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 Geometry - This will show a list of available geometry objects 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 file with the "cf_" prefix in their names) to the beginning and end of different RIB blocks. As 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:

  • Object Archive - This menu allows you to specify whether the exported RIB code for the object is exported into a separate RIB archive ("Read Archive") or inlined into the scene RIB ("Inline Code"). For this tab there is also a "Delayed Archive" selection, this uses the delayed read archive call which only loads the RIBs for the object in memory if its bounding box is on camera (great for animations with lots of objects).

  • Datablock Archive - This menu allows you to specify whether the exported RIB code for the datablock (geometry data) is exported into a separate RIB archive ("Read Archive") or inlined into the scene RIB ("Inline Code"). For this tab there is also a "Instance Object" selection, this uses the ObjectBegin/End blocks just before each frame block in the main RIBs for instance calls. These make efficient use of memory but are limited as to which RIB code can be used in them (see the RiSpec or your renderer's manual) and are not as efficient to export.

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

  • Geometry Code - This allows the insertion of custom code fragments directly in the object RIB after the objects geometry (if any). This is handy for creating custom geometry code such as using Quadrics by hand.

  • Object End Code - This allows the insertion of custom code fragments into the end of the object 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:

  • Atmosphere Shader - This will select an atmosphere (fog) shader that will only affect this object.
  • Notes - This will display a popup of any notes attached to shader fragment by the author (usually containing information about which Blender controls are used by this shader).

Also note that the built-in vs_MOSAICfog shader automatically uses all Blender's world Mist settings and uses the HorRGB color for the mist. This means that setting up and using the world mist should feel identical to using it in Blender.

Note : Immediately following this blog series I will be rewriting the built-in shader system so some shader related information may change.

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

Here's a breakdown of the controls in this group:
  • Enable Environment Mapping - This will generate a scene and render pass entry for a environment map for this object 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 environment map dialog for editing the environment pass if it exists.


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

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

  • Shading Rate - This will bypass the current scenes shading rate for this object only (0 uses scene's shading rate).

  • orient - This allows you to manually specify the geometry orientation as left or right handed (DEFAULT export nothing).

  • shading - This allows you to manually specify smooth or constant shading interpolation, see you renderer's docs for more info (DEFAULT export nothing).

  • para class - This lets you set which parameter class to use. These let you specify if "facevarying" or "facevertex" is used for UV and color mesh data which can produce very different result depending on your renderer.

  • DisplaceBound - This lets you specify how much displacement bound to use (0 exports nothing). This parameter is used by RenderMan to extend the objects bound box to make room for displacement shaders that push geometry out of bounds. This is necessary because most RenderMan renderers use the object bounds to limit shader calculations and will clip anything that falls out of bounds.

  • CoorSystem - This specifies the coordinate system to use for the displacement bounds, see you renderers docs for more info.

  • cull hidden - Whether or not to cull hidden primitives, see your renderer's docs for more info (DEFAULT exports nothing).

  • cull backface - Whether or not to cull backfaces, see your renderer's docs for more info (DEFAULT exports nothing).

  • dice binary - Whether or not to use binary dicing, see your renderer's docs for more info (DEFAULT exports nothing).

  • dice raster - Whether or not to use raster oriented dicing, see your rendere'rs docs for more info (DEFAULT exports nothing).

  • trace displace - Whether or not to raytrace displacements, see your renderer's docs for more info (DEFAULT exports nothing).

  • trace motion - Whether or not to raytrace motion blur, see your renderer's docs for more info (DEFAULT exports nothing).

  • Use Object 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 object that is not animated. If enabled them MOSAIC will only export this object on the first frame of this animation and will then just re-use it without recalculating any of its data. Even though this option is on by default (to eliminate confusion) you should always disable this for ALL objects not being animated for much improved export times :)

  • Extend Bounds Calculations - This is another speed hack and is disabled by default. Some RenderMan renderers require that particles and the motion of a motion blurred object within the shutter be contained in a bounds box. You can tell if this is the case if your renderer clips a motion blurred object or particles. The calculations for recalculating the bounds for these (especially for particles) can be excessive and not necessary for all renderers.

  • Transform MBlur - This enables the motion blurring of the objects 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 leads to current frame.

  • Geometry MBlur - This enables the motion blurring of geometry motion, that is the morphing of vertices or control points of the geometry.

    Warning : this can be very slow for dense geometry and it is recommended you stick with transform MBlur unless the geometry is morphing far and fast enough to actually see it blur.

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

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



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

Thanks for reading, WHiTeRaBBiT

Wednesday, July 16, 2008

MOSAIC feature ramblings - part 8

Part 8 - The Groups Setup tab:


Groups SetupThe "Groups Setup" tab allows you to use code fragments and atmosphere shaders with groups of objects instead of just one at a time. This can prove especially helpful when dealing with large and complex scenes with lots of custom fragment work. The exporter achieves groups in RenderMan by wrapping every object in a group in a single AttributeBegin/End block, allowing custom code to be entered at the beginning or end of the block. This ensures that any custom code entered in the block is pushed and popped off the render state so they will not affect anything else outside of the group.

The exporter handles objects in groups in a very simplistic manner, it cycles through each group exporting each object in the group only once. This means that multiple or nested group setups are ignored and each object is only used in the first group it belongs to.

Also note that lamps must be declared before all geometry (unless dealing with area light geometry), so lamps will not be apart of any groups (however lights can still be put in groups for the material GR: control).

The group selection menu will only recognize groups that have something in them (empty groups are ignored), and groups cannot use RIBsets (due to some internal complexities). The "Group Block" archive menu has options unique only to groups. By default this option is set to "Ignore Group" for all new groups and must be set to "Attribute Block" before the group will be exported (although the objects in the group will still export but not as apart of a group).

Let's illustrate a simple example of using groups for scene setup. Let's say you're browsing the 3Delight docs and see a SSS example you want to try.

The example shows some RIB source using an attribute like this:

Attribute "subsurface" "scattering" [ 2.19 2.62 3.00 ] "absorption" [ 0.0021 0.0041 0.0071 ] "refractionindex" 1.5 "shadingrate" 16 "scale" 0.2

You read that this attribute simply needs to be placed before any geometry you want to use SSS. To do this in MOSAIC you would simply create a new text file and name it something like "cf_sss" and copy the code in it, then select it in the "Object Begin Code" menu in the "Geometry Setup" tab for the object you want to use SSS, simple! Now let's say you like the effect but want to experiment with 30 objects switching SSS on and off them individually, but you don't want to have to turn "cf_sss" code fragment on and off each one individually. This is where groups come in. You can assign the objects to a group and then attach the "cf_sss" to that group's "Group Begin Code", using Blender to add and remove objects from group without ever having to touch MOSAIC making experimenting much faster :)

Now let's outline the controls for this tab:

Navigation management:

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

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

Code management:
This group of controls is for attaching user created code fragments (text file 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:

  • Group Block - This menu allows you to specify whether to export the RIB code into an attribute block or completely ignore the group.

  • Group Begin Code - This allows the insertion of custom code fragments into the beginning of the group attribute block before anything MOSAIC exports.

  • Group End Code - This allows the insertion of custom code fragments into the end of the group attribute block 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:

  • Atmosphere Shader - This will select an atmosphere (fog) shader that will only affect the objects in this group.

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


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

Thanks for reading, WHiTeRaBBiT

Tuesday, July 15, 2008

MOSAIC feature ramblings - part 7

Part 7 - The Cameras Setup tab:



The "Cameras Setup" tab allow you to set various properties of the camera for export. This tab will only work with Blender camera objects and will not be available for lights or objects set as active cameras, anything other than a camera as active camera is considered a specialty render pass and is setup in the "Scenes Setup" tab. The exporter automatically uses these camera controls under the Blender camera object "editing" tab:Camera Editing


  • Lens/Scale - Uses both the lens size and degrees as well as scale (for ortho).

  • Orthographic - Uses both standard and orthographic perspectives.

  • Dof Dist - Dof distance is used for the focal point if DOF is enabled in MOSAIC.

  • Dof Ob - Works by default from Blender.

  • Start - Just like Blender this sets the cameras near clipping.

  • End - Just like Blender this sets the cameras far clipping.




Something else to note is some RenderMan renderers can use something called a imager shader that can process both the background and entire render buffer. MOSAIC by default uses the built-in imager shader that simulates Blender's World background settings, although currently it only uses the HorRGB color to fill the background. After this blog series is complete I intend on rewriting the built-in shaders to fully simulate Blender's background settings (if possible). The imager shader can be applied to the camera (meaning different cameras could use different imager effects), and the the render pass scene setup tab so environment maps can match active camera.

The cameras tab is fairly straight forward so let's go ahead and list its groups and controls:

Navigation and RIBset management:
Cameras SetupThis group of controls is at the top of the tab and allows you to select available cameras, 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 Camera -This will show a list of available cameras for selection, once selected it will update Blender's current 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 file with the "cf_" prefix in their names) to the beginning and end of different RIB blocks. As 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:

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

  • Camera Begin Code - This allows the insertion of custom code fragments into the beginning of the camera block before anything MOSAIC exports.

  • Camera End Code - This allows the insertion of custom code fragments into the end of the camera block 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:

  • Image Shader - As mentioned previously this selects the desired imager shader for this camera.

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


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

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

  • Camera MBlur - This enables camera motion blur.

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

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

  • Use DOF - This enables the depth of field effect (uses the Blender's camera Dof Dist control for focal point).

  • fstop - This sets the RiDepthOfFeild "fstop" parameter (see your renderers docs or the RiSpec for more details).

  • focalL - This sets the RiDepthOfFeild "focal length" parameter (see your renderer's docs or the RiSpec for more details).

  • Shutter min - This sets the RiShutter "min" parameter (see your renderer's docs or the RiSpec for more details).

    Note : if set to 0 RiShutter will not be exported.

  • Shutter max - This sets the RiShutter "min" parameter (see your renderer's docs or the RiSpec for more details).

    Note : if set to 0 RiShutter will not be exported.

Well, that's it for the cameras tab... next up the "Groups Setup" tab :)

Thanks for reading, WHiTeRaBBiT