Takaro CryImporter

Takaro's CryImporter is for Importing geometry and animation from Crytek CGF, CGA, and CAF files into 3ds max 6 or above. A new version of...

Download

Uploading...
Do not refresh or leave this page!

File Description

Takaro's CryImporter is for Importing geometry and animation from Crytek CGF, CGA, and CAF files into 3ds max 6 or above. A new version of the Takaro CryImporter is now available, with a couple of interesting new features:

  • Added support for CAL files, so you can import all of the CAF animation files associated with a particular model in one hit, rather than having to do it individually.
  • Added support for importing morpher targets at an arbitrary time. This means that facial expressions can be added to the model after making changes to the basic mesh. As long as you don't alter the facial vertices or delete any vertices, it should work. If you do delete any vertices, it may still work, depending on whether any of the facial vertices got renumbered because of the deletion.

This release is version 1.1 of the utility.

This is a must have for any moddeler! See the readme for complete notes.

Read More

Download 'cryimporter_1.1.zip' (37KB)

Readme
Takaro CryImporter script for 3ds max 6 and above
==========================================================

Version 1.1
Copyright (C) 2006 Takaro Pty Ltd

Imports geometry and animation from Crytek CGF, CGA, and CAF files into 3ds max 6 or above.

==========================================================
LICENCE
==========================================================

This software is provided 'as-is', without any express or implied warranty. In no event will the
author be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any non-profit purpose, including non-
profit commercial applications, and to alter it and redistribute it, subject to the following
restrictions:

1. Explicit permission from the authors must be obtained if this software is to be redistributed as
   part of a 'for-profit' application.
 
2. The origin of this software must not be misrepresented; you must not claim that you wrote the
   original software. If you use this software in a product, an acknowledgment in the product
   documentation is required.

3. Altered source versions must be plainly marked as such, and must not be misrepresented as being
   the original software.

4. This notice must be included in any original source distribution.


For the latest version, bug reporting and tech support, go to:
http://www.takaro.net



==========================================================
INSTALLATION
==========================================================

1. Copy the CryImporter folder and its contents to the 'Scripts' directory in your 3ds max 
installation.



==========================================================
USAGE NOTES
==========================================================

1. Running the script

	1 Make sure you have the Crytek Exporter installed before running the importer, or it will not 
	work correctly. There are features in the exporter that the importer relies on.
	
  1 Once script is installed in your 3ds max scripts directory, start 3ds max and go to the
	utilities tab

  2 Press the 'MAXScript' button in the 'Utilities' rollout

  3 Press the 'Run Script' button and in the dialog box, select the 'CryImporter' directory, and 
  then 'CryImporter.ms'

	4 Select 'CryImporter' from the 'Utilities' drop-down list


2. Importing geometry from a CGF/CGA file

  1 If you want the model to appear see-through when it is imported (to see the bones better, for 
  instance), make sure the 'See-Through Mesh' checkbox is marked. All textures are still imported 
  for the model. This option simply sets the 'See-Through' display property of the mesh.
  
  2 If you want to import a character model and modify it, you may want to uncheck the 'Apply Face
  Expressions' checkbox. This will stop any facial expressions from being applied via a Morpher
  modifier, which can then be applied later using the 'Apply Face Expressions' button. This is 
  useful if you are modifying a character model but not changing the face, since the morpher data
  in the CGF file can probably still be applied to the model in this case, saving a lot of time. 
  There is no guarantee that it will work, though, since some changes to the underlying mesh may
  alter the vertex numbering, which is what the morpher data depends on.
  
  3 Press the "Import CGF/CGA" button and in the dialog box, select the model to import. If you wish 
  to import a CGA file, select CGA from the 'Files of type' drop-down list.

  4 Due to limitations with the Crytek Exporter, it is not possible to automatically set the shader 
  name for materials that are imported. This is probably due to a bug, since all other parameters 
  are settable. Due to this, the shader names must be set manually by the user. There may also be a
  notice that you need to activate the Transparency->Opacity checkbox. A messagebox will come up 
  telling you to open the MaxScript listener window, where the details will be listed. This is done 
  by pressing F11.
	
	5 If your model is a character model with facial expressions, you will be prompted to set the
	  'Morph target min offset' to 0.0 in the CryExporter. This is another action that cannot be done
	  automatically, but is necessary for the correct exporting of facial expressions.
	  

