[Solved] Need help modifying a mesh

Discuss modding questions and implementation details.
User avatar
XJDHDR
Posts: 258
Joined: Thu Jan 10, 2019 5:15 pm
Location: New Zealand
Contact:

[Solved] Need help modifying a mesh

Post by XJDHDR »

I am having some issues trying to modify a mesh from the base game. Sorry if my post seems noobish. I read TheLacus' post here and it was helpful but I seem to be having problems that aren't covered by that post.

I found the mesh I wanted to edit in DF Modelling and exported it to a DAE file. I then imported it into Blender but I'm having an issue. The UV mapping has been mangled somewhere between the two programs (presumably by Blender).
Spoiler!
This is what it looks like in DF modelling:
Image
This is what I get after importing it into Blender:
Image
Notice the difference in the UV mapping.
Please can someone help me figure out how to fix this? Thanks. I'm using Blender v2.82a, if that helps.
Last edited by XJDHDR on Sun May 17, 2020 7:42 am, edited 1 time in total.

User avatar
BadLuckBurt
Posts: 948
Joined: Sun Nov 05, 2017 8:30 pm

Re: Need help modifying a mesh

Post by BadLuckBurt »

Can you try with Blender 2.79 by any chance?

I made a library of .blend files from the DAE exports a while back and when I open that model (60110), it looks fine:

Image

Maybe something changed with the DAE importer between Blender versions, I don't know.
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt

.

Frozen_Dervish
Posts: 12
Joined: Mon Mar 18, 2019 1:24 am

Re: Need help modifying a mesh

Post by Frozen_Dervish »

I'm not sure what to make of the UV on it, but to get it to match you should export the texture as .png rather than .jpeg.

User avatar
XJDHDR
Posts: 258
Joined: Thu Jan 10, 2019 5:15 pm
Location: New Zealand
Contact:

Re: Need help modifying a mesh

Post by XJDHDR »

BadLuckBurt wrote: Wed Apr 01, 2020 8:24 am Can you try with Blender 2.79 by any chance?

I made a library of .blend files from the DAE exports a while back and when I open that model (60110), it looks fine:

Maybe something changed with the DAE importer between Blender versions, I don't know.
I managed to fix the UV mapping problem. I was using Win10 to export those meshes but, on a hunch, tried installing DF Modelling in a Win7 VM then exporting the mesh from there instead. This time, the UV map was correct. So it seems there is an incompatibility between DF Modelling and the .NET Framework that comes with Win10. I'll need to inform Interkarma of this.

I am having two more issues though, now that I'm at the point where I can get my new mesh to show up ingame:
  • The mesh is rotated 180° compared to the original.
  • The mesh is not using the game's textures but is using the textures I had to package with the mod instead. If I didn't package those textures, the mesh had none ingame.
Image

Can you or anyone else please help me figure out what I'm doing wrong now?
Frozen_Dervish wrote: Wed Apr 01, 2020 4:49 pm you should export the texture as .png rather than .jpeg.
The default option for texture exporting, which I stuck to, is as a PNG.

User avatar
BadLuckBurt
Posts: 948
Joined: Sun Nov 05, 2017 8:30 pm

Re: Need help modifying a mesh

Post by BadLuckBurt »

You need to rotate the mesh 180 degrees in Blender and apply that rotation, then do the 90 rotation fix before exporting to FBX. Then your model will show up correctly in Unity.

Regarding textures, I don't know if it's possible to make the mesh use DFU's textures instead of providing your own. The texture array doesn't exist inside the editor, it's created at runtime. So the only way would be to set the textures through script maybe when the mod loads but don't ask me how, no clue.
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt

.

User avatar
XJDHDR
Posts: 258
Joined: Thu Jan 10, 2019 5:15 pm
Location: New Zealand
Contact:

Re: Need help modifying a mesh

Post by XJDHDR »

BadLuckBurt wrote: Wed Apr 01, 2020 8:33 pm You need to rotate the mesh 180 degrees in Blender and apply that rotation, then do the 90 rotation fix before exporting to FBX. Then your model will show up correctly in Unity.
I tried but could not get the FBX exporter to get the rotation correct. I did install the 90° fix plugin for Blender but I'm not 100% sure if it's "activated". I then tried exporting my model as an OBJ and it exported correctly the first time:
https://imgur.com/3a6ay1i
https://imgur.com/5RRejwi

I'm interested in finding out what I did wrong with my FBX attempts, though. Do you know how I can check if that 90° fix plugin is working?
Edit: Nvm, I figured it out. It seems like the 90° fix plugin was breaking the export because once I uninstalled it, FBX started giving me the correct rotations as well.

