vector|vector4 texture(string map, ...)
Samples the texture at the global S and T coordinates from the shading context. These signatures are only available in shading contexts.
vector|vector4 texture(string map, float ss, float tt, ...)
Samples the texture at the given S and T coordinates, using a filter width based on the derivatives of S and T at that point. If you use this function outside a shading context, the filter width will be 0.
vector|vector4 texture(string map, float s0, float t0, float s1, float t1, float s2, float t2, float s3, float t3, ...)
Takes an explicit sampling quadrilateral with corners (s0, t0), (s1, t1), (s2, t2), and (s3, t3).
Returns
A sampled color value from the texture.
If you call the function with a vector4
return type, the function includes the texture alpha in the fourth component.
Image filtering options
Examples of specifying filter parameters:
colormap(map, u, v, "smode", "decal", "tmode", "repeat", "border", {.1,1,1}); colormap(map, u, v, "mode", "clamp", "width", 1.3); colormap(map, u, v, "filter", "gauss", "width", 1.3, "mode", "repeat");
If the texture is a deep .rat
file, you can use the "channel"
keyword argument
to specify a channel in the file:
string channelname = "N"; cf = colormap(map, u, v, "channel", channelname);
"wrap
",
string
="repeat"
repeat
or periodic
The image map will repeat outside the range 0 to 1. Basically, the integer component of the texture coordinate is ignored. This is the default.
clamp
or edge
or streak
The texture coordinates will be clamped to the range 0 to 1. This causes evaluations outside the range to evaluate to the color at the closest edge of the image (the border pixels are streaked outside the range).
black
or decal
or color
Coordinates outside the range 0 to 1 will evaluate to the border color (rather than a color in the image). The border color is black (i.e. 0) by default.
"uwrap
",
string
(AKA swrap
)
Specifies the behavior when the u coordinate is outside
the range 0 to 1. The values are the same as with wrap
.
"vwrap
",
string
(AKA twrap
)
Specifies the behavior when the v coordinate is outside
the range 0 to 1. The values are the same as with wrap
.
"border
",
float|vector|vector4
=0
Specifies the border color when Black/Decal/Color wrapping is used.
"channel
",
Specifies the color channel for textures that have multiple color
planes (for example, diffuse_indirect
or N
).
For ptex images, this specifies the index of the first channel
(for example, 0
or 4
).
"blur
",
float
Blurs in x and y directions. Blur is measured as a percentage
of the image size - so a blur of 0.1 will blur 10% of the image
width. Use xblur
and yblur
if you need different blur
amounts in either dimension.
"xblur
",
(AKA ublur
, sblur
)
Blur amount in the x image direction.
"yblur
",
(AKA vblur
, tblur
)
Blur amount in the y image direction.
"pixelblur
",
float
Blurs the texture by a floating point number of pixels.
Cf = texture("map.rat", ss, tt, "pixelblur", 2.0);
"xpixelblur
",
float
Blurs the texture by a floating point number of pixels in the X direction.
"ypixelblur
",
float
Blurs the texture by a floating point number of pixels in the Y direction.
"filter
",
string
="box"
Specifies the type of anti-aliasing filter to be used for evaluation. The following argument should be a string specifying one of:
point
Point sampling (i.e. no filtering)
box
Box filter (default)
gauss
Gaussian filter
bartlett
Bartlett/Triangular filter
sinc
Sinc sharpening filter
hanning
Hanning filter
blackman
Blackman filter
catrom
Catmull-Rom filter
"xfilter
",
string
(AKA ufilter
, sfilter
)
Specifies the filter for the X direction. The filters are
the same as with filter
.
"yfilter
",
string
(AKA vfilter
, tfilter
)
Specifies the filter for the Y direction. The filters are
the same as with filter
.
"width
",
float
=1.0
Filter width in both X and Y directions.
"xwidth
",
float
(AKA uwidth
, swidth
)
Filter width in the X direction.
"ywidth
",
float
(AKA vwidth
, twidth
)
Filter width in the Y direction.
"zwidth
",
float
Filter width in the Z direction (for shadow maps). This is measured in world space units, unlike the other width arguments.
"extrapolate
",
int
whether to use derivative extrapolation when computing anti-aliasing information. Extrapolation of derivatives is on by default. The argument should be either 0 or 1.
"lerp
",
int
Specifies whether RAT files should interpolate between different MIP levels. By default, this is turned off. Turning interpolation on will help remove discontinuities when different MIP levels of a .rat file are accessed. However, the results of texture evaluation will be slightly softer (i.e. blurrier) and will take more time.
There are three possible values for this argument.
0
Disable MIP map interpolation (fastest).
1
Approximate MIP map interpolation (fast).
2
High Quality MIP map interpolation (slower but highest quality).
"depthinterp
",
string
Specifies the depth interpolation mode for deep shadow maps, to control the opacity value that will be returned when the map is sampled between two z-records.
The argument must be a string.
discrete
(default) Return the first z-record before the sample point.
linear
Linearly interpolate the opacities of the z-records before and after the sample point.
See deep shadow maps for more on the difference between the two modes.
"beerlambert
",
int
When evaluating volumetric deep shadow maps, this will enable Beer-Lambert interpolation of opacity. Beer-Lambert is more a accurate but more expensive form of interpolation.
The argument should be either 0 or 1.
"srccolorspace
",
string
Specifies the color space in which the texture is stored. When texture values are accessed, they will be translated from this space into linear space for rendering if needed.
auto
(default) Determine the source color space based on the file. Currently, this will assume sRGB color space for 8-bit textures and linear for all other textures.
linear
Transform to linear space. This currently only affects 8-bit textures, since all others are assumed to be already in linear space. Use this option to force linear interpretation of textures used for bump or displacement maps.
"face
",
When using a Ptex texture map, the face
argument is used to
specify the face for ptexture lookup.
"ptexorient
",
int
When using Ptex textures, the implicit texture coordinates on
polygons are used as the interpolants for texture lookup (combined
with the face
). However, different software may have different
beliefs about winding and orientation. This keyword argument
allows you to control the interpretation of orientation for Houdini
polygons. The ptexorient
expects an integer argument which is
composed of a bit-field
For example, a value of 6 (0×4|0×2) is equivalent to calling
texture(map, 1-t, s)
instead of texture(map, s, t)
.
The default ptexorient
is 0, which works correctly with the
examples found at https://ptex.us.
See also | |
file | |
map | |
shading |
|