Results 1 to 16 of 16

Thread: Help with unit texture - It's all black

  1. #1

    Default Help with unit texture - It's all black

    Hello.

    I'm playing around with the two available Game of Thrones mods (GoT Enhanced and Fire and Blood), and since both are incomplete, I'm trying to import the best things one has to offer into the other. For the most part, Fire and Blood has more features and is closer to being complete, but it lacks the very necessary custom battle models for the main characters, so I'm trying to import the battle models from GoT, and so far have failed bitterly.

    May someone help me? I'm sure this is easy for the more experienced modders.

    It's the first time I use the battle_models.modeldb file for anything, and it seems a bit complicated. So while at it, I've looked out for the entry that corresponds to a model that is unused in the game, and I deleted the mesh and texture files that it points to and replaced them with files of the same name but which contained the data for a Daenerys Targaryen battle model. I expected this to give me a perfectly functional Daenerys model to use in battle, but it turns out the model is broken. It has the correct shape and clothes, and the hair tips, but the head, shoulders, legs, and sword are completely black like shadows. In the GoT original the same model loads perfectly fine, in full colors, so I know the model is good.

    Hope I've made myself clear. So my questions are, what causes a battle model to become all black when it loads? What can I possible have done wrong? If any more information is needed to give an answer, please let me know. I'm a complete noob when it comes to modelling.
    Last edited by es157; April 16, 2021 at 03:51 PM.

  2. #2

    Default Re: Help with unit texture - It's all black

    The correct process for doing this is to find the bmdb (battle_models.modeldb) entry name in the "from" mod's descr_strat or campaign_script (depending on whether the character starts on the map or is spawned), search this entry in the "from" mod's bmdb file, and then find all the referenced models, textures, and sprites. You can actually copy over the entire bmdb entry and delete the old one and old assets in the "to" mod. This requires that you to know how to read bmdb.

    Spoiler Alert, click show to read: 




    My guess as to why the model is completely black is that it's using the wrong textures. The game is finding assets with the names specified in bmdb (otherwise it would CTD from the battle map), and these textures are set up for the correct faction (or the model would be a silver surfer), but the textures are incorrect for the model.

  3. #3

    Default Re: Help with unit texture - It's all black

    Sorry, I fear I don't understand fully well what you said.

    You are definitely correct about one thing. I did get a silver surfer model in my first attempt, but I managed to turn it into a half-complete model in which the clothes and part of the hair are in the right colors, but the head, sword, and a few other parts are black. Can you please clearify what I'm missing in both cases? This whole exchange seems simple on the surface, so I assume I'm failing on a simple step.

    Could it be that my problem lies in the "attachments" part? What do these attachments actually represent in the model?
    Last edited by es157; April 16, 2021 at 06:46 PM.

  4. #4
    Araval's Avatar Primicerius
    Join Date
    Nov 2010
    Location
    Tartu, Estonia
    Posts
    3,976

    Default Re: Help with unit texture - It's all black

    Are you sure one of the textures you copied is right? It seems that one texture is not right or the modeldb entry is pointing to the wrong one.

    "Attachment" texture is just a name that one of the two textures that a model can use is referred to. I does not have to matter what's actually on it. Things that are added to the body, such as weapons, bags etc. are usually referred to as attachments. Attachment textures are thus more likely to be shared by different units.

  5. #5

    Default Re: Help with unit texture - It's all black

    Very strange. I'm sure I copied the entire entry exactly the way it was written in the original mod. In such case, I don't see what could be wrong.

    I'll have to do some more tests and see if I learn something new.

  6. #6
    Vladyvid's Avatar Wizard of Turmish
    Artifex

    Join Date
    Aug 2011
    Location
    Athkatla
    Posts
    1,873

    Default Re: Help with unit texture - It's all black

    Wrong texture path is one explanation, another possible reason for that could be wrong texture size. Both textures (model and att.) have to be the same size. In this case i suspect it was a mistake in coding the textures in bmdb, that happens all the time.

  7. #7

    Default Re: Help with unit texture - It's all black

    Quote Originally Posted by Vladyvid View Post
    Wrong texture path is one explanation, another possible reason for that could be wrong texture size. Both textures (model and att.) have to be the same size. In this case i suspect it was a mistake in coding the textures in bmdb, that happens all the time.
    But could that happen in case I just copied the whole entry from one game and pasted it into another? I'm also pretty sure I copied all the texture files.

    Edit: I have reworked my methods to try to make the textures work, and now the result is a silver surfer guy whose shape is absolutely not the shape of the Daenerys model. It is a random guy with a spiky helmet and holding an axe. I have no idea how the game found this specific shape for the general.

    Could someone tell me if there is something missing in my bmdb entry?

    8 Daenerys
    1 1
    64 unit_models/_Generals_and_Captains/Personaggi/Daenerys_lod0.mesh 10000
    3
    9 byzantium
    71 unit_models/_Generals_and_Captains/Personaggi/textures/Daenerys.texture
    78 unit_models/_Generals_and_Captains/Personaggi/textures/Daenerys_normal.texture 0
    4 merc
    71 unit_models/_Generals_and_Captains/Personaggi/textures/Daenerys.texture
    78 unit_models/_Generals_and_Captains/Personaggi/textures/Daenerys_normal.texture 0
    5 slave
    71 unit_models/_Generals_and_Captains/Personaggi/textures/Daenerys.texture
    78 unit_models/_Generals_and_Captains/Personaggi/textures/Daenerys_normal.texture 0
    3
    9 byzantium
    64 unit_models/AttachmentSets/final heater special_generico.texture
    69 unit_models/AttachmentSets/final heater special_generico_norm.texture 0
    4 merc
    64 unit_models/AttachmentSets/final heater special_generico.texture
    69 unit_models/AttachmentSets/final heater special_generico_norm.texture 0
    5 slave
    64 unit_models/AttachmentSets/final heater special_generico.texture
    69 unit_models/AttachmentSets/final heater special_generico_norm.texture 0
    4
    4 None
    15 MTW2_Non_Shield 0
    1
    18 MTW2_Sword_Primary
    0
    5 horse
    18 MTW2_HR_Non_Shield 0
    1
    18 MTW2_Sword_Primary
    0
    8 elephant
    18 MTW2_Elephant_Crew 0
    1
    18 MTW2_Sword_Primary
    0
    5 camel
    18 MTW2_HR_Non_Shield 0
    1
    18 MTW2_Sword_Primary
    0
    16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002


    As a matter of fact, I have made sure to include the relevant files (all the files indictated in the Personaggi folder) in my mod. So I'd assume the game would use these files to create my general model, yet it doesn't. The resulting general is a completely different guy with no colors, just a ghostly silver texture.

    In my previous attempt in which I said the general had shadow black body parts, I had used a different method. I had used a pre-existing entry in the bmdb file that was meant for Areo Hotah, a general who does not appear in any campaign, and simply replaced his texture and battle model with the ones for Daenerys. The result was a Daenerys with a black head and black shoulders and legs.
    Last edited by es157; April 19, 2021 at 07:24 AM.

  8. #8
    Vladyvid's Avatar Wizard of Turmish
    Artifex

    Join Date
    Aug 2011
    Location
    Athkatla
    Posts
    1,873

    Default Re: Help with unit texture - It's all black

    Quote Originally Posted by es157
    But could that happen in case I just copied the whole entry from one game and pasted it into another? I'm also pretty sure I copied all the texture files.
    Well, apparently yes, people make mistakes all the time. I mean if you made no mistake, there would be no topic. There must have been a mistake, either in code, or in files location. You should check the textures location with bmdb and see if everything corresponds correctly. Then there is also one more thing - if you renamed any of the texture files or not.

    When you said:
    You are definitely correct about one thing. I did get a silver surfer model in my first attempt, but I managed to turn it into a half-complete model in which the clothes and part of the hair are in the right colors, but the head, sword, and a few other parts are black. Can you please clearify what I'm missing in both cases? This whole exchange seems simple on the surface, so I assume I'm failing on a simple step.
    You said you had a silver surfer problem but managed to get to the current stage. For me that means wrong coding of the texture files. I suspect maybe you coded the same textures for both model and attatchment. Theres definately an attatchment texture mistake. Either coded a wrong texture in bmdb or the code is good but the texture file is wrong one (maybe renamed from something else).

    Simple solution i would suggest is to check the bmdb texture locations, and then check if those are the correct textures (and not renamed).

  9. #9

    Default Re: Help with unit texture - It's all black

    Quote Originally Posted by Vladyvid View Post
    Simple solution i would suggest is to check the bmdb texture locations, and then check if those are the correct textures (and not renamed).
    I'll give it another try. But if you don't mind me asking, do you see anything wrong in the code I shared above? Maybe it's something obvious in the eye of someone who has worked with this file before.

  10. #10
    Vladyvid's Avatar Wizard of Turmish
    Artifex

    Join Date
    Aug 2011
    Location
    Athkatla
    Posts
    1,873

    Default Re: Help with unit texture - It's all black

    8 Daenerys
    1 1
    64 unit_models/_Generals_and_Captains/Personaggi/Daenerys_lod0.mesh 10000
    3
    9 byzantium
    71 unit_models/_Generals_and_Captains/Personaggi/textures/Daenerys.texture
    78 unit_models/_Generals_and_Captains/Personaggi/textures/Daenerys_normal.texture 0
    4 merc
    71 unit_models/_Generals_and_Captains/Personaggi/textures/Daenerys.texture
    78 unit_models/_Generals_and_Captains/Personaggi/textures/Daenerys_normal.texture 0
    5 slave
    71 unit_models/_Generals_and_Captains/Personaggi/textures/Daenerys.texture
    78 unit_models/_Generals_and_Captains/Personaggi/textures/Daenerys_normal.texture 0
    3
    9 byzantium
    64 unit_models/AttachmentSets/final heater special_generico.texture
    69 unit_models/AttachmentSets/final heater special_generico_norm.texture 0
    4 merc
    64 unit_models/AttachmentSets/final heater special_generico.texture
    69 unit_models/AttachmentSets/final heater special_generico_norm.texture 0
    5 slave
    64 unit_models/AttachmentSets/final heater special_generico.texture
    69 unit_models/AttachmentSets/final heater special_generico_norm.texture 0
    4
    4 None
    15 MTW2_Non_Shield 0
    1
    18 MTW2_Sword_Primary
    0
    5 horse
    18 MTW2_HR_Non_Shield 0
    1
    18 MTW2_Sword_Primary
    0
    8 elephant
    18 MTW2_Elephant_Crew 0
    1
    18 MTW2_Sword_Primary
    0
    5 camel
    18 MTW2_HR_Non_Shield 0
    1
    18 MTW2_Sword_Primary
    0
    16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
    I will comment on the textures and model code, because im not really an animator so i cant comment on the anims.

    Basicly this code looks ok in terms of textures and the mesh. So this would indicate there is a problem with the relevant files.

    It's the first time I use the battle_models.modeldb file for anything, and it seems a bit complicated. So while at it, I've looked out for the entry that corresponds to a model that is unused in the game, and I deleted the mesh and texture files that it points to and replaced them with files of the same name but which contained the data for a Daenerys Targaryen battle model.
    What was deleted from bmdb?

    Edit: I have reworked my methods to try to make the textures work, and now the result is a silver surfer guy whose shape is absolutely not the shape of the Daenerys model. It is a random guy with a spiky helmet and holding an axe. I have no idea how the game found this specific shape for the general.
    If its a different shape then its using a different mesh. Maybe you renamed some meshes and now youre mixed up?

    Anyway, there were some mistakes along the way and im not sure if you can track them back. So one way around this would be do it again step by step:

    1. copy all the textures and mesh files from the source mode to your target mod, dont rename anything.
    2. copy the bmdb entry for daenerys to your target mod bmdb (i think this step was ok).
    3. check if the entry for Daenerys model corresponds with the correct entry in the descr_characters.txt

  11. #11

    Default Re: Help with unit texture - It's all black

    Quote Originally Posted by Vladyvid View Post
    3. check if the entry for Daenerys model corresponds with the correct entry in the descr_characters.txt
    *Red flag raised*

    I didn't change anything in descr_character to begin with. I never touched that file. What does that tell you?

    Taking a quick look at the file, I noticed that the relevant faction (Byzantium aka House Targaryen) has eleven different strat models for generals. Each of them are associated with a "level", which I don't know the meaning of.

    Here it is:

    faction byzantium
    dictionary 15
    strat_model targaryen_general ;faction general (level 0)
    strat_model kingsguard_member ;kingsguard member (level 1)
    strat_model kingsguard_commander ;commander of the Kingsguard (level 2)
    strat_model celtigar_general ;celtigar (level 3)
    strat_model velaryon_general ;velaryon (level 4)
    strat_model rosby_general ;rosby (level 5)
    strat_model stokeworth_general ;stokeworth (level 6)
    strat_model darklyn_general ;darklyn (level 7)
    strat_model hayford_general ;hayford (level 8)
    strat_model buckwell_general ;buckwell (level 9)
    strat_model dothraki_general ;dothraki bloodrider (level 10)
    battle_model targaryen_general
    battle_equip gladius, chainmail shirt helmet and rectangular shield

    As you see, there is only one battle model, the "targaryen_general" one.
    How does the game decide which general gets which model? What does this "level" thing stand for? I always believed that only through the custom_models line one could change the battle model of a given general, and that all the others would look the same. I found it's very hard to find information about Medieval II. Every search I make leads me to Rome I instead.

    Sorry if I'm asking too many questions.
    Last edited by es157; April 20, 2021 at 06:31 AM.

  12. #12
    Vladyvid's Avatar Wizard of Turmish
    Artifex

    Join Date
    Aug 2011
    Location
    Athkatla
    Posts
    1,873

    Default Re: Help with unit texture - It's all black

    Look the problem is im not really familiar with those mods you are working on. I dont know exactly how is that Daenerys model used in your source mod. You should check all that first. Check all the code (text) files that contain the word "Daenerys" and check for those with battle model association.

    About those levels, those are strat generals and i havent really dont much modding of that so i cant tell you much. Thats not really relevant to your problem with daenerys because they are not battle models.

    Also it could be helpful to see a screenshot or two of whats the problem.

  13. #13

    Default Re: Help with unit texture - It's all black

    OK, see if this helps clearify things.

    This is how the general looks like after I copy the "Daenerys" entire entry from the source battle_models.mdb and paste it without edits at the bottom end of the same file in the target mod. A silver surfer as I said before...

    https://i.imgur.com/qs72GA0.png

    I'm under the impression that battle_models.mdb is very sensitive to small mistakes and that one such small mistake is preventing the entire entry from being read correctly. Otherwise I don't see why the battle model would be blank and completely ignore the files it is supposed to be reading.

    I've done the file search in the source mod and found the name "Daenerys" is used for the model names "daenerys_lod0.mesh", "daenerys_normal.texture", and "daenerys.texture", for the battle_model.mdb entries, and as the standard general model name for sicily in descr_character. Other than those uses, I don't think there is any other that is relevant.

    Is there a chance that the error log may show something? I've tried to find some tutorial of how to use my log, but there is close to nothing even in the forums.
    Last edited by es157; April 21, 2021 at 09:35 AM.

  14. #14
    Vladyvid's Avatar Wizard of Turmish
    Artifex

    Join Date
    Aug 2011
    Location
    Athkatla
    Posts
    1,873

    Default Re: Help with unit texture - It's all black

    I'm under the impression that battle_models.mdb is very sensitive to small mistakes and that one such small mistake is preventing the entire entry from being read correctly. Otherwise I don't see why the battle model would be blank and completely ignore the files it is supposed to be reading.
    Yes its very sensitive, so much so that any mistake in the code would result that you wouldnt be able to load the battle, or the game even.

    I've done the file search in the source mod and found the name "Daenerys" is used for the model names "daenerys_lod0.mesh", "daenerys_normal.texture", and "daenerys.texture", for the battle_model.mdb entries, and as the standard general model name for sicily in descr_character. Other than those uses, I don't think there is any other that is relevant.
    Ok so i think there is the solution. You should copy the code for standard general to your target descr_characters for the battle model entry. The .mesh and .texture entries must be those for Daenerys model.

    Is there a chance that the error log may show something? I've tried to find some tutorial of how to use my log, but there is close to nothing even in the forums.
    The error log will probably say that there is no texture in the specified location or something like that, because its not coded correctly.

  15. #15

    Default Re: Help with unit texture - It's all black

    Quote Originally Posted by Vladyvid View Post
    Yes its very sensitive, so much so that any mistake in the code would result that you wouldnt be able to load the battle, or the game even.


    Ok so i think there is the solution. You should copy the code for standard general to your target descr_characters for the battle model entry. The .mesh and .texture entries must be those for Daenerys model.


    The error log will probably say that there is no texture in the specified location or something like that, because its not coded correctly.
    Oh thank you very much for the chat. I think I managed to get it to work.

  16. #16
    Vladyvid's Avatar Wizard of Turmish
    Artifex

    Join Date
    Aug 2011
    Location
    Athkatla
    Posts
    1,873

    Default Re: Help with unit texture - It's all black

    Youre welcome, good luck with your modding.

Posting Permissions

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