W4 AssetCreator

From Ciliz|W4

Scope

The W4 game engine uses its own asset storage format. Therefore, before using any fbx asset, it has to be converted. This can be done using the W4AssetCreator tool that comes with the W4 SDK.

W4AssetCreator converts assets from Autodesk FBX (.fbx) format. Other formats are not supported.

Mesh Example

Let’s take the Utah teapot as an example. If you view the file using the utility Autodesk FBX Review, you will see something similar to the following figure.

cb84552c-5001-4127-9d9d-1e93f9c96696.png

Pay attention to the orientation of the teapot spout when viewing fbx. As a result, the same teapot is displayed, but with a slight difference.

3aa4d02a-5152-44d6-9168-13a155f1b049.png

If you compare the drawings, you may notice that the spout of the teapot has changed its directed after the program execution. This happens due to differences in coordinate systems.

The FBX coordinate system Scene Axis and Unit Conversion is right-handed (with the Y pointing up), whereas W4 coordinate system is left-handed (the the Y axis is also pointing up).

Animated mesh Exmple

Preparing

Take, for example, Rigged Hand.

If you view it using Autodesk FBX Review you will see approximately the following:

Result

As a result of the program, the following animation is shown:

http://demo.w4-dev.ciliz.com/wiki-files/Hand_engine.mov

Параметры W4AssetCreator Ниже показан вывод приложения (при запуске без параметров) с описанием принимаемых на вход параметрах:

W4 Asset Creator Usage: ./W4AssetCreator [OPTION...] [name] [output]

FLAGS options: -h, --help print help --material arg add material to asset (default: "") --root arg root directory for all relative paths (except output) (default: /Users/p.steinberg/dev/w4-framework) --image arg add image to asset (default: "") --particles arg add particles to asset (default: "") --fbx arg input fbx file --pn arg name of plugin (default: "") --pp arg plugin params (default: "") --scale arg scale for converter --no-animation no export animations from input fbx file --animation arg add animation from fbx file. format 'path[:%stackName%=%animationName%;...]' (default: "")

POSITIONAL options: --name arg asset name, default is 'asset' (default: asset) --output arg output directory, default is current directory. Result output is %output%/%name%.w4a file (default: /Users/p.steinberg/dev/w4-framework)

--root В первую очередь нужно обратить внимание на этот параметр. Если он не задан - все относительные пути берутся от той папки, из которой запущено приложение.

--fbx - путь к *.fbx файлу, который будет сконвертирован в ассет, можно указать только один.

--scale - скейл для всех сущностей, экспортируемых из (--fbx)

--no-animation - если задан - не экспортируются анимации из fbx файла, указанного в аргументе (--fbx).

--animation - добавление в ассет дополнительных анимаций, которые расположены отдельно. При желании можно переименовать анимации при добавлении (см. описание формата выше)

--material - путь к материалу в формате json, который будет добавлен в ассет, можно указать несколько.

--image - путь к картинке, которая будет добавлена в ассет, можно указать несколько.

--particles - путь к описанию частиц в формате json, можно указать несколько.

--pn, --pp - аргументы для системы плагинов (здесь должна быть ссылка на доку по плагинам).

Так же есть два позиционных аргумента (возможно, стоит их совместить в один, директория не нужна, сделано для совместимости с предыдущим форматом):

Имя создаваемого ассета.

Путь к папке, в которой этот ассет будет находиться.

Usage Example

 W4AssetCreator --root=path/to/resources/root \
          --material=resources/materials/back1.mat,resources/materials/crowd.mat,resources/materials/dissolve_twoTextures.mat \
          --material=resources/materials/paperboy.mat,resources/materials/platform.mat,resources/materials/postament.mat,resources/materials/step.mat \
          --animation="A_PaperBoy_Dance2.fbx:Take 001=Crewman,A_PaperBoy_Flip.fbx:Take 001=Flip" \
          --image=resources/textures/dissolve.png,resources/textures/T_Homer_Face_D.png,resources/textures/T_PaperBoy_Body_D.png \
          --image=resources/textures/T_PaperBoy_Head_D.png,resources/textures/T_PaperBoy_LeftHand_D.png,resources/textures/T_PaperBoy_RightHand_D.png \
          --image=resources/textures/T_PaperBoy_Pants_D.png,resources/textures/T_trio_Head_D.png \
          --image=resources/textures/T_PaperNinja_Body_D.png,resources/textures/T_PaperNinja_Pants_D.png,resources/textures/T_PaperNinja_LeftHand_D.png \
          --image=resources/photos/W4_01.jpg,resources/photos/W4_02.jpg,resources/photos/W4_03.jpg,resources/photos/W4_04.jpg,resources/photos/W4_05.jpg \
          --image=resources/photos/W4_06.jpg,resources/photos/W4_07.jpg,resources/photos/W4_08.jpg,resources/photos/W4_09.jpg,resources/photos/W4_10.jpg \
          --image=resources/photos/W4_11.jpg,resources/photos/W4_12.jpg,resources/photos/W4_13.jpg,resources/photos/W4_14.jpg,resources/photos/W4_15.jpg \
          --image=resources/photos/W4_16.jpg,resources/photos/W4_17.jpg,resources/photos/W4_18.jpg,resources/photos/W4_19.jpg \
          --fbx=SK_PaperBoy_T_Pose.fbx \
          --no-animation \
          AssetName \
          asset/destination/directory