Clarisse offers 3 kinds of image map texture nodes:
- Texture Map which uses a Clarisse layered image as a texture. This node is very useful if you wish to use a live render as a texture.
- Texture Map File which can load any supported image file to be used as a texture.
- Texture Streamed Map File which is basically the same as the Map File except it streams from disk the input image file.
All Image Maps textures support AOVs. By default they output the
RGBA image buffer from the input image. However, it is possible to output a different image buffer using the attribute
Output Layer and specifying the name of the image buffer/AOV you wish to use.
Map and Map File#
Texture Map and Texture Map File both share a same set of attributes to control image pre-processing and image filtering. The difference between the two is that the Texture Map is connected to a Clarisse layered image (which can be a live render) whereas the Texture Map File is referencing a image from the disk. However, both textures evaluate/load the image when needed during a render.
Stream Map File#
Unlike Map Files, Stream Map Files always attempt to partially load images in memory during rendering. Moreover, when the image format supports tiles (such as EXR or TIFF), only needed tiles are streamed from disk during rendering.
This is extremely important as only parts of the images that are actually used in a render end up being loaded. Not only, this is more efficient but also it dramatically speed up the time to first pixel since, the renderer doesn't wait to load the entire texture into the memory.
Stream Map files also comes with 2 other benefits when compared to Map Files. The support of a texture cache on which the size can be user controlled and also have the ability to load images that already define mip map pyramids.
This extra layer of feature and flexibility comes with a cost since Stream Map Files are about 2 times slower to evaluate in shader graphs than Map Files.
The memory used for Stream Map File texture can be constrained so that they never exceed a certain amount of system memory. To define the size of the texture cache go to Edit > Preferences... > Input Output and set Stream Texture Cache to the size you wish. Just know that the smaller the size of the texture cache, the slower the render can be.
Indeed, if there are a lot of textures in the scene, the renderer may constantly need trash some textures to make some room due to the lack of memory and reload trashed ones later on because still needed by the renderer.
Mip Map Generation#
Depending on the image file format loaded by the stream map file (EXRs or TX), the stream map file can directly read tiles from the mip-map pyramid when available. This speeds up even more the time to first pixels as well as the efficiency of the texture cache since far away textures are likely to load smaller resolution images.
It is then highly recommended to use image formats that support tiles and mipmaps such as EXRs or even better TX files. Fortunately, Clarisse comes with a dedicated command-line utility called
maketx. which converts any input image to a tiled TX file that encoded the mip-map pyramid.
This utility can be found in Clarisse binaries directory. To convert an image to TX just type from the command-line:
This will automatically generate
image.tx in the same directory where
image.jpg is located.
To get detailed information on maketx usage, type from the command-line:
Instead of using image stills, it is possible to use a sequence of images to create animated textures. To do so, just set Sequence Mode attribute to Sequence.
|Sequence Mode||Set if the texture is a still image or a sequence of images.|
|Frame||Define the current frame. By default, it is using the current frame of the application. This is useful if you want to drive the current frame in the shading network such as when using time offset scattering. Only available on Stream Map Files.|
|First Frame||Set the first frame of the sequence|
|Last Frame||Set the last frame of the sequence|
|Frame Offset||Set the sequence frame offset|
|Pre Behavior||Set the pre-behavior of the sequence|
|Post Behavior||Set the post-behavior of the sequence|
|Filename||Set the filename of the image or sequence. Use # to specify the number of digits of the sequence. For example:
By pressing the Detect Sequence action in the Attribute Editor, the texture will try to automatically detect the sequence first and last frames based on filenames.
UDIM and UV Tiles#
The Stream Map File also handles UV tiling using either Mari's UDIM or Mudbox/ZBrush UV Tile naming convention. Special tags have to be placed in the filename to indicate which part of the filename needs to be resolved.
Clarisse automatically looks up for corresponding files matching the name set. It reads needed data while evaluating. To use The Foundry Mari naming convention, simply insert the
<UDIM> tag in the Filename attribute. For example, you could set the Filename to
The UV tile naming convention gives you more flexibility when compared to UDIM. Like UDIM, you can also use a single tag,
<UVTILE> to match the
u#_v# pattern. For example:
$PDIR/text/forest_<UVTILE>.jpg will match
If you need to match another pattern, you can use two tags to specify where the U and V indices are. For Example:
$PDIR/text/forest_<U>_<V>.tif will match
$PDIR/text/forest_coords<U>and<V>.tif will match
<UVTILE> tag is equivalent to
<V> tags are case sensitive. If you use uppercase, file indices will be offset by 1 for positive values.
$PDIR/text/forest_<UVTILE>.tif will read the file
$PDIR/text/forest_u1_v1.tif for (u,v) values ranged in [0,1] while
$PDIR/text/forest_<uvtile>.tif will read the file
Image Filtering and Mip Mapping#
Clarisse provides several ways to filter image maps.
|Nearest Neighbor||No filtering is performed. The nearest corresponding pixel is taken from the image. This returns the poorest results.|
|Bilinear Filtering||The nearest 4 pixels are used to compute the final color.|
|Trilinear Mipmapping||Create a image pyramid of mip maps if not available, performs two bilinear interpolation to compute the final color.|
|EWA Mipmapping||Same as Trilinear but performs an elliptical weighted average to compute the final color. This returns the best results specially with anisotropic projections.|
As we can see, mip mapping clearly gives best results. However it relies on the creation of a mip-map pyramid that needs some processing to generate as well as more memory (about 33% more).
The generation of the mip map pyramid is always performed during rendering. It is not stored to disk unless you are using a Stream Map File that references a file that encoding mip maps such as
TX. For more information please refer to Mip Map Generation.
Mip Mapping Controls#
Clarisse delivers texture map controls to fine tune render quality and optimize texture cache efficiency. You can tweak the sharpness of your texture maps individually, but you can also constrain maximum mip-map resolution to optimize I/O traffic, memory usage and render speed.
|Maximum Mipmap Level||Defines the maximum mipmap resolution used when rendering. 100% will allow the use of the highest resolution levels available while 0% will limit the choice to the lowest resolution.|
|Mipmap Quality||Influence the mipmap level chosen when rendering. 100% is neutral while 0% asks for lower resolution levels and 200% asks for sharper resolution.|
Using a special texture in which we stored different images for each mipmap level (each level displays the resolution of the mipmap being rendered. As our texture resolution is 8K, the first level is an image displaying 8k, the second level shows 4k, the third 2k and so on...), here are some examples:
Keep in mind that this is a percentage over the mip-map pyramid. It’s not a percentage over the resolution of the image. Indeed, a mipmap pyramid is generated by successively scaling down an input texture in half until the last generated image reaches a resolution of 1 pixel:
Our input texture resolution is 8K. As you can see the resolution of the mipmap at 50% is roughly a 128 pixel-wide image. It’s not a 4K image.
Role in Sampling#
Image Filtering has a very important role in rendering since it greatly improves the quality of your textures, depth of field, lights, global illumination, reflections and refractions.
Thanks to image filtering and more specifically mip-mapping, the renderer can generate far less noisy images for a given number of samples than when using nearest neighbor filtering for example.
The two renders below are using the same number of samples
Mipmapping also improves global illumination noise
Color Space and Pre Multiplication#
Since Clarisse internally relies on a pre-multiplied linear color pipeline, all images/textures must always be linearized and pre-multiplied by the alpha channel to be used properly. This is why, both Map File and Streamed Map File provide a set of attributes to pre-process the input image file when needed.
By default, Texture Maps have their Color Space Auto Detect attribute enabled which automatically configures the proper color space of input images based on the file format extension. For more information about color management and color spaces please refer to Color Management.
By default, textures return the default texture when the image file isn't found. It is possible to change this behavior so that the texture returns a custom color set by the Default Color attribute. To return the default color when the texture file is missing, change Missing File Behavior to Use Default Color.
Default Clarisse Texture