.

B3D-Exporter Version 1.4

1. Installation

1.1. License

I spent many hours in creating this plug-in. Nevertheless it’s released as freeware, so you can use this tool free of charge. Therefore I think it’s fair to give me a credit somewhere in your game, if this plug-in is used in creation process.

Use this software at your own risk. I’m not responsible for any damage done by this software.

This plug-in is still in development, so don’t hesitate to contact me, if you found any bugs or miss useful features. Of course, general feedback is welcome too.

Have fun:
Robert Hierl (BIG BUG)

Homepage: www.mein-murks.de
Contact: rhierl@gmx.de

1.2. Installation

Simply extract Zip-file in your Cinema4D/Plugin-directory.
Restart Cinema4D. Now there should be a new menu entry „Plug-Ins->Blitz3D->Export B3D-File". Use this command to export your object / scene as B3D-file.


To use this plug-in, you need at least Cinema4D Release 6.

2. Usage

To export a C4D-scene as Blitzbasic B3D-file, simply choose the menu command „Plug-Ins->Blitz3D->Export B3D-File".

2.1. Dialog

The following window shows up:

 

 

There is a bunch of options:

 

a.

Set „animation level“. Using „root node“ saves animation data direct at the root node of  your model. To activate animation in Blitz3D just use „Animate“ on your loaded file.
The second option „second level“ writes animation data for each object on second hierarchy level. In this case, you have to use „FindChild“ orGetChild“ first, then use „Animate“ on each child.

b.

Choose animation data to write. Rotation data will be written always, position data by default yes, scale data by default not.

c.

Write animation keys automatically. If this option is deactivated, only this animation keys get saved, which are explicit set in C4D. Interpolation for smooth movement and repeated sequences will be ignored.

Use „simple“ to automatically set additional keys. Interpolation and repeated sequences will be considered this way.

The option „full“ works much like „simple“, but expressions will be calculated too. Use this option to export XPresso-animations .

d.

Sets the minimum interval for automatically created keys. This plug-in optimizes the key structure by itself, so unnecessary keys will be deleted anyway. Therefore this option could be set to „1“ in most cases.

e.

If this option isn’t activated, only polygon objects will be exported with mesh structure. Any other object gets saved as pivot. Use the command “make editable” to convert.

If you use this option, C4D tries to convert all objects automatically. This is mainly for testing purposes, because UV-coordinates could be a bit messy at the moment.

f.

Use this option to disconnect all polygons automatically. This is useful to avoid texture mapping problems, when there is more than one UV per vertex.

g.

Using texture mix mode „normal“ disables shading in Blitz3D, the object glows like EntityFX Full-Bright is set.
Activate this option to automatically convert mix mode „normal“ to „multiply“ and automatically set object color to white, so hardware lights take affect.
When using more then one texture layer, all further textures are mixed using mode “add” to suit Cinema 4D logic.

h.

Replace texture suffix. Useful for PNG-textures, because Cinema4D doesn’t use this format. 

 

2.2. Warnings & Error Messages

While exporting, a detailed protocol will be dumped to the Console window of Cinema4D(Use <shift>+F10 or Window menu to show Console). On one hand you will find here information like textures, materials and objects, on the other hand warnings and error messages will be dumped here too.


At the moment there are following messages possible:

E: No parent mesh for bone!

There was a bone object without any related polygon object found. Check the object hierarchy and if all objects are made editable.

W:Parent mesh isn't in null position. It might be shown corrupt or displaced.

A bone animated mesh should not be moved, scaled or rotated. It should be set to the null position(world axis).
Vertices, those aren’t assigned to at least one bone will be shown displaced otherwise.

W:There aren't any vertices affected by bone(No valid restriction found).

There wasn’t any valid restriction tag found for this bone, so this one takes no effect.

W:Multiple UV for at least one vertex. Texture mapping might not be correct.

Cinema4D saves UV-coordinates per polygon, Blitz3D per vertex. So in C4D there are different coordinates per vertex possible, but only one of those gets exported to Blitz3D. This results in wrong texture mapping.

Use export option “Disconnect polygons” to avoid this problem.

W:UVW-tag not found. No texture mapping for this one.

There wasn’t any UVW-Tag found for this object. Therefore no texture mapping is possible.

