KatsBits Community

Block Primitives instead of Planes

ellisgl · 16 · 16063

0 Members and 1 Guest are viewing this topic.

Offline ellisgl

  • Newbie
    • Posts: 9
So I've created some simple items in SketchUp, exported the file as a COLLADA file, imported them into blender, converted faces to quad then export as a Qauke Map. The problem I'm having is that it's not exporting as "block primitives" and exporting as planes. Having 6 polys for a single block is annoying to work with. How do I get around this issue?


Offline kat

  • Administrator
  • Hero Member
  • *
    • Posts: 2692
    • KatsBits
That sounds like you've not 'Rem Doubled' the mesh before export. You need to make sure you do this otherwise yes, it'll export a series of panels rather than blocks. In Edit mode, select a face and move it, if it moves independent of other faces around it then you know it's detached and you need to Select All and "Remove Doubles". Have a read through of this if you've not already done so - making a simple map in Blender. Also, make sure your 'blocks' are all closed (solid and without any wholes) meshes otherwise those too will export as panels.


Offline ellisgl

  • Newbie
    • Posts: 9
The remove doubles work on my cube, but I have a hexagonal column that isn't wanting to play well. I can't find any "holes" in the columns. http://houseofellis.net/misc/netfire.blend


Offline kat

  • Administrator
  • Hero Member
  • *
    • Posts: 2692
    • KatsBits
OK.. yeah, you can't really make objects like that and have them export correctly out from Blender. First your hex shapes are relatively small, second they're off-grid and third they're rotated at slight angles. All that adds up to the problems you're having because the *.map format doesn't have the accuracy you need to represent those types of objects as brush volumes.

So... when you make that in SketchUp or you import it into Blender you're going to need to make quite a few adjustments to make sure it conforms to what the format needs - make sure the hex is on-grid and rotated properly to suit (this means the major sides must align to the grid).

If none of that works, export the mesh as a model. By the way, it's suggested you use the reference blocks, your table is a little small and using the scale value could be a bit tricky to use due to the objects non-scaled size.

Table in Blender


Resulting brushwork in GtkRadiant



Offline kat

  • Administrator
  • Hero Member
  • *
    • Posts: 2692
    • KatsBits
Not too sure about Hammer but ideally you want to avoid using use snap increments that small, again because of brush accuracy issues, generally speaking you want your objects to be blocks that are as large as possible to reduce the amount of map data that gets generated in BSP - using a lot of small objects eats into BSP like crazy so items like your table should really be models rather than brushwork. So if you were modeling a building use a larger snap value than if you were meshing up furniture, that ensures you're building optimally from the get-go.


Offline ellisgl

  • Newbie
    • Posts: 9
Well I'm using SketchUp to get the big stuff out of the way. I'm using Quark for my editor and it can be a pain / slow down in some instances.

As for the table being a model, I was having some issues exporting as an md3. Something about the keyframe not being set, then I set that and it gave me some other issues. I found this: http://cube.wikispaces.com/MD3+Export+From+Blender+Tutorial . I'll have to **** around some more tomorrow.


Offline kat

  • Administrator
  • Hero Member
  • *
    • Posts: 2692
    • KatsBits
What version of Blender are you using? That's an old tutorial so you'll probably need to drop back to that one (2.45) to get the most from that process - iirc you'll need to set at least a single frame for export otherwise the process can't produce a full MD3. Does Quark support other formats? ASE?


Offline ellisgl

  • Newbie
    • Posts: 9
I'm using 2.36 and yes Quark can do ASE models. So I'll try that out.


Offline ellisgl

  • Newbie
    • Posts: 9
Quick question, is there a script that will take all everything that is selected and convert to quad and remove doubles? Doing each one by hands is a pita.


Offline kat

  • Administrator
  • Hero Member
  • *
    • Posts: 2692
    • KatsBits
Both re-Quading and RemDoubs have to be done in Edit mode because of the way Blender works so the only way to do it on everything in one go would be to join all your meshes together (which you want to avoid really), or at least join objects belonging to the same item - the table top and legs joined together for example. So in a word, no, or at least not that I'm aware.


Offline ellisgl

  • Newbie
    • Posts: 9
So the next question is could it be scripted with the Python?
Loop through each selected object, select it, switch to edit mode, select all vertex, run tri 2 quads and then remove doubles?


Offline kat

  • Administrator
  • Hero Member
  • *
    • Posts: 2692
    • KatsBits
The principle is basically a batch command parsing a couple of functions so in theory it's possible. However, as you'd be dealing with datablocks at different levels - 'Object' datablock select, mode switch, function execute - it may be more complex to script up than one would expect.

Keep in mind that converting Tris to Quads doesn't always product optimal results when done automatically, the formation of Quads is based on the way tris are orientated to each other which can result in defunct Quads, so you always need to check meshes for that any way.


Offline ellisgl

  • Newbie
    • Posts: 9
Here's what I came up with:
Code: [Select]
import bpy

#Make sure we are in Object Mode
bpy.ops.object.mode_set(mode='OBJECT')

#Loop through selected objects
for obj in bpy.context.selected_objects:
    #If the object is a mesh
    if obj.type == 'MESH':
        bpy.context.scene.objects.active = obj
        bpy.ops.object.editmode_toggle()
        bpy.ops.mesh.select_all(action = 'SELECT')
        bpy.ops.mesh.tris_convert_to_quads()
        bpy.ops.mesh.remove_doubles()
        bpy.ops.object.editmode_toggle()

bpy.ops.object.select_all(action = 'SELECT')


Offline kat

  • Administrator
  • Hero Member
  • *
    • Posts: 2692
    • KatsBits
Simple bit of genius that ;)

Saved as a *.py file, loaded into the Text Editor and run with Alt+P.

From a practical point of view you might want to include a simple yes/no/all confirmation just in case you have situations where you don't want to convert everything in the scene. Other than that, Smoothing is kept where the Edge Split modifier is in place and edges marked so that's good.