On this page |
vector environment(string texture_filename, vector relect_dir, ...)
vector4 environment(string texture_filename, vector relect_dir, ...)
vector environment(string texture_filename, vector relect_dir0, vector relect_dir1, vector relect_dir2, vector relect_dir3, ...)
vector4 environment(string texture_filename, vector relect_dir0, vector relect_dir1, vector relect_dir2, vector relect_dir3, ...)
vector environment(string texture_filename, vector relect_dir, float filter_angle, ...)
vector4 environment(string texture_filename, vector relect_dir, float filter_angle, ...)
Returns the color of the environment texture in the direction given by the reflect_dir
argument. The signatures that specify four vectors filter the map pixels found within the cone defined by the vectors. Rather than specifying a filtering cone by providing four vectors, it is also possible to indicate an angle to filter over using the filter_angle argument with a single reflection direction.
The environment function can also be used to look up intensity values in an IES photometric light map, with the correct angular mapping applied.
Note
To perform environment map lookups in object space, you’ll need to first transform the direction vector using the vtransform() function.
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.
Examples
vector dir = vtransform("space:current", "space:object", {0, 1, 0}); vector clr = environment("sky.rat", dir);
See also | |
color | |
file | |
map | |
shading |
|
texture |