Search Unity

Blender Modeling Question

Discussion in 'Asset Importing & Exporting' started by Maker16, May 11, 2009.

  1. Maker16

    Maker16

    Joined:
    Mar 4, 2009
    Posts:
    779
    I'm fairly new to Blender, and I've posted this question on Blenderartitst.org, but I don't know how fast the turnaround time is there.

    I have a model of a starcraft hull completed. Now what I need to do is cut away a section of the sides of the hull so that I can use them as bay doors. The idea is, when they are closed, the hull looks normal. But then they can open up, and there is a cavity inside. I know how to create the interior portion of the bay. I just need to know how to cut away the part of the hull I need to make it into an animateable door.

    I think it has to be a boolean operation, like intersect. Assuming the interior portion of the bay doors is just going to be flat, would I just use a cube scaled to match the length and height of the door and use that in an intersection operation? I think that would result in the door segment. If so, could I just then take the door segment back to my original hull and do a difference operation. That would cut the hole into the hull, right, then I could just use the result of the intersection and the hull after the difference operation together.

    Am I on the right track, or am I making it a lot harder than it needs to be?
     
  2. GusM

    GusM

    Joined:
    Aug 27, 2005
    Posts:
    585
    I would not use boolean operations for a game model, as they usually give you not optimized geometry. You would better do it all by hand, modifying the topology of the main mesh and extruding/cutting from there.
     
  3. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    I agree with Gus. I'd go so far as to say that Booleans are useless unless you are dealing with voxels. Even though the Boolean modifier is nicer than just an operation firing, you'd be better off forgetting about them until Blender has voxel support.

    Anyway, a model or concept drawing is worth a million words in this case. Got something to show that you want advice on in particular?
     
  4. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    I've had pretty good luck using the boolean modifier in Blender, but I use it for fairly simple stuff, like cutting a cylindrical hole in fairly simple model. I'm also careful to use meshes that have "compatible" faces (hard to explain, but hopefully you know what I'm saying). I sometimes have to clean up the vertex positions, but overall it's been easier and faster than building it from scratch.
     
  5. Alvarus

    Alvarus

    Joined:
    Apr 10, 2009
    Posts:
    203
    For the sake of simplicity I'm assuming you want to put a hangar door in a Borg cube.

    1) I would place a rectangle over the face where the doors should be, then join the meshes by selecting both meshes and pressing ctrl-j.

    2) Then I would delete the face(s) of the ship section where the door will appear (select the vertices in edit mode, press "x", then select "faces" from the menu that appears). The result is shown in 3.

    4) Then I would create connecting faces by selecting four vertices at a time (Blender will triangulate later) and pressing "f". Do this for all four sides of your door.

    Then select the original door mesh vertices and press "p" to separate the selected vertices; you can use that as your door. Result is shown in 5, where I rotated the new door down.
     

    Attached Files:

  6. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    That's a good tutorial, except, instead of "drawing" that rectangle, I would just use the extrude tool on one face of the cube, but just hit Enter immediately afterwards. Then you can scale the new face.

    Although this is modo, not Blender, I have found Son Kim's method in this thread to be much more reliable than using a Boolean.

    http://forums.luxology.com/discussion/topic.aspx?id=30570&show=&page=0

    The only thing that I don't think translates directly to Blender is the "inset" bevel. I just use Knife Subdivide instead. If you know of a way to do an actual inset bevel in Blender, please let me know.
     
  7. Maker16

    Maker16

    Joined:
    Mar 4, 2009
    Posts:
    779
    Yeah, I discovered that shortcomings of the boolean operations pretty quickly. I suppose I could have worked on repositioning the vertices and such, but that was taking a little longer than I wanted.

    I wish I'd checked back here sooner, though, to get the simpler procedure you laid out. I will definitely use that in the future. What I ended up doing was just making a copy of my ship and selecting the same faces that were to become the door. On one of the meshes, I inverted the selection and deleted, leaving me with the door segment. On the other, I cut out the hole for the door.

    Now I'm going to create the interior of the bay, but the bit about joining two meshes together...I wasn't aware of that, so that'll come in handy for that part.

    Thank you guys for your advice. I'm actually picking up modeling fairly quickly (surprisingly enough), but there are a lot of things I'm stiull doing the hard way.
     
  8. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    Definitely make good use of combining meshes whenever possible. It's a little more difficult to deal with outside of Unity, but using a lower number of meshes with larger vertex count, as opposed to many small-count meshes, generally improves game performance. (You can search the forums for "draw calls" to learn more about that.)
     
  9. Maker16

    Maker16

    Joined:
    Mar 4, 2009
    Posts:
    779
    Is it safe to say it would be good practice to combine meshes of any objects that will never move independently of each other? I have the engine array as separate from the hull for the purposes of a very basic, rudimentary damage model. That way, the engines could be destroyed while the hull is still intact. If there is a better way of doing it with the mehses joined together, I'd be interested in learning about it.
     
  10. Maker16

    Maker16

    Joined:
    Mar 4, 2009
    Posts:
    779
    Here's a new issue, carrying on from the last step we've been discussing. Currently, I have cut the bay door panels away from the hull. The hull has a subsurf modifier on it, and so must the bay doors (so they fit seamlessly with the hull when they are closed). If I extrude the doors to give them some depth, the modifier recalculates the subsurf independent of the hull, and the doors will no longer fit seamlessly with the hull.

    How would I go about keeping the subsurf modifier on the doors, so that they still line up with the hull of the ship, but give the doors depth without affecting the exterior subsurfacing of the doors.

    I tried a handful of different approaches, none of which panned out. As I'm typing this, I'm wondering if I need to first extrude the interior portion of the door faces, THEN cut that section away from the hull. I don't know. I know I am making this as clear as mud, and if I was at home, I'd post screenies, but I'm not, so I can't.
     
  11. Alvarus

    Alvarus

    Joined:
    Apr 10, 2009
    Posts:
    203
    I can see how the subsurf modifier would throw a wrench into the works. But I kind of doubt Unity will import a subsurfed mesh because that is a blender function. It probably applies the subsurf to the model and imports that.

    If you're okay with the poly count, before you cut out the door, apply the subsurf to the model manually. You'll lose the low poly version of your model, though.
     
  12. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    All of your problems can be solved with the magical Crease function! You can access it via Shift-E (Edit -> Edges -> Subsurf Crease), but I prefer using N for "Transform Properties", and using the slider at the bottom of that floating panel. Exactly what you will need to crease will depend on your model. Feel free to post your .blend, and I'll edit it for you, if you can't figure it out yourself.

    Without seeing your mesh, I'm going to guess that you can fix the problem by selecting a single edge loop on the door (the one that has vertices that share their position with those of the hole in the ship), and setting the Crease value to 1.

    It does. But how is that any different in practice? You shouldn't need the easy-to-work-with topology when you're in Unity. It would be nice, if you wanted to perform scripting operations on the control verts from Blender, but you can always use your own SubSurf script in Unity. I am pretty impressed with this importing operation, actually! :D

    I do not recommend this procedure, given how nicely the modifiers translate to Unity!
     
  13. Alvarus

    Alvarus

    Joined:
    Apr 10, 2009
    Posts:
    203
    Hmmm, crease is a pretty cool little function. Never heard of that one.
     
  14. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    Crease in somewhat unnecessary if you don't care about vertex count, because you can achieve the same results with a couple more edge loops. But creasing is much more economical for game usage. I also prefer it in general, because of the reduced amount of control vertices to worry about. However, I've heard that people who actually model for industrial design have problems with creases. Fortunately, nothing I make actually has to function in the real world!
     
  15. Maker16

    Maker16

    Joined:
    Mar 4, 2009
    Posts:
    779
    Thanks for the tips, Jessy. I will give creasing a shot tonight. If I can't get it done, I probably will let you get your hands on the model because 3 hours just to try to get past this point was more than I was happy to spend.
     
  16. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    Hey, spending a lot of time messing around, without apparent results, is something I think we all do when we're new at things. It may not be as rewarding as producing a model quickly, but that isn't wasted time, either. I'm sure your familiarity with something was increased in those hours.

    That said, I don't recommend just stumbling blindly, either!
    http://wiki.blender.org/index.php/Doc:Manual/Modifiers/Mesh/Subsurf
     
  17. Maker16

    Maker16

    Joined:
    Mar 4, 2009
    Posts:
    779
    Yeah. I can appreciate the aspect of knowledge that is achieved by trying to solve something different ways, but, after a point, it just gets damned frustrating. :)

    So, I tried the creasing thing, and I could see how that might work, but I keep getting results other than what I expect. I suspect I am not selecting the correst edges.

    Here is the ship .blend file. I took out everything except the hull and the bay doors that I am working on. The intact hull, with nothing cut away is on the last layer as a back up. The working hull is on layer 1, doors on layer 2.

    Again, I just need to give the doors some depth. Extruding them to give them some thickness was the original plan. The hull and the doors have subsurf mod (2) and, as they are right now, the hull looks completely seamless when the doors would be in the closed position. They need to remain seamless after the doors have been extruded a bit.

    Any help you can offer would be GREATLY appreciated, if you have the time. If you do get it worked out, I'd also like to know the steps to get it done for future reference.
     

    Attached Files:

  18. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    Okay. First. TOO MANY POLYGONS!!! :eek: :D

    The whole idea of using the Subsurf modifier is that you don't use so many vertices to control the shape of something. Keep it easy on yourself!

    Let me know if this is what you wanted. I moved the result of "fixing" one door to layer 3.

    1. Select all faces of a door.
    2. Hit E and select "Region"
    3. Hit X 3 times to get to global X and use what value you like. (I picked 0.2)
    4. Select the edge loop that defined the silhouette of what you had before you extruded.
    5. Set its weight to 1.

    If you enable "Show Creases" in "Mesh Tools More", you can see the edge that I creased.
     

    Attached Files:

  19. Maker16

    Maker16

    Joined:
    Mar 4, 2009
    Posts:
    779
    First of all, thank you for working on that. I know you have your own stuff to be doing, so it is greatly appreciated. I'll check it out when I get home.

    Secondly, I thought the poly count on it was low. It's 5K, or something like that. Maybe I'm not looking at the right numbers. Is there anyway to reduce the number short of manually deleting verticies and reforming faces? I want to say I read somewhere there is a tool that will handle that, but I don't remember.
     
  20. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    The poly count is low before you use subsurf (which increases the count 4 times each level you go up). But for the shape of your ship, you can probably use about 1/10th as many polygons and not notice a difference. At subsurf level 2, that would amount to about 75,000 polys saved!!!! As it is, your mesh has so many vertices, that Unity can't even import it! (limit = 65,536 verts)

    You can use the Decimate modifier, but that triangulates things. You would be better off just selecting unimportant edge loops and deleting them. (Delete the LOOP and not the EDGE, to avoid having to manually recreate the faces.)

    If you're going to be using subsurf on a model, keep subsurf on the whole time. Only add the verts that you need. As it is, your model looks like you did that, but then applied a subsurf modifier, and then ran another subsurf modifier on top of that! It looks really smooth, sure, but it won't work for a game!
     
  21. Maker16

    Maker16

    Joined:
    Mar 4, 2009
    Posts:
    779
    Well, it's a learning process. Hopefully I can drop the vert count enough. I have been meaning to ask about a limit on what Unity can import, and now I know. I'm really not against just taking the subsurf off the model completely. Smooth is aesthetically pleasing, but I wasn't really hanging my hat on it. Maybe I can find a good enough balance.
     
  22. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    Another modifier that you should look into is the Edge Split. That will allow you to get nice hard edges, also, but it will only be a shading trick, as opposed to actual geometry creasing. (You mark edges as "Sharp" with this.) If you don't make use of creases and "sharp" edges, this may lead to you using too many edge loops, when subdivision modeling.
     
  23. Maker16

    Maker16

    Joined:
    Mar 4, 2009
    Posts:
    779
    It looks great, Jessy. I just had to tweak the edges a little more to get them to blend with the main hull more, but it was a great start. I really appreciate your help. The step by steps helped me a lot too. I just don't get things by reading or watching. I have to do it to understand it. Now it seems so simplistic. :roll:

    Maybe you can help with a few more questions. I am reading through the manual, but the damned hyperlinks in there keep distracting me from what I'm trying to learn (I swear I have ADD). In another thread, someone pointed me to a link on normal mapping in Blender (it links to the manual).

    I have an asteroid model that is pretty heavy on the polygons because I want it detailed close up (geometry-wise). Someone suggested I use normal mapping to get some detail (which works fine for general surface stuff, and probably will even be good for smaller craters). The mid to large craters, however, need actual geometry to get shadowed correctly as the rock rotates...I think.

    Anyway, I'm using displacement maps to form my craters, but anything less than 5 subsurf levels results in poor cratering. I read in the manual that displacement maps like smooth surfaces, and that is evident. So, how would you suggest I get good looking craters without having to do so many subsurf levels? Am I going to have to do them manually? My only thought is to create some cookie-cutter shapes and use boolean difference operations to cut out the craters.

    In the same vein, what is the difference between displacement textures and the displacement modifier?
     
  24. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    If you want self-shadowing, that's true. I only have Unity Indie, so I'm not allowed to have that kind of fun! :cry:

    Instead of using the Subsurf modifier, use Multires. Turn that up to level 5, bake a normal map, and then go back down to level 1 and save, for Unity use. You'll get lots of jagged-looking junk, but it will only be a lighting trick. That's just the state of technology for now, but it should still look great if you're not focusing on the silhouettes of things.

    You use a displacement texture in the Displacement modifier. However, as far as I can tell, you can achieve the same results by working with the material settings. If someone knows if there is a difference, or why the same functionality exists in two places, I'd love to learn that info.
     
  25. Maker16

    Maker16

    Joined:
    Mar 4, 2009
    Posts:
    779
    Ok, Jessy. Next question. I am trying to bake normal maps. The problem is, there are 2 or three different methods on the net regarding how to do this in Blender. In the manual, it states you don't even have to unwrap the mesh to do it??? That doesn't make sense, and I can't find a workflow that involves that methods.

    What I am currently trying in creating hi poly and low poly versions. Unwrap hi poly, and then bake AO (because, apparently, you have to do that first). Then I will bake normals. After that, do I need to unwrap my lo poly model? Or can I just apply the normal map to it?

    And how long is it supposed to take to bake anything??? Granted, I have something like 96K polys. My quad core is pushed to the limit and it's still taking a very long time. Also, when you create a new image in UV Editor window, what is a good size? It defaults to 1024X1024, so I left it on that.
     
  26. Jessy

    Jessy

    Joined:
    Jun 7, 2007
    Posts:
    7,325
    If you search for "Applying High-Res Normal to a Low-Res Mesh" on this page, you'll find a concise but basically perfect 9-step process.

    http://wiki.blender.org/index.php/Doc:Manual/Render/Bake

    You may need to invert the red and green channels of your image. I'm still learning whether or not that is always the case between Blender -> Unity, using the default bumped shaders, but I suspect it is. Give this method a shot, and tell me if you get hung up somewhere.

    As for baking time, It's mainly dependent on geometry and texture resolution. I only have a dual-core machine, and I'd like it to be faster, but it hasn't been what I'd call ridiculous (except for the cases where I tried such high poly counts that baking was impossible, and crashed Blender! :oops: :D ) Make sure you're not setting Multires or the Subsurf modifier to a Render level that is much higher than what you're working with in the scene. Otherwise, you're asking for trouble.

    ...and, wow. I didn't even realize until now that you were the person I was helping out in the other thread. This crazy week has really gotten to me, I guess! :eek:

    Also, it turns out (I think) that the Displacement modifier is basically there to give you a real-time way to see the displacement textures in action, as opposed to only in renders. I'm just a lowly Unity iPhone guy! Thanks for forcing me to get more familiar with this high-res stuff, because there hasn't been a way for me to take advantage of it in my own recent work. 8)