Results 1 to 14 of 14

Thread: Campaign Strat Map Terrain and 3D Model Textures Performance

  1. #1

    Icon5 Campaign Strat Map Terrain and 3D Model Textures Performance

    Hello,

    @Gigantus - I initially tried PM'ing you this but your inbox was full so I'm posting here in hopes you will see this and reply.

    I have some questions regarding TGA and DDS files used by Medieval 2 for the overall campaign strat map (CSM) and 3D settlement/(trading) resource models. I'll be referencing the DaC sub-mod since that is the project I am editing/creating 3D campaign strat map models for.

    Anyway, I have some questions about the TGA textures and their respective DDS versions. For all the 3D models that I have created for DaC, whether they're towns, castles, or (trading) resources, I have followed the instructions that my acquaintance Inarus (ex 3D strat map modeler for Westoros TW) told me which was to pair each TGA texture file with a DDS version of it since the game's engine would use the DDS version for enhanced performance. By pair, I mean to put the TGA and DDS files together in the same textures folder.

    When creating DDS files from TGA files in GIMP (I installed a DDS plugin in GIMP), I make sure for the compression to choose BC1/DXT1 and for mipmaps to choose 'generate' in order to create mipmaps for the textures. Anyway, yesterday I was in the data/terrain/aerial_map/ground_types folder and in it I saw there were only TGA files and no DDS files. So, I was thinking since these textures are used all throughout the campaign map that I could create the DDS counterparts for all the TGA files which I'm assuming the game's engine would use to help with performance?

    While speaking with Inarus, he told me that perhaps the original TGA file could be replaced with a single-pixel black dot so that the TGA file's size is kept low while the game's engine uses the DDS file to not only display the textures but also allow for the performance enhancement. From what Inarus told me, a TGA file is required or else the game will crash but what I recently learned from him (and request confirmation on) is that even though the game requires a TGA file with the proper name being present, it's the DDS file that is used by the engine if it exists and has the same name as the TGA file. I knew that the DDS file was used by the game's engine to help with performance but I thought the TGA file was also used to display the textures. But, I guess from what he recently told me that the TGA file just needs to exist with the proper name and that the DDS file could be used as the main go-to texture & performance file? Can I get confirmation that this would be possible?

    However, going off of my experience with editing/creating CSM models and assigning textures to them, when I assign the textures in my modelling software (and re-assign in MilkShape) I know that I must specify the specific file that is to be used to display the textures on the model. So, if I were to make a model from scratch using the previously mentioned suggestion, I would have to use the DDS version of the texture file as the primary texture when applying it to the model and only then would I be able to set the TGA file to be a single-pixel black dot but still keep it within the textures folder in order to satisfy the requirement for a TGA file to be present by the game/game's engine. Would this suggestion be correct? If I need to clarify what I just said, feel free to let me know.


    So, to recap the above:

    1. Is it possible to add the DDS versions of the TGA files located in data/terrain/aerial_map/ground_types (and for all the other TGA files in the other folders in the aerial_map folder). If so, would it provide a significant performance boost?

    2. Are the settings I used (and am still using) regarding the creation of DDS files from TGA files correct (specifically regarding the compression being set to BC1/DXT1)?. I've read in other threads that people have used DXT5 but that was for unit models and if I recall correctly from a thread I read back when I first started modelling CSM models it was suggested to use the lower-level DXT option.

    3. Could it be possible to implement the suggestion made by Inarus where the DDS file is essentially used to kill 2 birds with 1 stone because it would provide the textures for the CSM model but also allow for the enhanced performance since it's a DDS file?

    I hope what I'm talking about makes sense, if you need further clarification, feel free to let me know.

    ---

    So, that's my first set of questions, my second is regarding if whether or not there is a general file-size limit for 3D models on the campaign map. Not long ago, I uploaded the (trading) resource model overhaul that I did for DaC (ALBUM LINK) and some members of the DaC testing group are reporting random crashes and one tester is thinking that it could be due to the large number of new 3D models added to the map. While I make sure not to overdue the poly count in the models I work on, I can't help but wonder if there could be some limit, whether hard-coded and intentional or just due to the game's old engine, that could be a factor that I have to consider regarding implementing more 3D models. That said, prior to the addition of the new resource models I also upgraded a bunch of other town and castle models (ALBUM LINK) which would have increased the overall file-size and poly count but as with those I was conservative with the poly count and made sure to remove as many unseen (by the player) polys as possible.

    Side-note:
    Spoiler Alert, click show to read: 

    From what I recall, I've only seen one user report a direct performance issue in regards to my CSM models and I believe that was after the DaC V1.2 release. That user, on ModDB, mentioned that when he would zoom in and out of certain CSM settlements like Edoras that he would experience lag. Unfortunately, that user never replied to my suggestions for possible fixes (one fix was to check if he had the DDS files used by those CSM models) so I don't know if they ever resolved the issue. However, that's one case that was 100% referencing the CSM models I made.


    My overall goal is to update all the CSM models and I already have more models created since the (trading) resource models announcement that I have yet to announce so obviously I want to be aware if there could be a limit or if there could be severe performance drain and I want to combat that as much as possible and help improve the overall performance of DaC.


    To recap the above:

    1. Is there a general file-size or poly count limit (whether hard-coded & intentional or just due to the game's engine's old age) that could be causing DaC's tester's games to crash because there are many new 3D CSM models?

    As said above, feel free to let me know if I need to clarify anything.

    Regards,

    TheEliteDwarf
    Last edited by TheEliteDwarf; March 13, 2017 at 03:45 PM.

    GRAND ARCHITECT OF THE DWARVEN EMPIRE

  2. #2
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,095
    Blog Entries
    35

    Default Re: Campaign Strat Map Terrain and 3D Model Textures Performance

    22.000 PMs just isn't enough storage space

    I am not sure of the performance increase when using DDS, I only use TGA.
    As to the formatting: it's BC3\DTX5
    3D models on the campaign map cause lag - you can experience that when scrolling over large areas of dense forest or mountain peaks. Individual model like for resources should be kept at a reasonable poly count, but I am not sure how many. Best to check a default large city model to get an idea.
    I have been having some unusual lag when scrolling over some map areas and I will have to check if it is just forests or something else.










  3. #3

    Default Re: Campaign Strat Map Terrain and 3D Model Textures Performance

    What is the poly count limit on strat objects? I have a ship I've added that is 453 polys. is that too much?

  4. #4
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,095
    Blog Entries
    35

    Default Re: Campaign Strat Map Terrain and 3D Model Textures Performance

    There isn't a limit as such, it depends how often a model is used. The 3D model for the animated trees is only a few poly in count but spread over large areas it results in serious lag, same with the high mountain peaks.

    A ship with below 1K poly should not add any lag. Unless it's the trade ship, that could create lag at some point.










  5. #5

    Default Re: Campaign Strat Map Terrain and 3D Model Textures Performance

    Thanks. No it is a faction naval ship. I'm more or less dabbling with implementation before diving in.

    The .tga is 4.5mb though, I wonder if that's the issue? Saved it as a .tga.dds as well. no avail. I'm kind of stuck on what could be preventing it from loading.

    Afaik the only two files needed to be altered here are the cas and tga/dds files. however, I grabbed the elfship from tatw and popped it into the game the same way via replacing and... crash. I am missing something. I must be.

  6. #6
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,095
    Blog Entries
    35

    Default Re: Campaign Strat Map Terrain and 3D Model Textures Performance

    Yup, you are missing the text file stuff. The ship model is defined in descr_characters for each faction, from there you can trace it in descr_model_strat or create a new entry. Note: the default texture of the CAS file has to be present in the texture folder, regardless if it is used or not,else you will get the 'out of video memory' error. To find out the name and extension simply open the CAS file with a text editor and check at the end\bottom of the file.

    4.5MB is overkill for a strat model - resize the texture in binary steps, eg to 1024, 512, 256 - whatever the next smaller size is, that will reduce the memory size to a quarter of the original.










  7. #7

    Default Re: Campaign Strat Map Terrain and 3D Model Textures Performance

    I managed to get the info from the .cas file. Put the original named tga file in there as well. I will make a completely new entry to see if it works. I will definitely resize it.
    One ship strat model per faction? or is it a cas model based on what the admiral is in?

    Thanks for the info. Soldiering on but learning this has been a fight. lol

  8. #8
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,095
    Blog Entries
    35

    Default Re: Campaign Strat Map Terrain and 3D Model Textures Performance

    The default is one ship model per faction, but you can use up to ten models using this method. With this method an issue will arise that admirals cannot merge with each other into one fleet (admirals with traits and\or ancillaries).










  9. #9

    Default Re: Campaign Strat Map Terrain and 3D Model Textures Performance

    Omg. Thanks!!

  10. #10
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,095
    Blog Entries
    35

    Default Re: Campaign Strat Map Terrain and 3D Model Textures Performance











  11. #11
    Callistonian's Avatar Ducenarius
    Join Date
    May 2018
    Location
    somewhere in the continental US
    Posts
    944

    Default Re: Campaign Strat Map Terrain and 3D Model Textures Performance

    Quote Originally Posted by Gigantus View Post
    There isn't a limit as such...
    Are you sure about this? I've been getting a crash trying to convert Louis' Samwise Gamgee model to strat and couldn't figure out the cause (other than that it was the strat model in question since that's where the log terminated). I noticed the file size was 404 KB, about twice as large as the next largest file in the models_strat folder. The sword in this particular model is, by itself, about 2,600 verts and 6,000 polys. Removing this piece of geometry reduced the file size to about 250 KB and this, with no other changes, allowed the campaign map to load without crashing.

    This seems to suggest that there's a hard limit either on .cas file size or poly/verts count for strat models. Does anyone have any corroborating evidence for this?

  12. #12
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,095
    Blog Entries
    35

    Default Re: Campaign Strat Map Terrain and 3D Model Textures Performance

    One of those 'famous last words' moments in my life

    Information I have gathered since and others have confirmed is that there is indeed a individual crash limit of vertices. I think makanyane confirmed it a while back.

    Similar is happening to battle models as well but the limit is way higher and the crash usually happens cumulatively, not because of a single instance.

    2600 verts for a sword? Was that supposed to be for a life size replica? Most strat models have less then that for the whole model, some as little as half of that number.
    Last edited by Gigantus; July 25, 2020 at 03:16 AM.










  13. #13
    Callistonian's Avatar Ducenarius
    Join Date
    May 2018
    Location
    somewhere in the continental US
    Posts
    944

    Default Re: Campaign Strat Map Terrain and 3D Model Textures Performance

    I got confirmation from another dev on my mod team that the limit for strat model .cas files is in the ballpark of 300-500 KB which implies to me that there's a poly/verts limit.

    I agree that the detail on the sword is quite excessive. The same model (with the original sword) is also crashing for me on the battle map with no modifications (on my part). Removing the sword allows the game to continue rendering the model for about 30 additional seconds before crashing. I'm about to give up on this whole model.

  14. #14

    Default Re: Campaign Strat Map Terrain and 3D Model Textures Performance

    Quote Originally Posted by Gigantus View Post
    Information I have gathered since and others have confirmed is that there is indeed a individual crash limit of vertices. I think makanyane confirmed it a while back.
    erm, I did? I might have done but my memory is shot

    I know there's a definitely a too large/won't load issue but I don't remember confirming any exact limit and if it was verts/tris/kb/or combination with other models...

    This - was the last conversation I remember having about it in relation to strat map figures.

    I'd still be slightly curious to know if part of the problem is the proximity of vertexes, as that definitely messes up shadows on the static models (screws up whatever their ray-tracing type system is)

    anyway - less is better for all things strat - you're not going to be able to see the detail anyway!

Tags for this Thread

Posting Permissions

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