[Modding Guide] - .CHR Character Attachments

Discussion in 'PC Mods' started by Phacops, Jul 20, 2014.

  1. Phacops

    Phacops Here To Help

    www.precambriandesigns.com/drupal/misc/RC339.zip

    This guide covers attachments only, such as armor, or holsters, or knives, or anything else you can dream to attach. At this time, I don't have full Characters working, sorry :(

    Furthermore, I'll go back and rework this as I go along in case I need to clarify, considering I just started making this work yesterday, haha.

    -----

    We'll go over the basic setup for the file first then proceed to how to handle that in CryEngine and set up all the components to tack it on.

    Regarding CryBlend, see my very old post on that, which still has accurate info though you can update to Blender 2.71 and the latest version of CryBlend - http://steamcommunity.com/groups/stateofdecaymodding/discussions/0/864980277853151805/

    Make sure you have CryEngine 3.3.9 or it appears this will not work on export as it needs that version of the Resource Compiler



    Open Blender
    New file

    Save your file with a name that is descriptive of what it is
    If you didn't have 3.3.9 CryEngine previously -
    CryBlend Menu > Set CryBlend Paths > Find the Resource Compiler
    Then track down the folder you put 3.3.9 in
    Go to the bin32 Folder
    Go to the RC Folder
    Choose RC.exe

    Add > Armature > Single Bone
    A wild Armature appears in your Object list in the right sidebar!
    Screenshot 2014-07-20 14.16.46.jpg

    Cryblend Menu > Add BoneGeometry
    CryBlend Menu
    > Add FakeBone
    On the right where the objects are listed, drag and drop your Cube you started with onto your Armature that appeared
    Add with Automatic Weights
    Click the eye on the far right for the Bone and Bone_boneGeometry objects
    Screenshot 2014-07-20 14.16.49.jpg

    Press 'A' to select all
    CryBlend Menu > Add CryExportNode
    Name it something descriptive, such as - Samurai_Helmet
    That's for the future to watch for random errors, so you know which to blame.
    You can also doubleclick the name of the Cube in the right sidebar make it the same. Helps identify that this is the mesh to work on.
    Screenshot 2014-07-20 14.16.33.jpg

    Go to the Cube in the Object list on the left
    Click the plus sign (+) to the left of it to show the material (pink checkered sphere)
    Underneath the object list, click the pink checkered sphere there to bring up the Material section
    It should have a default Material called "Material"
    Click that to highlight it
    Under that portion of the window is a text area with Material
    Delete that in put in the name you chose earlier for the CryExportNode which MUST match or it will break, period.
    Follow that with a double underscore
    Type the number 1 (And any additional materials you add for new textures will be sequentially numbered, 2, 3, 4, and so on)
    Double underscore
    Whatever the texture will be, E.g. Helmet_Metal (Double underscores separate items, single underscores are just spaces to the Exporter)
    Mine now looks like Samurai_Helmet__1__Helmet_Metal
    CryBlend Menu > Add Material Physics > PhysNone
    This will make it render so you can see it but not cause any physical reactions

    The next part is hard to pin down on why it works as it does. This is the direction the Geometry should face; full Characters should face the positive-Y which is the direction the Green arrow points in. Attachments seem to go all wild, however. Oddly, it seems it needs to point at positive X, with Y as the up-down direction instead of Z, and Z is the left-right direction instead of Y. For any alignments to normal bones, this is correct for me. For smaller movable things, eyelids and such, it looks like it should face the Y with Z being the up down as usual.

    Alright, let's send it off!

    Go to the upper menus > Window > Toggle System Console
    This will show the ouput when it exports in case there is an error

    CryBlend Menu > Export to Game
    Change the dropdown in the far left from CGF to CHR, make sure the following is checked:
    Do Not Merge Nodes
    Run RC
    Refresh RC Output
    Run RC and Do Materials


    Note: If you establish all your materials and textures and are just opening the file for tweaking the geometry then you can uncheck Run RC and Do Materials as it is then an unnecessary step.

    Check out that system console which should be a second window attached to Blender if you're on Windows, at least. If I recall, on Linux it comes in as a separate, unparented window.

    Generally, errors and warning will be bad for CHR where many can be ignored for CGAs and even more can be ignored for CGFs, due to their relative lack of complexity.

    Even a basic warning seems to be cause for worry with CHRs.

    One error you can ignore is if you copy geometry and paste into a new file where, sometimes, it will double it up on the CryExportNodes so you may see [The name of your exportnode] followed by .001 on the end and a note that it couldn't export geometry from the scene. This is a latent bug in CryBlend that holds onto export nodes and tries to export them despite them not being in the scene at all. You'll find that any Materials you've ever made with CryBlend will get exported as files every time you run RC and Do Materials. I've got roughly 30 that pump out every time, haha.


    Common breaking errors and the solutions:

    If your fakebone has any rotations applied to it, delete them and write in 0 in the middle right sidebar, that's accessed by pressing 'N'. If it has any rotations on it - which will be obvious if it doesn't say 0 in X, Y, or Z - then CryEngine will tell you it failed to load.

    'vcount' node has some wrong value (must be 1..1) = Add whatever new geometry you get to your Vertex Groups as it is simply not identifying them as assigned to one. This isn't just at the start but EVERY time you add more vertices. You want to add a couple cubes to fill out the embellishments? Add 'em to the vertex group! Want to add a single, innocent vertex, hovering in mid-air, minding its own business? Add it to the vertex group! Find those Vertex Groups to the left of the little checkered pink sphere we entered our materials into, it looks like a triangle with a dot at each vertex. In edit mode, select all your geometry by pressing 'A' and then click that group, which defaults to Bone, and click Assign. Done!

    Always apply Rotation/Scale if you shift the size or direction of anything or the Editor/Game will not be able to open it

    Warning - this one is breaking - "Key 'ext_' was not registered, call RegisterKey() before using the key" This happens if you accidentally/intentionally press enter without choosing a DAE file name on export. Presumably it clashes info with prior saves and thus breaks the export operation although it does complete. If you port into the game you'll find that the geometry is invisible no matter what settings you change in the CDF.

    Crashes, usually with a "Joint index out of range" error - If you changed the name of one of the bones, then make sure the Bone you added that made the armature, the FakeBone, and the Vertex Group all have the same name.

    If it exports correctly then just take it from your Blender export directory and drop it somewhere easy to find for now, like Game/Objects - we can move it around when we release the mod later, to a place more suitable.

    CryEngine bit in the next post :)
     
    Last edited: Oct 19, 2015
    Green797 and SilentResident like this.
  2. Phacops

    Phacops Here To Help

    CryEngine:

    First make sure you unpacked your PAKs into CryEngine's game directory - I'd advise this for making sure mods work as well because then you port only the necessary parts to the game directory in the event the texture or object you used was from CryEngine stock.

    Then open CryEngine 3.3.9 and Sign In

    View
    Open View Pane
    Character Editor

    Add your parts, see your animations, and align your bits in the Attachments tab at the bottom

    Alignment Tab-
    File
    Open
    Find the CDF you want to edit, E.g. Game\characters\male\human\story_characters\marcus_campbell.cdf

    First we'll want to be able to see our character, so choose one such as Marcus and we'll have to fix their skin setup so it isn't invisible due to the unknown shader.

    You can do this easily by selecting the parts in the middle at the bottom under the attachments heading, E.g. Skin, and then, slightly to the right, above the clear and apply buttons, you'll see the section that says Mtl, then a filename for the material, then a less-than sign (this will assign the selected material you have in the Material Editor pane), and then ellipses (three periods). Click the ellipses to be quickly sent to the assigned material in the Material Editor pane. If your Character Editor pane is maximized then it won't appear and you'll have to move it, by the way.

    Note that it won't show a material for some parts but you can still get the actual one if you press the ellipses.

    Inside the Material Editor, on the right, at the top, underneath the actual textures, you can change the Shader dropdown to be the suitable type. Cloth for clothing, Humanskin for skin, Illum for everything else. Technically you can just do illum for it all because it is irrelevant and doesn't show up perfectly anyway :)

    If you do this for Skin, Legs, Head, Body, Hair (although the hair seems, usually, to be the only thing that is on illum because it doesn't have a special shader) then you can view placement and animations easily. Make sure you assign the Material and not a sub-part like ShirtShader, or it won't appear. Only issue is the excess flesh used for death sequences which I'm unsure how to get rid of, as of yet. Stopping layers seemed the logical choice but didn't seem to have an effect. For now I just set the opacity of the skin layer to 8% in the Material Editor and that makes a reasonable middleground.

    If you unpacked your animation/characters then you should see animations pop on the left, though you'll want to click the circling arrows to the left of filter in the left sidebar to make sure it reloads them. If they still don't initialize and just go red when you double click the animations on the left then you can go to the right sidebar under Advanced Animation Settings and click Choose Base Character.

    You can further enhance your knowledge of how your components will look within this same area later by scrolling down to the Debug Options heading, clicking that and using these options for more display components. For example, you can change the background color to better see the model, you can tell it to show joint names so you know which one you're hinging to, or want to hinge to, modify light orbit range and intensity to test different lighting sets - also good for level design to see how it will affect characters- and so on.

    If you need to stop those animations, as they default to looping, you can go to the Animation Control tab at the bottom and click the pause button.
    Screenshot 2014-07-20 12.44.00.jpg

    Since we have our materials configured for the core body, if we started with an existing one, we can now engage all that knowledge and add our parts and assign materials to them to get them working. Yeah, back to the point of attachments and character parts :)

    Go back to the Attachments tab if needed. Have a look around and tamper with things as you like before proceeding. Discovery is the heart of understanding, after all.

    In order to handle attachments, we simply do the following -
    Press the New Button in the left middle there
    Name it something descriptive to what you're doing with it, E.g. Armor-Chest, Armor-Waist, 10-Gallon_Hat, StrawberryShortcake_Shoulderpads, etc.

    Then we can go a little to the right to find the Object section which is just above where we found our Mtl section. Here we, like the materials, click the ellipses, the 3 periods.
    This will open the file finder and we can grab up the object we just made, E.g. samurai_helmet.chr

    Note that if you just went with the starting cube then the cube is person sized and thus will be ultra-mega-turtle-huge. But it shows that it works, right?

    Once you open it, click the apply button and this will drop it in. The rest is just choosing a bone to align it to.
    Screenshot 2014-07-20 14.56.29.jpg

    Until I/We figure out why Skin attachments crash on assignment, use Bone Attachments only. Whatever you assign it to is what it will move with. If you attach it to the head bone then the object's origin in your 3D program is what it will hook to the bone-point from that Bone. For example, if I hook a hat to a head then the origin should be at the base of the skill as that is the natural pivot point. You'll see it move around that point with the head as well. You can try out Face attachments which seem to work as well but the alignments go fairly wild.

    You may have to assign it to a part, put a check in the box for Align Attachment, then change the part to one that aligns it correctly but isn't the part you actually want it to move with. Once you align it and press apply, then are comfortable with the position, you can uncheck align, then choose the bone you want it to move with. Or, you can do it manually with the controls in the top left if you click the 4-way arrows and then you can slide them around in reference to your character this way til they line up perfectly.

    You can also shift the distance it resides at for an object to be farther away from the origin, or nudge it up really close for something that shouldn't move much, or dampen the physics on it so it is at the right distance but moves less in relation to the player.

    For example, the waist armor I made was being funky and not lining up correctly, although it did before. Rather than meticulously realign it in the 3D file, as a test, I shifted it from the Pelvis bone - the one it needs to move with - and changed it to spine1, which moved it up a bit. I then unchecked alignment and moved it to Pelvis which has it moving with the right part and also in the right spot in-game.
    Screenshot 2014-07-20 14.38.39.jpg

    Once you assign your bits and pieces, you can see how they run by assuring you followed the method above in the animation comments - sometimes you have to reload the animations again after assigning parts.

    If you like what you see then do
    File
    Save As
    [Your choice of filename]

    Simply drop that into the appropriate location - assuming, again, that it was the original - and it should work just fine!

    Yay!

    Assuming it worked, you just pop back into your Blender file and choose the cube, or whatever you renamed it to, and edit just that piece. Just note that any time you add full new objects within there, as mentioned above in common errors, to apply it to the Vertex Groups or it will break the whole file.
     
    Last edited: Jul 20, 2014
    SilentResident likes this.
  3. Phacops

    Phacops Here To Help

    Adding to this, you can do anything with all of this. Such as assorted armors like helmets, chestpieces, thigh/shin guards, etc.

    Alternatively you could do those in the texture alone and then bumpmap but this is certainly the flamboyant and more expansive way to do it, haha.

    You might start with just pulling parts out of the engine and then sizing them up and figuring out the constraints so you know how to build around them.

    For example, I built a couple weird helmets to get size constraints for Marcus' head so I can build a helmet.

    A rounding test for how big it has to be to also fit his hair - which is too big for comfort, apparently:
    Ro-box-head2.jpg

    And straight blockhead constraint after removing his hair to curl it straight onto his skull, looking like a basic robot:
    Ro-box-head.jpg

    Now I just turn that file into a modular one where I save it and open it later when I need to make a new headpiece, renaming it to a new save for working in with the constraints already in place.

    And this is a straight shot from the neatly tucked ro-box head file:
    itsabouttogetweird.jpg

    Finally, a fuller illustration with more parts and the aesthetic elaborated upon; clothing changes to mercenary pants CHR/MTL, Cop CHR for Torso to slim it and the Merc MTL on top of that slimmed torso, helmet further developed, with shoulder pads separated into left-right versions and flared then parented to each clavicle, elbow and toe spurs added and separated into left-right versions and parented to the toe bones, and a little flare in animation, backdropping and lighting - as well as a quick contrast filter in Photoshop :p
    Screenshot 2014-07-21 01.15.06.png

    And a few to show how it goes with fiddling with some Fresnels and the Bumpmapping:
    Pretty3.jpg Pretty.jpg Untitled-1.jpg
     
    Last edited: Jul 21, 2014
  4. Phacops

    Phacops Here To Help

    Will add in more replies here when I find out how to do a full character in Blender and get it to work, then will change the name to note that shift.
     
    SilentResident likes this.
  5. HaydnScarlett

    HaydnScarlett Here To Help

    You are amazing.
     
    Last edited: Jul 22, 2014
    SilentResident likes this.
  6. Phacops

    Phacops Here To Help

    Haha, not at all :)

    Considering prior comments, I'll note that CryBlend has to be enabled in the user settings > Addons > Search for "Cry" > Put a check in the box on the right and then save

    Added line about checking out my main mesh modding how-to since that covered that bit. Sorry, thought I put that in there...I'm still trying to do too much, haha.
     
    SilentResident and HaydnScarlett like this.
  7. Visigoth

    Visigoth Starting Off

    wow, that's impressive... Very "Mad Max Beyond Thunderdome"
     
  8. Phacops

    Phacops Here To Help

    With Tina Turner starring as some gilded fancy armor print :)
     
  9. Phacops

    Phacops Here To Help

    Needed a break from level design to think about some things, so I started a small mod rolling for character bits. Couldn't remember some of the intricacies so I cracked this open and reread.

    Just wanted to note that despite the age of the post, the information is still perfectly relevant and quick to follow. So, somebody start making character bits too...please ;)

    Quick note is that if you're replacing something, such as hair, then a quick method is to leave the MTL targeting the old info and just replace the geometry for now. Once you can see the geometry in the game then you can change the MTL to what you like - this will coax out funny business with settings that CryEngine can use but that State of Decay doesn't recognize, or interprets differently.

    To be more specific; when I first did this, ages ago, I got a lot of false negatives because MTL settings weren't right and it seemed like my geometry wasn't porting in which wasted hours of trying new methods when prior methods had actually worked.

    Will go further later, but here's an example demonstrating the workability:

    Maya with a mohawk and a red/merlot Bandana -
    MohawkMaya.jpg
     
  10. I tried doing this, n\but something wouldn't work. I fallowed the instructions. I can't remember what the issue was though; it's been a while since I tried. I think it was an issue with my blender.
     
  11. Phacops

    Phacops Here To Help

    Hmm, I just worked it yesterday with my build, as you can see the result in the above.

    If you try again then feel free to ask in the thread.

    Since mine works, we have a definite control to get yours up to speed, and that will help anyone else having an issue, of course :)
     
  12. Oh, and when I try opening the models in Cryengine, It gives me an error saying "LMG no longer supported". Then CryEngine crashes.
     
  13. Phacops

    Phacops Here To Help

    Sounds like you have a later version of CryEngine than the 3.3.9? That's the closest one they had to Undead Labs' version. I couldn't find exactly which build it was deprecated in, but the cry docs are from 2012 which seems like about right for it being the 3.4 builds or so.
     
  14. Phacops

    Phacops Here To Help

    Another quick note on construction:

    If you add in a light entity (Entity > Lights > Light) in Cryengine, then place it basically on top of your character with settings shown here, then that is almost a perfect match for what it will look like in game for the clothing itself. Looks like the game will add a slight additional gloss, but it's basically there.

    Obviously the skin shader in Cryengine doesn't take too kindly to it there though ;)

    LightEntityTexturator.jpg

    Also, if you want a correlation in the .mtl (The special dds is basically the same one but darker and grayed):

    <Material MtlFlags="524544">
    <SubMaterials>
    <Material Name="shirtShader" MtlFlags="524416" Shader="Illum" GenMask="80000" StringGenMask="%GLOSS_MAP" SurfaceType="" MatTemplate="" Diffuse="0.031551391,0.031551391,0.031551391" Specular="0.010397803,0.015175238,0.016988052" Emissive="0,0,0" Shininess="5" Opacity="1">
    <Textures>
    <Texture Map="Diffuse" File="characters/female/human/Fortitude/Maya/body/shirt_d.dds"/>
    <Texture Map="Specular" File="characters/textures/camouflage01.dds"/>
    <Texture Map="Bumpmap" File="characters/female/human/Fortitude/Maya/body/shirt_ddn.dds"/>
    <Texture Map="Custom" File="characters/female/human/Fortitude/Maya/body/shirt_m.dds"/>​
    </Textures>
    <PublicParams FresnelPower="5" GlossFromDiffuseContrast="1.5700001" FresnelScale="1" GlossFromDiffuseOffset="0" FresnelBias="0.34099999" GlossFromDiffuseAmount="0.68199998" GlossFromDiffuseBrightness="10" IndirectColor="0.25,0.25,0.25"/>​
    </Material>​
    </SubMaterials>​
    <PublicParams FresnelPower="4" GlossFromDiffuseContrast="1" FresnelScale="1" GlossFromDiffuseOffset="0" FresnelBias="1" GlossFromDiffuseAmount="0" GlossFromDiffuseBrightness="0.333" IndirectColor="0.25,0.25,0.25"/>
    </Material>
     
    Last edited: Feb 20, 2015
  15. SilentResident

    SilentResident Got Your Back

    You are indeed amazing, Phacops

    My dearest Undead Nicole, please can you pin this useful and handy modding guide by Phacops?

    The SoD modding community will be very grateful and appreciate this, because character modding is a big part of the State of Decay modding. And I shall note that there is gonna be a renewed modding interest with the upcoming YOSE release! :)
     
    Last edited: Feb 21, 2015
  16. Phacops

    Phacops Here To Help

    Haha, nah, only seems amazing because I'm the only one working in this area fully :) Thank you though.

    It seems we owe Nicole a cherry jello in a brain mold :D

    And I very much hope people do get into modding with YOSE and maybe somebody with actual CryEngine experience, haha.
     
  17. SilentResident

    SilentResident Got Your Back

    I hope the same... Truth to be told, it is worrysome that you are the ONLY person with such advanced modding skills this time around. :D

    And yea, I will be there when YOSE comes, and I am sure at least a 35%-50% of the old community will be back right after YOSE's release date, plus the new gamers. :D
     
  18. Phacops

    Phacops Here To Help

    I'm going to keep declining that I'm advanced or better than anyone - I'm just doing something in a different area with no full competition :)

    I agree with you on the worry, and that's why I make these guides. But I made a guide for building architecture and putting things in the level in 2013, and more in early 2014, and more geometry stuff in mid/late 2014...and here we are in 2015 - I've only seen a single person plant things in the level besides myself now. I'm the only one that made my own vehicles, not just reskinned them, only one that made character attachments, not just reskinned them.

    I feel sad :(

    I support your hypothesis that we'll get a load of modders out of that. We get little hits, as you know, any time they have a steam sale and a bunch of people buy it and then find the forums (Thanks UL for putting that marquee on the loading screen for how to get to forums!) and then they mod a little and disappear, haha.

    What surprises me is that I've had at least a few people approach and say they had CryEngine skills and asked what they could do, and I gave them some missions and they never did any of it. I even had people approach and ask if I wanted to make a game with them but I don't have time for that yet, haha. (I wouldn't assume they were anyone but random people, not anyone with gobbles of money that wanted to throw it at a real game, I should say to diminish risk of seeming to gloat.).

    I'm glad at least a few people, such as yourself, are around and interested, at least.



    ----


    Addition to guide:
    Approximate light settings for cloth shader handling, assuming one has ported the environment variables in the Time of Day settings from the Mission_Mission0.xml to it's own xml file then saved as a .tod and ported into CryEngine -
    LightEntityTexturator2.jpg
     
  19. SilentResident

    SilentResident Got Your Back

    Actually your post is very touching at heart. You are in fact a "lonely modder" in some of the game's fields, such as 3D meshes.

    I could truly have loved to get some of your knowledge/experience on 3D models. I find your articles immensely interesting, and I thank you everyday for having the courage to share this knowledge with us.

    I myself am not a 3D modder. I am a 2D modder. Both in State of Decay modding and as real life hobby, painting and artworks are my own field of jobs. But still I find it very problematic that my skills/hobby are covering an already well-explored field of State of Decay modding (UI, characters, items and weapons) instead of the less explored part which is models for cars and people and other 3D-related stuff.

    For being the ONLY person around having mastered so much about SoD's 3D modding, leads me to the conclusion that your name, Phacops, deserves to be added to the YOSE's refreshed list of names of the Shark Hoodie Guy.
    The least Undead Labs can do for expressing so much love about the game, is honoring your name. Why not Phacops be in Shark Hoodie Guy's list of special names? :D
     
  20. Phacops

    Phacops Here To Help

    Aww - Pha "Lonely Modder" cops

    You do very good work and I'm sure your skills at 2D would be very handy if you got into the 3D. You can build a basic mesh and have it look okay but you can cover that up easily with a very good skin, surely :)

    Haha, wasn't expecting such a lauding response. Again, I think we're always equals, and just have a different focus for each of us. Share your successes, own your failures, and all that.

    I still have very much to learn about all the things, but at least we have a method for other people to play on that are far better than I am :)
     

Share This Page