[Bf-committers] Thoughts on Plugins...

Jonathan Merritt j.merritt at pgrad.unimelb.edu.au
Mon Jun 20 17:08:47 CEST 2005


Bart wrote:

> What about making a plugin that uses shading language (Yafray, OpenGL
> Shading Language) definied in a shaderfile?
>
>  Example:
> - you got a material named "Custom Shader"
> - first you browse to a file (may ASCII) where the shader algorithm,
> name,
>     properties and customizable options (color, hardness etc.) are
> definied
> - after loading the file you got sliders and input fields to cutomize
> the shader


I agree; this is the basic approach I would take for a shader API.

However, I would split the task into two different levels...

In the Blender API, I would have *just* the bits required for the GUI
and the input and output of the shader.  Forget about shading language
details at this point.  Just have it set up as a C ABI that a plugin
must fulfil.

You then have the option of coding shaders in C/C++, or of implementing
a shading virtual machine to execute compiled RenderMan or GLSL shaders,
or a shade-tree structure, or ... whatever.  You have complete freedom
from a particular standard.

The reason for doing this is that the size of the tasks such as setting
up the API and integrating it into Blender's existing renderer pale in
comparison with the task of actually *implementing* a full shader VM
(just ask Paul Gregory!).  I would suggest re-using (for example) the
relatively modular VM from a project such as Aqsis and splitting it off
as a separate library.  It's a really big job though.  I expect most
people would opt for just coding shaders in straight C, or perhaps a
Java backend...

Jonathan Merritt.



More information about the Bf-committers mailing list