• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.
Yeah I tried to take all the .py files, put them in a zip file and install them into blender through the option to "install from file" and it showed up in the add on menu, but when I tried to use it I got an error.

But I also mean if I want to like contribute to the project, if I open the sln in Visual Studios, what then?
 
Just to bug you even more, how are animation exports going? I've been using your tools on Maya 2019 without issue and I'd love to be able to export custom anims too!
Also, any updates required for Imperator: Rome? So far it seems to be working pretty well, when exporting I've been selecting Stellaris and manually typing 'standard' when creating the shaders
 
Hey Ross, so I figured out how to install the bugfixes branch add on, but when I export a mesh it's only 50kb, and when I try to import it back in, there's nothing.

Is there a way to get you any useful log files or error messages if/when I find them? How do I export my mesh with the add on? When I select all of my objects the "Set Mesh Order" menu is blank.
 
Hey Ross, so I figured out how to install the bugfixes branch add on, but when I export a mesh it's only 50kb, and when I try to import it back in, there's nothing.

Is there a way to get you any useful log files or error messages if/when I find them? How do I export my mesh with the add on? When I select all of my objects the "Set Mesh Order" menu is blank.

Have you clicked to create a PDX material in the exporter and assigned it to the mesh? It'll only export meshes that have the materials listed in the exporter dialogue box assigned
 
So as promised I made a new release, you can download here: https://github.com/ross-g/io_pdx_mesh/releases/latest
:)

Didn't get around to writing up anything on the Github wiki apart from some basic install instructions. But the post above is correct - only meshes that have a PDX Material on them will be exported... all others are ignored. For animation export you have to select the root bone (or just the armature in Blender) and the current timeline will be exported.
I'll try to write some better instructions during the week and then make a post in the main PDX forum so more people take notice.

@Sid Meier Don't use the bugfixes branch, it's always a work in progress. As for log files, in Blender you need to look in the system console (Window > Toggle System Console)
@rewinged Download the new version and you will be able to export custom animation too. As for Imperator... I don't own it so can't check I'm afraid. I might PM you about testing some files! But yes, basically if stuff imports fine then you should just have to set the shader manually on the material as you already figured out.
@StarryWisdom Thanks for the kind words! That Andromeda ship looks really cool, that's exactly the type of thing that encourages me to spend more time on this.
@1codemaster Thanks for all your help, testing and suggestions over the months. It's made a lot of difference.
 
@ross-g I'd be happy to help. I've managed to get wonders and map objects in-game just fine but I'm struggling with units, I think the rig keeps breaking somehow but it could be my own fault. I'll keep testing it out. There are a whole bunch of new shaders for Imperator Rome though, here's the list:

collision
standard - as the name implies
standard_usercolor - Uses masks to show primary and secondary coloring depending on your nation
standard_flag - Tabard shader like in earlier games, uses nation flag and secondary UV.
standard_animate_uv
standard_alpha_blend
standard_alpha_to_coverage
standard_snow material_test
decal_world
portrait_skin
portrait_skin_face
portrait_attachment
portrait_attachment_alpha_blend
portrait_attachment_alpha_to_coverage
portrait_eye
portrait_hair
portrait_hair_backside
portrait_hair_opaque
lake
tree
tree_alpha_to_coverage
tree_cluster_alpha_to_coverage
gui_banner_color
gui_banner_flag


The tool automatically ocmbines all meshes on export right? I've been chatting to Carlburg, one of the 3D artists over at the discord about it. Also is there an easy way to tell what order the objects will be in after combining? The official exporter lets you print out the gfx file with the order index done already. The game also allows LODs by using Maya's built-in LOD system that groups them and sets them up, I haven't tested but does it export any of that information?
 
I'm currently not able to export anything that is skinned for some reason. I've made a custom unit for Imperator which exports fine as a static mesh, but when I bind it to the skeleton used by other units it seems to break on export. There's no errors or anything during the export but in-game the mesh explodes over the entire screen and if I import it back into Maya I get different error codes each time.

I'm guessing it's not particularly an issue with using the tool for Imperator, but must be some kind of bug with exporting skinned meshes in Maya. I've attached my .ma file if you don't mind taking a look @ross-g

