Jump to content

Need a tiny bit of help getting started


Recommended Posts

Also, I missed this before - if you can disable the alpha channel temporarily in GIMP then you'll actually see the diffuse ( the RGB channels ) properly. I would expect the alpha channel is storing specular levels ( it's definitely not storing actual transparency info ), so you're not really seeing what's actually there. You have to stop thinking of alpha = transparency, because most of the time doing texture work it isn't. Unfortunately, persuading GIMP of that is more hassle than it should be, iirc.If you use something else like Photoshop it'll treat alpha channels just like the RGB ones unless you actually tell it otherwise.

If you've got a grey texture to start with, tinting it is simple: put a flat colour layer *underneath* the one you loaded from the texture, and then set the original layer to Multiply or Overlay blending. You might have to mask off any bits you don't want tinted, but there's not much more to it than that. It's simple enough that I wrote a shader to do it in-game...

Edited by Van Disaster
Link to comment
Share on other sites

@Stone Blue @Van Disaster

 

Woo, success! You guys are awesome. Between you both, you explained the things that I was missing, and didn't know I was missing. Thank you!

In general it worked, but there is still one issue. I still have the black bits at the top

screenshot12_by_maekern-dacepyh.png

Here is the actual png texture, the way it looks when you open it in most programs (alpha channel being used as transparancy)

inflato1_by_maekern-dacepxd.png

 

Here it is with the alpha channel removed:

inflato1_no_alpha_by_maekern-dacepx5.png

(yes, I know the purple is ugly. I just wanted it to be obvious)

And here is JUST the alpha channel rendered out by itself:

inflato1_just_alpha_by_maekern-daceq28.p

As far as I can see, everything but the purple tint is as it was before, but I'm still getting those ugly black blobs. Thoughts?

 

 

 

 

Link to comment
Share on other sites

Again, no expert here, but look at the rim around the porthole, and the panel seams, as well as the hatch... They are also black... Also look at the color of the porthole itself... It almost looks like either the layers are out of order, or the transparencies or masks arent set properly, and the alpha is showing thru on top...??

I know, can I be more "Gee, there's something wrong, there...", in a more "Duh", manner...??  lol

Link to comment
Share on other sites

4 hours ago, NecroBones said:

 

I think it only looks white because of the PNG transparency over the forum's white background.

 

That is correct. It is transparent

4 hours ago, Stone Blue said:

Again, no expert here, but look at the rim around the porthole, and the panel seams, as well as the hatch... They are also black... Also look at the color of the porthole itself... It almost looks like either the layers are out of order, or the transparencies or masks arent set properly, and the alpha is showing thru on top...??

I know, can I be more "Gee, there's something wrong, there...", in a more "Duh", manner...??  lol

Yeah, I noticed the same thing. I just can't for the life of me figure out why.

Link to comment
Share on other sites

41 minutes ago, Tokamak said:

That is correct. It is transparent

Yeah, I noticed the same thing. I just can't for the life of me figure out why.

I have a suspicion of what's happening, but I'll need to fiddle with it in GIMP to be sure.

Regardless of how other programs or texture work treats the alpha channel, in GIMP it is a transparency, and gets saved as such in a PNG. If it's 100% transparent in any section, there's nothing in that area to display.

You could try transferring the alpha channel to a regular layer, making it 98 or 99% opaque, create a layer mask of it (greyscale copy of layer) and then copy/pasting that into a layer mask (white-full opacity) on the regular texture.

Link to comment
Share on other sites

Just now, Randazzo said:

I have a suspicion of what's happening, but I'll need to fiddle with it in GIMP to be sure.

Regardless of how other programs or texture work treats the alpha channel, in GIMP it is a transparency, and gets saved as such in a PNG. If it's 100% transparent in any section, there's nothing in that area to display.

You could try transferring the alpha channel to a regular layer, making it 98 or 99% opaque, create a layer mask of it (greyscale copy of layer) and then copy/pasting that into a layer mask (white-full opacity) on the regular texture.

Hrm, that would make sense. I will poke at that. Thanks!

Link to comment
Share on other sites

1 hour ago, Randazzo said:

I have a suspicion of what's happening, but I'll need to fiddle with it in GIMP to be sure.

