1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  3. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  4. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  5. Dismiss Notice
  6. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

Tutorial: Re-texturing 3D Assets

Discussion in 'Civ6 - Modding Tutorials & Reference' started by Deliverator, Sep 10, 2017.

  1. Deliverator

    Deliverator Graphical Hackificator

    Joined:
    Feb 12, 2008
    Messages:
    3,928
    Location:
    London, UK
    (This was originally posted elsewhere by @ChimpanG.)

    RETEXTURING ASSETS (BASIC)

    I'll just cover the basics of retexturing existing assets here. Most people will likely use this process for units, but it's the same process for buildings too. It should be noted that new textures can only be applied to new assets (as far as I'm aware) so this should come after you've created one of those.(edited)

    So let's say you want to retexture one of the existing building assets in game to make it your own. I might as well use the Royal Library as an example. First you locate your asset in the asset previewer. In my case, it was the 'DIS_CTY_PALACE_RNA' asset, that I believe is supposed to be used for Egypt and Nubia (but for some reason isn't). This model will have a material file associated with it, so click on the base geometry set (the one without the PIL or CON suffix) and it'll list the materials associated with that geometry. It should be clear but in the cases it isn't, check the entry in 'worked' state that kinda follows the same naming scheme as the asset as that'll probably the one you're looking for.



    Double click it and it'll open the associated material file in a new tab. It should show you all the texture maps that are associated within that material file. You may want to keep this tab open for reference later on because we're going to create a new material with the same setup. For now though, the texture you want is the one attached to 'BaseColor' so find the DDS for it in your pantry under textures, grab a copy of it and stick it on your desktop to play with (don't move it into your ModBuddy directory or you'll get an error when you create the texture). Might as well rename the DDS file at this point to be honest so give it something unique.



    I have only ever used Photoshop for this so I'll be running through my method for that, but I'm sure it's probably easy enough to translate this process in GIMP. Okay, so open your freshly-named DDS file in photoshop. It'll probably be a weird colour because DDS files are BGR, not RGB (or something like that) so just add an adjustment layer - channel mixer I think it's called - and in the blue channel, set red to +100 and blue to 0, and then in the red channel do the opposite. This should now show you the colours of the texture that you see in game.




    From there you can add a new layer and paint anything you like (or even create a tint map for your model if you wish, but I'll go into that bit after). When you're happy with your changes, just save the dds file and name it something unique. Back inside the Asset Editor you can create a new texture file, so create a new document > texture. Set the Class Name to 'Generic_BaseColor' and ideally name it the same as your dds file. Now import the dds you just made via "Source File Path". Don't worry about changing anything else. The resulting file should look something like this. Save.



    Next, you'll want to create a material that we can attach this texture to. So create a new document > Material. Set the Class Name to 'Landmark' for buildings, 'Unit' for units and so on. Basically whatever asset you're retexturing, use the same class name that its material has set up against it. That material asset we kept open in a tab earlier, here is where we reference it, so just attach the same textures but be sure to set your own texture up against the BaseColor. The result should look something like this. Save.



    Now open your asset (as noted at the beginning of this guide, it should be a new asset, not an existing one from the base game) and replace the base game materials (the ones you double-clicked on earlier) with your new material. Hit save and the asset editor should reload the asset with the new texture. If you get a big red exclamation mark, you've gone wrong somewhere. In my experience, it's likely down to the part where you add textures to the material, so go back and double-check that.



    Assuming it has all gone to plan, you should now have a retextured asset showing up in your preview window. IMPORTANT: Now, there's a chance you'll be retexturing a building asset to replace another's space on the tile, like how I'm replacing the library model with this palace retexture as discussed in the previous guide (pinned) so you'll want to add this new asset to the hero_buildings.xlp as a new building so that you can swap out whatever you've attached (via the attachment points, in my case the original palace model) with your new retextured asset.(edited)

    In the case of retexturing units, the process is largely the same except you don't need to do this last part ^ (because you're not attaching units to a tilebase). However, I will delve into Tint Maps on units a little as a quick addendum to this.

    Basically, that stage where you're painting over stuff in Photoshop. Create a layer and paint 100% white (HEX #FFFFFF) over the parts of the armor you want to be able to recolour with tints inside the asset editor. Before you save the DDS, add a layer underneath the white parts and make it 100% black. This will be your TintMap. (In the screenshot, I've created a TintMap on the Infantry armour texture to use for the Katipunero). Repeat the import process of the texture and when you get to the material stage where you add in all the textures, add your new TintMap texture against TintMask. When you later get to the stage where you're setting up your units.artdefs / unitbins stuff, having this tint map will allow you to create multiple variations of the same asset and have the game deploy them at random.



    Alternatives to Photoshop

    Paint.NET - Save .dds files in format A8B8G8R8 with Fant mipmaps.
    Gimp 2 - Save .dds files uncompressed.
     
  2. Kevin Lopez

    Kevin Lopez Chieftain

    Joined:
    Sep 20, 2017
    Messages:
    6
    Gender:
    Male
    Hey bro, thanks for the tutorial, its great. I have a question, Why does the texture for Gurdwara look so jumbled? it has all of the religious district building all in one image. is it always like this? how can I tell all the buildings apart? Thank You in advance.
     
  3. Kevin Lopez

    Kevin Lopez Chieftain

    Joined:
    Sep 20, 2017
    Messages:
    6
    Gender:
    Male
    everytime I change the gurdwara skin and do everything you did in the tutorial, the model turns all glitchy and stuff, like multiple layers are trying to show at the same time. But when i use the palace you use in the tutorial everything goes smoothly. whats the different between the two buildings?, why would one work and the other not work?
     
  4. Deliverator

    Deliverator Graphical Hackificator

    Joined:
    Feb 12, 2008
    Messages:
    3,928
    Location:
    London, UK
    Textured 3D models use something called a UV map to map the 2D texture to the 3D surfaces of the model. You can see that Gurdwara model (DIS_REL_Gurdwara.fgx) maps to the texture (DIS_REL_Base_B.dds) like this - note only the orange areas on the right of the image are used. The same texture is used for all the different Holy Site buildings. I loaded the model into Blender using CivNexus6 via the .cn6 format.

    gurdwara_uv.png

    @ChimpanG Actually wrote this tutorial. What program are using to save your .dds file? You need to save it uncompressed if using Photoshop or Gimp 2. It may be that your .dds is in the wrong format. Alternatively it may be that you are not specifying all of the required texture types (Base, Normal, AO, Gloss, Metalness) in the Material .mtl file. If you don't do that you get digital noise like these tanks.
     
    Kevin Lopez likes this.
  5. Kevin Lopez

    Kevin Lopez Chieftain

    Joined:
    Sep 20, 2017
    Messages:
    6
    Gender:
    Male

    Thanks man your a life saver. I was editing the textures in paint.net and then transfering them to gimp2 to save as a .dds. I was doing that because my pc is hooked up to a tv, and some programs are displayed very small on the tv(dont really know how to fix it. i'll try to put pictures up). but anyway my problem was 1. editing the textures in the wrong program and 2. in the gurdwara asset file, where the geometries are in, i had added all of the gurdwara geometries (even the ones with pil and con). then as soon as i deleted them and only left the one that doesnt start with pil or con, the problem was fixed. Do i need the pil and con geometries?
     

    Attached Files:

  6. Kevin Lopez

    Kevin Lopez Chieftain

    Joined:
    Sep 20, 2017
    Messages:
    6
    Gender:
    Male
    ok so now that i got the building retextured, how do I add it to my custom civ? I want to make this gurdwara my unique building and i want it to replace the temple. Also when I make a new civ should I start with a blank mod or should I use one of the templates in modbuddy? I want to make a civ with custom UU, and a custom UB, which template is best for this?

    PS. Im sorry for all the questions, especially if they are considered stupid, I have been trying to make a new civ for like 3 weeks now, and everytime I think I'm getting somewhere I seem to hit like 10 roadblocks.. Thanks, much appreciated, even if you answer even 1 of my questions.
     

Share This Page