3. Importing animations from a CAF file

  1 First import the geometry file that you want to add the animations to. 
    
    NOTE: If you import a geometry file and then save it as a .max file, you can't load that .max file 
    at a later date and import new animations into it. You must import the geometry in the same
    session as the animations so that the CryImporter can store internal information that allows it to 
    match up the animations to the right bones in the model.
    
    If you want to import multiple animations, you must either import them all in one session (you can
    use the 'append' feature mentioned in the next step to help with this), or you must export the
    model you imported previously and saved to a .max file, and then import it back in again when you
    want to import in more animations. 
  
  2 If you want the animation frames to be added after the current animation range (the range 
    currently shown on your track bar at the bottom of the screen), make sure the 'Append to current
    range' checkbox is marked. If it is unmarked, the animation will be imported starting at frame 0

  3 If you want to import a single animation file, press the "Import CAF" button and in the dialog box, 
    select the animation to import. If your model has a CAL file that lists several animations to be 
    used with the model, you can import all of the animations at once by pressing the 'Import CAL'
    button. You then specify the CAL file to use, and the importer will attempt to import all of the 
    CAF animation files in sequential order, appending each one to the end of the previous one. You
    will then be given a list of the animation ranges in the MaxScript Listener window, so you know
    where each animation starts and ends.


4. Configuration

4.1 Base Asset Path

Since CGF/CGA files contain texture paths as relative paths, it must be supplied with an absolute
base path to use in order to find the correct textures to apply to meshes. For this to work
properly, the user must extract some of the FarCry PAK files so that the necessary textures can be 
located by the Importer. Typically, extraction of textures.pak and objects.pak is sufficient. Once 
you do this, you should have a directory tree like the following:

   C:\ --- MyAssets --- Objects
                   \--- Textures
                   
In this case your base path will be "C:\MyAssets".

NOTE: The Crytek Exporter exports texture paths by removing the first directory name, and then 
keeping the rest, so for example, the texture "C:\MyAssets\Textures\foo.dds" is exported as 
"Textures\foo.dds". Because of this, you should set up your directory structure so that there is 
only one directory above the Object and Texture directory level, or else your models will probably 
not work properly inside FarCry or the Sandbox.

  1 Press the 'Set Base Asset Path' button and in the dialog box, navigate to the base directory.


4.2 Alternate Asset Path

Since users may want to import models that use custom textures, an optional alternate path may be
specified for locating textures. If specified, this path will be checked first, in order to support
custom versions of textures from the original Far Cry distribution.

  2 Press the 'Set Alternate Asset Path' button and in the dialog box, navigate to the base
directory where the custom textures are located.


4.3 Configuration File

Various properties may be set in the CryImporter.ini configuration file, so they don't have to be 
set every time the importer is used. This file should be located in the base scripts directory of 
your 3ds Max installation.



==========================================================
NOTES
==========================================================

* The Morpher modifier is used for facial animation. This modifier requires a copy of the mesh to be 
made for each facial animation, which is typically about 20 different animations for a character in 
FarCry. For clarity, these meshes are hidden during the import process.

* Facial expressions are done through the Morpher modifier, which makes copies of the basic body mesh, 
with small alterations for the facial expressions. This means that if you change the basic mesh, the 
copies made by the Morpher modifier will no longer be correct. The 'Apply Face Expressions' checkbox
and button allow you to not apply the Morpher modifier until after you've changed the basic mesh. As
long as you don't alter the face on the basic mesh, you should still be able to correctly apply the
facial expressions to your modified model. Deleting vertices may also cause problems, since vertices 
will get renumbered, and if the facial vertices get renumbered the morpher data will no longer be 
correct.  
   
* Bones typically do not look the same when they are imported. This is due to the fact that the 
CryExporter appears to sometimes export bone meshes badly, but I can't find a pattern to be able to 
programmatically determine which bones are faulty. Also, some files seem to contain only a few of 
the bone meshes. Due to these problems, the bone hierarchy is built using some guesses. It will 
still work the same, but the bones will sometimes look different. I try to construct bones that 
touch their child bones, but when this doesn't work quite right, I make them short, like dummy 
helpers. I also try to size bones appropriately so that they don't obscure the mesh too much, but 
this works better in some cases than others.

* Some CGF files seem to have references to textures without any path, implying that they should be 
found in the same directory as the CGF file. Unfortunately, you need to specify an absolute path when
you create a bitmap in 3ds max. If the importer can't find the texture in either of the paths 
specified in the config file, it will look in the path where the CGF file was located. If it's there,
it will use that path for the texture, and give a warning that it has done so. The reason that this 
matters is that part of that path will now end up in the exported file if you use CryExporter later on.
If your CGF file and textures are not currently sitting in an appropriately pathed place (like
C:\MasterCD\Objects\...), you may end up with a path reference in your CGF file that won't work in
Sandbox or FarCry. I can't see any solution to this except warning you of this behaviour!


==========================================================
KNOWN BUGS
==========================================================

* An error occurs with m249.cgf when animations are loaded. Bone80 on the right hand seems to have 
bad data or is not being set up correctly, resulting in distortion of the three smaller fingers on
that hand. This doesn't happen in game or in the Sandbox, so it is either a fault in CryImporter, or
the data is bad in the CGF or CAF files, and I need to add some sort of error handling to make it
behave properly.


==========================================================
TO DO
==========================================================

* Add support for 2Sided materials if necessary
* Add support for B-Spline and Const controllers if these are still relevant
* Find a use for scene prop chunks


==========================================================
VERSION HISTORY
==========================================================

1.1   (2006-04-29) - Fixed bug with importing opacity values in materials
                   - Added support for CAL files
                   - Added support for importing morpher targets at an arbitrary time, either from the
                     last imported mesh, or from any arbitrary mesh during a later session (this is just
                     so people don't have to do all the work on their mesh in one session; it would be 
                     foolish to attempt to import mesh morphs from any model but the one you started with)

1.0.5 (2006-04-04) - Added handling for version 744 BoneNameList chunks (not quite obsolete like I thought)
                   - Added graceful handling of models without BoneInitialPos chunks. I only know of one 
                     model like this so far, and it's a faulty one (mortar.cgf), but the goal is to gracefully 
                     import every model that shipped with FarCry without crashing.
                   - Fixed import of models that contain both BoneAnim data and VertAnim data (such as P90.cgf)
                     We now ignore vert anim data in this case. It seems to give the right results, so I'll keep
                     it this way unless I find out some way to apply the vert anim data correctly in this case.
                     
1.0.4 (2006-04-03) - Fixed bug caused by 3ds max 6 (maybe 7 too) inability to convert strings to booleans
                   - Fixed bug where a particular GUI widget property is not supported in 3ds max 6

1.0.3 (2006-03-17) - Added various error checking to material creation
                   - Added error check for mesh chunks that say they have bone info, but don't
                   - Added support for v745 material chunks
                     (since these appear to still be used by some files)
                   - Added support for textures in the local directory to an imported model, if they
                     can't be found in the configured directories first. 
                   - Materials with a physical material specified now have their physicalize flags
                     automatically set to true, regardless of whether or not the CGF file had the 
                     flag set. I don't know if this flag is used at all by the game, but it seems
                     that it should be on in this case, even though most files don't seem to do it.                   

1.0.2 (2006-03-10) - Fixed bug in mesh chunk importing due to discrepancy between official 
                     documentation for CGF file format and reality

1.0.1 (2006-02-20) - Added error checking for zero length ranges in timing chunks

1.0   (2006-01-30) - Added support for vertex animation chunks
                   - Added support for v826 controller chunks

0.7   (2006-01-27) - Added CAF file support
                   - Added support for most of the properties in CryTextures 
                      (don't know what to do with nthFrame, refSize, and refBlur)
                   - Added support for v827 controller chunks 

0.6   (2006-01-24) - Added support for boneLightBinds
                   - Added support for mesh morphs

0.5   (2006-01-22) - Added helpers
                   - Added lights
                   - Added bones
                   - Added skin modifier with correct assigning of vertex weights

0.4   (2006-01-18) - Added support for materials, so we now have fully textured meshes

0.3   (2006-01-14) - Displays basic meshes with names, but no other data
                   - Added INI file support
                   
0.2   (2006-01-13) - Reads and prints all chunk types

0.1   (2005-12-30) - Reads CGF, CGA, CAL files, and can extract chunk headers

Read More

Comments on this File

There are no comments yet. Be the first!

Takaro


50 XP


Registered 20th February 2006

5 Files Uploaded

Share This File
Embed File