Don't mind the crappy skinning job. I've reskinned that mesh over and over so by the end I've just been doing a quick bind skin to do tests
 

Attachments

  • RiggingTest3.zip
    567,9 KB · Views: 18
The tool automatically ocmbines all meshes on export right?
Actually kinda the opposite, but it's pretty complicated... Essentially the tool exports meshes as a top level node with each split of the mesh being exported as a separate entity underneath that mesh node. Any time you have a material, UV or normal border in a mesh you are actually creating a split and more vertices/triangles are written into the file than you originally created.
This is pretty standard for all game engines.
eg
you have a single quad -> exports as two joined triangles
you have two joined triangles (4 verts) with different materials -> exports as two separate triangles (6 verts)
you have two joined triangles (4 verts) with same materials but split UVs -> exports as two separate triangles (6 verts)

As for LODs I am not sure, it depends how they are stored in the file and read by the game. I don't have access to any Imperator files to check and as far as I can tell none of their other games use LODs at all.

I've been chatting to Carlburg, one of the 3D artists over at the discord about it.
I'd be interested to read that if you have a link? :)


I've had a quick look at your skinned mesh - unfortunately just the Maya file isn't going to show me much, but I did notice that you have your skin max influences set to 5. It needs to be 4 or less for Clausewitz (and basically all other game engines). The exporter is definitely designed to only export up to 4 infs, so I will put an error check in there to catch this in future.
 
Last edited:
Actually kinda the opposite, but it's pretty complicated... Essentially the tool exports meshes as a top level node with each split of the mesh being exported as a separate entity underneath that mesh node. Any time you have a material, UV or normal border in a mesh you are actually creating a split and more vertices/triangles are written into the file than you originally created.
This is pretty standard for all game engines.
eg
you have a single quad -> exports as two joined triangles
you have two joined triangles (4 verts) with different materials -> exports as two separate triangles (6 verts)
you have two joined triangles (4 verts) with same materials but split UVs -> exports as two separate triangles (6 verts)

As for LODs I am not sure, it depends how they are stored in the file and read by the game. I don't have access to any Imperator files to check and as far as I can tell none of their other games use LODs at all.


I'd be interested to read that if you have a link? :)


I've had a quick look at your skinned mesh - unfortunately just the Maya file isn't going to show me much, but I did notice that you have your skin max influences set to 5. It needs to be 4 or less for Clausewitz (and basically all other game engines). The exporter is definitely designed to only export up to 4 infs, so I will put an error check in there to catch this in future.

Here's a link to the discord https://discord.gg/3bZSqP
It's for Imperator but I'm sure you'd be more than welcome and may get some good information from Carlburg and others.

As for the LODs, Carlburg said they've supported them the past couple games but never really used them. I could send you one of the .mesh files from Imperator if you like, maybe one with lods so you can take a look at how it's referenced in the code or whatever (I have no idea about that stuff clearly :p )

And the 4 influence thing, I have no idea why it was set to 5 but I actually changed it right after I posted and it works fine now (apart from weapons and helmets not attaching to the rig for whatever reason) as usual, I spend countless hours trying to figure something out and find the answer right after I finally ask for help lol...
 
Any luck on writing up the Blender guide for the Paradox mesh plugin?

Edit to add: I tried to add materials, I have several meshes, and it just assigns the same material to every mesh.

Edit: Ah, I had to swap my materials assigned *to my meshes* with the created Pdox meshes.

Testing now...

Edit Again: Are the created paradox materials in the plug in "real" or can I duplicate my nodes from my original materials so I can still see my mesh?

Report: Hrm, my textures are all distorted/upside down and stretched using the plug in. Hrm.

Report 2: Partly fixed the issue, turns out was still using old animation reference; but submesh corresponding to the PdxPortraitMesh (aka the base body) is missing? And some parts of the animation are very distorted just not as bad as before.

-Is there a specific set of steps for exporting an animation? Any prep?
-What do I "name" the meshes in the .gfx file/meshsettings block?

Report 3: When I export my mesh using the plugin, and then re-import it back in, it is just degenerated to two meshes; armature seems fine though.

Report 4: When I try to import an armature I get this error:
AttributeError: 'tuple' object has no attribute 'data'

