Home » MODDING HQ 1.13 » v1.13 Idea Incubation Lab  » Tutorial for rendering and creating animations for LOBOT
icon1.gif  Tutorial for rendering and creating animations for LOBOT[message #360057] Sat, 16 May 2020 22:59
Asdow

 
Messages:13
Registered:August 2010
Okay, I figured I'd write a small tutorial on how to render a prop with blender and add it to the game for Logical bodytypes. Anyone who's interested in tinkering with making animations for JA can then use this as a starting point. Download link for the blender file and other needed stuff is here:
http://www.mediafire.com/file/b6haku98kr7f2fy/JA2_character_animation_photobooth_for_blender_2_82.7z/file
Inside the .7z is also a .pdf that gives you general info about the blender file and making animations, but I've made a batch script to make creating the .sti files more convenient.
You'll probably also find this thread about the LOBOT system useful:
http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=24337&start=0&
A JA 1.13 revision 8766 or newer is needed for this to work ingame. I'm also assuming basic knowledge of blender so I don't have to type out everything, but it should still be pretty straightforward to follow.


I'm going to use an AK47 model courtesy of ClemLan at https://sketchfab.com/3d-models/low-poly-ak-47-bc17b2df0fc9499c8138f20fd1719bab to show how it works.

First, let's open up the JA2 character animations photobooth_282.blend file and add the AK47 model into the scene, and set the pose to rest position. Note: If you're following along with that exact same AK47 model, after appending the kalash object from the source blender file to the scene, you'll need to expand it in the outliner, right click on the Animation under the kalash object and click 'clear clear animation data'. Otherwise the AK won't follow the vertex group we assign it to in a future step in the tutorial.
https://i.imgur.com/XKZkRSi.png

Next, we'll set the rifle model that is already set up visible in the viewport, and scale and adjust the AK's position to roughly match that.
https://i.imgur.com/y0j8N36.png
https://i.imgur.com/y0j8N36.png

Once that's done, we'll hide the rifle model, and in object mode, select the rifle, press shift and then select the pose helpers (Click on the big circle with four arrows under the body. Then we'll parent the AK to the body with ctrl + P and selecting Armature Deform With Empty Groups
https://i.imgur.com/o7remZx.png
https://i.imgur.com/o7remZx.png

After that, we'll have to drag the AK to be under the rig in the outliner at the top right corner of the screen.
https://i.imgur.com/P6oBxE8.png

Then, select only the AK model, press TAB to enter edit mode, press 'A' to select all and in the Object Data Properties window, search for DEF-hand.R Vertex Group, and assign the AK to it with a vertex weight of 1.0
https://i.imgur.com/ec1PxVy.png
https://i.imgur.com/ec1PxVy.png

After that, we can hop out of edit mode via 'TAB' and in the outliner, select pose and set the pose to Pose Position and if everything went right, the AK model now follows the right hand during the animation.
https://i.imgur.com/5BYSiEW.png

Next up, we have to link the AK object to all the other camera scenes. There are 8 scenes in total for different views. Select the AK and press CTRL + L to bring up the Make Links dialog and select 'Objects to Scene' -> Camera 2. Repeat for all cameras.
https://i.imgur.com/TvBWi8q.png
https://i.imgur.com/TvBWi8q.png

Then, we need to switch to the different camera scenes, and drag the AK object in the outliner to be under the rig object. This, too needs to be repeated for all cameras. It's tedious, but otherwise the layering in the renders doesn't come out correctly and the renders are messed up.
https://i.imgur.com/7UBW3YU.png
https://i.imgur.com/7UBW3YU.png

After that's done, the new object is added to all the scenes, follows the animation and renders correctly. Let's switch back to scene 'Camera 1' and hop to the Animation tab. From the bottom select the 'standing idle rifle' animation and we'll adjust the animation end to be frame #8. The beginning and end frame numbers in Camera 1 scene tell how long of an animation we'll render. In this case, the standing idle animation we're rendering is 8 frames long, so frames 1...8 it is. When creating new animations to replace an original JA animation, the length must be identical, so one needs to check how long the animation is.
https://i.imgur.com/4y87cRf.png
https://i.imgur.com/4y87cRf.png

Okay, we're almost ready to press render. Let's switch to composition tab. This one needs a little explaining. The composition nodegroups are responsible in extracting different pieces of the render and outputs them to .bmps that can be used to create the .sti files with the batch script. Which ones are active need to changed depending on whether we're rendering the basebody or a prop.
As an example, let's assume there is no standing idle animation made for Logical Bodytypes yet. Then, the first thing would be to render the layered basebody, and creation of different .sti files for shadow, head, torso, hands and legs. In that case, make sure that only the body is enabled for renders in the outliner, and in the composition nodegraph, activate the Shadow, Head, Torso, Hands and Legs nodegroups, and mute the 'prop' nodegroup. The muting and nonmuting of nodegroups can be done by selecting them and pressing the hotkey 'M'.
https://i.imgur.com/a14aTEG.png
https://i.imgur.com/a14aTEG.png
Then, the basebody object properties must be according to following screenshot. 'Holdout' must be disabled and 'Shadow' under 'Ray visibility' enabled.
https://i.imgur.com/1LsgvuP.png
https://i.imgur.com/1LsgvuP.png
After that, we'd be ready to press 'CTRL + F12' to render the animation and then move on to creating the .sti files, but let's continue on with the assumption that the layered basebody is already done and in game and we're only adding an AK type weapon graphics for when a merc has a suitable weapon on hand.

In that case, the basebody object properties should be opposite to what I just mentioned. Holdout is active, and Shadow is disabled. Additionally, now the prop nodegroup should be the only active one and the nodegroups related to a basebody are muted.
https://i.imgur.com/LvUwCJa.png
https://i.imgur.com/LvUwCJa.png

Ok, let's press 'CTRL + F12' and wait until blender finishes rendering the animation. The .bmp files it outputs are in the folder 'output', but we'll use the 'makesti.bat' script to create the .sti file. One thing to note though, is that if you've already rendered something, the files in output are not deleted, only overwritten so if you then render a shorter animation and create the .sti, there'll be unwanted frames in the animation. It's best practice to just delete all images from 'output' folder when switching to a different animation.
The makesti.bat script asks for a name for the .sti you want to create, how many frames per direction the animation has, what palette do you want to apply to the images, whether you want to create a layered body .sti files or a prop .sti. If prop is selected, it additionally asks a suffix for the .sti name. Then creates the needed command line arguments for makesti.exe, converts and crops the .bmps in 'output' folder and outputs those to 'make_script\extract' folder, so the .bmps in 'output' are not modified. For basebody and the default rifle model the JA2_character_model_palette_v3 should be used, but for some things, we may want or need a different color palette. I'll go over the creation of a palette sometime later, but for now, let's just use the guns_AK.stp palette for the AK.
https://i.imgur.com/2dVnLs4.png <- CMDline output of the batch script

Alright, assuming everything went right, we can find the finished S_R_STD_AK.sti in the folder 'make_script\sti'. We'll now move on to adding the needed .xml data to make it work in JA. Let's copy the .sti to JA installation, to the folder 'Data\Anims\LOBOT\RGM' and we'll also copy the guns_AK.stp palette file from 'make_script\Palettes' to JA installation 'Data\Palettes' folder. Okay, in JA's folder 'Data-1.13\TableData\LogicalBodyTypes' lives several different .xml files and we'll need to touch three of them, namely 'AnimationSurfaces_LBT_RGM.xml', 'LogicalBodyType_LBT_RGM.xml' and 'Palettes.xml'. So, let's first open the Palettes.xml and add the guns_AK palette we just copied over. It'll look like this after we're done.
<Palettes>
	<!--<Palette name = "default" filename = "Palettes\default.act" />	-->
	<Palette name = "hats" filename = "Palettes\Hats.stp" />
	<Palette name = "guns_universal" filename = "Palettes\guns_universal.stp" />
	<Palette name = "guns_AK" filename = "Palettes\guns_AK.stp" />
</Palettes>
https://i.imgur.com/l4LbYrG.png

Okay, then in 'AnimationSurfaces_LBT_RGM.xml' we'll add the highlighted line to it to add the .sti as an animation for lobot.
<AnimSurface name="LBT_RGMRIFLE_IDLE_AK" file="Anims\LOBOT\RGM\S_R_STD_AK.STI" flags="0" structdata="ANIMS\STRUCTDATA\M_STAND.JSD" directions = "8" framesperdir="8" profile="-1" />
https://i.imgur.com/6DmUCoq.png

And finally in 'LogicalBodyType_LBT_RGM.xml' we'll add the highlighted line to tell the game what animation surface is replaced when we're holding an AK type weapon. We'll also switch the palette to our newly added 'guns_AK' on line 85. The animation surface 'RGMSTANDING' is the original animation, and the names for those animations can be found in the 'Animation Control.cpp' file in the game's source code if you ever need to hunt one down when creating a new replacement animation for lobot.
<LayerProp filter="IsAKtypeWeapon" palette="guns_AK">
	<Surface name="LBT_RGMRIFLE_IDLE_AK" animsurface="RGMSTANDING" />
</LayerProp>
https://i.imgur.com/Xv1N3yc.png

Whew! After all that, we're ready to launch JA, and if it doesn't crash at startup, odds we'll see our brand new AK when the regular merc is just standing and chilling. If something went wrong and you get an error at startup, you can check the LiveLog.txt in 'Profiles\UserProfile_JA2113' for an error message.
And here's the result, one cool AK in our merc's hands.
https://i.imgur.com/nvKqxVj.png
https://i.imgur.com/nvKqxVj.png


As you can see, there are some inconvenient things still left in the workflow. Namely that only one prop can be rendered at a time, and the .xml entries are still done manually, but it should get one started to creating and adding animations to JA LOBOT system.
Previous Topic: Logical Bodytypes code added into the trunk (WIP)
Next Topic: HAM 5 Alpha - You know it!!
Goto Forum:
  


Current Time: Sat Jun 06 10:11:30 EEST 2020

Total time taken to generate the page: 0.01400 seconds