#1
7th Apr 2006 at 5:41 AM
Last edited by tiggerypum : 12th Apr 2006 at
7:33 AM.
Body Meshing: How to use Blender
Well I started making my first body mesh, and I hated the idea of using milkshape since its basicly worthless as a modeler (a great tool for format conversion though). Being oblivious to this whole body meshing thing a couple days ago I started making a body mesh in blender, spent hours at it, only to find out that I couldnt bring it in with mesh tool
. So I tried the approach with XSI Mod tool but the normals got jacked up even when I fused up all the seams and I didn't like the prospect of adding more geometry to fix the visual issues. So back to blender, heres how you can do it.
First grab my new obj import script, its short so I will just paste it here
Code:
#!BPY
"""
Name: 'Simple vert order (.obj)...'
Blender: 237
Group: 'Import'
Tooltip: 'Load a Wavefront OBJ File, Retain vertex order.'
"""
__author__ = "Campbell Barton, Minor hack by Entelin"
__url__ = ["blender", "elysiun"]
__version__ = "1.0"
__bpydoc__ = """\
This script imports OBJ files to Blender retaining vertex order.
It will only import vert's and face's nothing else.
Usage:
Run this script from "File->Import" menu and then load the desired OBJ file.
"""
import Blender
def import_obj(path):
Blender.Window.WaitCursor(1)
name = path.split('\\')[-1].split('/')[-1]
mesh = Blender.NMesh.New( name ) # create a new mesh
# parse the file
file = open(path, 'r')
for line in file.readlines():
words = line.split()
if len(words) == 0 or words[0].startswith('#'):
pass
elif words[0] == 'v':
x, y, z = float(words[1]), float(words[2]), float(words[3])
mesh.verts.append(Blender.NMesh.Vert(x, y, z))
elif words[0] == 'f':
faceVertList = []
for faceIdx in words[1:]:
#faceVert = mesh.verts[int(faceIdx)-1]
faceVert = mesh.verts[int(faceIdx.split('/')[0])-1]
faceVertList.append(faceVert)
newFace = Blender.NMesh.Face(faceVertList)
mesh.addFace(newFace)
# link the mesh to a new object
ob = Blender.Object.New('Mesh', name)
ob.link(mesh) # tell the object to use the mesh we just made
scn = Blender.Scene.GetCurrent()
for o in scn.getChildren():
o.sel = 0
scn.link(ob) # link the object to the current scene
ob.sel= 1
ob.Layers = scn.Layers
Blender.Window.WaitCursor(0)
Blender.Window.RedrawAll()
Blender.Window.FileSelector(import_obj, 'Import')
(^^^^ Why is this double spacing my code? ^^^^)
Put that in notepad and save it as objov_import.py and put it in your blender scripts folder. Fire up blender and you will see it in your import menu as "Simple vert order (.obj)..."
Ok heres what we need to do..
1. Open blender and delete the default square to get it out of the way.
2. Using that import plugin import the ??????gmdc.obj file you extracted from simpe. It should load it fine. Note my plugin only loads verts and faces, no normals or anything else, thats fine we will get them back later.
3. Edit it however you wish, like in milkshape you may not add new points, just move them around.
4. Export it back to .obj using blenders default exporter for obj. Deselect all of the options under the "Mesh Options" section, especially the top one "apply modifiers" unless you know you specificly want it.
5. open up your origonal ?????gmdc.obj file you got from
SimPE and make a copy of it called something like ????gmdc-footer.obj edit this file in notepad delete every v line the ones that look like this v 0.579892 0.058699 1.045849 do not delete the vn's vt's etc, its easy to do as they always appear together. Save it.
6. open up your new .obj file you exported from blender and copy all of it's v lines and paste them into your ????gmdc.obj file at the top where you had gotten rid of it's v lines. We are just replacing the new verticies with the others here. Save it.
7. open it up in mesh tool as usual, make the .5gd and replace it like normal in your mesh package in simpe.
Notes: I have done little testing, but it should work, the problem with using blender before was simply that upon importing the mesh it would not retain the vertex order. This is not because its a "cheap program" it's because "you cant support smooth groups, low context switching for materials etc AND ordered verts." Quoted from the official obj plugin maintainer.
Since we are using the origonal normals and such the lighting on your new model will be just as good as the origonal, you dont have to worry about the seams and all that. Of course this does limit you to the same restrictions in modeling that milkshape does since we are basicly doing the same thing.
I was following the tutorial at
http://www.modthesims2.com/showthread.php?t=141997 for everything else.
So now finally I will go and make the mesh I wanted.....