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 Specify the camera to use for camera specific lighting calculations such as specular highlights or reflections. fileFormat / ff unicode The image format as a file extension (e.g. dds). This must be included once for every output map specified. filename / fn unicode The filename to use when creating the map. This must be included once for every output map specified. filterSize / fs float 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 The filter type to use. 0 is a Guassian filter, 1 is a triangular filter, 2 is a box filter. flipU / fu bool Flip the U coordinate of the generated image. flipV / fv bool Flip the V coordinate of the generated image. ignoreMirroredFaces / imf bool Stops reverse wound (i.e. mirrored) faces from contributing to the map generation. ignoreTransforms / it bool 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 Pixel width of the generated map. This must be included once for every output map specified. mapMaterials / mm bool 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 Specifies a new output map to create. One of normal, displacementdiffuseRGB, litAndShadedRGB, or alpha mapSpace / sp unicode 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 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 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 sideof 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 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 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 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 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 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 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 Specifies a surface to use as a sampling source sourceUVSpace / sus unicode 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 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 Specified a surface to sample output information for. targetUVSpace / tus unicode 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 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 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. Flag can have multiple arguments, passed either as a tuple or a list. 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' )