-
Notifications
You must be signed in to change notification settings - Fork 7
Plugin Development
In IFSRenderer, each transform is a plugin in the form of .ifstf
files. These are small GLSL
snippets with extra markup. Contrary to DLL plugins, they are compiled at runtime, so it's easy to get started with just a simple text editor.
The portable version stores them in the Transforms
directory next to the executable. The installer version stores them in the user's AppData under the same name (C:\Users\username\AppData\Roaming\IFSRenderer\Transforms\
). The list of transforms in the editor window is loaded by reading this directory, which means you can just drag & drop and edit files here. Then, above the list of transforms is a reload button which reloads every plugin without needing to restart IFSRenderer. A message box shows the error if one of the plugins failed to load.
These two lines are required to identify a plugin:
@Name: My Awesome Plugin
@Version: experimental
As you can see, the value of version can be any string. It's used just to tell whether the currently loaded fractal was made with this version of the plugin. The user is prompted if they want to load the params using a different plugin version. @Description
is an optional field which is shown to the user in a tooltip when the mouse hovers over the transform. @Tags
is again optional, and has multiple purposes: it will help IFSRenderer - both the node editor and the generator - to categorize plugins (future plan).
The input to transform is p
which is a vec3
. The output is a vec3
too, which you must return
at the end.
Here's a simple example Cylinder.ifstf
:
@Name: Cylinder
@Version: 0.1
//optional
@Description: Cylinder transform aligned on the Y axis.
@Tags: test, my-tag
//define custom variables
@Radius: 1.0
//'p' is a vec3 input
float r = 0.5 + 0.5 * dot(p.xz, p.xz) / @Radius;
vec3 cyl = vec3(p.x / r, p.y, p.z / r);
//remember to return a vec3 output
return cyl;
@Radius
is a custom variable that the user can modify in the editor. There's a built-in way to easily generate random numbers, use random(next)
call to get a uniform random float in range 0-1.
The default transforms included in IFSRenderer are hosted in a separate repository bezo97/IFSTransforms
. Feel free to open a discussion to include new default plugins.