[Bf-committers] Render API Design

Bobby Parker sh0rtwave at gmail.com
Sun Jun 3 01:55:06 CEST 2007


>The Blender Render API could have  GetSpheres(), GetNurbs(),
>GetCCSubSurf(), GetCurve(), (etc.), and a GetTheRest().  The
>translator will have a function that Blender calls, say,
>StartRenderExport(). That function then calls each of the above API
>functions it can use to pull in the scene data.

This is probably not the best way of doing this, for several reasons.

The issue here really is about accessing data in the most appropriate
manner for A. the object type at hand, and B. the renderer at hand.

In Neqsus, for instance, I use a notion of "object adapters" (using
the very handy PyProtocols)
that inspects the type of each object in the scene in turn, and then casts
(or in python vernacular, "adapts") the object to a new object that supports
exporting of that particular data type.

The current Python API provides a fairly good template of what to do,
at a high level.
When exporting data to renderman, I fetch all the objects in the scene
first (and they're
provided as Bpy Objects. Object.getData() fetches the
"object-type-specific" data (beit a curve,
a subdiv surface, NURBS object, etc.) and I can then use that to
create the export data that I need.

Now the itchy part comes in with mesh objects. With the current suite
of modifiers, I have to disable the subdiv modifier
temporarily to get the base subdivision hull (NOT the subdivided data
as blender sees it.) This is an example
of where the Render API can help. By allowing an export plugin to set
a series of flags, the Render API can handle the job of
turning that subdivision modifier off, or BETTER YET, simply sending
the base hull, rather than the subdivided data on the
getMeshData() call(hypothetical name, no nitpicking!).

Other things that leap to mind is how to deal with things like
Metaballs, in the case of a Renderman renderer that has no
RiBlobby support. While, YES, the RiIgnoreError flag can be used when
working with a renderer that doesn't support blobbies...
This really isn't a workable option for creating the scene as it's
been modelled. We want to see the whole scene.
The Render API can have a flag that's set for Metaballs that either
exports metaball/RiBlobby data to the
renderer as actual RiBlobbies OR...actually fetch the blender-created
mesh as a mesh data type (which the exporter will then correctly
interpret as a mesh and you can then choose to subdivide or not).

Bobby Parker
ShortWave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.blender.org/pipermail/bf-committers/attachments/20070602/39f6629c/attachment.htm 


More information about the Bf-committers mailing list