zFilter Collection mel scripts

 

The zFilter mel collection is a set of 3 useful mel scripts allowing the user to filter textures files, and (most of) 2d/3d textures.

To execute the scripts, first source them in the script editor, then select your camera and execute them.

Those mel create a shading network based the pointCameraZ allowing the user to control how much and where all the textures in a scene are filtered, and this to avoid most of the texture flicking during an animation.

The scripts create 2 locators (near and far) parented to your camera to define the range of the filter in depth (in cam space). It also creates extra attributes (per script/texture) in the camera shape to control the values of the min (nearest of the cam) and max (farthest), and their interpolation.

- MinFilterValue: defines the minimum value of the filter
- MaxFilterValue: defines the minimum value of the filter
- FilterInterpolation : defines the interpolation between near and far locators.

Ok for the attributes? Let's get into the most interesting... How it works!

Globally, this script uses the pointCameraZ (camSpace) to drive the filter value of all your textures in your scene. This way, you can set a filter value lower for the nearest part from the camera and another one (say bigger usually) for the part the most distant from the cam. This reduce a lot the causes of texture flicking due to sub-pixels texels (when a texture is far from the camera).

zFileFilter: Only for texture files.
Extra attributes created: FileMinFilterValue (default: 0.1 of a range from 0 to 1), FileMaxFilterValue (default 1 of a range from 0 to 2) and FileFilterInterpolation (5 types based on ramp's interpolation

zAllTexFilter: 2d textures: checker, grid, fractal - 3d textures: brownian, cloud, crater, solidFractal
Extra attributes:
- TexMinFilterValue (default: 0,1 min: 0, max: 1)
- TexMaxFilterValue (default: 1, min: 0, max: 2)
- TexFilterInterpolation (same as zFileFilter mel script

zGraniteFilter: Granite and leather 3d textures only
Extra attributes:
- GraMinRandomValue: (default: 1, min: 0, max: 1)
- GraMaxRandomValue: (default: 0,1, min: 0, max: 1)
- GraFilterInterpolation: (same as the two above)

Here is an example: I took the first fractal and solidFractal I had in my pocket, and here we go...

download mel collection

Limitations:

These scripts are intended to be executed ONCE. So I strongly suggest you to use them when you have finish all the texturing and shading. If you have new textures to be filtered, connect them manually
- Files: connect the ramp_FileFilter.outAlpha to your texture's filter attribute.
- All other textures (zAllTexFilter): connect the ramp_TexFilter.outAlpha to your texture's filter
- Granite/leather: connect the ramp_GraFilter.outAlpha to the granite/leather's randomness attribute.

Granite/Leather textures: these textures are not exactly filtered. I use the attribute randomness to smooth and blend all the colors. Note that better effects are achieved when mapped on objects parallel to the camera (ground objects for ex.) than perpendicular ones.

 

zFilter Collection mel scripts - Emmanuel Campin - June 6th 2001