Go to: Synopsis. Return value. Keywords. Flags. MEL examples.

Synopsis

colorAtPoint [-coordU float] [-coordV float] [-maxU float] [-maxV float] [-minU float] [-minV float] [-output string] [-samplesU uint] [-samplesV uint]

colorAtPoint is NOT undoable, NOT queryable, and NOT editable.

The colorAtPoint command is used to query textures or ocean shaders at passed in uv coordinates. (For ocean shaders uv is x and z in worldspace ). The return value is a floating point array whose size is determined by either the number of input uv arguments passed in and the the queried value. One can query alpha only, rgb only, or rgba values. The returned array is only single indexed, so if rgb is specified then the index for red values would be index * 3. Blue is index * 3 + 1, and green is index * 3 + 2. For rgba use a multiple of 4 instead of 3. For alpha only one can simply use the index. There are two basic argument formats that may be used: colorAtPoint -u 0 -v 0 -u .2 -v .1 etc.. for all points or colorAtPoint -mu 0 -mv 0 -xu 1 -xv 1 -su 10 -sv 10 // samples 100 points If one is sampling several points and they are all in a regular grid formation it is more efficient to call this routine with the latter method, which uses a min/max uv and number of samples, rather than a long argument list of uv coords.

Return value

None

Keywords

texture, color, alpha, uv, ocean, outColor, paramUV

Flags

coordU, coordV, maxU, maxV, minU, minV, output, samplesU, samplesV
Long name (short name) Argument types Properties
-coordU(-u) float createmultiuse
Input u coordinate to sample texture at.
-coordV(-v) float createmultiuse
Input v coordinate to sample texture at.
-maxU(-xu) float create
DEFAULT 1.0 Maximum u bounds to sample.
-maxV(-xv) float create
DEFAULT 1.0 Maximum v bounds to sample.
-minU(-mu) float create
DEFAULT 0.0 Minimum u bounds to sample.
-minV(-mv) float create
DEFAULT 0.0 Minimum v bounds to sample.
-output(-o) string create
Type of data to output: A = alpha only RGB = color only RGBA = color and alpha
-samplesU(-su) uint create
DEFAULT 1 The number of points to sample in the U dimension.
-samplesV(-sv) uint create
DEFAULT 1 The number of points to sample in the V dimension.

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can be used more than once in a command.

MEL examples

// The return value is the array of values determined by the number of
// coord flag uses or samplesU * samplesV. The default return value is alpha.
// If instead the return value is RGB there will be 3 times as many values returned,
// and if it is RGBA there will be 4 times as many values.

createNode checker;

colorAtPoint checker1;
// returns the alpha value at uv (0.0,0.0) for texture checker1
// The return array will have one entry corresponding to this alpha.

colorAtPoint -u .5 -v .5  checker1;
// returns the alpha value at uv (0.5,0.5) for texture checker1
// The return array will have one entry corresponding to this alpha.

colorAtPoint -o RGB -u .5 -v .5 -u 0.0 -v 0.1  checker1;
// returns the colors at uv (0.5,0.5) and (0.0, 0.01) for texture checker1
// The return array will have 6 values in the following order: RGBRGB

colorAtPoint -o A -su 11 -sv 6 checker1;
// returns the alpha for 50 points in a uniform 11 by 6 grid mapped across
// uv (0.0, 0.0) to uv (1.0, 1.0) The 12th point would be the first point
// in the second row of samples where uv = (0.0, 0.2)

colorAtPoint -o A -su 3 -sv 3 -mu 0.3 -mv 0.3 -xu 0.4 -xv 0.4 checker1;
// returns the alpha for 9 points in a uniform 3 by 3 grid mapped across
// uv (0.3, 0.3) to uv (0.4, 0.4) The 4th point would be the first point
// in the second row of samples where uv = (0.35, 0.3).