Skip to content

Working with CRF (3d objects)

Stan Bobovych edited this page Jan 13, 2016 · 48 revisions

Warning, the Blender 2.76 plugins are in early stages of development. The importer and exporter have severe limitations.
Blender 2.75 and below are no longer supported.
Huge thanks to Sir_Kane for the assistance of reversing CRF format. Also, thanks to Joe for the quick intro to plugins.
Latest version of plugins is 0.9. You should delete any previous plugins and replace them with this version.

Installing plugins

  1. Download Blender plugins in dist/io_scene_crf from blender_1.0_tools.zip
  2. copy io_scene_crf directory to your user Blender directory
    ex. C:\Users\sbobovyc\AppData\Roaming\Blender Foundation\Blender\2.76\scripts\addons\io_scene_crf
    Blender reference documentation
  3. Activate testing plugins: File->User Preferences-> Supported Level, make sure "Testing" is enabled
  4. Activate plugin: Addons->Import-Export
    click the check box next to "JABIA CRF format"

Importing files

  1. File->Import->Compiled Resource File (.crf)
  2. Select a file
  3. Click import
  • Added option to use precomputed normals from the CRF file. This is just for testing since Blender should compute the exact same normals.
  • Normals are now scaled -1 to 1. Visualizing the normals may produce unexpected results since Blender clamps colors 0.0 to 1.0. This option will probably be removed in the future.
  • Added option to visualize blendweights. They are scaled 0.0 to 1.0.
  • If you see weird black artifacts, go into mesh edit mode and flip normals. Fixed in 0.8

Importer details

  • can import most meshes (weapons, character models)
  • New in 1.0 skeleton is imported and vertices are skinned

Exporting files

  1. Select a single or multiple objects.
  2. File->Export->Compiled Resource File (.crf)
  3. Click export

Now vertex color layer names are used to export various things:

  • vertex_specular_colors
  • vertex_specular_alpha
  • vertex_blendweight_xyz
  • vertex_blendweight_w

Exporter limitations

  • can only export static meshes, no supported for bones
  • mesh gets modified, so back up your work
  • mesh must be composed of triangles (user must convert quads to triangles)
  • to export a mesh, it must have a diffuse and normal texture (specular textures are also supported)
  • only one material per mesh
  • each vertex can only be linked to one set of UV coordinates
  • all normals must point inward

Quickstart for creating new models

  1. Create mesh in blender or import base mesh into blender without materials, bones, animations and any sort of modifiers
  2. Select model and assign its diffuse and normal maps, then under Image Mapping, change coordinate from 'Generated' to 'UV'
    Tip: To specify the normal map, go to Image Sampling and click on the 'Normal Map' box, then under 'Influence', uncheck the Diffuse C (color) and check the Geometry N (normals)
  3. Go into Edit Mode select all faces for the model, select 'Mesh>Faces>Triangulate all faces' and 'Mesh>Normals>Recalculate Inside'
  4. Create UVmap for the model by dragging a new window and making it show 'UV/Image edit' instead of '3d View'
    Tip: When UV Mapping, make sure to 'split' or 'detach' the selected faces being unwrapped by pressing Y in the 3d View
  5. In the 'Object Data' tab, under Vertex Colors, add the following:
    vertex_normal_xyz
    vertex_normal_w
    vertex_specular_colors
    vertex_specular_alpha
    vertex_blendweight_xyz
    vertex_blendweight_w
  6. Export the selected object as CRF twice as the same file. The first try won't generate the crf (just a dummy file), but exporting it a second time will generate the proper crf.

Using crf_objects from Blender python shell
from io_scene_crf import crf_objects

Notes on crf_magick.py
This is a python script that can parse most CRF files. It is very helpful during the debugging. In addition, it can:

  • scale the model
  • translate the model
  • convert most CRF files to a static CRF file (useful to batch convert skinned models)
  • print out various information about the CRF

To see all command line switches:
python crf_magick.py -h

For example, the following will scale the AKM by 10 and translate it 10 on y axis:
python crf_magick.py --write -s 10 -t 0 10 0 akm_01.crf new_akm.crf

The following will read in the AKM and write it out:
python crf_magick.py --write akm_01.crf new_akm.crf

The following is an example of info output: python crf_magick.py --info usp_45_01.crf

Pydot not installed, will not create graph.
File: C:\Users\sbobovyc\usp_45_01.crf
Number of meshes: 1
Model bounding box: ((-0.14422965049743652, -1.0564026832580566, -1.8128454685211182), (0.2461031675338745, 0.7167925834655762, 0.7444033622741699))
Mesh number: 0, vertices = 525, faces = 294

CRF file format
crf_format.pdf