From the course: Maya: Natural Environments

Shading XGen splines - Maya Tutorial

From the course: Maya: Natural Environments

Start my 1-month free trial

Shading XGen splines

- [Instructor] Let's talk about applying materials to XGen Spline primitives. When we create a spline primitive description from scratch, XGen will automatically assign a Maya Hair Physical Shader. When we import a preset, the shader defined in that preset is created and assigned. Let's go into the hypershade and investigate. We need to select the XGen description in order to load the connected shader. But we actually can't select the description in the viewport, we need to use the Outliner. So open up the Outliner, we've got our grass custom collection, expand that. And within that, we've got the description and also the description binding. You can select either one of those, I'll choose grass golden description. We can close the Outliner, open up the hypershade and then right click in the graph and choose graph materials on viewport selection. We've got the grass physical shader here, and that is a Maya material for renderings spline primitives. It's a generic physically based material that should work with any current physically based render engine. But just to keep us guessing, there is currently no documentation for this material shader. So we'll need to experiment with all of its assets attributes in order to find out how they work. Another gotcha within here is that the hypershade may not actually display the entire graph of this shading network. This is actually a real problem. We need to display everything that's connected here. And currently we are not seeing everything that's connected. So if you're not seeing there's stuff connected to the root and tip color, then you can right click in the graph and from the marking menu, choose show, show all. And now we actually see the entire graph. There's something here called an Ai user data color node. And that is an Arnold node. It's designed to grab a specific named attribute from a shape node and then pass those attribute values to the renderer. For example, it could grab vertex color from a mesh or velocity from a fluid simulation. Let's open up its attributes, select it, and open the Attribute Editor Control A if necessary. And we see that it's got a parameter here an attribute labeled attribute. And it's got the name or value, grass to color. And that is the same as the custom shader parameter in the XGen description. If we go to the preview output tab and scroll near the bottom, we'll see custom shader parameters and we've got one there, which is of the type color and of the name grass to color. This parameter value is being passed to the renderer via this Arnold Ai user data color node. And currently that's connected to both the root and tip colors of the spline primitives. Let's rename all of these because they've got kind of problematic names. Remember that these came over from the preset that we loaded. So let's rename these so they make a lot more sense. I'll select that shader node and we'll rename it to grass golden hair physical shader and press enter. Let's copy paste that to the shading group. So we can select that string, copy at Control C, select the shading group node, go to it's tab and paste that in put in an underscore and an sg at the end. We'll also rename this user data color node. We'll call that one grass golden Ai user data color and press enter. Okay, back to the hair physical shader. When we render in Arnold, the hair physical shader attributes are automatically converted into their equivalents in the Ai standard hair shader. Arnold always renders its own materials not the materials of the host applications, such as Maya. For example, a Maya Lambert shader gets reinterpreted as an Ai standard surface and render time. Now due to this conversion process, not all of the attributes of the Maya native hair physical shader will actually work in Arnold. Helpfully, the Arnold developers included a button to lock the unsupported attributes, so we won't have problems trying to adjust things that don't work. If we scroll down on the Attribute Editor, open up the Arnold section, click the big button lock unsupported attributes. And this locks a bunch of the attributes they turn gray, and additionally, it also creates a Multiply Divide note here in our shading network. And it's purpose is to take the output of this transmission use scatter, also known as, Longitudinal with TT, it takes that value and then multiplies it by 2.5 and then plugs it into the transmission V scatter. And that's all simply because the Ai standard hair does not have transmission U and V. Okay, now we've got a basic idea of a shader network for an XGen spline primitive description. And in the next movie, we'll actually drill down into these hair physical shader parameters and our direct look of our grass.

Contents