Jump to content

Some definitive answers. If you can.


Recommended Posts

Help if you can. I need some definitive answers to some basic questions. I have read, I think, literally everything I can find on making models for KSP and the amount of unclear and conflicting information is frankly astounding. And I'm close to giving up :(

- Can a mesh have more than one material?

- Can a submesh have more than one material?

- If a mesh can only have a single material, is it possible to have faces with different textures?

- And if not, in Unity, how do you change the texture tiling, rotation etc. on an individual face?

- Is it simply the case that you must use a single UV map and nothing else will work?

- Can a mesh have more than one collider (for example, on one or more submeshes)?

- If only one collider works, is it okay for the model to be more than one mesh (submeshed) or must that also be a single mesh?

- On a static model, such as a building, does a collider have to be convex?

- What's the 'secret' to having a ramp in a model? Splitting faces, solid geometry and nearly a week's worth of experimenting and I still haven't got a working collider on a single model.

Link to comment
Share on other sites

- Can a mesh have more than one material?

One mesh one material. A part can have multiple meshes each with their own material. One mesh is a mesh object you select in the unity mesh filter and mesh renderer component.

- Can a submesh have more than one material?

see above.

- If a mesh can only have a single material, is it possible to have faces with different textures?

no. This is a KSP limitation.

- And if not, in Unity, how do you change the texture tiling, rotation etc. on an individual face?

you can change tiling and offset for the shader that is applied to a mesh object. you can't adjust offset or tilling on an individual face. You have to edit your UV mapping in your 3d app.

- Is it simply the case that you must use a single UV map and nothing else will work?

1 UV channel per mesh.

- Can a mesh have more than one collider (for example, on one or more submeshes)?

Yes. You can use any combination of primitive colliders and mesh colliders. Mesh colliders should be set to convex if it's for a part piece, and must be 255 triangles or less. for concave objects, you need to combine multiple colliders to approximate the concave shape.

- If only one collider works, is it okay for the model to be more than one mesh (submeshed) or must that also be a single mesh?

Unity doesn't have submeshes. see above for how unity treats mesh objects. you can add multiple mesh objects to a single heirarchy under a game object, but that's not the same as merging or attaching multiple objects in a 3d app like max or maya.

- On a static model, such as a building, does a collider have to be convex?

No. If you are using only primitve colliders, none has to be convex. if you are using mesh collider, one of the two colliding mesh colliders must be convex.

- What's the 'secret' to having a ramp in a model? Splitting faces, solid geometry and nearly a week's worth of experimenting and I still haven't got a working collider on a single model.

a series of over lapping box colliders offset in position and rotation should work for a curved ramp. if a flat ramp, a flat box collider will do.

Edited by nli2work
Link to comment
Share on other sites

Sir, thank you. This is a bit more definitive. A few clarifications, if you can?

"...you can change tiling and offset for the shader that is applied to a mesh object. you can't adjust offset or tilling on an individual face. You have to edit your UV mapping in your 3d app."

Is it correct that as long as you stick to one material per mesh, then it is therefore technically fine to use an individual texture per mesh? I ask, because I am wary of using UV maps on buildings that only need three or four textures. And because I'm not quite ready to get in to learning the intricacies of UV mapping, regardless of the performance benefits.

"...for concave objects, you need to combine multiple colliders to approximate the concave shape."

Presumably this means that primitive colliders can be edited in Unity after they've been assigned to a mesh? Any pointers on moving and sizing primitive colliders in Unity would be useful. I'm probably just missing the obvious in Unity's manual.

EDIT - Learning about creating primitive colliders and editing them in Unity. Answered, ignore :)

"...you can add multiple mesh objects to a single heirarchy under a game object..."

Is this ok in KSP?

EDIT - Nevermind, obviously it must be. Stupid question. Ignore. Left the question for reference and shame :P

"If you are using only primitve colliders, none has to be convex. if you are using mesh collider, one of the two colliding mesh colliders must be convex."

