Skip to content

Exporting from Blender

tobspr edited this page Feb 28, 2016 · 28 revisions

It is highly recommended you use the BAM Exporter to export your models. Just follow the instructions in the readme to install it. After you successfully installed and configured it, continue to read.

You should also read Materials first to understand how materials work in the render pipeline.


Preparing your materials

Every material can have up to 5 textures, and must have at least 4, in the following order:

  1. BaseColor
  2. Normal
  3. Specular IOR
  4. Roughness
  5. Displace (Optional)

Your texture slot setup should look like this (note that it matters at which slot the textures are): Blender Texture Slots

You can use the "Fill default PBS textures" option to automatically fill in dummy textures (like in the image above, where empty_roughness was inserted to complete the material). Notice that the blender modifiers are irrelevant for the pipeline, e.g. setting the influence to the normal, or alpha, will have absolutely no effect. Instead the order of the texture slot contains its functionality.

All textures sizes should be a power-of two. It is recommended to choose a size of 1024x1024 or less, but for highly detailed materials you can use higher resolutions. Notice that not all textures have to have the same size. You can for example use a 512x512 texture for the basecolor, but a 2048x2048 texture for the normals to increase detail.

Basecolor Texture

Your basecolor texture should be 8bit sRGBA (notice the sRGB color space! otherwise it will look greyish), storing the alpha mask in the alpha channel. If your texture is RGB only, no alpha mask will be used. A sample basecolor texture could look like this:

Sample diffuse texture

If your material is nonmetallic, the basecolor texture will be used as the diffuse texture. Otherwise it will be used as the specular texture. See the Materials page for information. The materials base color is computed as material_basecolor * sampled_basecolor.

Normal Texture

Your normal texture should be 8bit RGB. It is important that you don't use the normal texture to modify the intensity of the bump mapping, but instead the normalmap-strength parameter, and store the full intensity in the normal map. The values in the normal map should be range from 0 .. 1 in Tangent Space (most exporters like crazyBump, shaderMap, bitmap2material already do that). Again, a sample normal texture:

Sample normal texture

Specular IOR Texture

The specular texture should be 8bit RGB, although only the R channel is used (You can use a single channel texture, too, but it might be necessary to set the correct format then). Sample specular ior texture:

Sample specular texture

NOTICE: Remember, the specular ior, and thus the specular ior texture has no effect on metallics.

The final index of refraction is determined by 1 + max(0, material_specular - 1) * sampled_specular_ior * 2. Example: If you have an index of refraction of 1.5 set as your material IOR, and your specular ior texture contains a value of 0.5, you end up getting an ior of 1 + 0.5 * 0.5 * 2 = 1.5. In general, a value of 0.5 in your specular gets the IOR specified in your material, and a higher/lower value gets a higher/lower IOR.

Roughness Texture

The roughness texture will be plain white the most time, but you can use it to add scratches or rust to the surface.

The final roughness is determined by material.roughness * roughness_texture.