Use the menu command “Texture->Generate UVW Coordinates” in the Object Browser to create such a tag.

W: Texture projection isn't set to UVW. Texture mapping might not be correct.

At least one of the texture tags of this object doesn’t use UVW mapping but the plug-in always exports texture coordinates using UVW tags. Therefore the texture might be shown different in Blitz3D.

W: Too many textures for brush. Writing 8 texture layers.

Blitz3D supports up to 8 texture layers. If there are more layers set to one surface, the surplus texture layers are ignored.

W:Object not recognized. Exporting as pivot.

This object isn’t a Null-, Polygon- or Bone Object. It will be exported as pivot.

W:Blend/FX/Texture-Flag couldn't be evaluated.

There was a texture flag found on luminance, transparency or alpha channel, but it doesn’t contain any valid value.

 

 

 

2.3. Object Hierarchy

  • A B3D-file contains only one root node unlike Cinema4D, where more root nodes are possible. In this case all objects get automatically placed in a new parent object called „ROOT“.
  • To maintain object hierarchy in Blitz3D, you have to load your file using LoadAnimMesh() instead of LoadMesh().

2.4. Textures & Materials

  • Every mesh needs an UVW tag for correct texture mapping. Use the menu command “Texture->Generate UVW Coordinates” in the Object Browser to create such a tag:
  • Cinema4D saves UV-coordinates per polygon, Blitz3D per vertex. So in C4D there are different coordinates per vertex possible, but only one of those gets exported to Blitz3D. This results in wrong texture mapping.
    To avoid this problem, you can simply activate the export option “Disconnect polygons”
  • One can use up to four texture layers for one object (“Multitexturing”). Generally the last texture tag (in list) applied to an object will be exported exclusively. If option “Mix Textures” is set in this tag, it will be according to its blend mode mixed with the previous layer. Please note that the further options like material color or luminance are considered in the first layer only.
    So the order of the tags is very important.
  • If there is a second UVW-tag, it will be exported too. Due to Cinema4D a texture tag refers always to the following UVW-tag. If there isn’t any UVW-tag on the right handed side of the texture tag, it will refer to the first UVW-tag. If a texture tag is located between two UVW-tags it will refer to the second set, otherwise to the first one.
  • The restriction of a texture tags to a polygon selection is also supported and will result in a new “surface”. Corresponding to the behaviour of Cinema 4D, texture tags without any restriction will overwrite all previous tags in the list. Therefore it’s important to place this tags in front, followed by the rest of the texture tags, which are applied to a polygon selection. However, a non restricted texture tag using “Mix Textures” will be mixed to all previous tags, no matter if there is any restriction or not. This is very useful for lightmaps. 

  • The following material options are exported to Blitz3D:
     
    • Texture Tag


    • Texture Flags
      EntityFX, EntityBlend and LoadTexture flags could be supplied directly.
      To do so, just enter your value with a leading  :” in the input field for the texture name in the corresponding channel.
      For example: Channel Luminance containing texture name „:16“ deactivates BackfaceCulling.
      -
      To set this value in Cinema4D Release 9, choose a dummy texture first. After that, click on that texture name field again. Now it’s possible to enter a free value for this field.

      Assignment of channels to options:

Luminance

EntityFX

Transparency

EntityBlend

Alpha

LoadTexture-Flag

    • Color Channel
      Additionally to color and texture name, the mix mode gets exported too. Possible options are
      Normal, Add or Multiply. Subtract results in texture blend 5 = Multiply2.


    • Luminance Channel
      To activate full-bright, just mark the whole channel. Use the blue bordered input field to supply an EntityFX-value directly. Refer to Texture Flags for further information.


    • Transparency Channel
      The Brightness and Additive option are set here. Those Color option will be only considered in calculation for brightness. To set the color for a transparent object, use the channel “Color”(see above). Use the blue bordered input field to supply an EntityBlend-value directly. Refer to Texture Flags for further information.


    • Alpha Channel
      If Alpha is activated, black texture pixels will be transparent by default. To refer to the alpha channel of  the texture, enter a texture name and set the flag “Image Alpha”.  Use the blue bordered input field to supply an LoadTextureFlag-value directly. Refer to Texture Flags for further information.


    • Specular Channel
      Only the Height value gets considered here:

