Adverti horiz upsell

lyrid_normal_map 1.0.3 for Maya (maya plugin)

normal map shader and shader list

License
Button download
13,464 Downloads

Compatibility

  • 2010, 2009, 2008, 8.x, 7.x

Operating Systems

  • Windows

History

Created:11/08/2007
Last Modified:11/13/2009
File Size: 999 KB

lyrid_normal_map shader specification

You can also download it from https://www.lvyuedong.org/projects/tech/mentalray/normalmap/normalmap.rar

lyrid_normal_map supports Maya7.0, 8.5, 2008 32&64bit, 2009 32&64bit, 2010 32&64bit version.

This shader can be not only used to read normal map texture, but also devote to combine with bump or other shaders which disturb normals.

 

Note: For long duration of usage, the #:nodeid comment had been added to shader declaration file (lyrid_normal_map.mi file in include folder) since version 1.0.2. So if you replaced the old .mi file with newest version, maya probably would miss or unknow these shader nodes which declared with old version and saved in your scene because of the different node id. If it happened, either you had better rebuild and reconnect the shaders, or keep the old lyrid_normal_map.mi file.

History

version 1.0.3:
1. Add the attribute "intensity" for lyrid_normal_map to control the intensity of changed normal.

version 1.0.2:
1. Change the attribute "texture" of lyrid_normal_map to "color", and delete the "texture coordinate" attribute in lyrid_normal_map.
2. Add "texture space" attribute to lyrid_normal_map, considering multiple uv sets of models.

3. Support x64 version.
version 1.0.1:
1. Change name of lyrid_shaderlist to lyrid_passthrough.
2. Add lyrid_normals_list shader.
version 1.0.0:
1. Begin with three new shaders: lyrid_normal_map, lyrid_passthrough_normal_map and lyrid_shaderlist.

 

Installation

Unzip the content
1. copy include/lyrid_normal_map.mi to path %MAYA_LOCATION%/mentalray/include,
2. choose right version and copy lib/lyrid_normal_map.dll to %MAYA_LOCATION%/mentalray/lib,
3. copy proper version mel scripts in mel path to %MAYA_LOCATION%/scripts/AETemplates,
4. copy icon*.xpm to %MAYA_LOCATION%/icons.

 

You need edit maya.rayrc file in %MAYA_LOCATION%/mentalray for Maya7.0(there is no need for higher version). open maya.rayrc using notepad or your favorite editor and add the following codes in boldface:

registry "{MRMAYA_START}"

...

link "{MAYABASE}/lib/lyrid_normal_map.dll"
...

mi "{MAYABASE}/include/lyrid_normal_map.mi"
echo "mental ray for Maya - startup done"

end registry

You can then launch Maya, make sure the mentalray plugin(Mayatomr.mll) is loaded, and open hypershade, you will find our custom shaders in textures tab, like this:

 

 

 

How to use

 

 

The "color" attribute can be connected from mib_texture_lookup shader which read texture and return color.

In version 1.0.3, the attribute "intensity" has been added to lyrid_normal_map shader(not shown above), which control the intensity of changed normal.
You can select object space(integer 0) or tangent space(integer 1) for normal mapping. The difference between lyrid_normal_map and lyrid_passthrough_normal_map is return type, the former returns vector and the latter returns color, which same as the difference between mib_bump_map and mib_passthrough_bump_map.
Texture space select which uv map to be used, mental ray support up to 63 uv sets in one model. This attribute is useful especially in multi-uv sets which assign proper resolution textures to different parts of model.

 

A standard shader graph may look like:

 

 

 

 

As you can see, to invoke the normal mapping effect, I have to connect the vector returned by lyrid_normal_map1 to one attribute, say ambient, of mib_illum_phong1. but what if this attribute already been in use?

 

lyrid_passthrough can simply passes those shaders which return needless results then invokes them and leave the attributes of destination untouched.

 

 

This shader returns three types of datas: color, vector and scalar. The shaders which return pointless results can be connected to passthrough attributes group, and the returned results by passthrough can be connected to the destination attributes, then set the substitute attributes group equal to set the destination attributes. Say your ambient attribute of mib_illum_phong1 is set to specific color, you just need connect color to ambient and set sub_color in substitute attributes group of passthrough to the same color.

 

click for larger version

 

 

Note, don't connect sub_color to Ambient. You must connect color attributes as sources although sub_color will be assigned to color internally. Passthrough doesn't mean invalid or useless, it just makes shaders been called and throws away the returned results.

How to make normal mapping effect along with bump mapping

By joining lyrid_normals_list shaders which is multi-usable, you can combine normal mapping effect with bump mapping, even more shaders which disturb surface normals. The parameters of lyrid_normals_list are very simple, which receive and output vectors. The shader connected to prev_normal will be called previously, then the shader connected to seq_normal will be called subsequently.

 

 

click for larger version

 

In above graph, The lyrid_normal_map1 will be called before mib_bump_map1, which mean bump shader will continue with bent normals which previously disturbed by normal map shader, rather than the original sphere normals, and of course, you can change the order. So You need notice that, in some case, the order is very important because of causing different effects.

 

 click for larger version

 

Because Maya's own surface shaders provide the normalCamera attribute, you can directly connect output vector of lyrid_normals_list to that attribute, without using lyrid_passthrough shader.

How to achieve normal mapping effect along with Maya's own bump2d shader

If you stick to maya's own bump2d, you'd better take care the following notes. To achieve normal mapping along with bump2d, either you can connect the output vectors which are bent normals to the "normalCamera" attribute of bump2d node, then connect the "outNormal" of bump2d to the "normalCamera" of surface shader, like what the following picture show you:

 

 

 

or, connect bump2d as usual, and passthrough the normal mapping shader to the "color" of surface shader.

 

 

 

Whichever ways you choose, the effect is same, and the normal mapping effect has been achieved before bump2d, and you can not change the order. For example, in the first way, maya would ignore the bump mapping if you changed the order between lyrid_normal_map and bump2d. So I highly recommend mib_bump_map shader. 

 

How to take normal mapping effect with multiple uv sets

Some people use multiple uv sets to assign proper resolution texture to different parts of model. Considering a human model, the head probably be shown more detail which need larger resolution textures:

 

click for larger version

 

So given resolution, the larger the uv map is in uv space, the more detail the texture can be shown. The following graph show you how to take normal mapping effect with two uv sets:

 

click for larger version

 

Care should be taken that the "select" attribute of mib_texture_vector must be same as the "texture_space" attribute of lyrid_normal_map, which determine which uv map to be used.

 

OK, try it! Any suggestion or critique will be welcome.

 

author: LvYueDong
contact: lvyuedong@hotmail.com



Please use the Bug System to report any bugs.
Please use the Feature Requests to give me ideas.
Please use the Support Forum if you have any questions or problems.
Please rate and review in the Review section.

People who favorited this item:

  • hmy911
    hmy911
  • Celorfilmarr
    Celorfilmarr
  • Mason Doran
    Mason Doran
  • DreamboxDigital
    DreamboxDigital
  • wolkiger
    wolkiger
  • raptsmile
    raptsmile
  • Melissa Whitcomb
    Melissa Whitcomb
  • xtvjxk
    xtvjxk