[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:

Re: Need help modifying a mesh

Post by XJDHDR »

Thank you very much for all the help, BadLuckBurt and TheLacus. That's all of my questions answered for now. All I need now is for something like TheLacus' idea to be implemented.
TheLacus wrote: Fri Apr 03, 2020 2:22 pm
  • 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 think this feature is a very good idea as well but have a question. If someone assigns None (Material) as the name, that obviously means the current texture override method won't work. So my question is whether this new method is only going to look at textures in DFMODs or will it take loose files in the Textures folder into account as well? If the former, this means that the incompatibility will simply be inverted. If the latter, then please go for it.
BadLuckBurt wrote: Fri Apr 03, 2020 3:06 am 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?
Everything in my comment outside that edit was written when I couldn't get FBXs to work so yes, I was referring to OBJs.
BadLuckBurt wrote: Fri Apr 03, 2020 3:06 am 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
TheLacus wrote: Fri Apr 03, 2020 12:43 pm 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.
That's the plugin I was referring to and I was using the version written for Blender 2.8x. But as I said, that plugin was just getting in my way and it's all good without it.
BadLuckBurt wrote: Fri Apr 03, 2020 3:06 am Materials in the docs are a reference to Unity Materials not OBJ
TheLacus wrote: Fri Apr 03, 2020 12:43 pm You must assign materials inside the Editor.
For OBJ models, the Editor links the material's name to the contents of it's MTL. If you want to edit the material name, you have to edit the MTL. It's not like FBX where the material name is indeed defined in the Editor.
BadLuckBurt wrote: Fri Apr 03, 2020 3:06 am if named correctly they are affected by loose files from StreamingAssets/Textures.
TheLacus wrote: Fri Apr 03, 2020 12:43 pm If you follow naming conventions they can be replaced with textures from loose files but not mods.
After testing some things, I found that there is a typo in the modding docs. On this page, it claims that the naming convention for materials is Archive_Record_0. This is incorrect, the naming convention is actually Archive_Record-0. I also just noticed this typo: "... several parts and put them togheter inside a prefab."

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

Re: Need help modifying a mesh

Post by TheLacus »

BadLuckBurt wrote: Fri Apr 03, 2020 2:30 pm I can't speak for the OP but I would very much welcome this so thumbs up from me.
Implemented with #1775. :)
XJDHDR wrote: Fri Apr 03, 2020 9:28 pm I think this feature is a very good idea as well but have a question. If someone assigns None (Material) as the name, that obviously means the current texture override method won't work. So my question is whether this new method is only going to look at textures in DFMODs or will it take loose files in the Textures folder into account as well? If the former, this means that the incompatibility will simply be inverted. If the latter, then please go for it.
It seeks textures from classic Daggerfall files, mods and loose files. Note that None (Material) is not the name of a material, it means that there is no material assigned.
XJDHDR wrote: Fri Apr 03, 2020 9:28 pm
BadLuckBurt wrote: Fri Apr 03, 2020 3:06 am Materials in the docs are a reference to Unity Materials not OBJ
TheLacus wrote: Fri Apr 03, 2020 12:43 pm You must assign materials inside the Editor.
For OBJ models, the Editor links the material's name to the contents of it's MTL. If you want to edit the material name, you have to edit the MTL. It's not like FBX where the material name is indeed defined in the Editor.
Yes, Unity imports materials with the mesh, but you have the ability to override them individually from the inspector or even fallback to the old way of materials auto-seeked by name inside a subfolder. In any case, you can manage materials how you want when you make a prefab.

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

Re: Need help modifying a mesh

Post by BadLuckBurt »

TheLacus wrote: Sat Apr 04, 2020 2:34 pm
BadLuckBurt wrote: Fri Apr 03, 2020 2:30 pm I can't speak for the OP but I would very much welcome this so thumbs up from me.
Implemented with #1775. :)
Thank you, much appreciated! This means I can make my custom dungeon pieces use vanilla textures without having to include them.
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 »

TheLacus wrote: Sat Apr 04, 2020 2:34 pm Implemented with #1775. :)
Thank you, once again.
TheLacus wrote: Sat Apr 04, 2020 2:34 pm It seeks textures from classic Daggerfall files, mods and loose files. Note that None (Material) is not the name of a material, it means that there is no material assigned.
Okay, that's good to hear. I just thought of another potential issue though. Does your current implementation require that you remove every single material from your model or only the ones you want to have assigned at runtime? If the former, this would be problematic for models that use custom textures (as in, not textures that replace a vanilla DF texture). To use runtime textures, you would have to remove the materials for these custom textures and there would be no way to reimplement them with the runtime materials feature. If this is all correct, would you be willing to add a way to assign custom textures using the runtime materials script or have it so that you don't need to remove all materials to make this work? Or would someone making such a model have to use the current method of assigning all of their materials beforehand?

XJDHDR wrote: Wed Apr 01, 2020 8:16 pm 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.
XJDHDR wrote: Fri Apr 03, 2020 9:28 pm After testing some things, I found that there is a typo in the modding docs. On this page, it claims that the naming convention for materials is Archive_Record_0. This is incorrect, the naming convention is actually Archive_Record-0. I also just noticed this typo: "... several parts and put them togheter inside a prefab."
I tried to contact Interkarma about these two issues but found that he is not accepting PMs, for likely understandable reasons. Can anyone who knows how to contact him please bring these two issues to his attention? Or maybe I can try this:
Interkarma wrote: Mon Aug 12, 2019 12:24 am (snip)

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

Re: Need help modifying a mesh

Post by BadLuckBurt »

All TheLacus did was allow modders to assign the classic textures at runtime. If you are using custom textures on a model, you dont even need this feature so I dont follow your question unless youre talking about mixing custom with classic textures on a model
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: Sun Apr 12, 2020 5:45 pm All TheLacus did was allow modders to assign the classic textures at runtime. If you are using custom textures on a model, you dont even need this feature so I dont follow your question unless youre talking about mixing custom with classic textures on a model
Yes, I'm talking about mixing custom and classic textures on the same model.

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

Re: Need help modifying a mesh

Post by BadLuckBurt »

As far as I can tell from the code, you specify the index of the material slots you want to replace so it should be possible to exclude slots
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: Sun Apr 12, 2020 5:47 pm
BadLuckBurt wrote: Sun Apr 12, 2020 5:45 pm All TheLacus did was allow modders to assign the classic textures at runtime. If you are using custom textures on a model, you dont even need this feature so I dont follow your question unless youre talking about mixing custom with classic textures on a model
Yes, I'm talking about mixing custom and classic textures on the same model.
I confirm is possible, you can override specific material slots.
XJDHDR wrote: Sun Apr 12, 2020 5:37 pm After testing some things, I found that there is a typo in the modding docs. On this page, it claims that the naming convention for materials is Archive_Record_0. This is incorrect, the naming convention is actually Archive_Record-0. I also just noticed this typo: "... several parts and put them togheter inside a prefab."
Thank you for the report, i fixed it. :)

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 »

Sorry to bother everyone again but I have another question for either TheLacus or anyone that knows the answer. How exactly do you implement Runtime Materials for a model?

I ask because I haven't been able to get it to work. I attached the Runtime Materials script to my prefab and filled in the textboxes with the required numbers. However, the models ingame are still using the original game's textures. Looking at the images TheLacus added, it looks like he also did something to remove the material from the model but at the same time, the material is still attached. I haven't managed to figure out a way to give my models that purple texture without breaking it in some way. I do also have both the game and DFU's source code updated to 0.10.23.

I have attached a copy of my models and prefabs as they are currently setup. I included 2 models that I'm working on.
Files.zip
Models that don't have working Runtime Materials setup.
(53.92 KiB) Downloaded 95 times
If anyone can help me get this working, I would greatly appreciate it.

Post Reply