2.5. Animation

  • Be careful with rotation. In Blitz3D an object will turn using the shortest way between two angles; Cinema4D on the other hand turns an object by its absolute value.
    For example: Key 1: 0°; Key 2: 350°. In Cinema it’s nearly a complete rotation by 350°, in Blitz3D it’s a rotation in the opposite direction by -10°.
    Use Autokeyframing to avoid this problem. 
  • Use „Edit->Project Settings…“ to set animation length:

    Frame rate is saved too, however Blitz3D seems to ignore this option.
  • The minimum frame number in Blitz3D is always 0 (zero),  the maximum frame number is calculated by “maximum minus minimum”.

2.6. Bone Objects

  • A bone animated mesh MUST NOT be moved, scaled or rotated! It has to be set to position 0,0,0 , scale has to be 1,1,1 and rotation 0,0,0, otherwise you will get an error message and the animation won’t be in correct place.
  • If you use bones, all Polygon Objects have to be placed at the same level with the animation data. It is recommended, that every bone animated mesh is saved as a separate file.
  • All bones have to be fixed. To achieve this state, just use right mouse button in the Objekt Browser, then choose function “Fix Bones”.
  • Only bones assigned to a valid Restriction will have an affect to the parent mesh. At the moment, there is only one restriction allowed:
  • Valid Restrictions are Point Selections and Vertex Maps. Polygon Selections aren’t allowed.
  • In Blitz3D weighted vertex points are handled different to Cinema4D.
    In Blitz3D the weight value is only relevant, if there is more than one bone affecting this vertex. Otherwise this vertex gets affected by 100%, no matter what the weight value is set to.
  • Also, the distance from a bone to its corresponding vertices is irrelevant in Blitz3D.

2.7. Vertexalpha & Vertexcolor

  • Vertex alpha and vertex color are set using Vertex Maps(“Selection->Set Vertex Weight”), because there isn’t any similar functionality in Cinema4D.
    One Vertex Map represents one component of the vertex information and is identified by its name:

Name of Vertex Map

Description

RED

Red component of vertex color(default by material color)

GREEN

Green component of vertex color(default by material color)

BLUE

Blue component of vertex color(default by material color)

BRIGHTNESS

Brightness value for vertex(default 100%)

ALPHA

Alpha value for vertex(default 100% = fully opaque)

  • It is important to use capital letters and write it exactly like above, otherwise the vertex map is ignored.
  • If there is at least one according vertex map, a matching EntityFX for this object is set automatically. Use Textureflags to override this behaviour.

3. Helper Plug-Ins

Additionally to the export plug-in itself, there are following useful “Helpers”:

 

H_Disconnect All Polygons

Use this plug-in to set each polygon of all selected objects at its own vertices. Useful to avoid texture mapping issues.

H_Invert Vertex Map

Use this plug-in to invert a vertex map. The option „Skip zero-weights“ prevents vertices with value “0” to be set to “100”.

H_Reverse All Normals

Use this plug-in to invert all normal vectors of the selected and all sub objects(useful for Zygote models).

4. Known Issues

-Weight maps and animations with disabled export option  Autokeyframing” aren’t supported in Cinema4D Release 10 right now, because it’s not supported in COFFEE yet.


5. History

Version 1.1
First international release

Version 1.3
!Option „Enable shading for texture mix mode 'normal'” works now correctly.
!New dialog design for better fitting of different font types.
!Every bone gets at least one key now, because it contains the actual position
!Helper plug-in “H_Disconnect_All_Polygons” doesn’t mess up vertex maps and point selections anymore.
+Support for texture tags, which are applied to a polygon selection. In this case, affected polygons are exported as separate surface.
+New material concept, which allows up to 8 texture layers.
+New export option “Disconnect polygons”

Version 1.4
!The assignment of texture tags to UVW-sets works now similar to Cinema4D. What you see is what you get.
+Support for Vertex Alpha  & Vertex Color using Vertex Maps(see 2.7 for further details)
-Message “W:Blend/FX/Texture-Flag couldn’t be evaluated” removed, because it is not possible to distinguish if an error occurred or just a “0”-value was supplied.

kind regards
Robert Hierl

Homepage: www.mein-murks.de
Contact: rhierl@gmx.de

27.05.2007 ©Robert Hierl