DirectX 11 Shader

 
 
 

The following are the attributes for the DirectX 11 Shader node, with the MayaUberShader shader file assigned.

In order to use this shader, you must be working in the DirectX 11 environment in Viewport 2.0 and have the dx11Shader.mll plug-in enabled. For more information, see Using DirectX 11 with Viewport 2.0

You can find the DirectX 11 Shader in the Hypershade Create bar. The MayaUberShader.fx file is automatically loaded when the shader is created.

The dx11Shader.mll plug-in allows you to load and view your own HLSL shaders in Maya Viewport 2.0. When you create a DirectX 11 shader using the Hypershade, the MayaUberShader.fxo file is automatically connected; however, you can also load your custom HLSL shader instead. Alternatively, other sample HLSL shaders are available at <maya directory>\presets\HLSL11\examples\.

The dx11Shader_defaults preset is provided. You can use this preset to revert the parameters back to the values initially compiled with the shader.

TipTo override the automatic loading of the MayaUberShader.fxo file, you can go to Windows > Settings/Preferences > Preferences > DX 11 Shader and set the effects file that you want to load by default.
NoteThe following lists the attributes of the MayaUberShader.fx file. Attributes under the Shader section of the Attribute Editor exists for all DirectX 11 shaders. However, the options available may be different. For example, all DirectX 11 shaders have a lights attribute, but the choices for the number of lights or type of lights may be different. Attributes under the Parameters section are specific to the MayaUberShader.fx file.

Shader

Shader File
Navigate to your shader file to assign it to your DirectX11 Shader.

The DirectX 11 Shader searches for the .fx files in the following locations and in the following order:

  • `workspace -q -rd`
  • `workspace -q -rd` + "/renderData/shaders"
  • `workspace -fre shaders`
  • `getenv("DX11SHADER_ROOT")`
  • `getenv("DX11SHADER_ROOT")` + "/shaders"
  • ${MAYA_LOCATION}/presets/HLSL11/examples