Is it good practice to 'set' a collider to convex even if it is actually convex anyway?

"...a series of over lapping box colliders offset in position and rotation should work for a curved ramp."

See above. Pointers on editing colliders in Unity would be very helpful. Especially how to edit a 6 sided (box) collider to make it irregular/sloped and how to rotate it.

EDIT - 6, not 4. Doh is me.

EDIT 2 - Learning about creating primitive colliders and editing them in Unity. Answered, ignore :)

"...if a flat ramp, a flat box collider will do."

Unity allows a mesh to be just a single face, single-sided. A box collider can be placed on a flat face. Is that ok in KSP? (I am aware this is not good modelling practice.)

By flat box collider do you simply mean, no angled faces on the box?

Edited by AlphaAsh
Link to comment
Share on other sites

- On a static model, such as a building, does a collider have to be convex?

No. If you are using only primitve colliders, none has to be convex. if you are using mesh collider, one of the two colliding mesh colliders must be convex.

- What's the 'secret' to having a ramp in a model? Splitting faces, solid geometry and nearly a week's worth of experimenting and I still haven't got a working collider on a single model.

a series of over lapping box colliders offset in position and rotation should work for a curved ramp. if a flat ramp, a flat box collider will do.

1st point: one of the two ? There is only one.

non convex collider seems to be ok for buildings.

:D for the ramp: model it, set collider to non-convex, you're good !

