Sei sulla pagina 1di 19

model_game_building

software blender 2.49


unity 3d 2.61
neoaxis indie (non-commercial will work also) 0.91
photoshop 3, paint dot net for textures.

game buildings are different from sketchup-type buildings that


are made for rendering only. They're made from triangles, in games
there are few wasted triangles.

Batt

Sketchup type buildings tend to


triangulate very messy.

unfortunately this battlefield 2 building songhu level,


got horribly cheesed on its capture by dx ripper.
It's simple enough
so we can reconstruct it.

Dx ripper now saves as .obj file (sometimes) so you don't need 3ds max
anymore. You can also try saving with 3dvia printscreen, which you
can convert online to DAE format or offline with 3ds max 9 and a
script. These game files can be huge and crash 3ds max though.

1st thing is to spacebar add plane (we'll do the stairs) skey


xkey ykey,shift-d duplicate,
rotate duplicate vertical, use snap to closest vertex in edit mode
doesn't seem to work in object mode. select 1 plane then shift-select
the other , CTRL-J join,

now you have a 2 plane object, go edit mode,


Akey, select all, UKEY cubic uv projection, add a texture, now
shift d it again, snap in edit mode,
CTRL-J all the stairs together.
now make 5 more, shift-d object mode, gkey z and y to move it
where it should go, then in edit mode GKEY and SHIFT to snap it to
the last one. SHIFT select all the stairs and CTRL-J join, in edit mode akey all the verts and rem_doubles
with a tiny limit of .018 or
so.

scale the
stairs like the target stairs.

Yes I've heard of the array modifier, don't want to relearn it, maybe
later.

Next ekey this vertice in y direction, make sure you go GKEY if


you don't get it under the top of the stairs in 1 go, then go
FKEY to make the other edge.

Next make the stair triangles, and the


2 big triangles, ukey project from view. Do I need to make these
other triangles?

I noticed some game engines (like Unreal) have unconnected geometry


like handles sticking into pots, but I've always heard that all
triangles should be connected to each other with welded (rem doubles) verts. These
are easy to make so I'll make them, only thing that matters is
whether your game engine will render them fast without visual glitches.
to leave these triangles off might cause a rendering glitch, while
sticking handles inside pots shouldn't. So making the big triangles
was stupid,

I deletekey them 'only faces' then delete the upper edges.


Next it looks like a good idea to extrude edges out of the stairs
in a floor plan then extrude up.

Caption says extrude faces, but it should be extrude edges.

select the back ground stair vertex ekey in x,

go all around, get


a screenshot of the source building on a 2nd monitor, or even better,
a 2nd copy of blender with your source building in it.

Yorik has a tutorial on how to snap to a DXF floor plan.


You can go view/properties/grid and set the spacing from 1 to .1 (smallest)
lines, 100, divisions 20 if you need more accuracy.
somehow the floor plan was off z=0,there's a command in yorik's tut
on how to snap to the z-zero, don't remember offhand. once you
connect with the other end of the stairs,

rem doubles, select


edges and ekey zkey the edges up to the top of the stairs.
I just noticed the end shed thing is just crammed onto the building,
oh, well, I raise the 1st floor walls.

Now I make another edge to


raise the real end wall from. Next the ends of the roofs,
then the dock,

then I subdivide the other side edge and extrude to


make the other dock,

underneath is a hiding place so it has to have


thickness 'ekey extrude region (when you have 2 faces selected)

zkey
down.

odd, now there's no top to the 2nd dock thingy. verts and fkey here.
A good time to make the 2nd stairs, using 2 planes.

Then just get an ortho view and shift-d gkey move with x axis locked
shift-x and copy. Use array if you need Cad precision.

Most of these game models use a


texture atlas, a checkerboard of 128 or 256 squares. Problem is
you don't know how many textures or what size any one building will need.

here's a couple from multiverse, can't load the ogre mesh file for
it though.

Here's one i did octagon_atlas.jpg

this will do for now.

I'll wait until it's finished and all joined together before I texture.

watch extrusions, they make extra polys, delete them.

and the edges


that go with them.
then mesh edge subdivide
and move the resulting vertex in line with the other one. I extruded the walls in this order,

later might have to


add some polys if rendering glitches result.

I select all faces and ctrl -t convert to triangles,

the
roof ends needs them.

I delete the corner triangles

then extrude this rafter business

gkey with snap (the magnet icon and 'vertex') Snap menu SHIFT-s
and ctrl held down snaps vertex to nearest vertex.

make it like this, delete any interior polys, and fkey make the
long triangle sides.

select the rafter assembly and shift-d duplicate ,gkey in y move it to the
other end, in a top view get the 3d cursor in its center make sure
3d cursor is the selected pivot and rkey rotate
zkey using ctrl to snap to 5 degrees (this didn't work though) and
rotate it 180 if you can . oops, the building is too long.

select the
building end in wireframe mode get 2 views so you have the right polys
and gkey ykey so it fits the rafter. now the other end, I need some
quads here so I alt j make quads out of tris,

select 3 horizontal edges


go mesh/edge/loop subdivide,

move the resulting pink vert edge where it says. extrude the wall towards the inside of the building then
build the missing faces. select the top roofend poly edges and
edge loop subdivide again,

ctrl-t convert to tris the end one

and delete the unncecessary triangle, go mesh, edges, rotate edge CCW if you need to first.

extrude_vert_zkey, then make a face


now extrude zkey the inner part.
extrude the back wall, be deleteing unseen polys as you go.

Just as a personal note I really hate the shades of pink and purple
blender uses, I wish I could change them, I think you can in Blender
2.5, which has an equally ugly orange.

Now some pictures with no explanation, too busy modeling


select rafter things and shift-d gkey xkey them to the other roof

make quads out of the roof ends

-I know the caption says 'tris' but I mean 'quads'-


and edge loop subdivide to get a
center line. Extrude a vertex up and then over for the ridge line.

roof peaks must lie along the same line!

I just noticed the ceiling has many polys.

My ceiling has just 6, hm...ceiling done, my next thought is to


make 3 planes for the roof, there's 1 plane that going down the
ridge that has some extruding to do. then extrude the fascia, which
are the vertical sides of a roof to meet the ceiling.

K, for the roof top I extrude out the ends in x sides in y,

move
the sides to match the roof slope, then ekey zkey the thickness

roof top is 4 faces, have to add more if there are rendering errors
for the end shed roof, spacebar add mesh plane, scale move I had to
hit CTRL-A apply size and rotation before I could scale it. I couldn't
rotate it! (I accidentally checked 'rotate object centers only')

So if I did it over I'd just extrude an edge, then


extrude the sides, fill the face, and scale it out . It looks like
the battle 2 roof, but I'm not sure if 3d ripper got the model
out of battle 2 right. 1 thing I may do later is 'damage' move a few
verts so it's not all right angles, most buildings get damaged and
out of plumb after a while, especially in a war!

K, now for the texturing, a really boring part. Note: later I had to change the texture into long strips,
MEASURE your polys, THEN make the texture!

I start with the


roof, most of this building is a cube. I pick faces in solid mode as
it is hard to see what I've picked in textured move., UKEY 'project
from view'

or 'cubic projection'. Do the largest faces, like the


end roof will have to be resized to match the large roof texture
scale. The texture atlas will have to be altered also.
shingles are too large, on the texture atlas I'll put in a 2x denser
batch of shingles.

uv editor has same controls as 3d view akey select all, gkey move
skey scale in xkey or ykey Make sure you're NOT in 3d view when you mean to move UV's, your polys will
get moved or scaled.g

go image/replace if you can't change a previously assigned set of faces to your texture.

I mesh edge subdivided here to shorten the triangles, they were too
long.

HANDy navigation keys are 1key, CTRL-1Key (on the numeric keypad with
NUMLOCK on) 3key ctrl-3key, 7key ctrl-7 key, the 6 basic views.
K I found a few game bldg textures, they make the textures fit the polys,
like the roof is long...I need long skinny ones that tile on the horizontal.

And I don't have any, have to go to cgtextures,


Use of the Textures is only allowed under the following conditions:
- Private or commercial use
- Use in 2D or 3D computer graphics, movies and printed media
- Incorporation in computer games, 3D models
- Selling 3D models bundled with modified versions of the textures
EXCEPT UNDER these conditions, so maybe I can use them, they all need work though.
Long story short, I made a new texture with long strips, note you can go off
either edge of the long strips with a poly's uvs and it will still texture.

Battlefield 2 has a clever idea for its Karkand level city buildings, there are 2 parts to each
building, the basic masses that need walls only, and the 'trim' which is pipes,
windows, doors, signs, air conditioners, easier to texture. Their building
textures are long and skinny, like 128wide x1024 down

If you can't rotate anything..


you most likely pressed the "Move Object Centers Only" button in the 3D header; three dots and a double
arrow

K here's how to get textures to appear in your blender render, this is for
a 1 -texture mesh
select your mesh in object mode, go F5 buttons menu,

there are 3 menus by


pressing f5, you want the one that says links and pipeline link to object
type in 'hut_mat' if your object is called 'hut' in f9 buttons menu. way off to the right, hit NUMKEY minus to
zoom out hit map input UV! default is 'ORCO'

Then load a 'TEX" IMAGE in the f6 buttons menu

Next in 3d view hit spacebar add camera and some lights, move them around,
go VIEW/Camera, hit F12 for a render window, in F10 buttons menu render
settings you can change the size to 50 percent for a quicker render,

f10 render menu , f12 renders

and change the output from jpg to tga There's also Yafaray, which makes better renders and is free, but I
could'nt figure it out. And luxrender. Hit f3 to save the render.

Blender material repository-


http://matrep.parastudios.de/index.php?p=7
Many materials here- but you have to spacebar ADD a camera and some lights, 1 light anyway to see the
texture in the render window.
No, they don't tile like cgtextures!

Quoting from 'lightmaps_in_blender.zip' at http://terrymorgan.net/sitemap.html


Next the lightmap, (actually ambient occlusion, 'full render didn't work this time around) no game building is
complete without one.
Briefly add lights and a camera to see if the lights look any good, read the
zip file for details

* In Object Mode select all of the meshes - SHIFT-RMB


* Join the meshes together - CTRL-JKEY.(this is already done in this mesh)
Next go to the edit mode F9 and add a new uv tex layer 'lightmap'

It's highlighted in pink

Go to the UV/image menu and image/new/256x256/OK, named hut_lmap


UKEY unwrap smart projections, in uv/image make sure 'hut_lmap' is your image

a 1024 takes 3 minutes to render, use 256 until you like the lightmap.

it will be all black at this point.


Now save this image, just type the 'hut_lmap' it will make a tga file.

Now in the f9 buttons menu, make sure the lightmap uv tex is 'set rendering' click on the little sunset icon
next to lightmap

Use UV smart unwrap for the lightmap UV's

Hit F5 (original tut said f6) until you can get this ambient occlusion menu the dark gray of 'ambient
occlusion' means it's ON.

I tried full render and got the textures even though I was on 'lightmap'
channel. It got grayscale when I checked 'ambient occlusion' but I know
there's another setting.

Ambient occlusion is our lightmap I guess,

now we need normal map for the


color texture, I do this in Texturemaker, free version might do this, but
I think it's restricted to 256x256. I know there's an nvidia plugin for
photoshop that does this, it doesn't work in pshop 3 though. Gimp has/had a
normal map plugin.

Now in f9 buttons menu change the name in ME: and OB: to hut, export
to fbx, you must include the .fbx on this brain-dead exporter. 'hut' won't work,
put hut.fbx

Now to get the mesh into unity, which I can't make it work with lightmaps but someday..
I'm using the 'turntable' unity project, it' about as simple as you'd want, I
copy the assets where it says

and fire up unity3d and load the turntable.unity


project (or is it scene?)
On my vista computer I get 'unity editor has stopped working' just hit the
x in the corner of that message, it loads eventually.

click on the hut when it shows up in the inspector ask for 'mesh colliders'
and change the size from .01 to 1,

I ended up with 10, then drag hut into the scene view.

there may be 2
materials, (one for each texture you made) the one you want is going to be lightmapped diffuse (you have to
pick this) load the color in the diffuse and the lightmap in the lightmap.

It
doesn't work, but I've done this before, maybe they want to to buy the $1500 version? anyway the lights of
unity make it look nice.

Except I switched textures in midstream and some of the faces have the old texture on them.

I think I want generation per material on the fbx import.

if you ogre export, and get 'error in normalise, triangle too skinny, do the
rem doubles thing again with a tolerance of .001, then .002 until you don't get
the error. Otherwise you really do have a skinny traingle.

Ogre mesh had 3 submeshes, but it did find the lightmap set of uvs, and
also some non-textured faces, some missing faces when I remmed doubles with
too high of a tolerance. So I went back and fixed that. Delete any unused
edges, like the one you used for a construction line for the roof.

You'll have
to do a new lightmap batch of uv's smart unpack if you change the geometry.

In blender 249, ogremeshesexporter.py is retarded, you have to load it from


the text editor then hit alt-p to get it to run.

I moved the hut to o,o,o xyz then I remembered I didn't move the lights! Gave
me a chance to add a few more.

It takes about 3 minutes to make a 1024 square


lightmap actually ambient occlusion on my 2ghz machine. Don't forget to
save the image. It's a good idea to make .dds files out of these tga's. The
game engines unity (at game compile time) and neoaxis (in the editor)will do this (It can take Neo a couple
of minutes sometimes.) but
you can use paint dot net for this. The dds's will look
weird in xnview
and paintdotnet sometimes.
It made a ton of work to change textures in the middle of the
modeling, every face had to be reselected and given the
new texture. Oh, duh, if the faces are situated on the same
texture strip position on each texture, you can select all and
assign it the second texture. You'll know it's ok when you
read the scene.material the converter writes and there's only
1 texture listed.
when I exported a second ogre mesh I only got 1 submesh (?)

Neoaxis tips-
Each submesh needs its own .highmaterial, and the lightmap.png goes in the diffuse2 slot, be sure to put
'texcoords1'
there. Separate interactive stuff that needs their own .mesh doors, chests, etc.,can't be JOINED and lightmap,
they will lose their uniqueness, maybe a generic shadowing on the texture would make it blend in. Argh, I
forgot a triangle,
now I need a new lightmap image, otherwise the triangle won't
join in the fun, I tried this 'lightmap uv pack' it never
rendered anything.

The neoaxis building is dark, you can brighten up the lightmap TGA in a paint program, then have neoaxis
convert it to DDS, it
can make the preferred dx5 type dds.

Watching the game film, next time I'm getting my texture


nailed down before I do ANY uvmapping.

Copyright 2010 by Terry Morgan


http://terrymorgan.net
hike1213atgmailcom

Potrebbero piacerti anche