Computed Defaults and UVW Inputs for OSL

OSL has a very special feature called a computed default. This means a map can have an input that, if it is not connected anywhere, can contain some specially computed value as a useful default. You recognize a computed default by the fact that the input has a map input, but there are no value spinners in the interface for the value (if it is not connected, the computed value is used).

Many maps use this. For example, all of the included OSL maps come with a UVW input. In contrast to the classic 3ds Max maps, this lets you connect the output of any computation (returning a three-component value such as vector, point, or even color) to drive the lookup position of the texture.

For the map to do something meaningful when the UVW input is not connected, computed defaults are used. Most 2D textures use a computed default mapping to 3ds Max map channel 1, and most 3D textures have a computed default of the shaded points object space coordinate. That way, maps give a reasonable default texturing when used directly. If you want to use a different UVW map channel, or transform the UVW coordinates, you can use maps from the UVW category to accomplish that.

Exactly what computed default is used is completely up to the OSL code itself. A few maps do special things purely for demonstration purposes, for example the Blackbody shader uses the U coordinate of map channel 1 to make an example gradient across the surface, as does the Wavelength shader. This also means OSL maps downloaded from the internet may literally do anything for a computed default.

Remember: If you only have a map input and no spinners, it's probably intended for you to supply a meaningful input there.