Regardless of how other programs or texture work treats the alpha channel, in GIMP it is a transparency, and gets saved as such in a PNG. If it's 100% transparent in any section, there's nothing in that area to display.

You could try transferring the alpha channel to a regular layer, making it 98 or 99% opaque, create a layer mask of it (greyscale copy of layer) and then copy/pasting that into a layer mask (white-full opacity) on the regular texture.

That was indeed it. Thank you again!

Link to comment
Share on other sites

Hokay... the next step is playing with unity... but information is scattered, inconstant, and hard to find. If I just want to do things with a part like skinning, and not actually editing the mesh, can I or can I not import the .mu files into Unity? Do I need the original source assets instead? If so :(

 

Edited to add: Okay, I'm getting the impression the answer is "no", but I have gotten the plugin for blender that lets me import mu files. The question that remains is: is there a way to also import the texture/UV mapping, or will I have to retexture the whole model, if I'm importing something?

Edited by Tokamak
Link to comment
Share on other sites

The .mu importer will ( should ) bring the UV mapping with it. You will have to set the material up yourself probably, the lack of that will be why you have an apparently untextured mesh.

Alpha is displayed as transparency in a browser and GIMP. Note that it's the browser & GIMP treating it like that, not anything about the image file beyond it having four channels.

Edited by Van Disaster
Link to comment
Share on other sites

The .mu importer will bring everything, including the materials... EXCEPT some animations will not import, so you may need to redo them in Unity...You will also have to set the shaders, and match the textures to the game objects... But thats super easy to do...

Link to comment
Share on other sites

9 hours ago, Van Disaster said:

Alpha is displayed as transparency in a browser and GIMP. Note that it's the browser & GIMP treating it like that, not anything about the image file beyond it having four channels.

Because GIMP specifically uses that fourth channel for transparency in a PNG.

https://docs.gimp.org/en/gimp-using-web-transparency.html

Edited by Randazzo
Link to comment
Share on other sites

20 hours ago, Randazzo said:

I have a suspicion of what's happening, but I'll need to fiddle with it in GIMP to be sure.

Regardless of how other programs or texture work treats the alpha channel, in GIMP it is a transparency, and gets saved as such in a PNG. If it's 100% transparent in any section, there's nothing in that area to display.

You could try transferring the alpha channel to a regular layer, making it 98 or 99% opaque, create a layer mask of it (greyscale copy of layer) and then copy/pasting that into a layer mask (white-full opacity) on the regular texture.

 

This is a really good point. I avoid making anything 100% opaque, or 100% transparent, and only use the range of values from 1-254 (no 0 or 255) in the alpha channel, for this very reason. Sometimes you get some strange all-black or all-white effects.

Link to comment
Share on other sites

Phew, this rabbithole goes deep. I've gotten the hang of the alpha channel thing, but dealing with texturing a model kept leading me into unity and blender stuff, so I decided to just start at the beginning to get some idea what I was doing, and make a simple part from scratch. The problem is that every tutorial I can find is outdated, and they seem to disagree with each other.

This tutorial http://www.alternatewars.com/Games/KSP/KSP_Mods.htm is exhaustive, and really friendly and well written, but clearly REALLY old, because it's having you save your mesh for kerbal as a .dae file instead of .mu, and the part.cfg format is the really old one that doesn't even use the PART{} tag. Just for the sake of making sure I followed it anyway, and it was a REALLY useful crash course in getting started with Blender... but even after fixing the .cfg format, and exporting to .mu, the part makes KSP hang with the error:

PartLoader: Compiling Part 'TokamakIndustries/adapter/part/tokadapter'
 
(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 64)

NullReferenceException: Object reference not set to an instance of an object
  at PartLoader.SetFogFactor (UnityEngine.GameObject model, Single fogFactor) [0x00000] in <filename unknown>:0 

  at PartLoader.ParsePart (.UrlConfig urlConfig, .ConfigNode node) [0x00000] in <filename unknown>:0 

  at PartLoader+<CompileParts>c__Iterator4A.MoveNext () [0x00000] in <filename unknown>:0 
 
(Filename:  Line: -1)

That's okay, I didn't really expect it to work anyway. I still have an acceptable simple little part, that I've UV-mapped and everything. On to more recent but still outdated tutorials!

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

Now I am confused, because the first tutorial never told me to do anything with unity at all. It just showed me how to make a mesh, a texture, and a part.cfg which would supposedly be KSP ready. This second tutorial tells me completely different things. It throws me to the wolves as far as actually using Blender or another modeling program is concerned, but thanks to the first, I already have a usable model. Or so I thought.

First I import my model from blender into unity, and things are already a mess. The alternatewars tutorial told me that KSP would expect me to make a collision mesh object, which has to be made of 12-sided cylinders and named node_collider. I had faithfully done this. Now that I am going through the second (much less detailed and helpful) tutorial from the wiki, I have two problems at once:

1) In unity, my node_collider mesh is visible, puking all over the actual part model, and I can't find any way to hide it so I can actually see my part properly