Report 5: I can import the mesh and armature and animations *separately* but not together. Jorodox doesn't seem to "see" any issues with anything so all of this is very vexing.
 
Last edited:

Thanks! I will try again with this to see if I can solve my issues.

For animation states, is there a way to trigger an animation state on a certain in-game trigger, like opening the diplomacy window (for Stellaris)? Or for Relations low/high?
 
I will try again with this to see if I can solve my issues.
Could you detail what your issues were? You're last post was edited so often it's a little confusing to read and figure out what problem you had.

But I'll try to briefly answer some of the questions:
Materials - Yes you have to create PDX materials, these exist in the Blender scene and you must assign them to meshes. Only meshes with PDX materials will be exported, other meshes are ignored. Once you create the materials you can assign textures etc to them as usual, they are no different to standard Blender materials... just with some extra data to link to PDX shaders.
Animation - As long as the timeline is set to the right start and end points, just select the armature that your mesh is skinned to and export animation.
Skinning - You MUST only have 4 bone influences per vertex for the mesh to skin properly. Otherwise you will get all sorts of animation problems and mesh tearing etc. There is a function in Blender to ensure this requirement (Limit Total in Weight Paint mode).
Importing - If you export your Blender scene and then try to re-import it from .mesh then it will NOT look the same. There will probably be more meshes when you re-import because exporting splits the mesh into individual materials. There may be other splits within the meshes themselves depending on how your UVs and normals are setup.


Try to follow the guide that 1codemaster has written, it's pretty good. If you have errors when trying to import a file, then upload that file here and I will take a look for you.
Good luck! :)
 
Could you detail what your issues were? You're last post was edited so often it's a little confusing to read and figure out what problem you had.

But I'll try to briefly answer some of the questions:
Materials - Yes you have to create PDX materials, these exist in the Blender scene and you must assign them to meshes. Only meshes with PDX materials will be exported, other meshes are ignored. Once you create the materials you can assign textures etc to them as usual, they are no different to standard Blender materials... just with some extra data to link to PDX shaders.
Animation - As long as the timeline is set to the right start and end points, just select the armature that your mesh is skinned to and export animation.
Skinning - You MUST only have 4 bone influences per vertex for the mesh to skin properly. Otherwise you will get all sorts of animation problems and mesh tearing etc. There is a function in Blender to ensure this requirement (Limit Total in Weight Paint mode).
Importing - If you export your Blender scene and then try to re-import it from .mesh then it will NOT look the same. There will probably be more meshes when you re-import because exporting splits the mesh into individual materials. There may be other splits within the meshes themselves depending on how your UVs and normals are setup.


Try to follow the guide that 1codemaster has written, it's pretty good. If you have errors when trying to import a file, then upload that file here and I will take a look for you.
Good luck! :)


I redid the steps and gave it another go and here is a screenshot so you can see my current issue (click to enlarge):


The four on the left are my control groups using the Collada export method that experience tearing.

The 5th one, the far right I used your exporter and for some strange reason only the front and back hair meshes are showing; the rest appear to be invisible? There's no errors in the error log. There is a little bit of distortion that might be because of weights needing to be renormalized but the animation looks perfectly fine in Blender.

In the screenshot is how the setup looks when I click on the exported .mesh file in Jorodox; everything looks fine. I am deeply perplexed.

I checked the following:
-The working hair mesh and the not working other meshes all have the same normals.
-They are all facing the same direction.
-All the meshes have the pdox materials assigned. I'm not sure if you mean some special other step but I just replaced my original cycles material with the created pdox one, but only hair shows up...

