Please note that converting TGC models violates the Software license. For particulars refer to section 1.2b. If you publish games with TGC converted models then legal action can be taken against you. All of my converted files have been deleted, but I believe the documentation for converting models is not within part of the Software license. (This is like converting a .txt to .rtf file, it's done all the time.) To use FPSC models in Leadwerks in a legal way the Leadwerks engine must support the files natively.
Recorded with Nvidia ShadowPlay and best viewed at 1440p in full screen.
I have been playing around with Leadweks 3.1/3.2 engine and I'm happy about many things. For a game to exist there are a lot of tasks that need to get done; we need art work, programming, design, etc. The indie developer that has an emphasis in programming... well your artwork is likely going to be quite bad -- after all, your strength is in programming. However, the lazy programmer (the best type out there!) can look out for game assets that have been created already. Of course though, the dream would be to simply drag and drop models and textures and simply focus on programming... but it's not always like that. In the case of many available model packs we need to convert from one file format to another. The above video shows the steps to convert TheGameCreators FPSC pack models into compatible Leadwerks assets. Once converted, and the shaders corrected, the models look very good inside the game engine.
Below you can find a typed version of the tutorial, which also has links and code.
Here's a typed version of the tutorial.
(I would recommend copying and pasting this into Notepad++ for easier readability.)
Title: Import TheGameCreators FPSC Pack Models Into Leadwerks 3.1/3.2 By Jesse B Andersen Date: July 19, 2014 URL: http://www.jessebandersen.com/ STEP 0 - PRE-TUTORIAL Install the following: FPSCreatorModelPack53.exe http://www.jbafiles.com/link/thegamecreatorsmodelpack53taskforce341 Install as a standalone package. C:\Program Files\The Game Creators\Model Packs\Files Ultimate Unwrap 3D Pro - http://www.jbafiles.com/link/unwrap3d
DDS Converter - http://www.jbafiles.com/link/ddsconverter Leadwerks Engine 3.1 to 3.2 - http://www.jbafiles.com/link/leadwerks Check: http://www.jbafiles.com/link/leadwerksdistortingcrumpling The models we are trying to import are in .X file format, we need to convert them to .FBX file format. Leadwerks imports .FBX and converts them to .MDL (Leadwerks model format). The textures in the pack are in .DDS, but in this case Leadwerks cannot import them, so we must convert them to .PNG. Later on Leadwerks converts the .PNG to .TEX. This tutorial goes over the conversions and material issues. STEP 1 - PREPARING FILES AND FOLDERS Create a "Resources" folder. Inside the Resources folder create a "Source" and "Output" folder. Go to C:\Program Files\The Game Creators\Model Packs\Files\Meshbank\341 , copy the .x model, and paste it into the "Source" folder. TF341_01A.X Optional, copy TF341 Animation List.txt too so you can read animation list. Go to C:\Program Files\The Game Creators\Model Packs\Files\Texturebank\341 , copy the DDS files, and paste them into the "Source" folder. TF341_01_1_D.DDS TF341_01_N.dds TF341_01_S.dds STEP 2 - CONVERTING PART 1 Converting .DDS to .PNG Open the DDS Converter program. Click Add , navigate to your "Source" folder, and select all the DDS files to convert. C:\Users\Jesse\Desktop\Resources\Source Assign the Output Folder C:\Users\Jesse\Desktop\Resources\Source Click on PNG as the Output Format Click Convert button. Close program. Converting .X to .FBX Open Ultimate Unwrap 3D Click File > Open and navigate to your "Source" folder. Click on the file, TF341_01A.X, and then click Open button. Click OK on the "Import DirectX 9.0 Model" window. Click File > Save As... > and select the "Output" folder. Ensure that you select "AutoDesk FBX 2012 files (*.fbx) as the "Save as Type:", and then click Save button. Click the OK open on "Save AutoDesk FBX 2012 Model" window. Close program. STEP 3 - CONVERTING PART 2 Go to your "Output" folder, select all files, and copy them (Ctrl + C). Open Leadwerks. Go to "Assets" tab, then click "Models > Characters" and create a new folder "Marines." (I would also recommend creating a subfolder for each model, so "Marine 001"). Right click the created folder and click on "Open Folder" Paste (Ctrl + V) your files into the folder. Wait for Leadwerks to convert the files (it usually takes a few seconds). When the files have been converted press the Delete key so that you remove the now unnecessary files. The remaining files should be: TF341_01_1_D.tex , TF341_01_1_D.tex.meta , TF341_01_N.tex , TF341_01_N.tex.meta , TF341_01_S.tex , TF341_01_S.tex.meta , TF341_01A.mdl , tf341_01a.mdl.meta STEP 4 - MATERIALS PART 1 On the taskbar click on Leadwerks. You should now see the converted files (four of them) on the right side. Right click on the container (Assets container) that holds the files, click New > Material , name the file TF341_01A_MAT and click OK button. Double click on the created material, it opens the Material Editor, and go to Textures tab. Drag and drop, from the Assets container to the small boxes next to Diffuse, Normal, and Specular. - Drag "tf341_01_1_d.tex" to the Diffuse box. - Drag "tf341_01_n.tex" to the Normal box. - Drag "tf341_01_s.tex" to the Specular box. (Leadwerks is smart enough to correctly modify each texture based on its name, however if it doesn't you may need to click on the "pencil" icon next to the texture and correctly assign values.) Go to the Shaders tab. You have the Shader and Shadow options. For the Shader, click on the "Select File" button, and go to "Shaders\Model\Animated" , select "diffuse+normal+specular.shader" , and click the Open button. For the Shadow, click on the "Select File" button, and go to "Shaders\Model\Shadow" , select "shadow+animation.shader" , and click the Open button. Click on the Save button. STEP 5 - MATERIALS PART 2 This step is optional, but you may have to do it if your shaders have not been updated. In some of the .shader files there is code that produces distortion/crumpling. In the case of the model we are using the result is a few lines that go from the gas mask to a pivot next to the feet. So let's update the shaders we are using. Click on the "pencil" icon next to the Shader in the Material Editor, on the left panel list select "Vertex". Find the following code: mat4 animmatrix = bone.matrix[vertex_boneindices] * vertex_boneweights; animmatrix += bone.matrix[vertex_boneindices] * vertex_boneweights; animmatrix += bone.matrix[vertex_boneindices] * vertex_boneweights; animmatrix += bone.matrix[vertex_boneindices] * vertex_boneweights; and replace it with: vec4 wt = vertex_boneweights; float m = wt+wt+wt+wt; wt/=m; wt/=m; wt/=m; wt/=m; mat4 animmatrix = bone.matrix[vertex_boneindices] * wt; animmatrix += bone.matrix[vertex_boneindices] * wt; animmatrix += bone.matrix[vertex_boneindices] * wt; animmatrix += bone.matrix[vertex_boneindices] * wt; Now click on the Run icon, or press F6. Close the Script Editor. Do the same for the Shadow shader. Click on the Save button in the Material Editor window, and close the window. STEP 6 - ASSIGN MATERIAL TO MODEL Double click on the model, tf341_01a.mdl, in the Assets container. In the Hierarchy tab right click on "Surface 0" and left click on "Select material..." Click on the material you created, TF341_01A_MAT, and click the "Open" button. Your model should now be on display with the correct material. Double check the animation and ensure that it looks good. I would recommend resizing the model: Click on TOOLS > Resize , select Fit option and type 5.75 Feet Tall (which is average USA male height). Click on Save button in the Model Editor. Clock Model Editor. STEP 7 - TEST MODEL Drag and drop the model, from the Assets container, to the scene. Assign physics mode ("Character Controller"), Mass (1 is ok for now), Collision type ("Character"), and assign a Script. From here on, the "real" work begins. You will have to extract animations, code animation and AI/behavior, and much more. Currently extracting animations in Leadwerks is a painful process, but for the animations list model pack by TheGameCreators has an animation list in text format, in this pack it's named "TF341 Animation List.txt". STEP 8 - TAKE A BREAK I hope that the developers of Leadwerks notice the immense amount of work, per model, that it can require for models to be imported and adjusted. The consumed amount of time is not for "indie" developers, certainly everyone has other life events (family, school, work, etc) that are going to stop many from going forward with developing games, simulators, etc. In order to lessen the time burden, which is a lot of "busywork," the workflow of game assets needs to be improved. I hope this tutorial proves useful. For more information, including other tutorials, check my blog at http://www.jessebandersen.com . Thank you.
August 2, update regarding animations by Josh K.
FPSC Pack TF341 Animations.csv (comma separated values)
Bounce Back,60,79 Bounce Front,20,39 Bounce Left,140,159 Bounce Right,100,119 Climb Ladder,3211,3231 Cower Flinch,552,570 Cower From,2989,2999 Cower Idle,2958,2988 Cower To,2947,2957 Crouched Idle,892,915 Crouched Move,917,939 Crouched Throw,941,1000 D1,5460,5478 D2,5481,5499 Female Idle 0,5442,5448 Female Idle 1,5451,5457 Female Walk,5416,5438 Flinch Gut,3003,3022 Flinch Left,3023,3042 Flinch Right,3043,3062 Get Up Back,3273,3302 Get Up Front,3233,3272 Groun Slump Idle,38,39 Ground Slump Get Up,3249,3271 Guard Idle,612,636 Guard Move Fast,3304,3321 Guard Move Slow,638,660 Idle,712,736 Impact Back,40,59 Impact Front,0,19 Impact Left,120,139 Impact Right,80,99 Jump,3364,3388 Melee Axe Chop,520,549 Melee Defend Idle,3129,3138 Melee Kick,3105,3125 Melee Punch,3063,3083 Melee Stand Aim Down,3202,3205 Melee Stand Aim Up,3206,3209 Melee Stand Defend,3126,3142 Melee Stand Left Punch,3185,3201 Melee Sword Parry,501,519 Melee Sword Riposte,462,500 Melee Sword Slash,400,430 Melee Sword Stab,431,461 Melee Uppercut,3084,3104 Move Slow,738,760 Recover Back,3233,3272 Recover Face,3273,3302 Shield Advance,376,398 Shield Backhand,349,365 Shield Crouch Advance,3336,3357 Shield Crouch Idle 0,3359,3360 Shield Crouch Idle 1,3361,3362 Shield Flinch,366,374 Shield Idle,365,366 Shield Throw Grenade,481,609 Shield Transition,341,348 Sit Chair,190,215 Sit Chair Die,268,280 Sit Chair Flinch 1,321,329 Sit Chair Flinch 2,330,339 Sit Chair KBD,216,241 Sit Chair KBD Type,242,267 Sit Chair Sit Down,291,320 Sit Chair Stand Up,281,290 Spawn,3001,3002 Stack Idle,662,686 Stack Move Slow,688,710 Strafe Left,762,781 Strafe Right,782,801 Talk Neutral 0,5368,5390 Talk Neutral 1,5391,5413 Talk Radio PTT End,5361,5367 Talk Radio PTT Full,5336,5367 Talk Radio PTT Idle,5342,5343 Talk Radio PTT Loop,5343,5360 Talk Radio PTT Start,5336,5342 Throw Grenade,821,880 Transition Crouch,882,890 Transition Stand,3324,3333 Unarmed Move Fast,803,819 Weapon Bounce Back,60,79 Weapon Bounce Front,20,39 Weapon Bounce Left,140,159 Weapon Bounce Right,100,119 Weapon Climb 0,3600,3620 Weapon Climb 1,3989,4009 Weapon Climb 2,4378,4398 Weapon Climb 3,4767,4787 Weapon Climb 4,5156,5176 Weapon Crouch Cock 0,3532,3548 Weapon Crouch Cock 1,3921,3937 Weapon Crouch Cock 2,4310,4326 Weapon Crouch Cock 3,4699,4715 Weapon Crouch Cock 4,5088,5104 Weapon Crouch Recoil Burst 0,3558,3568 Weapon Crouch Recoil Burst 1,3947,3957 Weapon Crouch Recoil Burst 2,4336,4346 Weapon Crouch Recoil Burst 3,4725,4735 Weapon Crouch Recoil Burst 4,5114,5124 Weapon Crouch Recoil Semi 0,3549,3557 Weapon Crouch Recoil Semi 1,3938,3946 Weapon Crouch Recoil Semi 2,4327,4335 Weapon Crouch Recoil Semi 3,4716,4724 Weapon Crouch Recoil Semi 4,5105,5113 Weapon Crouched Idle 0,1282,1304 Weapon Crouched Idle 1,1670,1693 Weapon Crouched Idle 2,2059,2082 Weapon Crouched Idle 3,2448,2471 Weapon Crouched Idle 4,2837,2860 Weapon Crouched Move 0,1305,1329 Weapon Crouched Move 1,1695,1717 Weapon Crouched Move 2,2084,2106 Weapon Crouched Move 3,2473,2495 Weapon Crouched Move 4,2862,2884 Weapon Crouched Reload 0,1330,1389 Weapon Crouched Reload 1,1719,1778 Weapon Crouched Reload 2,2108,2167 Weapon Crouched Reload 3,2497,2556 Weapon Crouched Reload 4,2886,2945 Weapon Flinch Gut 0,3392,3411 Weapon Flinch Gut 1,3781,3800 Weapon Flinch Gut 2,4170,4190 Weapon Flinch Gut 3,4559,4578 Weapon Flinch Gut 4,4948,4967 Weapon Flinch Left 0,3412,3431 Weapon Flinch Left 1,3801,3820 Weapon Flinch Left 2,4190,4209 Weapon Flinch Left 3,4579,4598 Weapon Flinch Left 4,4968,4987 Weapon Flinch Right 0,3432,3451 Weapon Flinch Right 1,3821,3840 Weapon Flinch Right 2,4310,4229 Weapon Flinch Right 3,4599,4618 Weapon Flinch Right 4,4988,5007 Weapon Get Up Back 0,3662,3691 Weapon Get Up Back 1,4051,4080 Weapon Get Up Back 2,4440,4469 Weapon Get Up Back 3,4829,4858 Weapon Get Up Back 4,5218,5247 Weapon Get Up Front 0,3622,3661 Weapon Get Up Front 1,4011,4050 Weapon Get Up Front 2,4400,4439 Weapon Get Up Front 3,4789,4828 Weapon Get Up Front 4,5178,5217 Weapon Guard Idle 0,1001,1025 Weapon Guard Idle 1,1390,1414 Weapon Guard Idle 2,1779,1803 Weapon Guard Idle 3,2168,2192 Weapon Guard Idle 4,2557,2581 Weapon Guard Move Fast 0,3696,3710 Weapon Guard Move Fast 1,4085,4099 Weapon Guard Move Fast 2,4474,4488 Weapon Guard Move Fast 3,4863,4877 Weapon Guard Move Fast 4,5252,5266 Weapon Guard Move Slow 0,1027,1049 Weapon Guard Move Slow 1,1416,1438 Weapon Guard Move Slow 2,1805,1827 Weapon Guard Move Slow 3,2194,2216 Weapon Guard Move Slow 4,2583,2605 Weapon Idle 0,1101,1125 Weapon Idle 1,1490,1514 Weapon Idle 2,1879,1903 Weapon Idle 3,2268,2292 Weapon Idle 4,2657,2681 Weapon Impact Back,40,59 Weapon Impact Front,1,19 Weapon Impact Left,120,139 Weapon Impact Right,80,99 Weapon Melee Kick 0,3494,3514 Weapon Melee Kick 1,3883,3903 Weapon Melee Kick 2,4272,4292 Weapon Melee Kick 3,4661,4681 Weapon Melee Kick 4,5050,5070 Weapon Melee Punch 0,3452,3472 Weapon Melee Punch 1,3841,3861 Weapon Melee Punch 2,4230,4250 Weapon Melee Punch 3,4619,4639 Weapon Melee Punch 4,5008,5028 Weapon Melee Uppercut 0,3473,3493 Weapon Melee Uppercut 1,3862,3882 Weapon Melee Uppercut 2,4251,4271 Weapon Melee Uppercut 3,4640,4660 Weapon Melee Uppercut 4,5029,5049 Weapon Move Fast 0,1192,1208 Weapon Move Fast 1,1581,1597 Weapon Move Fast 2,1970,1986 Weapon Move Fast 3,2359,2375 Weapon Move Fast 4,2748,2764 Weapon Move Slow 0,1127,1149 Weapon Move Slow 1,1516,1538 Weapon Move Slow 2,1905,1927 Weapon Move Slow 3,2294,2316 Weapon Move Slow 4,2683,2705 Weapon Recover Back 0,3622,3661 Weapon Recover Back 1,4011,4050 Weapon Recover Back 2,4400,4439 Weapon Recover Back 3,4789,4828 Weapon Recover Back 4,5178,5217 Weapon Recover Face 0,3662,3691 Weapon Recover Face 1,4051,4080 Weapon Recover Face 2,4440,4469 Weapon Recover Face 3,4829,4858 Weapon Recover Face 4,5218,5247 Weapon Reload 0,1210,1269 Weapon Reload 1,1599,1658 Weapon Reload 2,1988,2047 Weapon Reload 3,2377,2436 Weapon Reload 4,2766,2785 Weapon Spawn 0,3390,3391 Weapon Spawn 1,3779,3780 Weapon Spawn 2,4168,4169 Weapon Spawn 3,4557,4558 Weapon Spawn 4,4946,4947 Weapon Stack Idle 0,1051,1075 Weapon Stack Idle 1,1440,1464 Weapon Stack Idle 2,1829,1853 Weapon Stack Idle 3,2218,2242 Weapon Stack Idle 4,2607,2631 Weapon Stack Move Slow 0,1077,1099 Weapon Stack Move Slow 1,1466,1488 Weapon Stack Move Slow 2,1855,1877 Weapon Stack Move Slow 3,2244,2266 Weapon Stack Move Slow 4,2633,2655 Weapon Stand Aim Down 0,3591,3594 Weapon Stand Aim Down 1,3980,3983 Weapon Stand Aim Down 2,4369,4372 Weapon Stand Aim Down 3,4758,4761 Weapon Stand Aim Down 4,5147,5150 Weapon Stand Aim Up 0,3595,3598 Weapon Stand Aim Up 1,3984,3987 Weapon Stand Aim Up 2,4373,4376 Weapon Stand Aim Up 3,4762,4765 Weapon Stand Aim Up 4,5151,5154 Weapon Stand Cock 0,3515,3531 Weapon Stand Cock 1,3904,3920 Weapon Stand Cock 2,4293,4309 Weapon Stand Cock 3,4682,4698 Weapon Stand Cock 4,5071,5087 Weapon Stand Recoil Burst 0,3578,3590 Weapon Stand Recoil Burst 1,3967,3979 Weapon Stand Recoil Burst 2,4356,4368 Weapon Stand Recoil Burst 3,4745,4757 Weapon Stand Recoil Burst 4,5134,5146 Weapon Stand Recoil Semi 0,3570,3577 Weapon Stand Recoil Semi 1,3959,3966 Weapon Stand Recoil Semi 2,4348,4355 Weapon Stand Recoil Semi 3,4737,4744 Weapon Stand Recoil Semi 4,5126,5133 Weapon Strafe Left 0,1151,1170 Weapon Strafe Left 1,1540,1559 Weapon Strafe Left 2,1929,1948 Weapon Strafe Left 3,2318,2337 Weapon Strafe Left 4,2707,2726 Weapon Strafe Right 0,1171,1190 Weapon Strafe Right 1,1560,1579 Weapon Strafe Right 2,1949,1968 Weapon Strafe Right 3,2338,2357 Weapon Strafe Right 4,2727,2746 Weapon Talk Neutral A0,3755,3777 Weapon Talk Neutral A1,4144,4166 Weapon Talk Neutral A2,4533,4555 Weapon Talk Neutral A3,4922,4944 Weapon Talk Neutral A4,5311,5333 Weapon Talk Radio PTT End 0,3748,3754 Weapon Talk Radio PTT End 1,4137,4143 Weapon Talk Radio PTT End 2,4526,4532 Weapon Talk Radio PTT End 3,4915,4921 Weapon Talk Radio PTT End 4,5304,4310 Weapon Talk Radio PTT Full 0,3723,3754 Weapon Talk Radio PTT Full 1,4112,4143 Weapon Talk Radio PTT Full 2,4501,4532 Weapon Talk Radio PTT Full 3,4890,4921 Weapon Talk Radio PTT Full 4,5279,5310 Weapon Talk Radio PTT Idle 0,3729,3730 Weapon Talk Radio PTT Idle 1,4118,4119 Weapon Talk Radio PTT Idle 2,4507,4508 Weapon Talk Radio PTT Idle 3,4896,4897 Weapon Talk Radio PTT Idle 4,5285,5286 Weapon Talk Radio PTT Loop 0,3730,3747 Weapon Talk Radio PTT Loop 1,4119,4136 Weapon Talk Radio PTT Loop 2,4508,4525 Weapon Talk Radio PTT Loop 3,4897,4914 Weapon Talk Radio PTT Loop 4,5286,5303 Weapon Talk Radio PTT Start 0,3723,3729 Weapon Talk Radio PTT Start 1,4112,4118 Weapon Talk Radio PTT Start 2,4501,4507 Weapon Talk Radio PTT Start 3,4890,4896 Weapon Talk Radio PTT Start 4,5279,5285 Weapon Transition Crouch 0,1271,1279 Weapon Transition Crouch 1,1660,1668 Weapon Transition Crouch 2,2049,2057 Weapon Transition Crouch 3,2438,2446 Weapon Transition Crouch 4,2827,2835 Weapon Transition Stand 0,3713,3722 Weapon Transition Stand 1,4102,4111 Weapon Transition Stand 2,4491,4500 Weapon Transition Stand 3,4880,4889 Weapon Transition Stand 4,5269,5278