Jump to content

Help needed with a couple part basics: understanding the part's texture


Recommended Posts

Hi all. I'm trying to get my first part into game. I have no log errors, and the part shows up in the VAB, but a) you can tell the texture is not wrapped correctly, and b) when the part is instantiated and hanging on the mouse cursor, it's invisible, and adding it to a node it's still invisible. The log file lists that the part was added to the craft.

Instead of recounting the arduous steps getting to that point, lemme ask the basics:

I imported A.fbx and B.png into my Unity project. The export therefore had A.mu and B.png. Was I supposed to convert B.png to B.dds, or should it have worked as-is?

I assume the base name of the texture must be baked into the MU? Would that mean I need B.dds? Or should it be A.dds? Does the png need to be deleted?

Also, I need to flip something somewhere? Where does that step fit in? I assume that's what I missed for the texture to show up incorrectly in the parts list?

Thanks for any help! It's wild to be this close to actually seeing something I modeled and textured in game. Of course it'll be pure crapola, but it's a first step hopefully.

 

Link to comment
Share on other sites

When I made parts I would leave the texture as .png until I was done modifying the part - and only convert the texture to .dds at the very end saving a convert to .dds every time I changed the texture. Short answer is the .png should work.

I did have some parts that wouldn't show if they were unattached but the would show when attached due to the shader I was using but what you're seeing sounds different. Maybe delete the texture from the game file and see if it shows up - would indicate it's a texture problem if it does, something else if it doesn't. Maybe try a different shader like the simple diffuse to see if it's the shader?

Sorry I can't be more help - Good luck!

Re-read your post - the texture name is baked into the .mu file and (grain of salt here - it's been awhile) the file extension is ignored so if Unity was given A.mu and B.png you would want the texture to be B.png or B.dds - either should work.

If you do go the dds route the texture needs to be flipped vertically when you export from Paint/Gimp/Photoshop. The .png do not need flipped.

Edited by wasml
Link to comment
Share on other sites

On 12/23/2021 at 12:45 PM, wasml said:

Sorry I can't be more help

That was a lot of help actually :)

My next challenge, in case anyone has any ideas about this. What I've done is created a new material, selected KSP/Diffuse, then selected the image file, which leads to the shader error at the bottom.

I'm following the wiki page here:

https://wiki.kerbalspaceprogram.com/wiki/Tutorial:Making_an_asset_from_start_to_finish

which I expected to be out of date, and it is. I've tried to work around the parts where the instructions just don't match up with what's on the screen, but when I encounter errors later on down the line like this it makes me wonder. 

ESj3Zd1.png

edit:  btw, I started from scratch since my last post. Every step I made sure that things were errorless and working as closely to the tutorial as possible. But I crash and burn here at this step.

Edited by OrbitalManeuvers
Link to comment
Share on other sites

It looks like you don't have a root game object for your part. At the menu at the top "File Edit Assets GameObject..." select "GameObject | Create Empty" - this will give you a root GameObject. Select the new GameObject (you can rename this if you want) and on the right side you'll see a "Add Component" button. Click this button and select "KSP | Part Tools" (the "|" being a sub-menu). This will add Part Tools to your root game object. Now add your test probe model to the root and then add your texture. Hopefully this won't throw and error.

Link to comment
Share on other sites

5 hours ago, wasml said:

It looks like you don't have a root game object for your part

Thank you for helping. You're right, there isn't one, and creating one comes later in the steps I have. But I tried creating one at this point and it doesn't improve anything. All of the KSP shaders fail with the same error - this AutoLight.cginc file has a reference to '../CustomUnityShadowLibrary.cginc' and I don't have that file anywhere in the project. If I switch the material to use a standard shader, it works fine and projects onto the model. I don't know if AutoLight.cginc isn't supposed to be included in the first place, or if I'm missing something. Not sure if the message in the bottom right is related.

Link to comment
Share on other sites

I just looked at your screen shot again and realized there may be another problem. The material should go on the model's mesh object but I don't see a mesh object. Under your testprobe object with the blue toaster looking icon there should be a cube icon like the "Directional Light" has. This would be the mesh that you add the material to. If I were to guess I'd say your export is messed up. It could be as simple as one of the export options wasn't checked. If you're using Blender - is "mesh" selected in the fbx export setup?

Edit: Just took a peek at the tutorial - the link to part tools looks like it an old PartTools for 0.23. Here's a link to the Squad PartTool release with the latest for Unity 2019.4/KSP 1.12.x

Edit2: As far as the missing mesh goes - if you click the right arrow on your testprobe in the assets folder you should see any meshes, transforms and a material - if you only see the material then the mesh didn't get exported from the 3D modeling program.

Edited by wasml
More info
Link to comment
Share on other sites

23 minutes ago, wasml said:

If you're using Blender - is "mesh" selected in the fbx export setup?

lookie :)

cQbnJx2.png

Basically, I started over. I knew the PartTools linked in that old wiki was wrong, and found that same updated page, but somehow I downloaded the wrong link from that page (the older one). So that fixed the problem with assigning the KSP/Diffuse shader to the material, and I kinda knew how to do the steps after that, and viola.

Blender 3.0 seems to have Mesh selected by default in the FBX export. It also has other object types selected, so it's a good reminder that you either need to unselect what you don't want, or delete them from the blender scene/layer/idk before export, which is what I'd been doing anyway.

In Unity, I used a built-in box collider, which I added as a component to an empty game object that I added as a sibling to the model, under the Root parent empty. Did I need to do that, or could I use Add Component to put the collider on the Root empty that I have anyway?

So none of my numbers are right (and the model is turned around from what I expected) but these are all details that just need to be ironed out now that the process is a bit more clear and working.

Also, I read elsewhere that TextMeshPro should be removed and reinstalled. I did try to do that, and I'm not 100% it worked correctly, but I don't even know if that was necessary, or what TMPro does.

For anyone else reading this, one of the big gotchas is in the installation of PartTools. The wiki says you can just unzip it into the Assets folder. Not true. Once you do that, you must locate the part tools object in the project view, click on it, then in the inspector you click Open. A new window opens and lists all the stuff in there, and you click Import. Then in the project view, find PartTools/Lib, and click on both of the items there, and for each, turn off Validate References in the inspector pane, and hit the surprise Apply button. 

@wasmlThank you again for loaning some brain cells to my fight, it's very much appreciated. I've been on a quest to try the workflow of Blender -> PS -> Unity/cfg -> KSP. This contributes to my life goal of knowing a little bit about a lot of things, and l'm learning less and less about more and more, until soon I shall know nothing about everything. :)  (Thus the crappy model, crappy texture, and crappy cfg - I know just enough to get them to work, but not enough to get them to be good!)

Link to comment
Share on other sites

Congratulations! I remember it was quite a rush when I got my first part in-game and working.

As far as putting the collider on the root part - I usually put the collider on the mesh it goes with but whatever you find easiest. The one situation where the collider on the root part wouldn't work is where you have movable sub part like a gimbaling engine or a cargo ramp and the collider needs to move with the mesh.

TextMeshPro - I delete this from my parts and haven't had any problems and it makes the backups significantly smaller. I don't remember where I got the idea that TextmeshPro was for GUI's - could be wrong but I haven't used it when making parts.

Link to comment
Share on other sites

3 minutes ago, wasml said:

I don't remember where I got the idea that TextmeshPro was for GUI's - could be wrong but I haven't used it when making parts.

oh oh oh yes this is correct! haha ANOTHER project I did was learning how to write a plugin, and I did a prefab for it, thus TMPro was a thing then, but shouldn't be for parts!

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