pymel.core.rendering.surfaceSampler

surfaceSampler(*args, **kwargs)

Maps surface detail from a source surface to a new texture map on a target surface. Both objects must be selected when the command is invoked, with the source surface selected first, and the target last.

Flags:
Long name (short name) Argument Types Properties
camera (cam) PyNode ../../../_images/create.gif
 
Specify the camera to use for camera specific lighting calculations such as specular highlights or reflections.
fileFormat (ff) unicode ../../../_images/create.gif
 
The image format as a file extension (e.g. “dds”). This must be included once for every output map specified.
filename (fn) unicode ../../../_images/create.gif
 
The filename to use when creating the map. This must be included once for every output map specified.
filterSize (fs) float ../../../_images/create.gif
 
The filter size to use in pixels. Larger values (e.g. over 2.0) will produce smoother/softer results, while values closer to 1.0 will produce sharper results.
filterType (ft) int ../../../_images/create.gif
 
The filter type to use. 0 is a Guassian filter, 1 is a triangular filter, 2 is a box filter.
flipU (fu) bool ../../../_images/create.gif
 
Flip the U coordinate of the generated image.
flipV (fv) bool ../../../_images/create.gif
 
Flip the V coordinate of the generated image.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list.
ignoreMirroredFaces (imf) bool ../../../_images/create.gif
 
Stops reverse wound (i.e. mirrored) faces from contributing to the map generation.
ignoreTransforms (it) bool ../../../_images/create.gif
 
Controls whether transforms are used (meaning the search is performed in worldspace), or not (meaning the search is performed in object space).
mapHeight (mh) int ../../../_images/create.gif
 
Pixel width of the generated map. This must be included once for every output map specified.
mapMaterials (mm) bool ../../../_images/create.gif
 

Where appropriate (e.g. normal maps), this controls whether the material should be included when sampling the map attribute. This must be included once for every output map specified.

mapOutput (mo) unicode ../../../_images/create.gif
 
Specifies a new output map to create. One of “normal”, “displacement” “diffuseRGB”, “litAndShadedRGB”, or “alpha”
mapSpace (sp) unicode ../../../_images/create.gif
 
The space to generate the map in. Valid keyword is “object”. Default is tangent space. This must be included once for every output map specified.
mapWidth (mw) int ../../../_images/create.gif
 
Pixel width of the generated map. Some output image formats require even or power of 2. This must be included once for every output map specified.
maxSearchDistance (msd) float ../../../_images/create.gif
 

Controls the maximum distance away from a target surface that will be searched for source surfaces. A value of 0 indicates no limit. When generated maps include artifacts from the “other side” of an object, try setting this value to a distance approximately equal to the radius of the object. If this flag is included, it must be included once for every target.

maximumValue (max) float ../../../_images/create.gif
 
The maximum value to include in the map. This allows control of how floating point values (like displacement) are quantised into integer image formats.
overscan (os) int ../../../_images/create.gif
 

The number of additional pixels to render around UV borders. This will help to minimise texel filtering artifacts on UV seams. When mipmaps are going to be generated for the texture a higher value may be necessary (in addition to a filterSize greater than 1).

searchCage (sc) unicode ../../../_images/create.gif
 

Specifies a search envelope surface to use as a search guide when looking for source surfaces. If this flag is included, it must be included once for every target.

searchMethod (sm) int ../../../_images/create.gif
 

Controls the search method used to match sample points on a target surface to points on the sources. 0 is closest to envelope, 1 is prefer any intersection inside envelope to intersections outside it, and 2 is only use intersections inside envelope.

searchOffset (so) float ../../../_images/create.gif
 

Specifies a fixed offset from a target surface to use as the starting point when looking for source surfaces. This value is only used when no search cage is specified for a given target. If this flag is included, it must be included once for every target.

shadows (sh) bool ../../../_images/create.gif
 
Where appropriate (e.g. lit and shaded), this controls whether shadows are included in the calculation. Currently only depth map shadows are supported.
source (s) unicode ../../../_images/create.gif
 
Specifies a surface to use as a sampling source
sourceUVSpace (sus) unicode ../../../_images/create.gif
 

Specifies that the transfer of data between the surfaces should be done in UV space and specifies the name of the UV set on the source surface(s) that should be used as the transfer space.

superSampling (ss) int ../../../_images/create.gif
 

Controls the number of sampling points calculated for each output value. The algorithm will use 2 ^ n squared samples for each point (so a value of 0 will use a single sample, while a value of 3 will calculate 64 samples for each point).

target (t) unicode ../../../_images/create.gif
 
Specified a surface to sample output information for.
targetUVSpace (tus) unicode ../../../_images/create.gif
 

Specifies that the transfer of data between the surfaces should be done in UV space and specifies the name of the UV set on the target surface(s) that should be used as the transfer space.

useGeometryNormals (ugn) bool ../../../_images/create.gif
 

Controls whether geometry or surface normals are used for surface searching. Using geometry normals will ensure a smooth mapping but can introduce distorted mappings where there are large distances between the source and target surfaces. Surface normals can introduce overlapping or discontinuous mappings, but does allow map distortion to be influenced by surface normal direction.

uvSet (uv) unicode ../../../_images/create.gif
 
The name of the UV set to use when creating output maps. If this flag is included, it must be included once for every target.

Derived from mel command maya.cmds.surfaceSampler

Example:

import pymel.core as pm

# Generate an object space normal map of a cube onto a sphere called test.dds
pm.surfaceSampler( mapOutput='normal', filename='C:/test', fileFormat='dds', source='pCube1', target='pSphere1', uv='map1' )