Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Section
Column
width50%

These tutorials explain how to use instanced, animated objects (archives) with XGen and V-Ray for Maya.

UI Text Box
typenote

Before starting these tutorials, it is recommended that you review the  XGen General page.

Column
width5%

 

Column
width45%

 

 

 

 

Part I: Export an Archive

...

...

 

Section
Column
width55%

 To export geometry with materials as an XGen archive, the scene has to be saved on disk.

...

Select the geometry that you want to export.

UI Text Box
typenote

Ensure that the name has no colons. For example, a mesh named  Torso:torso1Shape  will not export properly as an archive using XGen. Deleting the colon will fix the problem. Transforms should also not contain any colons.

UI Text Box
typenote

Ensure that the AbcExport maya plugin is loaded before exporting archives - XGen uses it.

...

Choose Export Selection as Archive(s)

...

 from the

...

File menu. For

...

older versions of Maya, this

...

can be found under

...

XGen or Generate

...

menus.

...

Column
width

...

5%

 

Column
width

...

40%

...

Image Added

...

 

...

 

...

Image Removed
Generate menu

Section
Column
width

...

55%

...

 

 

Image Removed

 

 

In the dialog that opens, give the archive a name and export it

...

.

To download the scene created with these steps, please click the button below.

Image Added

 

Image Removed

 

UI Text Box
typenote

When an XGen archive export fails (no .xarc file is generated), find the <archive_name>.log file in the output directory of the export and check for errors.

Column
width5%

 

Column
width40%

Image Added 

 

Part II: Create a Simple Scene

...

In this step, we will create a simple scene for the XGen Archive primitives.

 

...

Section
Column
width55%

Set Up a Plane

 

Create a plane.

Assign a description with archives randomly across the surface.

...

Set the density to 0.5.

Column
width5%

 

Column
width40%

Image Added


Set up the Archive Primitives

...

 

Section

...

Column
width55%
Set the size of the archive to 50 and add

...

the cookie_monster

...

 archive.
Column
width5%

 

Column
width40%

Image Added

 

...

Image Added

 

...

 

...

Section
Column
width55%
A dialog will appear that asks you if the materials for the archives should be imported into the scene.

...

Choose Yes.

...

Column
width5%

 

Column
width40%

Image Added

...

 

...

 

Section
Column
width55%

Save the scene after the materials have been imported.

...

Give

...

the twist

...

 attribute the following expression:

...

...

Code Block
languagephp
rand(-180, 180)
Column
width5%

 

Column
width40%

Image Added

 

Set Up the Render

You should see something like this in the viewport:

 

Image Modified
 
 

 Add a VRay Dome Light to the scene and render.

...


The result should be like this:


 

Part III: Adding Multiple Archives

...

 

Section
Column
width55%

More than one archive can be instanced in the same XGen description. Here is an example with a second archive

...

.

And let's see how this looks in the viewport.

Column
width5%

 

...

Column
width40%

Image Added

 

...

 

 

Image Modified

 

And when rendered it should look like this

...

.


Image Modified

 

To download the scene created with these steps, please click the button below.

...

Part IV: Per Patch/Description Materials

...

 

Section
Column
width55%

A material can be assigned to a patch/description and all archive instances can be forced to use that material

...

.

Select the description from the Outliner and right click in the viewport > Assign New Material.

...

To make everything yellow we can assign

...

VRayMtl to the description and tick

...

the Use Per Patch/Description Material For

...

Archives option from

...

the VRay settings

...

 in the

...

 Preview/Output

...

 tab:

Column
width5%

 

...

Column
width40%

Image Added

 

...

 

There may not be a change in the viewport, but when rendered it should look like this:

...

Image Modified

  1.  
     Projected textures can be used too! Here is an example with a projected file texture instead of the yellow diffuse color:

...

Part V: Shading Archive Instances Uniquely

...

 

Section
Column
width55%

Archive instances can be shaded uniquely through the use

...

of Custom Shader Parameters

...

. Unlike XGen Hair there are no specified/hardcoded names for such parameters -

...

 colors and floats with any name can be used

...

with VRay User Color

...

 and VRay User Scalar

...

 and can be plugged to anything.

Here we will get rid of

...

the tori archive and make

...

each cookie monster body with a unique random color.

 

Add a V-Ray User Color Map

Disable the Use Per Patch/Description Material For

...

Archives option from the VRay settings in the Preview/Output tab.

Since the materials for the archive have been imported we can select the cookie_monster:body_blue

...

material and attach

...

VRay User Color

...

 to the Diffuse Color.

...

Give User attribute

...

name "body_color" as a value (or whatever name you like - It should just match the name of the parameter we will add later).

...

Column
width5%

 

Column
width40%

Image Added

 

Add a Custom Shader Parameter

...

 

Section
Column
width55%
Go to

...

the Preview/Output

...

 tab of the XGen window and scroll down to

...

the Custom Shader Parameters

...

 section.

...

Add body_color

...

 as type color like so.

Column
width5%

 

Column
width40%

Image Added

...

 

Randomize the Color with an Expression

...

Section
Column
width55%

Go to the expression editor for the new attribute

...

Image Removed

...

.

Set the following expression:

Code Block
languagephp
[rand(0,1), rand(0,1),rand(0,1)]
Column
width5%

 

Column
width40%

Image Added

 

And when rendered it should look like this:

Image Modified

 

You can also set this expression to the Primitive Color attribute of the Preview Settings in the Preview/Output tab to get some sort of visual feedback in the viewport.

 

Add a V-Ray User Scalar Map

...

 

Section
Column
width55%

To render each cookie with a random amount of reflectivity we can create

...

VRay User Scalar

...

 and plug it to

...

the Amount of the reflection

...

of cookie_monster:BrownMtl.

Set

...

the Reflection Color

...

 to white

...

 so that

...

the Amount

...

 dictates the reflectivity.

Set

...

the User attribute name

...

 of the VRay User Scalar

...

 to something like "reflectivity".

 

Randomize the Reflectivity

Add a custom shader parameter of

...

Image Removed

 

type float.

Set the expression of the new parameter to the following:

Code Block
languagephp
rand(0,1)


Column
width5%

 

Column
width40%

Image Added

 

And when rendered it should look like this (with every cookie having different reflectivity):


Image Modified

 

Additional Options

  1. A texture map could be also used to drive the Custom Shader Parameters like explained in the XGen General page

  2. Here is another render with randomized refraction for the cookies instead of reflectivity


...

XGen can export an archive with animation within it from the export menu as shown below:

 

Image RemovedImage Added

 

As an example here is the cookie monster with its eyes animated for 26 frames:

...

UI Text Box
typenote

The animation in the archive does not contain samples for non-integer times! If rendering with motion blur and more than 2 geometry samples for the scene the animated archives will have only 2 geometry samples.

 

Part VII: Frame Attribute Per Archive

...

 

Section
Column
width55%
To make each archive instance be in a different frame of it's inner animation you can use

...

XGen Frame attribute from

...

the Primitives

...

 tab of the XGen window - you can put an expression like rand(0,10)

...

 or $frame.

You will also need to enable

...

the Use XGen Frame Attribute Per Archive

...

 option from

...

the Preview/Output

...

 tab of the XGen window.

Column
width5%

 

Column
width40%

Image Added

 Image Removed

 

Notes

...

Fancy Bullets
typecircle
  • Everything that can be done for XGen hair (animation, motion blur, batch mode, scene modifications, XGen attributes, IPR) can also be applied to XGen archives
  • If an archive is exported with a material from the "initialShadingGroup", then it will not be imported by xgen into the scene when importing the archive.

...