User talk:Tehrasha: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Update with some images)
m (i have doubts tehrasha's still working on that edit)
 
(19 intermediate revisions by one other user not shown)
Line 2: Line 2:
A Quick-n-Dirty Tutorial
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.
Examples given in this tutorial were performed with Blender 2.57, and the [[Blender SMD Tools]] add-on written by Tom Edwards and should be applicable to future releases of the Blender 2.5x series.  Much of the basic modelling instruction also applies to older versions of Blender, but many of the menus and keyboard shortcuts have changed. 
 
Examples of model exporting and compiling in this tutorial use Team Fortress 2 as the platform, however, it should work with any Source based game.  (CS:S, GMod, DoD, HL2, L4D, etc..)


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.
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.
{{toc-right}}


== Software Requirements ==
== Software Requirements ==
[http://www.blender.org/download/get-blender/ {Blender 2.5}] 3D Modelling program
[[Blender]] :: Free, Open source 3D modelling program.
 
[[Blender SMD Tools]]  Addon for Blender to allow import and export of SMD files


[http://developer.valvesoftware.com/wiki/SDK_Installation  {SourceSDK}Software Developers Kit for Valve's Source engine
[[Blender SMD Tools]:: An addon for Blender to import and export SMD files.


[http://nemesis.thewavelength.net/index.php?c=178 {VTF Edit}]  Handy editor for Valve's VTM and VTF files
[[SDK_Installation]] :: Software Developers Kit for Valve's Source engine.


[http://www.contexteditor.org/ {ConText}]  For editing and running QC files to compile models
[[VTFEdit]] :: Handy editor/creator for Valve's VTM and VTF files.


[http://www.contexteditor.org/ ConText] :: An enhanced text editor for the editing and running QC files to compile models.


=== Optional Software ===
=== Optional Software ===
[http://www.gimp.org/ {GIMP}] Free image editor for texturing, not covered in this tutorial.
[[GIMP]] :: Open source image editor for texturing, not covered in this tutorial.


[http://nemesis.thewavelength.net/index.php?c=271 {GCFScape}]  For browsing and extracting models/textures/sounds from Valve's GCF files.


== Keys reference ==
== Key reference ==


{| {{standard-table}} style="width:17em;"
{| {{standard-table}} style="width:17em;"
Line 30: Line 32:
| align=right | {{key|LMB}}  
| align=right | {{key|LMB}}  
| Left Mouse Button
| Left Mouse Button
|-
| align=right | {{key|MMB}}
| Middle Mouse Button
|-
|-
| align=right | {{key|RMB}}  
| align=right | {{key|RMB}}  
| Right Mouse Button
| Right Mouse Button
|-
| align=right | {{key|MW}}
| Mouse Wheel
|-
| align=right | {{key|MWUp}}
| Mouse Wheel Up
|-
| align=right | {{key|MWDown}}
| Mouse Wheel Down
|-
|-
| align=right | {{key|9}}  
| align=right | {{key|9}}  
Line 53: Line 43:
|}
|}


== Basic Model ==
== Building the Basic Model ==
 
{| {{standard-table}}
{{key|TAB}} To select object mode if not already there. [[Image:blender_tut_object_mode.jpg]]
|-
 
| align=right | {{key|TAB}}
{{key|RMB}} Right-click on the starter cube to select it.
|To select object mode if not already there. [[Image:blender_tut_object_mode.jpg]]
 
|-
{{key|TAB}} Swtch to edit mode.  [[Image:blender_tut_edit_mode.jpg]]
| align=right | {{key|RMB}}
 
| Right-click on the starter cube to select it.
{{key|A}}, {{key|DEL}}, {{key|F}} Select the entire cube, and delete it.
|-
| align=right | {{key|TAB}}  
| Swtch to edit mode.  [[Image:blender_tut_edit_mode.jpg]]
|-
| align=right | {{key|A}}, {{key|DEL}}, {{key|F}}
| Select the entire cube, and delete it.
|}


[[Image:blender_tut_add_mesh_cylinder.jpg]] [[Image:blender_tut_object_cylinder.jpg]]
[[Image:blender_tut_add_mesh_cylinder.jpg|Add Mesh>Cylinder]][[Image:blender_tut_object_cylinder.jpg|Cylinder Properties]]


Add a new cylinder mesh to the project, and set its properties to 32 verticies, radius 4, depth 1, uncapped.
Add a new cylinder mesh to the project, and set its properties to 32 verticies, radius 4, depth 1, uncapped.
{{Clr}}
[[Image:blender_tut_animated_extrude.gif|300px|thumb|right|Click for animated steps]]


{{key|CTRL-TAB}}, {{key|E}}           Select edge select mode  [[Image:blender_tut_edge_select.jpg]]
{| {{standard-table}}
|-
| align=right | {{key|CTRL-TAB}}, {{key|E}} |
| Select edge select mode  [[Image:blender_tut_edge_select.jpg]]
|-
| align=right | {{key|RMB}}
| Right-click on one of the edges of the top-most ring.
|-
| align=right | {{key|CTRL-E}}, {{key|L}}
| Then use edge-loop to select all of the edges in the top ring.
|-
| align=right | {{key|E}}, {{key|S}}, {{key|SHIFT-Z}}, {{key|LMB}}
| extrude and scale x/y much smaller
|-
| align=right | {{key|E}}, {{key|G}}, {{key|Z}}, {{key|.}}, {{key|5}}, {{key|ENTER}}
| extrude and grab +z .5
|-
| align=right | {{key|E}}, {{key|S}}, {{key|SHIFT-Z}}, {{key|LMB}}
| extrude scale x/y a bit smaller
|-
| align=right | {{key|ALT-M}}, {{key|A}}
| Merge at center
|}


{{key|RMB}} Right-click on one of the edges of the top-most ring.
{{Clr}}
 
[[Image:blender_tut_animated_extrude2.gif|300px|thumb|right|Click for animated steps]]
{{key|CTRL-E}}, {{key|L}}        Then use edge-loop to select all of the edges in the top ring.
 
{| {{standard-table}}
{{key|E}}, {{key|S}}, {{key|SHIFT-Z}}, {{key|LMB}}          extrude and scale x/y much smaller
|-
 
| align=right | {{key|CTRL-TAB}}, {{key|F}}
{{key|E}}, {{key|G}}, {{key|Z}}, {{key|.}}, {{key|5}}, {{key|ENTER}}              extrude and grab +z .5
| Change to face select mode  [[Image:blender_tut_face_select.jpg]]
 
|-
{{key|E}}, {{key|S}}, {{key|SHIFT-Z}}, {{key|LMB}}          extrude scale x/y a bit smaller
| align=right | {{key|SHIFT-RMB}}
 
| manually select alternate outside faces
{{key|ALT-M}}, {{key|A}}              merge at center
|-
 
| align=right | {{key|E}}, {{key|S}}, {{key|1}}, {{key|.}}, {{key|2}}, {{key|ENTER}}
{{key|CTRL-TAB}}, {{key|F}}           face select mode  [[Image:blender_tut_face_select.jpg]]
| Extrude and scale by 1.2 times.
 
|-
{{key|SHIFT-RMB}}             manually select alternate outside faces
| [[Image:blender_tut_individual_origins.jpg|100px|thumb|Individual Origins]]
 
| Select Individual Origins for center of scale/rotation   
{{key|E}}, {{key|S}}, {{key|SHIFT-Z}}, {{key|1}}, {{key|.}}, {{key|1}}, {{key|ENTER}}       extrude scale x/y 1.1
|-
 
| align=right | {{key|S}}, {{key|.}}, {{key|5}}, {{key|ENTER}}
[[Image:blender_tut_individual_origins.jpg]] Select Individual Origins for center of scale/rotation   
| scale end faces
 
|-
{{key|S}}, {{key|.}}, {{key|5}}, {{key|ENTER}}                 scale end faces
| [[Image:blender_tut_median_point.jpg|100px|thumb|Median Point]]
 
| {{Warning|Do not forget to return the pivot point to Median Point.}}  
[[Image:blender_tut_median_point.jpg]] Select Median Point for center of scale/rotation  
|-
 
| align=right | {{key|A}}, {{key|G}}, {{key|Y}}, {{key|1}}, {{key|0}}, {{key|ENTER}}
{{key|A}}, {{key|G}}, {{key|Y}}, {{key|1}}, {{key|0}}, {{key|ENTER}}           select all, grab and move out of the way
| select all, grab and move out of the way
|}


 
Repeat steps above with an uncapped cylinder of 16 sides, size 2, depth 1
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.


{{key|A}}                     select all
{{key|RMB}}, {{key|CTRL-NUM+}}..etc..            Right click one face or edge in the large gear, and press {{key|CTRL-NUM+}} repeatedly until all of the large gear is selected.


{{key|CTRL-N}}               recalculate normals
{{key|G}}, {{key|Y}}, {{key|LMB}}     Move the large gear along the Y-axis until its teeth barely mesh with teeth of the smaller gear.  Left-click to release the gear when its position is acceptable.


{{key|TAB}}                   Select object mode  [[Image:blender_tut_object_mode.jpg]]
{{key|A}}, {{key|CTRL-N}}                      Select the entire mesh (both gears) and recalculate the 'Normals' so that all of the faces will be facing outwards.


Object>Transform>Origin to 3DCursor
{{key|TAB}}                    Switch to object mode  [[Image:blender_tut_object_mode.jpg]]


Object>Transform>Geometry to Origin
Object>Transform>Geometry to Origin
Line 113: Line 131:
'''SAVE FILE''' as tut.blend
'''SAVE FILE''' as tut.blend


== Unwrap, UV Map, and Texture ==
== Unwrapping, UV Mapping, and Texturing ==
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.
[[Image:Blender_tut_cube_unwrap.jpg|thumb|300px|right| A typical unwrap of a simple cube.]]
Unwrapping can be challenging.  While you can select to have Blender automatically unwrap your model, the results are usually a confusing mess of individual faces with no organization.  Try to imagine how you would unfold the object if it were made of paper such as this unfolded cube.


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


{{key|TAB}}                  Select edit mode [[Image:blender_tut_edit_mode.jpg]]
Open a new windoid and set it to display the UVImage Editor so you can see the unwrapped results while you select edges to make seams.


{{key|CTRL-TAB}}, {{key|E}}           edge select mode
{| {{standard-table}}
|-
| align=right | {{key|TAB}}
| Select edit mode [[Image:blender_tut_edit_mode.jpg]]
|-
| align=right | {{key|CTRL-TAB}}, {{key|E}}
| Select edge select mode
|-
| align=right | {{key|SHIFT-RMB}}
| Select edges to be made into seams.
|-
| align=right | {{key|CTRL-E}}, {{key|A}}
| Mark the selected edges as seams
|-
| align=right | {{key|A}}, {{key|U}}, {{key|U}}
| Select all and unwrap to see the layout int he UV editor windoid.
|}


{{key|SHIFT-RMB}}            select edges
If your layout still looks like complete chaos, add/remove seams until the parts of the model can be easily identified.


{{key|CTRL-E}}, {{key|A}}            mark seams
{{key|U}}, {{key|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.
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.


Line 135: Line 165:
export UV Layout as a 512x512 tut_uv.png
export UV Layout as a 512x512 tut_uv.png


{{note | 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.}}
{{note | For purposes of this tutorial, the UV map we have just exported will be used as the texture.  It is not very much to look at, but full texturing, Ambient Occlusion, Normal maps, etc.. are better handled in their own tutorials.}}
 
{| {{standard-table}}
|-
|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
|}


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'''
'''SAVE FILE'''


== Boning Up ==
== Rigging the Model ==
{{key|TAB}}                       object mode  [[Image:blender_tut_object_mode.jpg]]
{| {{standard-table}}
 
|-
Cursor to origin
| align=right | {{key|TAB}}
{{key|NUM3}}                     select view 3 Y/Z
|Start in object mode  [[Image:blender_tut_object_mode.jpg]]
|-
ADD Armature> Single Bone     This will create 'Armature Bone'
| colspan=2 | Set cursor to the origin
 
|-
{{key|TAB}}                       edit mode  [[Image:blender_tut_edit_mode.jpg]]
| align=right | {{key|NUM3}}
 
|Select view '3' Y/Z, looking down the X axis.
{{key|Z}}                         wireframe mode (easier to position bones)
|-
 
|ADD > Armature > Single Bone
{{key|RMB}}                       select top end of 'Armature Bone'
|This will create 'Armature Bone'
 
|-
{{key|E}}, {{key|Z}}, {{key|1}}, {{key|ENTER}}                     extrude new bone 'Armature Bone.000'
| align=right | {{key|TAB}}
 
|Select edit mode  [[Image:blender_tut_edit_mode.jpg]]
Deselect the 'Connected' checkbox to disconnect from its parent
|-
 
| align=right | {{key|Z}}
{{key|G}}, {{key|Y}}                     grab and center on big gear
|Select wireframe visual mode (easier to position bones)
 
|-
{{key|G}}, {{key|Z}}, {{key|-}}, {{key|1}}, {{key|ENTER}}                 embed bone into the gear (not necessary but clean)
| align=right | {{key|RMB}}
 
|Right click on the top end of 'Armature Bone' to select it
{{key|RMB}}                       select top end of original 'Armature Bone'
|-
 
| align=right | {{key|E}}, {{key|Z}}, {{key|1}}, {{key|ENTER}}
{{key|E}}, {{key|Z}}, {{key|1}}, {{key|ENTER}}                     extrude new bone 'Armature Bone.001'
|This will extrude a new bone 'Armature Bone.000'
 
|-
Deselect the 'Connected' checkbox to disconnect from its parent
| colspan=2 | Deselect the 'Connected' checkbox to disconnect from its parent
 
|-
{{key|G}}, {{key|Y}}                     grab and center on smaller gear
| align=right | {{key|G}}, {{key|Y}}, {{key|LMB}}
 
|Grab and center the bone over the big gear.  This will its axis of rotation. Left-click to release the grab and accept its current location
{{key|G}}, {{key|Z}}, {{key|-}}, {{key|1}}, {{key|ENTER}}                 embed bone into the gear (not necessary but ...)
|-
 
| align=right | {{key|G}}, {{key|Z}}, {{key|-}}, {{key|1}}, {{key|ENTER}}
{{key|TAB}}                       object mode  [[Image:blender_tut_object_mode.jpg]]
|This will embed the bone into the gear (not necessary but cleaner)
 
|-
{{key|RMB}}                       select the mesh
| align=right | {{key|RMB}}
 
|Right click on the original 'Armature Bone' to select it
{{key|SHIFT-RMB}}                 select the armature
|-
 
| align=right | {{key|E}}, {{key|Z}}, {{key|1}}, {{key|ENTER}}
{{key|CTRL-P}}                   parent the mesh to the armature with empty groups
|This will extrude new bone 'Armature Bone.001'
 
|-
{{key|TAB}}                       edit mode  [[Image:blender_tut_edit_mode.jpg]]
| colspan=2 | Deselect the 'Connected' checkbox to disconnect from its parent
 
|-
{{key|RMB}}, {{key|CTRL-NUM+}}           select all of the faces in just the big gear
| align=right | {{key|G}}, {{key|Y}}, {{key|LMB}}
 
|Grab and center the bone over the smaller gear.
set vetex group as Bone.000, assign
|-
 
| align=right | {{key|G}}, {{key|Z}}, {{key|-}}, {{key|1}}, {{key|ENTER}}
{{key|RMB}}, {{key|CTRL-NUM+}}           select all of the faces in just the small gear
|Embed the bone into the gear (not necessary but ...)
 
|-
set vetex group as Bone.001, assign
| align=right | {{key|TAB}}
|Switch back to object mode  [[Image:blender_tut_object_mode.jpg]]
|-
| align=right | {{key|RMB}}
|Right-click the mesh to select it
|-
| align=right | {{key|SHIFT-RMB}}
|Shift-right-click the armature
|-
| align=right | {{key|CTRL-P}}
|Parent the mesh to the armature with empty groups
|-
| align=right | {{key|TAB}}
|Return to edit mode  [[Image:blender_tut_edit_mode.jpg]]
|-
| align=right | {{key|RMB}}, {{key|CTRL-NUM+}}..etc..
|Right click one face or edge in the large gear, and press {{key|CTRL-NUM+}} repeatedly until all of the large gear is selected.
|-
| colspan=2 | Under Object Data, set the vetex group as Bone.000 and click Assign
|-  
| align=right | {{key|RMB}}, {{key|CTRL-NUM+}}..etc..
|Right click one face or edge in the small gear, and press {{key|CTRL-NUM+}} repeatedly until all of the small gear is selected.
|-
| colspan=2 |Set vetex group as Bone.001 and click Assign
|}
   
   
'''SAVE FILE'''
'''SAVE FILE'''
Lets check out our work...
Lets check out our work...
{{key|TAB}}                      object mode  [[Image:blender_tut_object_mode.jpg]]


{{key|RMB}}                       select Bone.000
{| {{standard-table}}
|-
| align=right | {{key|TAB}}
|Select object mode  [[Image:blender_tut_object_mode.jpg]]
|-
| align=right | {{key|RMB}}
|Select '''bone.000''' at the center of the large gear.
|-
| colspan=2 | Blender should automatically switch to Pose Mode [[Image:blender_tut_object_mode.jpg]] when the bone is selected.
|-
| align=right | {{key|R}}, {{key|Z}}, move mouse, {{key|RMB}}
|Only the large gear should spin in the z-axis, right-clicking {{key|RMB}} ignores changes
|-
| align=right | {{key|RMB}}
|Select '''bone.001''' at the center of the small gear.
|-
| align=right | {{key|R}}, {{key|Z}}, move mouse, {{key|RMB}}
|Only the large gear should spin in the z-axis, right-clicking {{key|RMB}} ignores changes
|}
 
'''Excellent!'''


{{key|R}}, {{key|Z}}, move mouse and only the large gear should spin in the z-axis, {{key|RMB}} to ignore changes
== Animating the Model ==


{{key|RMB}}                      select Bone.001
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.  


{{key|R}}, {{key|Z}}, move mouse and only the small gear should spin in the z-axis, {{key|RMB}} to ignore changes
{| {{standard-table}}
|-
|[[Image:blender_tut_animation_layout.jpg|thumb|100px|Animation Layout]]
|Change screen layout from Default to Animation.
|-
| align=right | {{key|RMB}}
|Right click on the Armature to select it.
|-
| align=right | {{key|TAB}}
|To get to Pose mode if not already there. [[Image:blender_tut_pose_mode.jpg]]
|-
|[[Image:blender_tut_keyframe_rotation.jpg|thumb|100px|Active Keying]]
|Set Active Keying to 'Rotation'
|}


'''Excellent!'''
=== Large Gear Clockwise ===


== Time for Timing ==
{| {{standard-table}}
The large gear is going to spin in the opposite direction and at 1/2 the speed of the smaller gearFor sake of ease and sanity with rotating objects, set the animation stop at frame 360.  
|-
|
| Set frame counter to Frame 1
|-
| align=right | {{key|RMB}}
|Select '''bone.000'''
|-
|[[Image:blender_tut_set_keyframe.jpg|right]]
|Set a keyframe
|-
|
| Set Framecounter to Frame 91 (90 degrees +1)
|-
| align=right | {{key|R}}, {{key|Z}}, {{key|9}}, {{key|0}},  [[Image:blender_tut_set_keyframe.jpg]]
|Rotate +90 degrees on the Z-axis and set a ROT keyframe.
|-
|
| Set Framecounter to Frame 181 (180 degrees +1)
|-
| align=right | {{key|R}}, {{key|Z}}, {{key|9}}, {{key|0}},  [[Image:blender_tut_set_keyframe.jpg]]
|Rotate +90 degrees on the Z-axis and set a ROT keyframe.
|-
|
| Set Framecounter to Frame 271 (270 degrees +1)
|-
| align=right | {{key|R}}, {{key|Z}}, {{key|9}}, {{key|0}},  [[Image:blender_tut_set_keyframe.jpg]]
|Rotate +90 degrees on the Z-axis and set a ROT keyframe.
|-
|
| Set Framecounter to Frame 361 (360 degrees +1)
|-
| align=right | {{key|R}}, {{key|Z}}, {{key|9}}, {{key|0}}, [[Image:blender_tut_set_keyframe.jpg]]
|Rotate +90 degrees on the Z-axis and set a ROT keyframe.
|}


Animation Pane
=== Small Gear Counterclockwise ===
RMB  Right click on the Armature to select it.
TAB  To get to Pose mode if not already there. [[Image:blender_tut_pose_mode.jpg]]


Frame 1
{| {{standard-table}}
select bone.001, set ROT keyframe, set interpolation to linear
|-
select bone.002, set ROT keyframe, set interpolation to linear
|
| Set frame counter to Frame 1
|-
| align=right | {{key|RMB}}
|Select '''bone.001'''
|-
|[[Image:blender_tut_set_keyframe.jpg|right]]
| Set a keyframe
|-
|
| Set Framecounter to Frame 91 (90 degrees +1)
|-
| align=right | {{key|R}}, {{key|Z}}, {{key|-}}, {{key|9}}, {{key|0}},  [[Image:blender_tut_set_keyframe.jpg]]
|Rotate -90 degrees on the Z-axis and set a ROT keyframe.
|-
|
| Set Framecounter to Frame 181 (180 degrees +1)
|-
| align=right | {{key|R}}, {{key|Z}}, {{key|-}}, {{key|9}}, {{key|0}},  [[Image:blender_tut_set_keyframe.jpg]]
|Rotate -90 degrees on the Z-axis and set a ROT keyframe.
|-
|
| Set Framecounter to Frame 271 (270 degrees +1)
|-
| align=right | {{key|R}}, {{key|Z}}, {{key|-}}, {{key|9}}, {{key|0}},  [[Image:blender_tut_set_keyframe.jpg]]
|Rotate -90 degrees on the Z-axis and set a ROT keyframe.
|-
|
| Set Framecounter to Frame 361 (360 degrees +1)
|-
| align=right | {{key|R}}, {{key|Z}}, {{key|-}}, {{key|9}}, {{key|0}},  [[Image:blender_tut_set_keyframe.jpg]]
|Rotate -90 degrees on the Z-axis and set a ROT keyframe.
|}


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


Frame 181 (180 degrees +1)
But wait!  The smaller gear should spin twice as fast! [[Image:Blender_tut_animated_render.gif|thumb|right|Click to see animated results.]]
select bone.001, rotate +90z degrees, set ROT keyframe
select bone.002, rotate -90z degrees, set ROT keyframe


Frame 271 (270 dergees +1)
Uncheck all of the keyframes for Bone.001
select bone.001, rotate +90z degrees, set ROT keyframe
select bone.002, rotate -90z degrees, set ROT keyframe


Frame 361 (360 degrees +1)
{| {{standard-table}}
select bone.001, rotate +90z degrees, set ROT keyframe
|-
select bone.002, rotate -90z degrees, set ROT keyframe
|
|Select Bone.002
|-
|{{key|RMB}}
|Right-click to select one of its f-curves
|-
|{{key|A}}, {{key|CTRL-C}}
|Select all and copy the keyframes
|-
|
|Move framecounter to 362
|-
|{{key|CTRL-V}}
|Paste the copy of those keyframes after the existing frames.
|-
|{{key|A}}, {{key|S}}, {{key|X}}, {{key|.}}, {{key|5}}, {{key|ENTER}}
|Select all and scale the X axis by .5
|-
|{{key|G}}, {{key|X}}, {{key|-}}, {{key|1}}, {{key|8}}, {{key|0}}, {{key|ENTER}}
|Grab shift the f-curve 180 degrees to the right.
|-
|
|Return framecounter to Frame 1
|-
|
|Object mode  [[Image:blender_tut_object_mode.jpg]]
|-
|
|Play animation.
|}


'''SAVE FILE'''
'''SAVE FILE'''


But wait!  The smaller gear should spin twice as fast!
== Getting the Model into Source ==


Deselect Bone.001
=== Exporting ===
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
{| {{standard-table}}
Object mode  [[Image:blender_tut_object_mode.jpg]]
|-
Play animation.  Cheer!
|{{key|TAB}}
'''SAVE FILE'''
|Make sure Blender is in Object mode. [[Image:blender_tut_object_mode.jpg]]
|-
|{{key|RMB}}
|Right click on the mesh (the gears)
|-
|{{key|SHIFT-RMB}}
|The shift-right-click on the Armature
|-
|
|File->Export->SMD->selected
|}


== Export, QC, and Compile ==
Object mode  Make sure Blender is in Object mode.  [[Image:blender_tut_object_mode.jpg]]
RMB  Right click on the mesh (the gears)
SHIFT-RMB  The shift-right-click on the Armature
File->Export->SMD->selected
Voom.  
Voom.  
Exit Blender
Exit Blender


{{note|These examples use a command line executing text editor, [http://www.contexteditor.org/ {ConText}], to compile QC files.  This saves on lots of repetitive typing of long directory trees into a console command line.  Interlopers has a well designed and easy to follow tutorial on the setting up ConText for compiling models via their QC file.  See: External Links}}


:::Personal Preference:::
=== QC, File Names, and File Locations ===
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.
Correct file paths and naming is probably the cause of the majority of failures in compiling QC files.


Line 290: Line 464:
File Locations
File Locations


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


Hope this helps.


== See Also ==
== See Also ==
Line 306: Line 478:
[http://www.interlopers.net/tutorials/24774 {Interlopers -- QC Compiling Tutorial using ConText}]
[http://www.interlopers.net/tutorials/24774 {Interlopers -- QC Compiling Tutorial using ConText}]


--[[User:Tehrasha|Tehrasha]] 10:12, 4 February 2011 (UTC)
--[[User:Tehrasha|Tehrasha]] 22:54, 18 April 2011 (UTC)
--[[User:Tehrasha|Tehrasha]] 00:51, 5 February 2011 (UTC)

Latest revision as of 03:34, 13 August 2018

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

Examples given in this tutorial were performed with Blender 2.57, and the Blender SMD Tools add-on written by Tom Edwards and should be applicable to future releases of the Blender 2.5x series. Much of the basic modelling instruction also applies to older versions of Blender, but many of the menus and keyboard shortcuts have changed.

Examples of model exporting and compiling in this tutorial use Team Fortress 2 as the platform, however, it should work with any Source based game. (CS:S, GMod, DoD, HL2, L4D, etc..)

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 :: Free, Open source 3D modelling program.

Blender SMD Tools  :: An addon for Blender to import and export SMD files.

SDK_Installation :: Software Developers Kit for Valve's Source engine.

VTFEdit :: Handy editor/creator for Valve's VTM and VTF files.

ConText :: An enhanced text editor for the editing and running QC files to compile models.

Optional Software

GIMP :: Open source image editor for texturing, not covered in this tutorial.


Key reference

Key
LMB Left Mouse Button
RMB Right Mouse Button
9 9 on the main keyboard
Num9 9 on the Number Pad

Building the Basic Model

Tab To select object mode if not already there. Blender tut object mode.jpg
RMB Right-click on the starter cube to select it.
Tab Swtch to edit mode. Blender tut edit mode.jpg
A, DEL, F Select the entire cube, and delete it.

Add Mesh>CylinderCylinder Properties

Add a new cylinder mesh to the project, and set its properties to 32 verticies, radius 4, depth 1, uncapped.

Click for animated steps
CTRL-TAB, E | Select edge select mode Blender tut edge select.jpg
RMB Right-click on one of the edges of the top-most ring.
CTRL-E, L Then use edge-loop to select all of the edges in the top ring.
E, S, SHIFT-Z, LMB extrude and scale x/y much smaller
E, G, Z, ., 5, Enter extrude and grab +z .5
E, S, SHIFT-Z, LMB extrude scale x/y a bit smaller
ALT-M, A Merge at center
Click for animated steps
CTRL-TAB, F Change to face select mode Blender tut face select.jpg
SHIFT-RMB manually select alternate outside faces
E, S, 1, ., 2, Enter Extrude and scale by 1.2 times.
Individual Origins
Select Individual Origins for center of scale/rotation
S, ., 5, Enter scale end faces
Median Point
Warning.pngWarning:Do not forget to return the pivot point to Median Point.
A, G, Y, 1, 0, Enter select all, grab and move out of the way

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


RMB, CTRL-NUM+..etc.. Right click one face or edge in the large gear, and press CTRL-NUM+ repeatedly until all of the large gear is selected.

G, Y, LMB Move the large gear along the Y-axis until its teeth barely mesh with teeth of the smaller gear. Left-click to release the gear when its position is acceptable.

A, CTRL-N Select the entire mesh (both gears) and recalculate the 'Normals' so that all of the faces will be facing outwards.

Tab Switch to object mode Blender tut object mode.jpg

Object>Transform>Geometry to Origin

SAVE FILE as tut.blend

Unwrapping, UV Mapping, and Texturing

A typical unwrap of a simple cube.

Unwrapping can be challenging. While you can select to have Blender automatically unwrap your model, the results are usually a confusing mess of individual faces with no organization. Try to imagine how you would unfold the object if it were made of paper such as this unfolded cube.

Open a new windoid and set it to display the UVImage Editor so you can see the unwrapped results while you select edges to make seams.

Tab Select edit mode Blender tut edit mode.jpg
CTRL-TAB, E Select edge select mode
SHIFT-RMB Select edges to be made into seams.
CTRL-E, A Mark the selected edges as seams
A, U, U Select all and unwrap to see the layout int he UV editor windoid.

If your layout still looks like complete chaos, add/remove seams until the parts of the model can be easily identified.

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. It is not very much to look at, but full texturing, Ambient 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

Rigging the Model

Tab Start in object mode Blender tut object mode.jpg
Set cursor to the origin
NUM3 Select view '3' Y/Z, looking down the X axis.
ADD > Armature > Single Bone This will create 'Armature Bone'
Tab Select edit mode Blender tut edit mode.jpg
Z Select wireframe visual mode (easier to position bones)
RMB Right click on the top end of 'Armature Bone' to select it
E, Z, 1, Enter This will extrude a new bone 'Armature Bone.000'
Deselect the 'Connected' checkbox to disconnect from its parent
G, Y, LMB Grab and center the bone over the big gear. This will its axis of rotation. Left-click to release the grab and accept its current location
G, Z, -, 1, Enter This will embed the bone into the gear (not necessary but cleaner)
RMB Right click on the original 'Armature Bone' to select it
E, Z, 1, Enter This will extrude new bone 'Armature Bone.001'
Deselect the 'Connected' checkbox to disconnect from its parent
G, Y, LMB Grab and center the bone over the smaller gear.
G, Z, -, 1, Enter Embed the bone into the gear (not necessary but ...)
Tab Switch back to object mode Blender tut object mode.jpg
RMB Right-click the mesh to select it
SHIFT-RMB Shift-right-click the armature
CTRL-P Parent the mesh to the armature with empty groups
Tab Return to edit mode Blender tut edit mode.jpg
RMB, CTRL-NUM+..etc.. Right click one face or edge in the large gear, and press CTRL-NUM+ repeatedly until all of the large gear is selected.
Under Object Data, set the vetex group as Bone.000 and click Assign
RMB, CTRL-NUM+..etc.. Right click one face or edge in the small gear, and press CTRL-NUM+ repeatedly until all of the small gear is selected.
Set vetex group as Bone.001 and click Assign

SAVE FILE

Lets check out our work...

Tab Select object mode Blender tut object mode.jpg
RMB Select bone.000 at the center of the large gear.
Blender should automatically switch to Pose Mode Blender tut object mode.jpg when the bone is selected.
R, Z, move mouse, RMB Only the large gear should spin in the z-axis, right-clicking RMB ignores changes
RMB Select bone.001 at the center of the small gear.
R, Z, move mouse, RMB Only the large gear should spin in the z-axis, right-clicking RMB ignores changes

Excellent!

Animating the Model

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 Layout
Change screen layout from Default to Animation.
RMB Right click on the Armature to select it.
Tab To get to Pose mode if not already there. Blender tut pose mode.jpg
Active Keying
Set Active Keying to 'Rotation'

Large Gear Clockwise

Set frame counter to Frame 1
RMB Select bone.000
Blender tut set keyframe.jpg
Set a keyframe
Set Framecounter to Frame 91 (90 degrees +1)
R, Z, 9, 0, Blender tut set keyframe.jpg Rotate +90 degrees on the Z-axis and set a ROT keyframe.
Set Framecounter to Frame 181 (180 degrees +1)
R, Z, 9, 0, Blender tut set keyframe.jpg Rotate +90 degrees on the Z-axis and set a ROT keyframe.
Set Framecounter to Frame 271 (270 degrees +1)
R, Z, 9, 0, Blender tut set keyframe.jpg Rotate +90 degrees on the Z-axis and set a ROT keyframe.
Set Framecounter to Frame 361 (360 degrees +1)
R, Z, 9, 0, Blender tut set keyframe.jpg Rotate +90 degrees on the Z-axis and set a ROT keyframe.

Small Gear Counterclockwise

Set frame counter to Frame 1
RMB Select bone.001
Blender tut set keyframe.jpg
Set a keyframe
Set Framecounter to Frame 91 (90 degrees +1)
R, Z, -, 9, 0, Blender tut set keyframe.jpg Rotate -90 degrees on the Z-axis and set a ROT keyframe.
Set Framecounter to Frame 181 (180 degrees +1)
R, Z, -, 9, 0, Blender tut set keyframe.jpg Rotate -90 degrees on the Z-axis and set a ROT keyframe.
Set Framecounter to Frame 271 (270 degrees +1)
R, Z, -, 9, 0, Blender tut set keyframe.jpg Rotate -90 degrees on the Z-axis and set a ROT keyframe.
Set Framecounter to Frame 361 (360 degrees +1)
R, Z, -, 9, 0, Blender tut set keyframe.jpg Rotate -90 degrees on the Z-axis and set a ROT keyframe.

SAVE FILE

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

Click to see animated results.

Uncheck all of the keyframes for Bone.001

Select Bone.002
RMB Right-click to select one of its f-curves
A, CTRL-C Select all and copy the keyframes
Move framecounter to 362
CTRL-V Paste the copy of those keyframes after the existing frames.
A, S, X, ., 5, Enter Select all and scale the X axis by .5
G, X, -, 1, 8, 0, Enter Grab shift the f-curve 180 degrees to the right.
Return framecounter to Frame 1
Object mode Blender tut object mode.jpg
Play animation.

SAVE FILE

Getting the Model into Source

Exporting

Tab Make sure Blender is in Object mode. Blender tut object mode.jpg
RMB Right click on the mesh (the gears)
SHIFT-RMB The shift-right-click on the Armature
File->Export->SMD->selected

Voom.

Exit Blender

Note.pngNote:These examples use a command line executing text editor, {ConText}, to compile QC files. This saves on lots of repetitive typing of long directory trees into a console command line. Interlopers has a well designed and easy to follow tutorial on the setting up ConText for compiling models via their QC file. See: External Links

QC, 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

Compiling and Viewing

See Also

External Links

{Interlopers -- QC Compiling Tutorial using ConText}

--Tehrasha 22:54, 18 April 2011 (UTC)