Versions Compared

Key

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

...

This page covers the basics of using XGen with V-Ray for Maya, including a step-by-step guide to controlling XGen Attributes through texture maps.

Want to follow along but don’t have a license?


UI Button
colorblue
newWindowtrue
icondownload
titleDownload Free Trial
urlhttps://www.chaos.com/free-trial?utm_campaign=docs-tutorials&utm_medium=website&utm_source=docs.chaos.com



Prerequisites

...

Section
Column
width55%
Make sure xgenVRay.py is loaded as a plugin into Maya (Plug-in Manager - near xgenToolkit.mll) before creating scenes or rendering. 
Column
width5%

 


Column
width40%

 

 

 


...


Section
Column
width55%

When rendering XGen descriptions with V-Ray, make sure the Output Settings in the Preview/Output tab of the XGen window are as follows:

Operation is set to Render and Renderer is set to VRay. 


UI Text Box
typenote

If VRay is not in the Output Settings as shown above, try restarting Maya (with xgenVRay.py as "Auto load" in the Plug-in manager).

To ensure that V-Ray is there, always start Maya 2015+ normally, check in the Plug-In Manager that the module xgenVRay.py is loaded, and then load/create XGen scenes. Opening scenes by double-clicking on the file will not ensure that V-Ray is registered in the XGen UI

Column
width5%

 


Column
width40%

Basics

...

Section
Column
width55%
V-Ray can render two kinds of primitives that XGen has to offer - Splines and Archives. Spheres and Cards primitives are not yet supported. 
Column
width5%

 


Column
width40%

 

 


...


The following images show how instanced primitives look when the base mesh has a low versus a high subdivision. Note how XGen clumps primitives more to the center of each face. This is the same behavior for all kinds of primitives.

 


Section
Column
width10%

 


Column
width40%

Low Subdivision

Column
width40%

High Subdivision

Column
width10%

 

 



Base meshes onto which XGen populates primitives, should use Maya's subdivision settings, as V-Ray's own subdivision settings will not work with them.

...

Materials and V-Ray Object Properties may be assigned to descriptions and all primitives for that description will share them; they can also be assigned on a per-patches basis for fine-grained control over primitives on different patches. This means two patches in the same description can use different materials and have separate V-Ray Object Properties.

 


 

 



For example, if you have a description with four patches in it, you can assign a master material to the description and give a specific material to one of the patches, such as in the example shown below:

 


 

 



UI Text Box
typenote

Assign the description material to the transform node, not to the shape node. Such assignments are hierarchical, meaning they affect the selected node and all its children: the patches are children of the description transform, not the description shape.

...

The following section describes two ways of controlling XGen attributes: through expressions or through texture maps. 


Part I: Through Expressions

...

Section
Column
width55%

Here we demonstrate how expressions may be used to control XGen attributes:

  1. Click on the Sigma button of an attribute. In this example, we control the Length attribute.
Column
width5%

 


Column
width40%

 

 


...


Section
Column
width55%
 2. Edit the expression in the lower text-box of the popup. Click Accept to use it. In this example, we will introduce randomization to the Length.
Column
width5%

 


Column
width40%

 


Part II: Through Texture Maps

...

Section
Column
width55%
1. Click on the arrow pointing down next to the Sigma button of the Length attribute and select Create Map.
 
Column
width5%


Column
width40%

 

...


...


Section
Column
width55%

A pop-up window appears.

2. Increase the Map Resolution to about 200. This is the resolution of the PTex map in texels per-face. Use larger values for high resolution textures.

Name the map as you wish, and click Create.

 
Column
width5%


Column
width40%

...

 


...


Section
Column
width55%

Paint or Connect an Image

  1. After creating the map, you will be in PTex painting mode. You can paint on the surface of the plane with the 3D Paint tool.
  2. If you wish to use an image file, open the Hypershade and Node Editor and click on the icon circled below next to the Length attribute.
Column
width5%

 


Column
width40%

 

 


...


Section
Column
width55%

3. You should see a file texture connected to the plane, shown here.

4. Select the file texture and load the texture map that you wish to use to drive the length of the primitives. Texture maps with higher contrast work better for controlling attributes.

Column
width5%

 


Column
width40%

 

...


...


Section
Column
width55%

Save the Texture

  1. When you are done painting/selecting a texture, click on the Save icon next to the attribute. Always remember to save after changing a texture map, Otherwise XGen will not refresh, and the changes will not be visible in the viewport or renders.
  2. Using a bitmap like the one shown below left should correspond to a view in the viewport like the shown below right.

Column
width5%

 


Column
width40%

 

...


...


Section
 
Column
width10%


Column
width40%

Bitmap

 


Column
width40%

Result in viewport

 


Column
width10%

 

 

 




Editing the Expression

  1. If we edit the expression of the Length attribute through the Sigma button from this:

    Code Block
    languagephp
    $a=map('${DESC}/paintmaps/length');#3dpaint,200.0
    $a

    to this, we can invert the result of the map:

    Code Block
    languagephp
    $a=map('${DESC}/paintmaps/length');#3dpaint,200.0
    $a = 1.0 - $a;
    $a
  2. Add a dome light with an HDRI dome tex to the scene, apply V-Ray Materials, and render. We should see something like this:

...