Page 1 of 2 12 LastLast
Results 1 to 20 of 30

Thread: Use a part of a unit from another faction

  1. #1
    Steph's Avatar Maréchal de France
    Patrician Artifex

    Join Date
    Apr 2010
    Location
    Pont de l'Arn, France
    Posts
    9,174

    Default Use a part of a unit from another faction

    The goal of this tutorial is to explain how you can easily take a part of a unit from one faction, and use it for a unit from another faction.

    The tools used for that are PFM and Gimp + the DDS plugin.

    I'm speaking here only of the method to get the proper parts. You can also refer to l'Aigle tutorial about saving dds files with no quality loss.

    I suppose you know how to create packs, and I won't explain this part here.

    Part 1: Identifying what we need : a look at the variants and the textures

    Let's suppose we want to create a new Austrian unit, with the standard uniform (let say Austrian line infantry), but using the Tartleton helmet (same as the British horse artillery).

    First, we use PFM to open the data.pack, and have a look at the uniform table.




    From here, we see that aur Austrian unit is using the Austria_Inf_Austrian_German_Fusiliers variants. And of course, if we look at British horse artillery, we'd get Britain_Art_Horse_British_6_lber

    Now, we open variantmodels.pack, and we look at the unit folder. We have two things to do here.
    First, we can find the variant of Austria_Inf_Austrian_German_Fusiliers, with for instance austria_inf_line_austrian_german_fusiliers.soldier.unit_variant.
    Since we want to create a new uniform based mostly on that, we extract the soldier, officer, musician and flagbearer. To start with, we suppose we will try to use the same Austria texture.
    So we can just rename the export unit_variant to austria_MyNewUnit.soldier.unit_variant. And then we import it into our mod. It is important to keep the start as austria_, since that is what indicates to the engine in what atlas it should look.

    This is based on the austria texture, so now I look at the units/atlas folder, and have a look at the autria_diffuse.dds

    This file contains all the texture for Austria. But we can see it doesn't contain a texture for the British helmet we want.



    But if we look at Britain_diffuse.dds, it contains our helmet. Let's have a look at the British variant.
    britain_art_horse_british_6_lber.soldier.unit_variant. More particularily at the hat.



    Each part requires two elements: the mesh, and the texture.
    The mexh (i.e. the shape of the part) is not a problem. It is shared between every faction. Se we can copy the line from the british variant VariantModels/UnitParts/Euro/Hats/Tartleton/mesh and past it in the mesh of the hat of our new variant (to replace VariantModels/UnitParts/Euro/Hats/Shako/Base_Shako/mesh

    If we try to start now it will not work. Because in the new unit variant, the texture is still VariantModels/UnitParts/Euro/Hats/Shako/Austrian_Basic_Shako/texture, and this texture is not adapted to this mesh: the unit would look very weird.
    So we also need to use the texture from the british unit. But we cannot jsut copy the texture entry from the variant, because it references an image which is NOT in the austria_diffuse.dds (and the other files: normal, gloss, colour mask...).

    So before we go further, we need to take the part of the britian_diffuse.dds corresponding to the tartleton, and copy it in our austria_diffuse so it is available.

    First problem here is: how can know exactly what part to use?
    Well, looking at the british artillery variant, the texture for the hat shows VariantModels/UnitParts/Euro/Hats/Tartleton/tex/texture

    This is actually a reference to exact coordinate, and we can find it in the britain_diffuse.atlas file. So let's have a look at this in PFM. First, at the top of PFM, check "Toggle coordinate as Pixel Units"


    Find the line for our unit part, and look to the right for the size and the coordinate. Width and height are 384x384. And the X1 Y1 show 1152 2944. Note these values.


    Part 2: Copying and pasting with gimp

    We can now extract britain_diffuse.dds, and open it with gimp.

    We need to copy exactly the part we need. We can try to it graphically, but it's far from easy as we need to very precise. So we'll use a better way.




    Use the rectangular selection tool, and select any part of the image (it doesn't matter where). Then, in the toolbox, enter the exact size and coordinate (taking from the atlas). And now, you can see the selection rectangle: the selection is exactly our helmet texture (note: you cannot enter the exact size and coordinate if you don't select a part of the image graphically first, but what you select graphically doesn't matter, you will modify it with exact value just after).




    Now we can copy the texture. We need to paste it in the Austrian texture. We have several solutions for that. The first one is to replace a part that we don't want to use anymore. For example, let say we don't want to use the casquet (the Austrian small hat from the Italy campaign) for any unit.
    So we look in the Austrian_diffuse.atlas, and we find that for the casquet, the coordinates are 1920 and 1024. The size is still 384x384.

    So now, we open the austrian_atlas.dds with gimp, and we use the method desribed above with the rectangular selection to select this part exactly



    The last step is simple:
    copy the image from the britain_diffuse.dds with CTRL+C (the selection should be exactly the tartleton texture) and paste in the austria_diffuse.dds with CTRL+V. Since the current selection in austria_diffuse is exactly the casquet, the image will be pasted exactly over it!

    You can now save (check l'Aigle tutorial to avoid compression loss), and import austria_diffuse.dds in your mod.





    Part 3: Using the new texture
    This part is simple. We now have a modified austria_diffuse, were the casquet texture as been replaced by the tartleton texture. However, we have just replaced the image. In the austria_diffuse.atlas, the name is still VariantModels/UnitParts/Euro/Hats/Casquet/Infantry/texture
    So now, go to austria_MyNewUnit.soldier.unit_variant , edit the hat part, and in the texture, use VariantModels/UnitParts/Euro/Hats/Casquet/Infantry/texture.



    We now have a new variant, using the mesh of the tartleton, but also the texture (except it replaces the casquet texture, so it's name casquet in the variant.

    Part 4: Finalizing the new unit
    To finish the unit:
    - Use the same method with the gloss, normal and colour mask. We need to copy the image from the tartleton over the image of the casquet in every austria_XXXX.dds.
    - In the uniform table, add austria_MyNewUnit uniform to the new unit.

  2. #2
    Steph's Avatar Maréchal de France
    Patrician Artifex

    Join Date
    Apr 2010
    Location
    Pont de l'Arn, France
    Posts
    9,174

    Default Re: Use a part of a unit from another faction

    Optional possibilities

    Name of the texture
    The example above replaced the casquet by the tartleton. So at the end, in the variant, you still have VariantModels/UnitParts/Euro/Hats/Casquet/Infantry/texture
    If you want, you can rename it to tartleton to make it easier to maintain, but then you need to edit all the atlas files, and replace the VariantModels/UnitParts/Euro/Hats/Casquet/Infantry/texture with Tartleton, without changing the coordinates.
    This is not necessary: if you manage to remember what replaces what, you can keep the original names.

    Using a new diffuse file
    This method is not very complicated, but there is a default: you need to replace the casquet. What if you want to keep it?

    The first solution is to extract austria_diffuse.dds, austria_diffuse.atlas (and the gloss, normal, colour mask), and rename them austria2_diffuse.dds, etc.

    Then, rename the variant to austria2_MyNewUnit.soldier.unit_variant (don't forget to rename it in the uniform table as well).

    The default austrian units will use the austria version (don't touch it), while new units will the new helmet would use austria2.

    Be careful: every new diffuse file will take memory. So if you want to make several new units this way, try to copy all the new parts in your new austria2. You could make austria3, austria4, etc if you have many units to do, but the goal is to try to minimize the number of new texture. So the main difficulty is to organize your new units part to share as much as possible on the same diffuse texture.

    Using empty area
    If you look at the austria_diffuse, you can see it has a lot of "empty space". So instead of replacing the casquet, it is possible to paste the tartleton texture in this empty area.
    This requires to add a new line in the atlas file, with new coordinates, and then to paste the tartleton at this exact coordinate.
    This work when you just have to add a few textures. It can be to copy a part from another faction, but you could also use it to make some variation (example: new plume colours).

    Warning: PFM allows adding a new line in the atlas, and to rename the texture, but you cannot modify the coordinates, width or height, it won't work.

    For that, use Legio_Desaix's atlas manager
    http://www.twcenter.net/forums/showthread.php?t=430002

    Note: the atlas manager works well for coordinate, but not very well to add line or rename. So you may have to mix PFM and atlas manager.
    Last edited by Steph; April 20, 2012 at 12:13 PM.

  3. #3
    Diamat's Avatar VELUTI SI DEUS DARETUR
    Join Date
    Apr 2010
    Location
    My Mind
    Posts
    10,742

    Default Re: Use a part of a unit from another faction

    Wonderful tutorial, Steph. It will be very helpful for all us simpletons.

    For those of you not using Gimp, here is how to select the correct coordinates with Photoshop:

    1. Go to "View" and check "Rulers"
    2. Go to "Edit" > "Preferences" > "Units & Rulers"
    3. Under the "units" header change both tabs to "pixels"
    4. Select the Rectangular Marquee tool (M)
    5. Create a random square
    6. Right-click on the square and select "Transform Selection"
    7. Now at the top you should see a bar pop up like in the picture below
    Spoiler Alert, click show to read: 

    8. Change your X and Y coordinates accordingly.
    9. Right-click in the "W" (width) box and check "pixels"
    10. Input the desired Width (W) and Height (H)

    Done.
    Last edited by Diamat; April 20, 2012 at 09:01 PM.

  4. #4
    Decanus
    Join Date
    Dec 2011
    Location
    Argentina
    Posts
    589

    Icon10 Re: Use a part of a unit from another faction

    Thanks Steph for creating such a marvelous tutorial. Finally i know that the coordinates needed are the X1 and Y1, apart from the width and heght.
    Thank you very much. Now let´s work and see if i can handle this
    Last edited by lordargento; May 04, 2012 at 11:09 PM.

  5. #5

    Default Re: Use a part of a unit from another faction

    Thank you for this tutorial Steph !
    In all deinen Schlachten zu kämpfen und zu siegen ist nicht die größte Leistung.
    Die größte Leistung besteht darin, den Widerstand des Feindes ohne einen Kampf zu brechen.
    (Sun Tsu)

  6. #6
    The Hedge Knight's Avatar Fierce When Cornered
    Artifex

    Join Date
    Oct 2009
    Location
    England
    Posts
    5,875

    Default Re: Use a part of a unit from another faction

    Great tutorial Steph.

    On a note taw made an atlas to tsv converter here which is awesome as it means you can use spreadsheet programs to do the maths for you, its probably much simpler than the atlas editor or pfm once you get used to it.
    http://www.twcenter.net/forums/showthread.php?t=419801

  7. #7
    Steph's Avatar Maréchal de France
    Patrician Artifex

    Join Date
    Apr 2010
    Location
    Pont de l'Arn, France
    Posts
    9,174

    Default Re: Use a part of a unit from another faction

    There is actually no math involved here, you just need to read the values and enter it in the selection tool.

  8. #8

    Default Re: Use a part of a unit from another faction

    Great tutorial!! It helps a lot Thanks=)

  9. #9
    Decanus
    Join Date
    Dec 2011
    Location
    Argentina
    Posts
    589

    Icon9 Re: Use a part of a unit from another faction

    Great Steph, i need your aid. I do not know what am i doing wrong. The game crashes while it is loading a custom battle after having choosen my new unit.
    Here it is, please if you can take a look.
    Thank you in advance Good Steph, i know that you are the one who could help me
    Last edited by lordargento; May 05, 2012 at 05:45 AM.

  10. #10
    Steph's Avatar Maréchal de France
    Patrician Artifex

    Join Date
    Apr 2010
    Location
    Pont de l'Arn, France
    Posts
    9,174

    Default Re: Use a part of a unit from another faction

    I don't see an obvious error.
    What you can try is edit the uniform table to change the uniform of an existing austrian unit, and replace it with the new one (don't change any stat, just the uniform). So if it crashes, you can be sure it comes from the variant, and not from the db.
    Then you try to remove the flagbearer, the drummer, etc
    and check if it sill crash

  11. #11
    Decanus
    Join Date
    Dec 2011
    Location
    Argentina
    Posts
    589

    Icon9 Re: Use a part of a unit from another faction

    I´ve just done what you suggested, and it seems that the problem come from the variant itself, since the game crashes with the unit using my new uniform with the tarleton helmet.
    It´s really sad
    Well, i´ll try to do everything again.
    Thanks Steph, you are always great trying to help me.
    Last edited by lordargento; May 05, 2012 at 03:29 PM.

  12. #12
    Decanus
    Join Date
    Dec 2011
    Location
    Argentina
    Posts
    589

    Icon6 Re: Use a part of a unit from another faction

    Steph, when i save the changes of each of the .dds files in Gimp, each time a save, the following message appears:
    "Gimp message, DDS image: It appears your image may be a volume map, but not all layers are the same size, thus a volume map cannot be witten."
    Although the .DDS files seem to be modifyed correctly (as you have seen in the files i sent you, the tarleton helmet appears correctly over the austrian casquet), is that Gimp message normal or perhaps it is the source of my problem?

  13. #13
    Decanus
    Join Date
    Dec 2011
    Location
    Argentina
    Posts
    589

    Icon10 Re: Use a part of a unit from another faction

    First of all THANKS STEPH!!!
    I FINALLY DID IT!!
    I do not know well how, but finally it´s working!
    The little problem is the following: the chin strap of the tartan helmet appears with a kind of black line under it, visually you see the chin strap not touching directly (as happens for instance with the british horse artillery) the soldiers faces, but instead, this black line is what is touching the soldiers skin, with the chin strap over it. Also the chinstrap seems to be "pasted" to the helmet, looking very unnatural compared to their british counterpart, where the chin strap arise from the helmet itself. Other bad thing is that the tartan helmet seems a bit grey in front (the visor), not completely black as the traditional one found in the british horse artillery for instance. This is caused because a .dds file was not saved correctly (perhaps normal.dds or the gloss.dds, since when i saved those files, the following gimp message appeared: "It appears your image may be a volume map, but not all layers are the same size, thus a volume map cannot be witten." ), or because Gimp is not very good at compressing .dds files?
    Last edited by lordargento; May 06, 2012 at 03:07 AM.

  14. #14
    Decanus
    Join Date
    Dec 2011
    Location
    Argentina
    Posts
    589

    Default Re: Use a part of a unit from another faction

    Double post.

  15. #15
    Decanus
    Join Date
    Dec 2011
    Location
    Argentina
    Posts
    589

    Default Re: Use a part of a unit from another faction

    Here i leave my extra-mini wip mod. If someone would like to help me, please take a look and tell me if you find a solution (or reason) for the visual problems detailed in my previous post.
    Thank you all in advance.

  16. #16
    Steph's Avatar Maréchal de France
    Patrician Artifex

    Join Date
    Apr 2010
    Location
    Pont de l'Arn, France
    Posts
    9,174

    Default Re: Use a part of a unit from another faction

    You should not use gimp to save dds, the compression is not very good. See l'Aigle's tutorial.

  17. #17
    Decanus
    Join Date
    Dec 2011
    Location
    Argentina
    Posts
    589

    Icon7 Re: Use a part of a unit from another faction

    Steph, you are back, it´s good to see you online once again. Thanks for the advice. But did you see my unit, do you think the only reason for those visual problems is Gimp not being effective to compress .dds files??
    I must say i´ve seen l'Aigle's tutorial, but it only brings us little modders info about difusse.dds files. The rest have not been explained yet.
    Thank you once again Grand Steph.

  18. #18
    Steph's Avatar Maréchal de France
    Patrician Artifex

    Join Date
    Apr 2010
    Location
    Pont de l'Arn, France
    Posts
    9,174

    Default Re: Use a part of a unit from another faction

    I can't tell, as I said several times l'Aigle is handling the textures editing. I deal only with the variants and icons, and the db of course.

  19. #19
    Decanus
    Join Date
    Dec 2011
    Location
    Argentina
    Posts
    589

    Icon7 Re: Use a part of a unit from another faction

    Thank you very much Steph, you are always very kind, polite and of course helful.
    Once the system allows me, i´ll give another Rep. Thanks

  20. #20

    Default Re: Use a part of a unit from another faction

    You say "We can now extract britain_diffuse.dds, and open it with gimp." can you explain how you do this please?

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •