Table of Contents
by Kent Mein
This section reports an in-depth reference for coding Blender's Texture and Sequence plugins.
Relevant to Blender v2.31
In this Section we will write a basic texture plugin and then go through the steps to use a texture plugin. The basics behind a texture plugin is that you are given some inputs; position, and normal values as well as some other info. Then you return intensity, colour and/or normal information depending on the type of texture plugin.
All the files necessary to develop plugins as well as a few sample plugins can be found in the blender/plugins. You can alternately get a bunch of plugins from http://www.cs.umn.edu/~mein/blender/plugins
Plugins are supported (loaded/called) in Blender using the dlopen() family of calls. For those unfamiliar with the dlopen system it allows a program (Blender) to use a compiled object as if it were part of the program itself, similar to dynamically linked libraries, except the objects to load are determined at runtime.
The advantage of using the dlopen system for plugins is that it is very fast to access a function, and there is no overhead in interfacing to the plugin, which is critical when as (in the case of texture plugins) the plugin can be called several million times in a single render.
The disadvantage of the system is that the plugin code works just like it is part of Blender itself, if the plugin crashes, Blender crashes.
The include files found in the plugin/include/ subdirectory of the Blender installation document the Blender functionality provided to the plugins. This includes the Imbuf library functions for loading and working with images and image buffers, and noise and turbulence functions for consistent texturing.