Jump to content

Re-texture stock parts?


Recommended Posts

Is it possible to create a new part (new CFG that is) which uses a stock .mu with a custom texture?

MODEL {
  model = stock/path
  texture = my/mod/path
}

I see other parts setting MODEL/TEXTURE, but since I don't know of any mods that do this, I kinda think it's not a thing.

But there are mods like "stock parts overhaul", and I find it hard to believe they started from nothing...  But I see they have their own .MU files for most stuff.  Is there a way to decompile the .mu, maybe?  Is that a thing that's done?  Usually that sort of thing runs afoul of license agreements...
  

Link to comment
Share on other sites

33 minutes ago, NermNermNerm said:

Is it possible to create a new part (new CFG that is) which uses a stock .mu with a custom texture?


MODEL {
  model = stock/path
  texture = my/mod/path
}

I see other parts setting MODEL/TEXTURE, but since I don't know of any mods that do this, I kinda think it's not a thing.

But there are mods like "stock parts overhaul", and I find it hard to believe they started from nothing...  But I see they have their own .MU files for most stuff.  Is there a way to decompile the .mu, maybe?  Is that a thing that's done?  Usually that sort of thing runs afoul of license agreements...
  

 

 

Link to comment
Share on other sites

Thanks @Electrocutor , does that process work for you?  Looks like the results of the participants in that thread are a bit mixed.  I got the same result that @JoePatrick1 got - a null reference exception.  Did you ever get that figured out?

My process was:

1) Create a new part, using the model from the stock 1.25m ISRU.  In the cfg I've got:

    MODEL
    {
        model = Squad/Parts/Resources/MiniISRU/MiniISRU
        texture = ksp_s_processorSmall_diff, Squad/Parts/Resources/MiniISRU/ksp_s_processorSmall_diff_scribbles
        scale = 1.25,1.25,1.25
    }

ksp_s_processorSmall_diff is the name of the .dds in the stock folder.  After suspecting the file format of my _scribbles file for a while, I have reverted to just copying the original file into _scribbles.  No joy, still busted.  So no chance it's a bad image file.

There was also a lot of handwavy in the thread about which folder it should be copied into, but I tried:

  • With _scribbles alongside the original
  • With _scribbles in another folder
  • With a copy of the .mu in my folder (the folder with the .cfg in it) alongside the _scribbles file (This fails with "can't find a texture to replace because I didn't copy it)
  • Same as above, plus copy the original .dds file.

I'm out of stuff to try.

Link to comment
Share on other sites

5 hours ago, NermNermNerm said:

Thanks @Electrocutor , does that process work for you?  Looks like the results of the participants in that thread are a bit mixed.  I got the same result that @JoePatrick1 got - a null reference exception.  Did you ever get that figured out?

My process was:

1) Create a new part, using the model from the stock 1.25m ISRU.  In the cfg I've got:


    MODEL
    {
        model = Squad/Parts/Resources/MiniISRU/MiniISRU
        texture = ksp_s_processorSmall_diff, Squad/Parts/Resources/MiniISRU/ksp_s_processorSmall_diff_scribbles
        scale = 1.25,1.25,1.25
    }

ksp_s_processorSmall_diff is the name of the .dds in the stock folder.  After suspecting the file format of my _scribbles file for a while, I have reverted to just copying the original file into _scribbles.  No joy, still busted.  So no chance it's a bad image file.

There was also a lot of handwavy in the thread about which folder it should be copied into, but I tried:

  • With _scribbles alongside the original
  • With _scribbles in another folder
  • With a copy of the .mu in my folder (the folder with the .cfg in it) alongside the _scribbles file (This fails with "can't find a texture to replace because I didn't copy it)
  • Same as above, plus copy the original .dds file.

I'm out of stuff to try.

The texture replacement is extremely picky; it does work, but you have to get everything right and won't get any useful error to tell you what you did wrong. Plus, the original texture has to present as it is used to load the model in first. To be honest, I haven't used this since PartVariants came out since I just use that now.

A quick search yields:

https://forum.kerbalspaceprogram.com/index.php?/topic/157846-solved-texture-tag-not-working-in-model-section/

 

It seems that if a model has any mesh that doesn't have a maintexture in the mu mapped (like most flag meshes), it will fail with a null ref.

Also, make sure that your texture is dxt1 or dxt5.

 

[Edit]

A quick look at the miniISRU in Blender shows it only has one texture, and it is mapped; so as long as your replacement dds is properly formatted, it really should work. You can check the log to make sure your dds is being loaded in.

Edited by Electrocutor
Link to comment
Share on other sites

Dunno what to say, but nope, I get a face-full of Null Reference Exception.

I suspect that the trouble is that I'm not trying to replace a flag or a sub-texture, like most of the posts here, I'm trying to replace the base texture.  If you wanna say I'm wrong, try this:

  1. Create a new CFG file for a part (or just start with the mini-isru one and give it a new name), copy it to a new folder under gamedata
  2. Copy the stock .mu file to that folder
  3. Copy the stock .dds file to that folder
  4. Copy the stock .dds file to a new .dds file
  5. Set model.texture as I've done above

Boom.

Link to comment
Share on other sites

On 10/28/2019 at 10:28 PM, NermNermNerm said:

Dunno what to say, but nope, I get a face-full of Null Reference Exception.

I suspect that the trouble is that I'm not trying to replace a flag or a sub-texture, like most of the posts here, I'm trying to replace the base texture.  If you wanna say I'm wrong, try this:

  1. Create a new CFG file for a part (or just start with the mini-isru one and give it a new name), copy it to a new folder under gamedata
  2. Copy the stock .mu file to that folder
  3. Copy the stock .dds file to that folder
  4. Copy the stock .dds file to a new .dds file
  5. Set model.texture as I've done above

Boom.

I found your issue:

7zIwzTt.jpg

The MiniISRU model has textures attached to some the colliders, but they are blank... you could submit this as a bug, but I don't know if they'll bother to fix it.

Edited by Electrocutor
Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...