My .gfx entry:
Code:
    #### Mesh 5
    pdxmesh = {
        name = "homunculus_portrait_05"
        file = "gfx/models/portraits/homunculus/homunculus_portrait_05.mesh"
        animation = { id = "idle"    type = "homunculus_portrait_05_bored_animation" }
        animation = { id = "bow"    type = "homunculus_portrait_05_bow_animation" }
        scale = 1.0
 
      meshsettings = {
          index = 0
          texture_diffuse = "Hair3.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortraitHair
      }
 
      meshsettings = {
          index = 1
          texture_diffuse = "Homunculus.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortrait
      }
 
      meshsettings = {
          index = 2
          texture_diffuse = "Clothes4_Headgear4.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortraitClothes
      }
 
      meshsettings = {
          index = 3
          texture_diffuse = "Clothes4_Headgear4.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortraitClothes
      }
 
      meshsettings = {
          index = 4
          texture_diffuse = "Homunculus.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortrait
      }
 
      meshsettings = {
          index = 5
          texture_diffuse = "Clothes4_Headgear4.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortraitClothes
      }
 
      meshsettings = {
          index = 6
          texture_diffuse = "Homunculus.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortrait
      }
 
      meshsettings = {
          index = 7
          texture_diffuse = "Homunculus.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortrait
      }
 
      meshsettings = {
          index = 8
          texture_diffuse = "Homunculus.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortrait
      }
 
      meshsettings = {
          index = 9
          texture_diffuse = "Clothes4_Headgear4.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortraitClothes
      }
 
      meshsettings = {
          index = 10
          texture_diffuse = "Clothes4_Headgear4.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortraitClothes
      }
 
      meshsettings = {
          index = 11
          texture_diffuse = "Homunculus.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortrait
      }
 
      meshsettings = {
          index = 12
          texture_diffuse = "Homunculus.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortrait
      }
 
      meshsettings = {
          index = 13
          texture_diffuse = "Clothes4_Headgear4.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortraitClothes
      }
 
      meshsettings = {
          index = 14
          texture_diffuse = "Hair3.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortraitHair
      }
 
      meshsettings = {
          index = 15
          texture_diffuse = "Clothes4_Headgear4.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortraitClothes
      }

    }

I removed the name=jorodox bits since this was original jorodox code. What else can I attempt?

Edit to add/clarify: No errors in the log also means those textures I selected definitely exist. And the control groups showing up fine shows they aren't empty texture files.


I added another image to show the counts.


Edit: I have NAILED down what I think the problem IS at least. Every mesh seems to once exported, behaves as though there is only the Hair material applied, or the Hair texture; the .gfx file should be correct though, but I know for a fact that at least one other mesh is in there because when I click through the different hair styles I see "extra" hair pop up in a strange place that matches what I do in blender if I swap all of their materials. I will try playing with the "assign material" button and see if that fixes it but after that I will remain befuddled.
Edit: Going through each mesh and making sure the materials were assigned resulted in no change, but at least I guess we know what the problem is.

-Either that materials aren't assigned right (i.e they all have the exact same material assigned), or, they all have the same texture assigned. I will do a quick experiment that probably won't be conclusive.

Edit: I have NARROWED it down even FURTHER! The game is afoot!

I believe the problem is that the Blender .Mesh export is only exporting a SINGLE mesh. Essentially only the Mesh Settings with Index 0 in my .gfx currently does anything.

1 through 16 appear to do nothing (changing them has seen no change) which implies the problem is that the exporter does not export multiple meshes to a single file properly or I did something very wrong. Which is extraordinarily weird because Jorodox sees all my meshes just fine as you can see in the above screenshot.

Any suggestions?

Screenshot:

Hard to see since you can't see movement but this more or less proves the issue is something like I described, there appears to only be one mesh, but all the submeshes are clearly there.
 
Last edited:
One step forward two steps back.

I've managed to mostly fix the issue. I've managed to get almost every mesh to appear. The problem appeared to be that the individual mesh settings blocks all needed the internal name of the mesh, thank you 1codemaster for your guide for hinting this to me.

But now the "body" mesh with the skin, is the only one that still refuses to appear.



