• 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.
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.

I'm at work, and I'd prefer to send you my blend via privately, if you have a discord ID or an email I can email you my blend file I can do that when I get home.

I also can't really simplify my mesh further. For example the left arm needs to be behind the body which means the left arm clothes mesh needs to be in front of the arm but behind the body etc; I can confirm that every mesh is there for a specific z-ordering purpose and that I don't just have extra meshes for the same of having extra meshes.

Also I fairly certain that the z-ordering is not the problem as you can see from my two images... The "bottom" most image I replaced the "Face Mesh" (Called
"y_dBodyFace" in Blender/GFX file) PdxMeshPortrait shader in Blender with PdxMeshClothes (Picked specifically that that is where the "y_dBodyFace" mesh and left arm's cloth's mesh's UV's overlap somewhat so something can appear) and the mesh shows up in the properly place albeit without the right texture because it's not the right shader.

Here are the two images side by side:
K0cmU8gl.png

SckFRLPl.png


If the z-ordering was wrong then I would not have the result as shown between these two images. It would be very strange for the z-ordering to be wrong specifically for the only every PdxPortraitMesh shader element but for every single other mesh to be correct.

In summary:
-Every single one of the PdxPortraitMeshClothes and PdxPortraitMeshHair meshes are all showing correct.
-Every single one of the PdxPortraitMesh (i.e the base skin) does not appear.
-I am pretty sure the z-order is correct based on my tests and on the gfx file and on what appears when I click on "set mesh order" in the plugin, everything looks fine.
-When I change PdxPortraitMesh to PdxPortraitMeshClothes they appear in the right order but obviously this doesnt help me.
-The Blender pdx shaders set in the plugin seem to overwrite the gfx file, so it hasn't worked to just use a different shader in blender.
-I don't think the issue is a result of too many meshes because otherwise the back hair mesh and front headgear mesh or front hair mesh wouldn't appear.

When I am home I will try to test if I export a single mesh with the PdxMeshPortrait shader with the plugin.
 
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?


No those are all hardcoded. You can only use states already listed in your target entity type, then, if you want, add custom states that you trigger from those foundational states. In otherwords customs states are only for you to use internally, they can not be triggered externally. As for your issue, do make sure you have only PDX Materials assigned, as i've had zero issues with the exporter in current release, even with quite complex meshes.

If you are having issues with a specific shader, try exporting everything with the PDXMeshAdvanced shader, then just assign each individually, via the pdx_mesh code (.gfx file). If the shader does not work in game, you might be missing a map or something like that.
 
No those are all hardcoded. You can only use states already listed in your target entity type, then, if you want, add custom states that you trigger from those foundational states. In otherwords customs states are only for you to use internally, they can not be triggered externally.

I'd like to beg the question as to what are those foundational states? Is there a list? For portraits, what states can I use? K_Vald has said that for portraits presumably it is only random between different idles.

As for your issue, do make sure you have only PDX Materials assigned, as i've had zero issues with the exporter in current release, even with quite complex meshes.

If you are having issues with a specific shader, try exporting everything with the PDXMeshAdvanced shader, then just assign each individually, via the pdx_mesh code (.gfx file). If the shader does not work in game, you might be missing a map or something like that

Yeah so far every mesh that I'm exporting only has the pdx materials assigned, even went through to make sure the material was assigned via the assigned button. I have tried to export with PdxMeshAdvanced instead and nothing appears either with my .gfx file comprised as you see above.
 
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.

I did some further testing.

With a SINGLE PLANE. With the PdxMeshPortrait shader in the plugin, with a single bone, with a single frame of animation.
-PdxMeshPortrait does not appear. No errors.
-PdxMeshAdvanced does not appear.
-PdxMeshPortraitClothes appears as long as the .gfx is also set to PdxMeshPortraitClothes and the portraits.txt file has selectors set.
-Whatever material I set in Blender seems to overwrite the .gfx shader; and won't appear unless they match.

I have uploaded a test blend, containing said single plane.

I have also uploaded the exported mesh and anim file.

I'd prefer not to upload the textures at this time but paint some 4K texture all white and I think that should work.
 

