User talk:Tehrasha

From Valve Developer Community
Revision as of 03:12, 4 February 2011 by Tehrasha (talk | contribs) (temporary place to work on future tutorial)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Blender :: Animated Modelling for Source A Quick-n-Dirty Tutorial

Examples given in this tutorial are based on Blender 2.56a, the Blender SMD Tools add-on and the exportation into Source for use in TeamFortress2.

This tutorial will not include detailed instruction on basic modelling and assumes that the user has at least a very basic knowledge of Blender and 3D modelling in general.

Software Requirements

{Blender 2.5} 3D Modelling program

Blender SMD Tools Addon for Blender to allow import and export of SMD files

{SourceSDK} Software Developers Kit for Valve's Source engine

{VTF Edit} Handy editor for Valve's VTM and VTF files

{ConText} For editing and running QC files to compile models


Optional Software

{GIMP} Free image editor for texturing, not covered in this tutorial.

{GCFScape} For browsing and extracting models/textures/sounds from inside Valve's GCF files.


Basic Model

Tab (if not there) object mode

RMB select starter cube

Tab edit mode

DEL, F delete starter cube

ADD>Mesh>Cylinder, uncapped, 32 sides, size 4 depth 1

CTRL-TAB, E edge select mode

CTRL-E, L edge select loop of top ring

E, S, SHIFT-Z extrude and scale x/y much smaller

E, G, Z extrude and grab +z .5

E, S, SHIFT-Z extrude scale x/y a bit smaller

ALT-M, A merge at center

CTRL-TAB, F face select mode

SHIFT-RMB manually select alternate outside faces

E, S, SHIFT-Z 1.1 extrude scale x/y 1.1

effect individual origins

S, .5 scale end faces

effect pivot center

A, G, Y, 10 select all, grab and move out of the way


Repeat steps above with an uncapped cylinder of 16 sides, size 2, depth 1

select all of the large gear and position it so that the teeth barely mesh together.

A select all

CTRL-N recalculate normals

Tab object mode

Object>Transform>Origin to 3DCursor

Object>Transform>Geometry to Origin

SAVE FILE as tut.blend

Unwrap, UV Map, and Texture

Unwrapping can be a challenge. While you can select to have Blender automatically unwrap your model, Try to think how you would unfold the object if it were entirely made of folded paper.

Open a new windoid and set it to display the UVImage Editor

Tab edit mode

CTRL-TAB, E edge select mode

SHIFT-RMB select edges

CTRL-E, A mark seams

U, U unwrap

If your layout looks like complete chaos, add/remove seems until you can easily identify the pieces. These gears, and most mechanical items with lots of flat planes, are not too difficult to unwrap. Organic items, such as heads or animals are considerably more difficult.

Use G grab, and S scale to reposition and resize the UV islands in the UVImage Editor for optimal use of texture space.

export UV Layout as a 512x512 tut_uv.png

Note.pngNote: For purposes of this tutorial, the UV map we have just exported will be used as the texture. Yes, it is very blah to look at, but texturing, Abient Occlusion, Normal maps, etc.. are better handled in their own tutorials.

add material name the material tut_uv (no need for filename extension) add texture Texture Type: Image of Movie Open the tut_uv.png that we just exported Mapping Coordinates: UV center scene in camera and F12 to RENDER for a look ESC to return 3D window SAVE FILE

Boning Up

Tab object mode

Cursor to origin KPD3 select view 3 Y/Z

ADD Armature> Single Bone This will create 'Armature Bone'

Tab edit mode

Z wireframe mode (easier to position bones)

RMB select top end of 'Armature Bone'

E, Z, 1 extrude new bone 'Armature Bone.000'

Deselect the 'Connected' checkbox to disconnect from its parent

G, Y grab and center on big gear

G, Z, -1 embed bone into the gear (not necessary but clean)

RMB select top end of original 'Armature Bone'

E, Z, 1 extrude new bone 'Armature Bone.001'

Deselect the 'Connected' checkbox to disconnect from its parent

G, Y grab and center on smaller gear

G, Z, -1 embed bone into the gear (not necessary but ...)

Tab object mode

RMB select the mesh

SHIFT-RMB select the armature

CTRL-P parent the mesh to the armature with empty groups

Tab edit mode

RMB, CTRL-KPD+ select all of the faces in just the big gear

set vetex group as Bone.000, assign

RMB, CTRL-KPD+ select all of the faces in just the small gear

set vetex group as Bone.001, assign

SAVE FILE

Lets check out our work...

Tab object mode

RMB select Bone.000

R, Z, move mouse and only the large gear should spin in the z-axis, RMB to ignore changes

RMB select Bone.001

R, Z, move mouse and only the small gear should spin in the z-axis, RMB to ignore changes

Excellent!

Time for Timing

The large gear is going to spin in the opposite direction and at 1/2 the speed of the smaller gear. For sake of ease and sanity with rotating objects, set the animation stop at frame 360.

Animation Pane Pose mode Frame 1 select bone.001, set ROT keyframe, set interpolation to linear select bone.002, set ROT keyframe, set interpolation to linear

Frame 91 (90 degrees +1) select bone.001, rotate +90z degrees, set ROT keyframe select bone.002, rotate -90z degrees, set ROT keyframe

Frame 181 (180 degrees +1) select bone.001, rotate +90z degrees, set ROT keyframe select bone.002, rotate -90z degrees, set ROT keyframe

Frame 271 (270 dergees +1) select bone.001, rotate +90z degrees, set ROT keyframe select bone.002, rotate -90z degrees, set ROT keyframe

Frame 361 (360 degrees +1) select bone.001, rotate +90z degrees, set ROT keyframe select bone.002, rotate -90z degrees, set ROT keyframe

SAVE FILE

But wait! The smaller gear should spin twice as fast!

Deselect Bone.001 Select Bone.002 Select one of its f-curves Select all CTRL-C to copy the keyframes move framecounter to 362 CTRL-V to paste in identical keyframes Select all Scale X by .5 Grab X and SHIFT -180

Return framecounter to 1 Object mode Play animation. Cheer! SAVE FILE

Export, QC, and Compile

Object mode Select mesh SHIFT-Select Armature File->Export->SMD->selected Voom. Exit Blender


Personal Preference:::

I use a command line compiler rather than a point and clicky GUI interface. I use ConText, which is a text editor that can also run scripts. Interlopers has a wonderful tutorial on how to set it up for compiling QC files.


File Names, and File Locations:::

Correct file paths and naming is probably the cause of the majority of failures in compiling QC files.

Models :: Materials :: SMD ::

My model compiles, but the texture doesnt show up!? My model is invisible!?

Example:: QC FILE SMD FILE File Locations

If all of these are correct and you still have problems.... Have you ever considered knitting as a hobby?

Hope this helps.

See Also

External Links

{Interlopers -- QC Compiling Tutorial using ConText}

--Tehrasha 10:12, 4 February 2011 (UTC)