animation, maya, & valve modeling, exporting, and compiling

16
Animation, Maya, & Valve Modeling, Exporting, and Compiling Feb 10 th 2006

Upload: dougal

Post on 30-Jan-2016

81 views

Category:

Documents


0 download

DESCRIPTION

Animation, Maya, & Valve Modeling, Exporting, and Compiling. Feb 10 th 2006. Create a Material. In Photoshop, create a 512x512 image File->New Set the image size Change the Width and Height fields to 512 pixels Edit your image! Save the image to ‘img.tga’ File->Save a Copy - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Animation,  Maya, & Valve Modeling, Exporting, and Compiling

Animation, Maya, & Valve Modeling, Exporting, and Compiling

Feb 10th 2006

Page 2: Animation,  Maya, & Valve Modeling, Exporting, and Compiling

Create a Material

• In Photoshop, create a 512x512 image– File->New– Set the image size

• Change the Width and Height fields to 512 pixels

– Edit your image!– Save the image to ‘img.tga’

• File->Save a Copy• Save to ‘<source dir>/materialsrc/’

– I recommend using GIMP for image editing!

Page 3: Animation,  Maya, & Valve Modeling, Exporting, and Compiling

TGA File Format

• TGA is short for Targa (aka Truevision), a popular non-proprietary image format favored by Valve

• TGA files can be saved with a fourth channel, called Alpha channel, which usually defines transparency

• However, VMF shaders use the alpha channel • A shader is a piece of software that instead of

executing on the CPU, it executes on the GPU• There are two types of shaders: Pixel shaders and

Vertex shaders• Half-Life 2 uses Microsoft's High Level Shading

Language (HLSL)

Page 4: Animation,  Maya, & Valve Modeling, Exporting, and Compiling

Compile the Material

• Compile to a VMT and a VTF• Again, you can download VTFEdit, which is a GUI for

authoring textures– http://nemesis.thewavelength.net/index.php?p=38

• We will use the ‘vtex.exe’ utility• This utility can be found under

– C:\Program Files\Steam\SteamApps\<username>\sourcesdk\bin

• Here is the command we will execute – Go to Start->Run– Type in ‘cmd’ (command prompt)– Move into your ‘<source dir>/materialsrc/’ directory– vtex.exe –mkdir –shader VertexLitGeneric img.tga– Look under ‘<content dir>/materials/’ for the VMT and VTF

Page 5: Animation,  Maya, & Valve Modeling, Exporting, and Compiling

Maya and Animation

• Yesterday, we created a static object in Maya and learned how to export and compile it for the SMD and MDL file formats needed by Valve

• Today, we will create a joint for that static model and produce a single animation

• You will first need to construct a ‘base pose’ for an object that you want to animate– We already did this with our static object yesterday

• You need to then create a joint/bone hierarchy (called a skeleton)

Page 6: Animation,  Maya, & Valve Modeling, Exporting, and Compiling

Base Pose & Skeleton

http://www.okino.com/conv/skinning.htm

Page 7: Animation,  Maya, & Valve Modeling, Exporting, and Compiling

Animation & Exporting

• Follow the general modeling and exporting guidelines from our last lecture, and also from the following URL

– http://student.fho-emden.de/~marteppe/monogreen/otherstuff/tut03.htm

• We are going to use the model we exported yesterday• We will create a separate file for each animation that we

want to use in the game• Valve stores just one file with the base pose and joint

hierarchy, and all other animation files only have the skeleton for a particular animation

• I will put a tutorial up soon regarding how take already existing HL2 characters and change their ‘skin’ (texture files for the face & body)– ‘Cheapest’ way to get a custom look and feel for your game

Page 8: Animation,  Maya, & Valve Modeling, Exporting, and Compiling

Animation

http://www.okino.com/conv/skinning.htm

Page 9: Animation,  Maya, & Valve Modeling, Exporting, and Compiling

Maya: Add a Joint

• Hit Space->Skeleton->Joint Tool

• Increase the radius so you can see it, say to a vale of 50

• Click on the joint and hold ‘Ctrl’ and click on pCube1

• Hit Space->Skin->Bind Skin->Rigid Bind

• You can also do smooth skinning, but it will not help us out much in this example

Page 10: Animation,  Maya, & Valve Modeling, Exporting, and Compiling

Maya: Animate the Object

• Select the pCube1 object

• Hold Shift and press ‘W’, ‘E’, and ‘R’

• Go to 30 on the time bar, this will be how we are selecting our 30 fps

• Change the rotate values to 45, 45, and 45

• Right click in the Transform Attributes box and hit Set Key

• You can now run it and watch it animate

Page 11: Animation,  Maya, & Valve Modeling, Exporting, and Compiling

Maya: Export the Animation

• Go to File->Export SMD Options

• Turn on ‘export Animation smds’ under the ‘Export’ tab

• Go to ‘Path Settings’ tab and hit ‘default’

• Make sure that ‘smd/qc Path’ is set to – <source dir>/modelsrc/RotCube.smd

• Make sure that ‘texture Path’ is set to – <source dir>/materialsrc/

Page 12: Animation,  Maya, & Valve Modeling, Exporting, and Compiling

Exporting the Animation

• Go to the ‘Animations’ tab

• Type in ‘Rotating’ in ‘sequence Name’

• Type in ‘0’ for ‘sequence start’ and ’30’ for ‘sequence end’

• Type in ‘loop fps 30’ in ‘add on end’

• Hit ‘OK Settings’

• Hit ‘Full Compile’

Page 13: Animation,  Maya, & Valve Modeling, Exporting, and Compiling

SMD Files

• Under ‘<source dir>/modelsrc/’ you should have a few SMD files and a QC

• RotCube.qc => File that will be used to specify how we compile into a MDL

• RotCube.smd => Reference model

• RotCube_idle.smd => Idle animation

• RotCube_phy.smd => Physics model

• RotCube_Rotating.smd => Animation file

Page 14: Animation,  Maya, & Valve Modeling, Exporting, and Compiling

Compile to a MDL

• We will use the studiomdl.exe utility• This is in the same bin directory as the

vtex.exe material compile utility• To run studiomdl.exe and compile our

SMD files into a MDL that we can run in our mod, type– studiomdl.exe RotCube.qc

• The result is automatically copied over into– <content dir>/models/

Page 15: Animation,  Maya, & Valve Modeling, Exporting, and Compiling

Valve Model Viewer

• In the Source SKD menu, launch ‘Model Viewer’

• Go to File->Load Model

• Your model should appear as ‘RotCube’

Page 16: Animation,  Maya, & Valve Modeling, Exporting, and Compiling

Hammer & your Animation

• Add a ‘prop_dynamic_override’ entity• Double left click on it• Go to the ‘world model’ keyvalue• Press on Browse• Find your model• Name the entity ‘myobject’• Create a ‘logic_timer’ entity• Change the ‘Refire Interval’ to 5 (seconds)• Go to the ‘outputs’ tab• Click ‘add’• Select ‘onTimer’ (the output)• Find the ‘myobject’ (the entity to effect)• Select ‘SetAnimation’ (the input)• Put ‘Rotating’ in the ‘with a parameter override of’ textbox