Code:
    #### Mesh 5
    pdxmesh = {
        name = "homunculus_portrait_05"
        file = "gfx/models/portraits/homunculus/homunculus_portrait_05.mesh"
        animation = { id = "idle"    type = "homunculus_portrait_05_bored_animation" }
        animation = { id = "bow"    type = "homunculus_portrait_05_bow_animation" }
        scale = 1.0
  
      meshsettings = {
          name = "a_HairBackTest"
          index = 0
          texture_diffuse = "Hair3.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortraitHair
      }
 
      meshsettings = {
          name = "c_BodyArm.L"
          index = 1
          texture_diffuse = "Homunculus.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortrait
      }
 
      meshsettings = {
          name = "c_ClothesArm.L"
          index = 2
          texture_diffuse = "Clothes4_Headgear4.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortraitClothes
      }
 
      meshsettings = {
          name = "l_BodyClothesBack"
          index = 3
          texture_diffuse = "Clothes4_Headgear4.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortraitClothes
      }
 
      meshsettings = {
          name = "n_Body_Body"
          index = 4
          texture_diffuse = "Homunculus.dds"
          texture_normal = "nonormal.dds"
          texture_specular = "nospec.dds"
          shader = PdxMeshPortrait
      }
 
      meshsettings = {
          name = "o_BodyClothesNeck"
          index = 5
          texture_diffuse = "Clothes4_Headgear4.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortraitClothes
      }
 
      meshsettings = {
          name = "o_EyesBack"
          index = 6
          texture_diffuse = "Homunculus.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortrait
      }
 
      meshsettings = {
          name = "p_Eyes"
          index = 7
          texture_diffuse = "Homunculus.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortrait
      }
 
      meshsettings = {
          name = "s_Boobs"
          index = 8
          texture_diffuse = "Homunculus.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortrait
      }
 
      meshsettings = {
          name = "y_ClothesBodyBase"
          index = 9
          texture_diffuse = "Clothes4_Headgear4.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortraitClothes
      }
 
      meshsettings = {
          name = "y_ClothesBoobs"
          index = 10
          texture_diffuse = "Clothes4_Headgear4.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortraitClothes
      }
 
      meshsettings = {
          name = "y_ClothesBoobs.001"
          index = 11
          texture_diffuse = "Clothes4_Headgear4.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortraitClothes
      }
 
      meshsettings = {
          name = "y_dBodyFace"
          index = 12
          texture_diffuse = "Homunculus.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortrait
      }
 
      meshsettings = {
          name = "z_BodyArm.L"
          index = 13
          texture_diffuse = "Homunculus.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortrait
      }
 
      meshsettings = {
          name = "z_ClothesArm.L"
          index = 14
          texture_diffuse = "Clothes4_Headgear4.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortraitClothes
      }
 
      meshsettings = {
          name = "z_HairFront"
          index = 15
          texture_diffuse = "Hair3.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortraitHair
      }
 
      meshsettings = {
          name = "z_HeadGear"
          index = 16
          texture_diffuse = "Clothes4_Headgear4.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
          shader = PdxMeshPortraitClothes
      }

    }

All the ones with "texture_diffuse = "Homunculus.dds"" and "shader = PdxMeshPortrait" are the ones that don't work.

Code:
    homunculus5 = { entity = "homunculus_portrait_05_entity" clothes_selector = "homunculus_clothes_1"
        hair_selector = "homunculus_hair_1" greeting_sound = "robot_human_greetings"
        character_textures = {
            "gfx/models/portraits/homunculus/Homunculus.dds"
            "gfx/models/portraits/homunculus/Homunculus_02.dds"
        }
    }

My portraits.txt file. My next step is to remove the skin mesh selector.

Summary:
The PdxMeshPortrait shader seems to not work with the meshes exported with the Blender exporter plugin.

Edit: Good news is I fixed the animations by renormalizing all my weights on each mesh; now if only I could figure out why the PdxMeshPortrait meshes aren't appearing.
Edit 2:

Okay, I have I think confirmed the issue is with selecting PdxMeshPortrait in the plugin, because when I change it to a different shader, (such as clothes since that is the only one where the UV's work) then it appears, example: Face mesh now shows up using the Cloth shader:


Edit: Changing it to the alphablender shader, or the advancedmesh shader, neither of these appear to have worked.
 
Last edited:
I can't check in detail (away from PC) but it looks like you have broken the render order of your meshes.

My advice:
- seems like you have 17 meshes? Way too much... Simplify this, you only need a new mesh if you're changing material or want to specify render order.
- regardless of how you positioned the meshes in 3D the render order is determined by the mesh index. There is a button on the tool panel to edit that. (I think mesh index in the .gfx is just a reference, not setting it)

Upload a blend file if you want more answers.