(my Chalice tower have non convex collider for the bottom with an entrance, kerbals can go inside, and they don't fall on the ground or go trough walls).

@AlphaAsh: you may not go very far if you still asking questions answered before and by not doing your "homework": try, try and retry, before asking.

Link to comment
Share on other sites

@AlphaAsh: you may not go very far if you still asking questions answered before and by not doing your "homework": try, try and retry, before asking.

Chap, after very out-of-date years of experience producing 3D art for games and now many many many hours trying to get up-to-date, it's becoming pretty clear to me that getting my homework right isn't bloody happening (excuse my bad language). Hence questions you may feel I should have answered already by 'retrying'. I have been. Repeatedly.

Link to comment
Share on other sites

1st point: one of the two ? There is only one.

non convex collider seems to be ok for buildings.

yeah for 90% of cases this will be true, e.g. a car with mesh collider colliding with a building with box collider. car does not need to be set to convex. however if you have two cars colliding, both with mesh colliders, one of them has to be set to convex; or one of the is using only primitive colliders.

non convex colliders work for buildings because in almost all cases, the vessel colliding into it has a convex mesh collider, or is using 1 or more primitive colliders.

Link to comment
Share on other sites

Is it correct that as long as you stick to one material per mesh, then it is therefore technically fine to use an individual texture per mesh? I ask, because I am wary of using UV maps on buildings that only need three or four textures. And because I'm not quite ready to get in to learning the intricacies of UV mapping, regardless of the performance benefits.

You have to know UV map and how it works, there's no getting around it. It's how the game engine (or any 3d app) knows what is supposed to happen on each pixel. This is rather complicated to explain because 3d modeling apps work slightly different on the surface than 3d engines. UV coordinates are some times done automatically behind your back in a 3d app like Max... but for game engines, you have to explicitly specify the UV information. Now regarding your question, I assume by "texture" you mean images like jpg, png, tga, bmp..., yes it is technically fine to do one texture per mesh, it is technically fine to break each individual triangle into their own mesh and apply a shader to each. but it would be very difficult to work with a game object with 8 thousand mesh objects each with their own texture. In the end this is something you have to learn through practice to know when to combine and when to break things up.

Unity allows a mesh to be just a single face, single-sided. A box collider can be placed on a flat face. Is that ok in KSP? (I am aware this is not good modelling practice.)

By flat box collider do you simply mean, no angled faces on the box?

Unity comes with few primitive colliders: Box(Cube); Sphere; Capsule. Plus some advanced colliders: Mesh; Wheel; and Terrain.

By box collider, I mean the primitive collider, scaled down so it's a large flat box (like the kind you buy donuts in... mmmm). Performance wise, primitive colliders are the best. Mesh colliders should be used only when necessary for complex and organic shapes.

One thing to keep in mind is Unity is component oriented. components define the behaviour of any game object. The most basic game object in unity is just a simple transform, storing the XYZ; nothing else. You attach a mesh filter component so the game object knows which piece geometry it is assigned. You attach a collider, and rigid body components to give it physics characteristics. You attach a mesh renderer component to make the geometry visible to the game camera.

And yeah, post some screen caps. It's better to learn from specific examples than all this abstract stuff.

Edited by nli2work
Link to comment
Share on other sites

Cheers lads. I'll put a few screenies together of the current version of the simpler model I'm having issues with. Keep in mind this will be the Nth version of the model and that even the most basic of stuff, like the geometry, may be 'wrong' (where in a previous version, it might not have been). I have no issue going all the way back to the modelling if that's what needs to happen.

Back in a bit. And Justin, thank you for being so tolerant. I know I can be a blowhard egomaniac sometimes.

Link to comment
Share on other sites

Hiya, couldn't understand why you'd be having bother with a simple thing like a ramp, I'd never made a standalone ramp, they'd always been attached to other parts, So i threw together a quick and dirty ramp and ran it through unity into ksp loaded it up and the pics below tell the story.

Really cant figure why its not working for you, it's such simple process no different to any other ksp object , create an empty game object because the ramps root transform was wrong, drop the model in as a child, set material, add collider , I used a mesh collider for this one, with convex checked, added part tools to the GameObject and exported to KSP , aside from dragging it to its location, it works a charm.

Edited by SpannerMonkey(smce)
Link to comment
Share on other sites

unityherarchy.png

The gameobject hierarchy.

unitymodel.png

Here's the model.

unityinspector.png

Each mesh has one material.

- This version currently has no colliders as I stripped them all until I have a better idea of where I'm going wrong.

- I have tried colliders on each mesh. I have tried re-importing the model with a single material/mesh and using that as a single collider for the whole model.

The issues that I have had with various versions with different geometry and combinations of collider solutions are: vessels exploding on contact with either verge where it intersects with terrain, vessel explosions at the top of the verge when it intersects with the runway side strips and back, vessel explosions when moving off the strip on to the runway and back. Vessel explosions = generalisation for physics wrongness in KSP. Obviosuly I've made progress with some versions and then ended up two steps back again, otherwise I wouldn't have gotten all these results.

Link to comment
Share on other sites

Looks like I'm done. I simply can't get working colliders on even the most simplest of models. My latest attempts were:

- a 'brick' (one mesh) with a 'roof' (second mesh, flat with two sloped sides). Box collider on the brick. Mesh collider on the roof. Drop the slopes in to terrain. Vehicle went up the slope, acroos the roof, down the other slope, then back up the slope... and at the top of the slope, kaboom. So not even crossing from one collider to another.

- same model, this time with a single mesh collider. Vehicle went ape-**** as soon as it hit the bottom of the slope.

I've no idea what I'm doing wrong, so moving on.

Link to comment
Share on other sites

I tried importing your dae and only one of the "strips" came through. ID18... The problem is probably in your original 3d model.

You have 2 sub-meshes in ID28 object and it's got overlapping faces or vertices in the model... might have been "double-sided" materials, or something else. hard to say what exactly without knowing what 3d app you are using. I hope you are not using google sketchup. If you are, drop it and pick up Blender, free 3d app. Wings3D is a viable option as well, but last I checked it's UV/Texturing tools were a bit skimpy.

overlapping faces, edges, and/or vertices is big no no for real time assets, Unity or not. That's something you have to fix in your mesh before exporting. I suspect this is what's messing up the collision with mesh colliders, I'd be almost certain if your vehicle flips like mad just before exploding.

Link to comment
Share on other sites

Appreciate you looking at it chap, but that's just one bad apple amongst many attempts that don't have any of the issues that does. Also discovered this morning that I've been using an old version of parttools and spent the better part of today tring to get KerbTown to actually render anything produced with the correct version.

EDIT - As for SketchUp, it's the best 3D app I can find that doesn't bury basic features under a pile of pointless features you'll never use, is actually intuitive in how you can move in a scene, doesn't require my arthritic hands to use a middle mouse button (I simply can't) and does actually have the precision you want if you get to know it. DAEs import from SketchUp in to Unity and the hierarchy can be easily re-arranged.

Edited by AlphaAsh
Link to comment
Share on other sites

I tried importing your dae and only one of the "strips" came through. ID18... The problem is probably in your original 3d model.

You have 2 sub-meshes in ID28 object and it's got overlapping faces or vertices in the model... might have been "double-sided" materials, or something else. hard to say what exactly without knowing what 3d app you are using. I hope you are not using google sketchup. If you are, drop it and pick up Blender, free 3d app. Wings3D is a viable option as well, but last I checked it's UV/Texturing tools were a bit skimpy.

overlapping faces, edges, and/or vertices is big no no for real time assets, Unity or not. That's something you have to fix in your mesh before exporting. I suspect this is what's messing up the collision with mesh colliders, I'd be almost certain if your vehicle flips like mad just before exploding.

I should clarify for fear of spamming. I have a number of models without the basic issues in them you describe that still won't accept working colliders. I had hoped parttools 0.23 might be using a different mu format from 0.18 (for up-to-date KSP) but then discovered KerbTown was just showing invisible objects. Now working with parttools 0.20 and back to not getting any working colliders.

EDIT - Now wondering if this is a Unity version issue. Hmmm...

Edited by AlphaAsh
Link to comment
Share on other sites

I'm pretty certain your issues originate in Sketchup. You can try is exporting out to FBX or OBJ instead of DAE. Unity will accept those formats. I don't know if it will really solve anything since the problem really stems from how Sketchup exports. Use the following settings. Never export double-sided faces or edges.

22rR4yu.jpg

I've dealt with sketchup models from 3dwarehouse before and they almost all have the same mesh problems you got... over lapping faces pointing in opposite directions, broken up triangles, and the like. Sketchup is good for simply displaying 3d models and sharing visuals, where the artist don't want to be bothered with things like face normal directions, and UV mapping and channels, but for a game engine it's usually a mess. if FBX or OBJ are still problematic with mesh colliders you'll have to stick with primitive colliders.

Edited by nli2work
Link to comment
Share on other sites

Interesting. I'll certainly try those settings on the export. FBX isn't an option as I don't have near $600 handy :D My wife is taking a look at Blender since she has a 3D printer she wants to play with and I hope to persuade her to filter my DAEs through that to FBX.

Link to comment
Share on other sites

Yup, looks like most of my problems stemmed down to SketchUp's DAE exporter. Once the DAE is converted to FBX in Blender, Unity is muuuuch happier with it and pretty much every model I've been churning out these last two weeks is merrily working in KSP. So nice call nil2work. I'm just too stubborn for my own good apparently.

Link to comment
Share on other sites

good to hear things are working smooth! DAE exports will probably work fine, I'm pretty sure it's the Two-Sided Faces and Edge exports is the root of the problem, so just make sure those are not exported.

Link to comment
Share on other sites

Two-sided faces was causing issues. I've tried exporting from Sketchup without edges and/or hidden geometry and it b0rks the model in Blender. They've not caused issues in Unity once converted through Blender to FBX.

Two materials on a mesh is still happening but can be easily fixed in Unity with no side effects. My collider issues seem to be mostly caused by two things: edges that are too long; open geometry (or flat as I prefer to call them) mesh colliders (or primitive colliders).

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