Attachments

  • PdxExportTest.7z
    73,7 KB · Views: 12
  • homunculus.7z
    558 bytes · Views: 11
Some additional information.
8WxnOiTl.png


Making a 1K texture that's a solid colour to be sure; I have tested the different shaders & gfx settings:
PdxMeshPortraitClothes & PdxMeshPortraitHair will show up, as long as there is a selector's file with a reference to the texture, and is defined for the shader in the .gfx regardless of the Blender scene as long as it has a PDX shader material and exported successfully.

Example:
portrait.txt
Code:
    homunculus6 = { entity = "PdxExportTest_00_entity" clothes_selector = "homunculus_clothes_2"
        hair_selector = "no_texture" greeting_sound = "robot_human_greetings"
    }

If it is like the above and the gfx like below:
.gfx:
Code:
    pdxmesh = {
        name = "PdxExportTest_00"
        file = "gfx/models/portraits/homunculus/PdxExportTest.mesh"
        animation = { id = "idle0"    type = "PdxExportTest_rest_animation" }
        scale = 1.0
      
        meshsettings = {
            name = "Plane"
            index = 0
            texture_diffuse = "PdxExportTest.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
            shader = PdxMeshPortraitClothes
          #PdxMeshAdvanced
          # bk:  PdxMeshPortraitHair
        }
    
    }

Then it works and shows up; but I need PdxMeshPortrait, like below.


.gfx:
Code:
    pdxmesh = {
        name = "PdxExportTest_00"
        file = "gfx/models/portraits/homunculus/PdxExportTest.mesh"
        animation = { id = "idle0"    type = "PdxExportTest_rest_animation" }
        scale = 1.0
      
        meshsettings = {
            name = "Plane"
            index = 0
            texture_diffuse = "PdxExportTest.dds"
            texture_normal = "nonormal.dds"
            texture_specular = "nospec.dds"
            shader = PdxMeshPortrait
          #PdxMeshAdvanced
          # bk:  PdxMeshPortraitHair
        }
    
    }

animations.asset
Code:
animation = {
    name = "PdxExportTest_rest_animation"
    file = "PdxExportTest.anim"
}

entities.asset
Code:
entity = {
    ###Name - entity name, structed: unitname_entity
    name = "PdxExportTest_00_entity"
    ####paradox mesh - inside a .gfx file (powerarmor_meshes.gfx)
    pdxmesh = "PdxExportTest_00"
  
    ####Animations and triggers
  
    ###state to be in when nothing else is triggered
    default_state = "idle"
    state = { name = "idle"       animation = "idle0"    animation_blend_time = 0 chance = 2.0 looping = no next_state = idle}

    scale = 2.5
}

hair1 file
Code:
homunculus_hair_2 = {
    default = "gfx/models/portraits/homunculus/PdxExportTest.dds"
  
    game_setup = {#will run with a limited country scope. species and government is set but the country does not actually exist
        default = "gfx/models/portraits/homunculus/PdxExportTest.dds"
    }

    #species scope
    species = { #generic portrait for a species
        default = "gfx/models/portraits/homunculus/PdxExportTest.dds"
    }

    #pop scope
    pop = { #for a specific pop
  
        default = "gfx/models/portraits/homunculus/PdxExportTest.dds"

        random = {
            list = {
                "gfx/models/portraits/homunculus/PdxExportTest.dds"
            }
        }  
    }

    #leader scope
    leader = { #scientists, generals, admirals, governor
  
        random = {
            list = {
                "gfx/models/portraits/homunculus/PdxExportTest.dds"
            }
        }      
    }

    #leader scope
    ruler = { #for rulers
      
        random = {
            list = {
                "gfx/models/portraits/homunculus/PdxExportTest.dds"
            }
        }      
    }
}


PdxMeshShader works with the Jorodox/collada exporter; but doesn't want to work with the plugin exporter and with this time scene with a single mesh, I have no idea what I could possible be doing wrong.

Current Blend Scene:


So I'd say it's just more accurate to say that the specified shader in the .GFX file is not working with the mesh exported from Blender, if it isn't a Selector material.
 
