Extensions:2.4/Py/Scripts/Temp/BlenderToIndigo

提供: wiki
< Extensions:2.4‎ | Py‎ | Scripts‎ | Temp
移動先: 案内検索

Introduction

The BlenderToIndigo exporter is an python script to export a Blender scene to a '.igs' file, the file format of Indigo, a free unbiased ray tracer.

This script is based on the Indigo08S_Export scripts published on BlenderDev/Indigo_exporter and this thread in the Indigo forums. It is a complete rewrite, meant to be more easy to maintain and it should be possible to support different versions of Indigo with the same script.

Download

Media:BlenderToIndigo08S_r58.zip
Exporter version 2.52 for Indigo 0.8 Stable.
Changes:
* added options to save/load the exporter settings to/from the blender file
* added options to the GUI, rearranged the GUI
* removed bug about exporting a mesh with uv data


Media:BlenderToIndigo08S_r52.zip
Exporter version 2.52 for Indigo 0.8 Stable.
Changes:
* added support for mesh modifiers, DupliVerts, Duplifaces, DupliFrames, DupliGroups, Curve objecs, Surf Objects, MBall objects
* changed spectrum handling
Media:BlenderToIndigo08S_r43.zip
Exporter version 2.43 for Indigo 0.8 Stable.
Initial release on this wiki.

GUI

The GUI looks as follows. Most buttons (tooltips available on all) should be clear for the experienced Indigo user.

BlenderToIndigo Overview.png

Previewing and editing the materials in a Blender text buffer

This is probably a feature that could use some extra information. With the button "Materials to buffer" all materials can be exported to a Blender text buffer. The material code can be reviewed and edited. When "Use material buffer" is enabled, the material code of this buffer will be used instead of the normal material code. Be carefull not to delete or change material names (unless you know what you are doing)

Blender object export

How an object is exported is based on the mesh name. The name is first split on ".". If one of the name parts is "sphere", "plane", "rlight", "meshlight" the object will be exported to the appropriate Indigo object. (plane and sphere export are only available a if the button "Use Indigo primitives" is enabled)

Example of Blender Objects mapped to Indigo primitives based on mesh name

Examples:

  • mesh with name "foo.sphere" will be exported to an Indigo sphere (with position and radius from the blender object)
  • mesh with name "bar.plane.001" will be exported to an Indigo infinite plane (with position and orientation from the blender object)
  • mesh with name "foobar.rlight.bla" will be exported to an Indigo rectanglelight (with position, size and orientation from the blender object)

the mesh with name "bar.meshlight.002" will be exported as a meshlight

Other mesh objects will be exported as normal mesh models. One small exception is if the first material of a mesh has emit>0, then it will be exported as a meshlight (to keep a bit compatible with the old exporter)

See #Emitting_objects for more information how the emitting properties of the rectanglelights and meshlights can be defined.

Blender material export

There is no easy way to map the settings of a Blender material to a Indigo material/medium. This exporter does a large part of this mapping based on the name of the material and its textures. The type of the material (diffuse, phong, specular,...) is determined by the material name parts. These parts are obtained by splitting the name on ".". For example the name parts of "foo.bar.baz" are "foo", "bar" and "baz".

Diffuse material

One of the name parts should be "diff" or "diffuse". The settings of this material are defined as follows:

  • colour: the diffuse color of the Blender Material

Phong material

One of the name parts should be "phong". The settings of this material are defined as follows:

  • diffuse: the diffuse color of the Blender material
  • ior: the IOR of the Blender material
  • exponent: the hardness of the Blender material multiplied with 20 (the range 0 to 500 is rescaled to 0 to 10000 that way)
  • fresnel_scale: the reflection (ref) of diffuse shader of the Blender material

Phong material with nk data (complex ior)

If the material name refers to nk-data (e.g. "Au.nk", "Al.nk"), this nk-data is used as the complex IOR data.

Specular material

One of the name parts should be "spec" or "specular". The settings of this material are defined as follows:

  • transparent: if the alpha value of the Blender material is less than .9, the specular Indigo material will be transparent.
  • internal_medium_name: see #Medium for information on medium export

Glossy transparent

One of the name parts should be "glossy". The settings of this material are defined as follows:

  • exponent: the hardness of the Blender material multiplied with 20 (the range 0 to 500 is rescaled to 0 to 10000 that way)
  • internal_medium_name: see #Medium for information on medium export

Diffuse transmitter

One of the name parts should be "diff" or "diffuse". The settings of this material are defined as follows:

  • colour: the diffuse color of the Blender Material

Albedo texture

Uses the image of the first image texture with UV mapping to the color channel. Untested, probably only supports images in the same directory of the .igs file.

Bump map

Uses the image of the first image texture with UV mapping to the normal channel. Untested, probably only supports images in the same directory of the .igs file.

Medium

The settings of a Indigo medium are defined by the names of the texture slots of the Blender material. These names are split on "," and then interpreted as "key=value" pairs if possible. With these (key, value) pairs, the settings and options of a medium are determined. See the examples for more clarification.

  • precedence: "prec=15", the default is 10
  • medium type is defined with "med=basic", "med=epi" or "med=der", the default it "basic"

Epidermis medium

Example of a setup with an epidermis medium in a specular material
  • melanin_fraction: "melfrac=0.5", the default is 0.5
  • melanin_type_blend: "melblend=0.5", the default is 0.5

Dermis medium

  • hemoglobin_fraction: "hemo=0.5", the default is 0.5

Basic medium

  • ior: the IOR of the Blender material
  • cauchy_b_coeff: "cauch=.1", the default is 0
  • absorption_coefficient_spectrum: can be set with "abs=rgb", "abs=uniform", "abs=blackbody" or "abs=peak". The settings of the spectrum is set with the diffuse colour of the Blender material as described in #Spectrum.
  • subsurface scattering can be enabled by defining scattering_coefficient_spectrum with "sss=rgb", "sss=uniform", "sss=blackbody" or "sss=peak". The settings of the spectrum is set with the specular colour of the Blender material as described in #Spectrum.
  • phase_function: "sssph=uniform" for a uniform phase function or "sssph=henyey" for Henyey-Greenstein phase function, uniform is the default. If Henyey-Greenstein is chosen, the g_spectrum can be defined with "gspec=uniform", "gspec=rgb", "gspec=peak".The settings of the spectrum is set with the mirror colour of the Blender material as described in #Spectrum.
Example of a setup with an basic medium with subsurface scattering in a glossy transparent material

Spectrum

It is possible to define the settings of each spectrum type with at most 3 parameters. The exporter uses therefor a Blender color for the setup of a spectrum:

  • rgb: the RGB values of the Blender color define the RGB components of this spectrum.
  • uniform: the R value of the Blender color is used as uniform value
  • peak: peak_min=1000*R, peak_width=1000*G, base_value=0, peak_value=100*B
  • blackbody: temperature=10000*R, gain=G

Emitting objects

Example ot meshlight setup

The emit properties of an object (rectanglelight or meshlight) are defined by its first material. As with the normal materials the spectrum type can be defined with a textureslot "spectrum=rgb", "spectrum=blackbody", "spectrum=peak", "spectrum=uniform". The settings of the spectrum is set with the diffuse colour of the Blender material as described in #Spectrum.

An additional efficacy_scale can be enabled with the texture slot names "power=100" and "lumeff=20".