The only outstanding issue left is the conflict with texture replacers.
BadLuckBurt wrote: Wed Apr 01, 2020 8:33 pm Regarding textures, I don't know if it's possible to make the mesh use DFU's textures instead of providing your own. The texture array doesn't exist inside the editor, it's created at runtime. So the only way would be to set the textures through script maybe when the mod loads but don't ask me how, no clue.
I looked through the asset injection docs again and found this line:
Materials named Archive_Record_0 will be affected by custom textures provided by loose files.
Now, I'm trying to work out 2 things:
  • What does "loose files" mean? Is it only texture files that are in StreamingAssets\Textures or does it include files packed into a dfmod as well?
  • What naming convention does the engine want for the material names and texture paths? I currently have my model's MTL set up as below which I think is what the docs say they should be (not sure about the texture path though) but it's still displaying the vanilla textures.
My current MTL:

Code: Select all

newmtl 147_1_0
Ns 225.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 2
map_Kd images\\147_1-0.png

newmtl 147_2_0
Ns 225.000000
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
illum 2
map_Kd images\\147_2-0.png

User avatar
BadLuckBurt
Posts: 948
Joined: Sun Nov 05, 2017 8:30 pm

Re: Need help modifying a mesh

Post by BadLuckBurt »

You will have to be clearer about your current setup of the model in Unity. You mention OBJ and FBX but appear to still be using the OBJ?

I dont know Blender 2.82 which I assume you're still using but the rotation fix may be obsolete in that version, a lot changed compared to 2.79 which probably breaks scripts

Materials in the docs are a reference to Unity Materials not OBJ and if named correctly they are affected by loose files from StreamingAssets/Textures.
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt

.

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Need help modifying a mesh

Post by TheLacus »

XJDHDR wrote: Thu Apr 02, 2020 10:42 pm
BadLuckBurt wrote: Wed Apr 01, 2020 8:33 pm You need to rotate the mesh 180 degrees in Blender and apply that rotation, then do the 90 rotation fix before exporting to FBX. Then your model will show up correctly in Unity.
I tried but could not get the FBX exporter to get the rotation correct. I did install the 90° fix plugin for Blender but I'm not 100% sure if it's "activated". I then tried exporting my model as an OBJ and it exported correctly the first time:
https://imgur.com/3a6ay1i
https://imgur.com/5RRejwi

I'm interested in finding out what I did wrong with my FBX attempts, though. Do you know how I can check if that 90° fix plugin is working?
Edit: Nvm, I figured it out. It seems like the 90° fix plugin was breaking the export because once I uninstalled it, FBX started giving me the correct rotations as well.
You can rotate the model and then reset rotation in Blender, so that you don't have to work with an inconvenient rotation. It's easier to do than explain it; the plugin can automatize this operation with a single button but is possible that it doesn't work anymore. This is the plugin page for reference.
XJDHDR wrote: Thu Apr 02, 2020 10:42 pm The only outstanding issue left is the conflict with texture replacers.
BadLuckBurt wrote: Wed Apr 01, 2020 8:33 pm Regarding textures, I don't know if it's possible to make the mesh use DFU's textures instead of providing your own. The texture array doesn't exist inside the editor, it's created at runtime. So the only way would be to set the textures through script maybe when the mod loads but don't ask me how, no clue.
I looked through the asset injection docs again and found this line:
Materials named Archive_Record_0 will be affected by custom textures provided by loose files.
Now, I'm trying to work out 2 things:
  • What does "loose files" mean? Is it only texture files that are in StreamingAssets\Textures or does it include files packed into a dfmod as well?
  • What naming convention does the engine want for the material names and texture paths? I currently have my model's MTL set up as below which I think is what the docs say they should be (not sure about the texture path though) but it's still displaying the vanilla textures.
You must assign materials inside the Editor. If you follow naming conventions they can be replaced with textures from loose files but not mods. If there is a request i can investigate support for run-time materials defined by xml files, but no guarantees. The most important thing is that asset-injection remains performant and doesn't negatively affect core or other mods.

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Need help modifying a mesh

Post by TheLacus »

I made a quick test and i think we can support the following setup:
  • Materials must not be assigned from the Inspector (None (Material)). This allows to detect materials that need to be assigned at runtime and ensure that mod authors don't leave inadvertently some auto-generated materials that would be unused.
  • A meta file must be provided for each model that relies on this features. The following is a possible example:

    Code: Select all

    {
        "Materials": {
            "0": {
                "Archive": 23,
                "Record": 0
            }
        }
    }
    
Would this work for your needs?

User avatar
BadLuckBurt
Posts: 948
Joined: Sun Nov 05, 2017 8:30 pm

Re: Need help modifying a mesh

Post by BadLuckBurt »

TheLacus wrote: Fri Apr 03, 2020 2:22 pm I made a quick test and i think we can support the following setup:
  • Materials must not be assigned from the Inspector (None (Material)). This allows to detect materials that need to be assigned at runtime and ensure that mod authors don't leave inadvertently some auto-generated materials that would be unused.
  • A meta file must be provided for each model that relies on this features. The following is a possible example:

    Code: Select all

    {
        "Materials": {
            "0": {
                "Archive": 23,
                "Record": 0
            }
        }
    }
    
Would this work for your needs?
I can't speak for the OP but I would very much welcome this so thumbs up from me.
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt

.

Post Reply