Code:
Traceback (most recent call last):
  File "..\Blender Foundation\Blender\2.79\scripts\addons\io_pdx_mesh\pdx_blender\blender_ui.py", line 352, in execute
    bonespace=self.chk_bonespace
  File "..\Blender Foundation\Blender\2.79\scripts\addons\io_pdx_mesh\pdx_blender\blender_import_export.py", line 1034, in import_meshfile
    create_skin(pdx_skin, pdx_bone_list, obj, rig)
  File "..\Blender Foundation\Blender\2.79\scripts\addons\io_pdx_mesh\pdx_blender\blender_import_export.py", line 749, in create_skin
    armt_bones = rig.data.bones
AttributeError: 'tuple' object has no attribute 'data'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "...\Blender Foundation\Blender\2.79\scripts\addons\io_pdx_mesh\pdx_blender\blender_ui.py", line 358, in execute
    self.report({'ERROR'}, err)
TypeError: IO_PDX_MESH_OT_import_mesh.report(): error with argument 2, "message" -  Function.message expected a string type, not AttributeError

location: <unknown location>:-1

When I try to import a paradox vanilla mesh (mammalian_01) I get an import error and its missing meshes; but works on someone else's machine/version of blender.




Edit:

Great success!

So it seems that the Blender Plugin rotates/flips the orientation of my armature or meshes during export in the opposite fashion from how the Collada Jorodox Mesh convert behaves. For Jorodox my UVs need to be pointing in the +Y direction. The Clothes and Hair shaders work independent of facing; but in Ross's plugin I needed to take PdxMeshPortrait meshes and flip the UV's with my armature setup to be pointing to -Y and this fixed it.

Sooooo many hours on this and it was such a simple fix I could've easily stumbled on it earlier but because of how Jorodox works I basically wrote it off as impossible.

Big thanks to ICodeMaster for their assistance; over discord we communicated back and forth and resolved my issue after much methodical testing; I have a couple of easily solved issues now to fix and we're all set.

Thank you everyone for your help!
 
Last edited:
Ahh great stuff guys :) well done for figuring it out! I'll make a note about that in my FAQ.

I didn't think to check that as you had already mentioned the face normals were correct. But yeah, in Blender the forward direction is -Y ... I have no idea about Jorodox really, the one time I tried it I got some odd left/right flip issues.
 
Yeah basically lets say you open blender for the first time; NUMPADKEY_1 will bring you to the "front camera view" and lets assume you're in orthographic mode. Thus any objection that is "facing you" in the global -Y, but as it's local +Y colinear with the global +Y.

When you add an armature with a single bone; and attack it to a 2D plane oriented along global Z axis (facing towards you); to display correctly through Jorodox:
-UV's need to be pointing in global +Y.
-Armature and Objects Local +Y align with global +Y.
-But your animations and textures and meshes are setup facing the "camera" which is in the -Y direction.

This is how it works in Jorodox after much trial and error so when it came time to use your plugin I assumed that this basic setup was still correct and dismissed retesting it u til 1Codemaster pointed out that the hair and clothes shaders might be double sided shaders and independent of UV direction... Because that's apparently the case with PdxMeshAdvanced (which is weird because PdxMeshAdvanced also never appeared iirc).

It seems like with this setup with the Blender plugin the UV's for any mesh that is using PdxMeshPortrait needs to be flipped from facing -Y to positive Y.

Presumably codemaster needs to add a warning section specifically for users coming from Jorodox.

Unrelatedly there is something still very wrong with my importing; I cant seem to import the standard vanilla meshes (but codemaster can); something seems otherwise wrong with my blender but at least exporting seems to work perfect; AND it solves my mesh issues from the Collada process.

Great success, I can also go back to my other species now after I am done my current one that has hair animations implemented using rigidbody physics.
 
