Creating worldmodels from viewmodels: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
m (Spam revert.)
Line 1: Line 1:
[http://episomes.info/articles/thehellsong.html the hell song] [http://megaman.overhit.info/ megaman] [http://atherurus.overhit.info/ atherurus] [http://episomes.info/articles/peugeot106lee.html peugeot 106 lee] [http://episomes.info/articles/talkingoverme.html talking over me] [http://forswear.info/blog/laciebig.html lacie big] [http://missmark.info/topic/callan.html callan] [http://jacinthe.info/html/bugsbunny.html bugs  bunny] [http://forswear.info/blog/romasanjose.html roma san jose] [http://wwwpornocl.overhit.info/ www porno cl] [http://benqdcc40.anywhy.info/ benq dc c40] [http://forswear.info/blog/nokia6610.html nokia 6610] [http://costumeslip.geratic.info/ costume slip uomo] [http://forswear.info/blog/meerut.html meerut] [http://jacinthe.info/html/soundsystembose.html sound system bose] [http://jacinthe.info/html/nikon7900.html nikon 7900] [http://nonmi.unrust.info/ non mi] [http://wwwplayboy.apodoses.info/ www playboy] [http://jojoweak.apodoses.info/ jojo weak] [http://newbalancerosa.geratic.info/ new balance rosa] [http://jacinthe.info/html/djhype.html dj hype] [http://episomes.info/articles/philips42pf9966.html philips 42pf9966 12] [http://ghostreconps2.geratic.info/ ghost recon ps2] [http://nokia5100.unrust.info/ nokia 5100] [http://episomes.info/ episomes.info] [http://nikonlens28.unrust.info/ nikon lens 2 8] [http://episomes.info/articles/piscinegonfiabili.html piscine gonfiabili] [http://economiaunige.geratic.info/ Economia unige] [http://forswear.info/blog/the69eyeslost.html the 69 eyes lost boys] [http://josh.geratic.info/ josh] [http://geratic.info/index2_666.html home] [http://smartpure.unrust.info/ smart pure] [http://crash3.overhit.info/ crash3] [http://episomes.info/articles/gpsreceiver.html gps receiver] [http://missmark.info/topic/uboat.html u boat] [http://worldfish.unrust.info/ world fish] [http://forswear.info/blog/socasoca.html soca soca] [http://fin.geratic.info/ f i n] [http://missmark.info/topic/calzaturebikkembergs.html calzature bikkembergs] [http://jacinthe.info/html/bergamo.html bergamo] [http://immaginejpg.apodoses.info/ immagine jpg] [http://episomes.info/articles/bigblackgirls.html big black girls] [http://johnscofieldquiet.unrust.info/ john scofield quiet] [http://amywinhouse.unrust.info/ amy winhouse] [http://zebda.apodoses.info/ zebda] [http://forswear.info/blog/deh3700mp.html deh 3700mp] [http://forswear.info/blog/jutre.html jutre] [http://grp.geratic.info/ grp] [http://ho20.unrust.info/ ho 20] [http://evapocker.unrust.info/ eva pocker] [http://newoil.overhit.info/ new oil] [http://episomes.info/articles/wwwinblucom.html www in blu com] [http://gunroses.apodoses.info/ gun roses] [http://forswear.info/blog/bm59.html bm 59] [http://nemesys.unrust.info/ nemesys] [http://jacinthe.info/html/kevinrichardson.html kevin richardson] [http://anywhy.info/index7_1000.html page] [http://sdram168pin.anywhy.info/ sdram 168pin] [http://mucca.anywhy.info/ mucca] [http://forswear.info/blog/chatlive.html chat live] [http://azureuslinux.overhit.info/ azureus linux] [http://forswear.info/blog/borsaacquacalda.html borsa acqua calda] [http://syncmaster713bm.unrust.info/ syncmaster 713bm] [http://equo.apodoses.info/ equo] [http://sainseiyahades.anywhy.info/ sain seiya hades] [http://nikc.unrust.info/ nikc] [http://liset.geratic.info/ liset] [http://forswear.info/blog/calamina.html calamina] [http://dualchannel.apodoses.info/ dual channel] [http://tvplasmawxga.overhit.info/ tv plasma wxga] [http://episomes.info/articles/mrsrobinson.html mrs robinson] [http://novaspacelonley.apodoses.info/ novaspace lonley] [http://bodyuomo.apodoses.info/ body uomo] [http://nerodownload.apodoses.info/ nero download] [http://forswear.info/blog/manofhonor.html man of honor] [http://acer15sxga.geratic.info/ acer 15 sxga] [http://missmark.info/topic/ilcielo.html ilcielo] [http://vorkuta.unrust.info/ vorkuta] [http://hotsyncusb.overhit.info/ hotsync usb] [http://unrust.info/ unrust.info] [http://apodoses.info/ apodoses.info] [http://bmw320compactkm.apodoses.info/ bmw 320 compact km 0] [http://peugeot20614.unrust.info/ peugeot 206 1 4 xt] [http://unrust.info/index0_666.html homepage] [http://episomes.info/articles/caulfield.html caulfield] [http://missmark.info/topic/rosemarybaby.html rosemary baby] [http://missmark.info/topic/mercedesslk200.html mercedes slk 200 k] [http://throughtherain.apodoses.info/ through the rain] [http://hoganuomocalzature.unrust.info/ hogan uomo calzature] [http://tvcloewe.apodoses.info/ tvc loewe] [http://benqa82.anywhy.info/ benq a82] [http://missmark.info/topic/alphaforce.html alpha force] [http://missmark.info/ missmark.info] [http://km400.apodoses.info/ km 400] [http://forswear.info/blog/graciefields.html gracie fields] [http://wwwseanpaul.anywhy.info/ www sean paul] [http://idontwantyour.anywhy.info/ i don t want your back] [http://wackyraces.unrust.info/ wacky races] [http://jacinthe.info/html/extremecfnm.html Extreme cfnm] [http://krazyracers.apodoses.info/ krazy racers]
This tutorial teaches you how to create a world model from a [[Viewmodel|view model]]. It does not teach you how to do modeling or how to work with a model editor. Even though the screenshot shows 3ds max 7, the same can easily be done in all other model editors if you have sufficient knowledge of them.
This tutorial teaches you how to create a world model from a [[Viewmodel|view model]]. It does not teach you how to do modeling or how to work with a model editor. Even though the screenshot shows 3ds max 7, the same can easily be done in all other model editors if you have sufficient knowledge of them.



Revision as of 10:37, 26 October 2007

This tutorial teaches you how to create a world model from a view model. It does not teach you how to do modeling or how to work with a model editor. Even though the screenshot shows 3ds max 7, the same can easily be done in all other model editors if you have sufficient knowledge of them.

Please note that even though this tutorial uses a view model for demonstration a world model should have a lot less polys and / or LOD_Models to ensure best performance in-game.

Setting up your model

If you just take your model and compile it as a prop_physics, the engine will not know where to put it onto the playermodel. The result can be somewhat hilarious but is most likely not what you are looking for.

To change this, load your view model (without hands) into your favorite model editor. It will be helpful (but is not necessary) to remove all bones that you needed for animating your view model, so you end up with one object/bone.

Place the hand bone

Now there are two ways to go. The first one is if you are doing a new model (not a replacement model) or if you don't have the model you want to replace decompiled:

Create a new bone with the name ValveBiped.Bip01_R_Hand. Place it so that it is in the position you want the right hand of the playermodel to be. Now link your model to the bone. (If you move ValveBiped.Bip01_R_Hand now, the weapon moves with it.)

In case you have a decompiled model you want to replace, move your new model into the position of the old one, delete the old one and link your model to the ValveBiped.Bip01_R_Hand bone.

Note.pngNote:ValveBiped.Bip01_R_Hand is part of the standard Valve rig. If you use a custom rig, you'll need to use the bone name of that one.
Note.pngNote:ValveBiped.Bip01_R_Hand will not work as a bone name if using xsi instead you must create a bone called BIP01_R_Hand and parent it to the ValveBiped node

Export and compile

Export your model (make sure to export unused bones if your exporter asks you). Compile it like any other physics prop (however without $staticprop because that would collapse your bones).

Just for reference here is the .qc that was used to compile the model seen in the screenshots:

$modelname "weapons/w_m4a1.mdl"

$cdmaterials "models/weapons"

$scale 1

$keyvalues { "prop_data" { "base" "metal.medium" } }

$model w_m4a1 "w_m4a1.smd"

$sequence idle "w_m4a1" loop fps 15

$collisionmodel "w_m4a1.smd"
{
	$mass 3.0 // Mass in kilograms
	$concave
}

Now start the model viewer and load a playermodel of your choice as well as your world model. Most likely your weapon will not be perfectly sitting in the hand, might range from some fingers going through the weapon to the weapon pointing in a completely wrong direction.

Go back to your model editor. The actual position of the weapon or of the bone doesn't matter at all! All that counts is the relative position towards each other. In some cases you need to rotate. I'd advise not to rotate the weapon model but the bone. Either unlink it and link it later again or edit it without affecting children bones (for max you can find this setting in the hierarchy tab).

In case you want to add attachment-bones, like for a muzzle flash, add a bone with an according name (e.g. ValeBiped.muzzle flash) and link it to ValveBiped.Bip01_R_Hand.

Technical explanation

If you want to have a little bit of extra knowledge that helps you to understand how this works, read on.

The engine merges the bone ValveBiped.Bip01_R_Hand of your player model with the a bone of the same name in your world model (in case it's the root bone). All bones that are a child of this bone will naturally move with it, that's why we have linked the weapon and the muzzle flash to it. The skeleton of the player model and of your world model have become one! When you have loaded both in the model viewer and you activate Bones in the render tab you can easily see it.

To make sure the you got this correctly, you can also look into your .smd file.

If everything is correct, it should start like this:

version 1
nodes
  0 "ValveBiped.Bip01_R_Hand"  -1
  1 "m4a1"   0
end
skeleton
time 0
  0 # # # # # #
  1 # # # # # #
end

As you can see, in nodes the ValveBiped.Bip01_R_Hand is defined as the root bone while the bone called m4a1 is a child of it. In the skeleton part the position of both are defined.

If this is not the case, but you are sure that everything is set up correctly, check your exporter settings again.

See also