2) The wiki tutorial says nothing about having made a node_collider mesh, and tells me that I need to make a collider in unity

Also unrelated 3) The wiki tutorial instructs me to make a material with my texture and apply it to the model... but the model already has a material baked in from blender, so this seems redundant, but it doesn]t say how to just tell unity "I've already textured this, just use what is there"

 

I'm not quite sure what questions to even ask other than "HALP! XD" 

 

So yeah. Phew. This is eating up day after day. I'm doing my best not to come whining for help at every turn, so I'm not that guy who says "It dun work nothing happens plz fix for me". I'm spending hours and hours slogging through stuff on my own before finding which stumbling blocks I can't get over myself, but DAMN trying to learn anything about this is a clusterfrack of outdated and conflicting any information.

I really really REALLY love KSP, so I'm going to keep at it, but at this point I'm kind of surprised that KSP has a modding community at all. I have much increased appreciation for the people who wade through all of this and manage to make the great stuff that they do.

I also deeply appreciate how you guys are kind of dog-piling on me with help and encouragement. That's making this an adventure instead of just a slog :)

 

Link to comment
Share on other sites

Oh boy, you're really taking the dive now. Well, you do have to use unity to export anything properly. Although the Blender add-on may allow you to save in .mu format, it will not work in game (in my experience anyway). I honestly don't know if there are any up-to-date resources (Unity 5 based) for getting parts set up and exported. I'm still using Unity 4.2.2 myself.

This video helped me get my first part exported:

 

Unity 5 is really only an absolute requirement if you're creating parts that need the asset bundles (KSPedia and who knows what else), or wheels or landing legs. For Engines it's more convenient for me to use 4.2.2 for emissives and such.