The ` denotes executing either a MEL or C function to obtain the required value.

NoteThe MayaUberShader.fx file, as well as other sample HLSL11 shaders, are provided in <maya directory>\presets\HLSL11\examples\.

Click to reload your .fx file and to edit it in your default text editor.

Technique
These options provide different shading methods within the same shading material.
NoteThe following lists the different techniques for the MayaUberShader. Different shaders have different techniques to achieve a variety of effects.
TipYou can change the technique for multiple dx11Shaders in one step by using the Channel Box, or by setting the Technique value in the Attribute Spread Sheet. Use integers to set the Technique values in the Attribute Spread Sheet. TessellationOFF = 0, TessellationON = 1, and WireFrame =2. This shortcut is only applicable to changing multiple instances of the same fx shader.
  • TessellationOFF: This is the default option and simply displays the mesh in the workspace without any tessellation.

  • TessellationON: This option uses shading level tessellation to provide a smoother model without the need for extra geometry.

  • WireFrame: This option provides a wireframe version of the tessellated mesh so that you can review the tessellation of the TessellationON feature.

Light0 / Light 1 / Light 2

If you select the Automatic Bind option, Maya automatically assigns the lights in the scene to the shader. If there are less than three lights in your scene, then light 1 and/or light 2 are left unbound until a new light is created. If this option is selected, Maya indicates the light that is bound for each of Light0 / Light 1 / Light 2.

Use the navigation icon to access the connected light shape Attribute Editor.

You can also select Use Shader Settings to refrain from binding a light. This way, you can tweak the light properties via the Light 0 / Light 1 / Light 2 attributes in the DirectX 11 Shader Attribute Editor.

You can also manually bind your lights. Select, from the drop-down list, the lights from the scene that you want to bind the shader to.

Currently, the MayaUberShader supports 3 point lights, spot lights, ambient lights or directional lights.
ImportantAfter binding a light, you cannot change its parameters in the dx11Shader Attribute Editor. Instead, you must make changes from the light Attribute Editor.
NoteWhen the DirectX 11 Shader is loaded, Maya automatically binds the lights that are set to Automatic Bind. All parameters sharing the same Object attribute are considered to define one light. If a specific light keyword, that is, ambient/point/spot/directional, is found in the Object attribute string, then Maya connects the first light of this type found in the scene. Once this is done, any unconnected lights are connected to remaining scene lights based on position/direction parameter compatibility.

Parameters

Lighting

Linear Space Lighting
Disable this option to refrain from correcting gamma in the textures. Enabling this option assumes that the textures have gamma applied and therefore removes this gamma and re-applies it later on.
Shadows
Select this option to enable shadow casting.
Shadow Strength
Use this slider to control the intensity of the shadows.
Shadow Bias

Sometimes, real-time shadows can cause artifacts on your objects caused by limited precision in the shadow map or differences in scene scale. Use this attribute to remove shadow artifacts on your object.

Double Sided Lighting
Select this option to reverse the backfacing normals of a double-sided, transparent object to improve its lighting.
Rim Light Min / Rim Light Max / Rim Light Brightness
Use these options to simulate a rim light in your scene to highlight edges of objects. Use Rim Light Min and Rim Light Max to set the falloff from bright to dark. Rim Light Max is the distance from the edge at which falloff begins. Rim Light Min is the distance from the edge at which the falloff ends.

Light 0

Enable Light 0
Select this option to enable the specified light in the shader.
NoteThe following parameters are repeated for Light 0, Light 1 and Light 2.
Light 0 Position
Use this attribute to set the position of the light.
NoteIf the light is not bound to a Maya light, you can to manually connect existing lights, cameras, locators and so forth to this attribute.
NotePress 7 for scene lighting.
Light 0 Color
Customize the color for your light. Click the swatch either to change the light’s color in the Color Chooser or to map a texture to the light.
Light 0 Intensity
Use this attribute to set the brightness of the light. A light with an intensity value of 0 produces no light. A light with a negative intensity value removes light from a scene in the area of the light’s influence.
Light 0 Direction
Use this attribute to set the direction of your light.
Light 0 Cone Angle
Use this attribute to set the cone angle for your spotlight. This is the angle (in degrees) from edge to edge of the spot light’s beam.
Light 0 Penumbra Angle
Use this attribute to set the penumbra angle for your spotlight. This is the angle (in degrees) from the edge of the spot light’s beam over which the intensity of the spot light falls off linearly to zero.
Light 0 Decay
Use this attribute to control how quickly the light's intensity decreases with distance. For more information, see Decay Rate.

Ambient and Emissive

Ambient Emissive Map
Enable this option and connect a file texture to Ambient Emissive Map to apply an emissive texture that is bright like a light source. To stop using the texture, disable Ambient Emissive Map.
Ambient Sky Color / Ambient Ground Color
Use these options to brighten the object by simulating light coming from the ground or sky.

Diffuse

Diffuse Map / Diffuse Map Alpha
Select Diffuse Map to apply a diffuse texture to your object to tint it. Connect your texture to the Diffuse Map attribute. Select Diffuse Map Alpha to apply the texture's alpha information to the opacity of the object.
Diffuse Color
You can also tint your object using Diffuse Color.
Lightmap Map
Select Lightmap Map to apply a baked shadowmap. The shadowmap is then multiplied with the diffuse to create baked shadows.
Soften Diffuse for Skin
Select this option to apply soften diffuse (or blended normal diffuse). This feature makes the diffuse lighting on an object more realistic for simulating skin.
Soften Diffuse Mask
Use this option to apply different amounts of soften diffuse to different parts of the object.
Soften Diffuse
This option is a blended normal diffuse. Increase this value to create the light bouncing effect, softening the appearance of the skin.

Opacity

Opacity
Use this attribute to control the transparency of the object.
Opacity Mask
Use this attribute to apply a texture that specifies the areas of the object that are fully transparent.
Opacity Mask Bias
Use this attribute to set the threshold below which the pixels in the opacity mask become fully transparent. For example, if set at 0.5, all pixels in the opacity mask with a value smaller than 0.5 become completely invisible.

Specular

Specular Map
Select Specular Map to increase or decrease the amount of specularity on the object based on the values in the texture. The RGB channels in the specular map controls the Specular Color, while the alpha channel in the specular map controls the Specular Power.
Specular Color
Specular Color controls the brightness and color of the specularity.
Specular Power
Specular Power controls the shape of the specular highlight.
Kelemen-Szirmaykalos For Skin
Select this option to perform Kelemen-Szirmaykalos specular calculations to better simulate human skin. If this option is disabled, the Blinn shader is used for specular calculations.

Normal

Normal Map
Select Normal Map to simulate the lighting of bumps and indentations from the details baked into the normal map.
Normal Height
Use the Normal Height option to change the height of the bumps in the normal map texture.

Reflection

Reflection Cube Map

Select the Reflection Cube Map option to include reflection in your scene. A Reflection Cube Map allows you to create more realistic pre-baked reflections.

TipYou can generate cube maps using freely available third party tools.
Reflection Intensity
Use this slider to adjust the intensity of the reflection on your object.
Reflection Blur
Use this option to create a blurred reflection effect. This option gives you more control over the type of metal or material you are trying to simulate.
Reflection Fresnel Min / Reflection Fresnel Max

Use Reflection Fresnel Min and Reflection Fresnel Max to adjust the amount of reflection based on whether a face is parallel to or perpendicular to the camera.

Use Reflection Fresnel Min to add more reflection to the faces of the object that are facing the camera.

Use Reflection Fresnel Max to add more reflection to the faces of the object that are perpendicular to the camera.

These options work best for curved objects.

Reflection Mask
Use these options to apply a texture to mask areas to prevent them from receiving reflection.
Spec Alpha for Reflection Blur

Enable this option to use the alpha channel of the specular texture to determine the amount of reflection needed to blur parts of the object. Disable this option to evenly blur the reflection everywhere on the object.

Spec Color to Tint Reflection
Enable this option to use the specular color to tint the color of the cube map reflection. The cube map is not tinted if this option is disabled.

Tessellation and Displacement

NoteYou can export texture maps from Mudbox to Maya in the following formats: PNG, JPG, BMP, TIF, TGA, EXR.
Displacement Map

Select Displacement Map to use displacement maps. Displacement maps extrude or indent vertices of your mesh. Displacement maps are especially useful when used in combination with tessellation to generate additional details in your object.

The benefit of displacement maps over normal maps is that shadows pickup the new details of the displacement map.

If you are using a greyscale displacement map, you should disable Tangent Vector Displacement.

Tangent Vector Displacement

Select this option if you want to apply vector displacement maps. You can create vector displacement maps in Mudbox. However, you must use the same low polygon model in Maya as you do in Mudbox.

Select both Displacement Map and Tangent Vector Displacement for vector displacement maps. When using a vector displacement map, you usually also want to provide a normal map to the shader to provide the correct normals to the shader after the vector displacement map has moved the vertices.

NoteSelect Tangent as your Coordinate Space if you output your normal map from Mudbox. Select Absolute Tangent as your Vector Space if you output your vector displacement map from Mudbox.
Displacement Height
Use this attribute to scale your displacement.
Displacement Offset

Use this attribute to control the base value for your displacement.

For example, if the offset is set to 0.5, a gray color is not displaced. An offset of 0 would produce an indentation. An offset of 1 would extrude.

Likewise, if the offset is set to 0, a black color is not displaced. An offset of 0.5 would extrude half as much as an offset of 1.0. Indentations do not occur.

Displacement Clipping Bias
In cases of extreme displacement, Maya may clip away faces inadvertently. This may occur in scenes with a landscape or objects that are long and wide. Use this attribute to set the maximum displacement to determine when a face of an object is clipped from view. You can also use Bounding Box Extra Scale to avoid inadvertently clipping your object.
Bounding Box Extra Scale
Use this option to control the bounding box to avoid inadvertently clipping your object when displacement is used.
Tessellation Range
When you set this attribute, tessellation is controlled by the distance of the object from the camera.
NoteYou may find it easiest to enable WireFrameON when adjusting the tessellation settings.
Tessellation Minimum

Value of tessellation that is constant throughout the mesh. A value of 1 means no tessellation.

Increase the Tessellation Minimum value to increase the resolution.

Flat Tessellation
Select this option to blend point normal tessellation (which smooths the edges of the object) with Flat Tessellation (which only tessellates but does not smooth the object). Set this value to 1 to disable the smoothing.

Translucency

Translucency
The Translucency feature simulates light passing through an object. For example, if simulating human skin, the skin becomes more red. Select this attribute to use the options below.
NoteUse these options to add translucency to your object. This option simulates light passing through the object to give it a more realistic look.
Thickness Mask

The Thickness Mask is a texture you render to control the amount of light that passes through certain areas of the skin. For example, non-bony areas with thin skin like the nose would have a reddish color, since a lot of translucency is coming through. By contrast, bony areas would have a darker color in the thickness texture.

Light Translucent Distortion

Use this value to set the amount that the normal (per pixel) influences the translucency.

If set to 0, the translucency is uniform over the entire object.

If set to greater than 0, for example 0.5; the translucent effect is no longer uniform but is instead broken up and distorted based on the normal. The result appears more organic.

Light Translucent Power
Use this attribute to change the focus or size of the translucent areas.
Light Translucent Scale
Use this option to adjust the amount of translucency created by the light behind the object. When you adjust the slider to 0, there is no translucency in your object.
Translucent Minimum
This attribute sets the amount of translucency that an object always has, even if there is no light behind it.
Outer Translucent Color / Medium Translucent Color / Inner Translucent Color
Use these options to change the skin translucency color; for example, for a creature with different colored skin.

UV

You can bind a UV set to each of your texture maps. To do so, you must first bind the UV set to the DirectX 11 Shader. You can bind up to 3 UV sets under the Surface Data section. Map your UV set to each of TexCoord 0/1/2 where applicable. You can then use this drop-down list to select the texture co-ordinates (in other words, UV set) that you want to map each texture map to. See Assigning a UV set to a texture map connected to the DX11 MayaUberShader for more information.

NoteThe UV section of the Attribute Editor is specific to the MayaUberShader. However, the Surface Data and Default Texture Data features are general to all effects shaders.

Surface Data

This section specifies the channels of the geometry, such as normals and tangents, that are passed into the shader. for the available options.

By default, TexCoord0 is mapped to UV set map1 and TexCoord1 is mapped to map2 and so forth. If you use UV sets with different names, you can bind them to the shader by specifying them in the TexCoord0/1/2 fields. Use uv: in front of your UV set name. For more information, see Assigning a UV set to a texture map connected to the DX11 MayaUberShader.

Default Texture Data

Use these options to select the default texture displayed in the UV Texture Editor when a UV set is selected. For example, if UV map1 is mapped to TexCoord0, and TexCoord0 is mapped to Diffuse Map, then when you select UV map1 in the UV Texture Editor, the Diffuse Map texture is displayed.