Hello everyone,
so I recently started working with Blender in order to import some custom models into HoI IV, but as of now I'm kinda stuck in one place because of a problem I've encountered. I used the io_pdx_mesh tool for Blender in order to import a vanilla .mesh and then copied over the armature/skeleton to my new model. Exported it to .dea and then used JoroDox to create the .mesh file. However, when imported into the game it seems that something went wrong with the bones (see attached image). I should mention that I had to flip the whole model (and the armature) on the Z axis (-180) as it was facing the wrong way. That went fine, but the arms are messed up to say the least.
Can anyone help me out here/did anyone ever had this issue too? Didn't find anything useful on the net by myself.
https://imgur.com/a/PA2DBrh
 
@TPS-Geronam

Basically, you will get bad results if you mix and match between using my tool and using Jorodox ... as they work quite differently.

Exported it to .dea and then used JoroDox to create the .mesh
You can just use the io_pdx_mesh tool in Blender to export the .mesh file directly, I think that will solve your problem and that way you should also not need to flip the model on the Z axis.
 
@TPS-Geronam

Basically, you will get bad results if you mix and match between using my tool and using Jorodox ... as they work quite differently.


You can just use the io_pdx_mesh tool in Blender to export the .mesh file directly, I think that will solve your problem and that way you should also not need to flip the model on the Z axis.
Hm, that doesn't seem to solve it, though thanks for the answer. I guess something went wrong with the bones themselves...
 
Last edited:
Can i see your .mesh import, .blend and .mesh export you get? I do not export the base bones, but they do work when imported and export fine for my mod
Sure, here you go. Sorry for the late response.
The imported/original mesh was just a vanilla file directly from the game directory.
 

Attachments

  • asian_s.zip
    364,3 KB · Views: 17
I looked over your guy, and you have a bunch of issues with the mesh itself.
RdA6JES.png

First, right here. I removed doubles and you have a LOT of doubles for a 300 vertex mesh, these are just vertices in the same location. PDX meshes don't handle these well at all.
njG2DEi.png

Second, you have an issue with your weight paints. I'd go over them either using the envelope method, and converting to vertex weights, or manually painting over.

Third, I'd recommend using one manifold (no open sides, all enclosed) mesh for a character, not multiple as you have here. I can't see your textures, but I assume you have different materials for each one? This can be solved by baking your materials out. In cycles, you can go to
 
First of all, many thanks for the answer, I will look into how to solve these issues on the net.


Err, did you want to say anything else here?
Ah yeah sorry i was distracted then thought i finished writing. You can go to cycles > render pannel on the right > bake. Then you can bake your diffuse color pass. You can then add a simple shader setup to each of your materials with just a texture, a diffuse shader, an output, and another unconnected texture I normally name bake
If you select this image, then press bake, it will bake your color data off without shadows, lighting, etc.You can repeat this process, changing the diffuse texture for your normal, spec, etc keeping it connected to the color input. This is a rough explanation, but i can give you more detail if you need to do it, you might not.

This is only really applicable if your body parts have separate textures, or they have separate textures and their Uv's overlap. Again, not sure where you are at for textures, but if they aren't all in one file (like a diffuse.dds instead of a gloves_diffuse, body_diffuse), I'd recommend baking them into one
 
*sigh* This just isn't my type of thing, I guess. Not to mention that I can't seem to get the mesh I got from the net working with the vanilla armature. Either it's me or the mesh itself, but the bones on the arms keep messing stuff up. Anyway, thanks for the help.
 
Hey @ross-g how do I unassign a mesh for export? If I assign a pdx material to a mesh, and then delete the mesh, it still appears in the Set Mesh Order dropdown.

Because I deleted a bone and some meshes, and now I can't export my mesh anymore because it still thinks they exist.

Edit: I was able to find a work around, go to the Heirarchy/Outliner, select "Blender File" from the dropdwon menu, find the material the mesh was using, (making sure all of your current meshes use some other material now for pdx export) and right click and select delete.

This fixed the issue for me. But there should probably be an option to deselect meshes for export, or a means of clearing the cache so to speak.
 
Last edited:
@Sid Meier - yep you figured it out, you have to delete the material for it to not appear in the "Set Mesh Order" popup. (that dropdown just lists all PDX materials in the scene)

I don't think having the extra material left over should cause problems with export though, as it'll just get skipped/ignored. But I'll do some testing to be sure.
Deleting a bone is definitely a problem though.