As for the collider it can be named anything, and does not require defining in the cfg file anymore. To solve your collider visibility issue, select it in unity, click "Add Component" in the inspector window, select physics, and "Mesh Collider". Make sure to check the box next to "Convex". Then, delete the Mesh Renderer object, and you have an invisible collider. You can see a partial example of this around the 9 minute mark in the video (adds a mesh collider, but doesn't delete the renderer).

Again, I use old Unity therefore my advice at this point may be awful.

 

 

Link to comment
Share on other sites

7 minutes ago, Randazzo said:

Oh boy, you're really taking the dive now. Well, you do have to use unity to export anything properly. Although the Blender add-on may allow you to save in .mu format, it will not work in game (in my experience anyway). I honestly don't know if there are any up-to-date resources (Unity 5 based) for getting parts set up and exported. I'm still using Unity 4.2.2 myself.

This video helped me get my first part exported:

 

Unity 5 is really only an absolute requirement if you're creating parts that need the asset bundles (KSPedia and who knows what else), or wheels or landing legs. For Engines it's more convenient for me to use 4.2.2 for emissives and such.


As for the collider it can be named anything, and does not require defining in the cfg file anymore. To solve your collider visibility issue, select it in unity, click "Add Component" in the inspector window, select physics, and "Mesh Collider". Make sure to check the box next to "Convex". Then, delete the Mesh Renderer object, and you have an invisible collider. You can see a partial example of this around the 9 minute mark in the video (adds a mesh collider, but doesn't delete the renderer).

Again, I use old Unity therefore my advice at this point may be awful.

 

 

I can confirm what you said about the blender-created mu file not being usable in game. Just for grins, I took an existing working part, imported it, and re-exported it, and sure enough it made KSP hang. So that's good to know.

I'm not totally sure how to get Unity 4. Unity 5 was the only obvious download on the unity site, but if I have problems I can look for it. As it is, the latest KSP part tools seem to work in the latest unity.

I will check out the video. Thanks!

Edit: When I select node_collider in unity, the inspector window has lots of options about the shader, and nothing else. Perhaps I should find unity 4, just so I'm using the same interface as others. :(

 

In case anyone else has found this thread later and is trying to use it for help, the KSP part tools thread that is current while I write this is http://forum.kerbalspaceprogram.com/index.php?/topic/135228-parttools-for-ksp-112/

 

Edited by Tokamak
Link to comment
Share on other sites

The only thing you do differently in U5 is animation related, which is not an area for absolute beginners. Maybe audio too, not my area.

In order, if you can't get direct exort working:

* Set up parttools
* Export as fbx, set Unitys import options on the file
* Expand the fbx in Unity, drag the main mesh into the scene & centre it.
* Remove the animator component & aďd a parttools one, set that up
* Set the correct shader & texture files in any materials
* Export with parttools

Load & see if it's visible.

* Add a new gameobject as a child, and add a mesh collider component, find the collision mesh from the expanded fbx. Don't add a mesh renderer to that! make sure it's set as convex ( if it's a concave model you'll have to break the collider into pieces until it is ).

You can add a single collider to the toplevel object if you like. You can break mesh renderers (parts of the model ) out into children too.

Done from memory on a mobile device, so I may have missed something

Edited by Van Disaster
Link to comment
Share on other sites

21 minutes ago, Van Disaster said:

The only thing you do differently in U5 is animation related, which is not an area for absolute beginners. Maybe audio too, not my area.

In order, if you can't get direct exort working:

* Set up parttools
* Export as fbx, set Unitys import options on the file
* Expand the fbx in Unity, drag the main mesh into the scene & centre it.
* Remove the animator component & aďd a parttools one, set that up
* Set the correct shader & texture files in any materials
* Export with parttools

Load & see if it's visible.

* Add a new gameobject as a child, and add a mesh collider component, find the collision mesh from the expanded fbx. Don't add a mesh renderer to that! make sure it's set as convex ( if it's a concave model you'll have to break the collider into pieces until it is ).

You can add a single collider to the toplevel object if you like. You can break mesh renderers (parts of the model ) out into children too.

Done from memory on a mobile device, so I may have missed something

Gotcha. I will try that. Thank you!

 

I notice that in every working part I import into blender to look at, there is a very specific scene structure, with "GameObject" at the root, and other elements nested with standard seeming names. Is this:

A) Just good practice, not required by KSP

B) An organizational structure required by KSP for it to use the part

C) Something that parttools will take care of for me so I should not worry about it

 

Link to comment
Share on other sites

Hrm. In Unity, I have a KSP Part Tools window, that is empty, unmovable, and unclosable. O.o Does this perhaps mean that I DO need to use an older version of Unity, for compatibility?

 

I suppose screenshots are helpful. The "part tools" window is empty, and I can't add any of the KSP components to game objects. I have made sure to follow the directions at 

 

errors_by_maekern-dacmldx.png

Edited by Tokamak
Link to comment
Share on other sites

Follow the instructions in Agathorn's post (the 2nd post) in the thread you posted... Those seem to be the most accurate, detailed instructions for installing Part Tools.

You might want to look at Beale's tutorial for making basic parts... Its a little dated, AND it uses Wings3D instead of Blender... BUT follow the tutorial using Wings3D, and you should be able to get the basic concepts of making a basic WORKING part for KSP... Its how i started, before I jumped to Blender...

THEN, when you are ready for Blender, watch and follow all three of Nifty55's Blender/Unity tutorials... Again, a little dated, but the best I found a few months ago when I started with Blender...

There's also this video for texturing and UV mapping, and this one for Part Tools

There was a good site for explaingin configs and stuff, but I cant find the link right now... :(

 

Edited by Stone Blue
Link to comment
Share on other sites

4 minutes ago, Stone Blue said:

Follow the instructions in Agathorn's post (the 2nd post) in the thread you posted... Those seem to be the most accurate, detailed instructions for installing Part Tools.

That's what I did. I've checked it multiple times. So I'm not sure what is wrong. I can see that the Unity log is getting spammed with NullReferenceExceptions

Edited by Tokamak
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...