Author Topic: 3D Tutorials and Links (20170222 Images Replaced 1/3)  (Read 30383 times)

Offline Luther Blissett

  • Moderator
Re: 3D Tutorials and Links
« Reply #30 on: January 16, 2012, 02:10:31 am »
#3-3 : Rigging a basic model : Hat

Intro

I'm not going to go into much detail here. The rigging of such a hat is very straightforward, so initially I'm pretty much going to give you a quick step-by-step of "click this and that" and get the model in-game. The next part(s) of this tutorial will more clearly show how to use Fragmotion, how to rig more complex armours and test animations. However, the process is essentially the same, so the more adventurous may wish to play around with some of the other files and work it out for themselves.

If you haven't already, this would be a good time to read Lizard's Tutorial on Rigging in Blender as you should find this very useful in understanding how the skeleton structure works, and he has gone into infinitely more detail than I am going to.

Disclaimer : I can not say for certain that this method is perfect. Karpov has been rigging the "official models" so far using a biped system in Max, and this is quite different. However, as said - I have tested this and it is working in game. All the "extra files" in the earleir SDK tutorials have been done using these methods.

General skeleton and bone info
A bit of basic info to begin with, is a few diagrams of how the rigging and skeleton are put together :

Strenth of connections

All the little yellow dots are the vertices of the model, the blue circles are the bones and the coloured lines are the connections between those. The colours represent the strength of the connection between these. Each vertex is connected to either one bone at 100%, or several bones at fractions of 100%. The bone display in other programs works differently - in this one we have little circles with sticks connecting them, which is not quite as informative as the "connected triangles", but ultimately it's displaying the same information. To briefly look at the general pattern of things, if you consider the model to "begin" in its centre and grow outwards to the limbs, most of the model is 100% connected to the bone preceding it as we move away from this centre. Some areas with complex joint movement (i.e. shoulders, pelvis) have several looser connections instead. Generally speaking, armours will follow the same pattern.

Names of bones

Here's a map of the bone layout. The animations are connected to the names of these bones. They should mostly be self explanatory. Some sections (especially the ponytail) aren't immediately clear from this angle, but still hopefully you can get a rough idea of the structure. When importing an .x file from those already in game, Fragmotion seems to duplicate all the bones with a "no_name" copy. As far as I've found from testing, all the no_name bones can (or should?) be deleted.

It's also worth noting that through my or Fragmotion's error, the model is effectively flipped left to right - notice that the "right leg" is from our perspective, not from the model's own right. This is the other way round in game, so if you have a non-symmetrical model, you will need to flip this as well. We will need to do this with our beret.

Bone tree structure

Hopefully this is fairly self-explanatory. These are the parent/child bone relationships (covered well in Lizard's tutorial), forming the entire "tree" of the skeleton. You can also see the ponytail bone segments a little more clearly from this angle. Looking at those connection strengths again, by looking from this angle, hopefully you also get a flavour of how the vertices and bones are connected i.e. on the left leg, everything from toes until the ankle connects to L_Foot, then everything until the knee connects to L_Calf, then everything on the rest of the leg connects to L_Thigh. When it reaches the pelvis, because of the motion of the legs at this point, it becomes quite complicated.

I'm a little unsure regarding the handles (L_Handle and l_handle_1 etc) - two are disconnected from the main tree, and two are included in the hands, though this is what's displayed from an imported .x model, and appears to work in game.

With this in mind, we should again have a quick look at these examples of other armours :



If you compare what we see here with the human model above, it should be fairly clear how the structure works. Basically, you want to study the existing models. As mentioned, you can import existing .x files into Fragmotion. Import them and have a look at a few. Try and find one which is similar to what you're rigging, then you can pretty much just rig yours in the same manner.

For more complex ones we'll need to test the rig against a full set of animations, but we'll cover that later. For now, we're doing a hat - so it's simply a matter of connecting the entire hat model to the head bone at 100%. We don't need to test this against running and walking etc, because of its simplicity.


Getting started

Download these (you may have the beret already) :

human_skeleton_only.ugh (Karpov's male hero skeleton) (New link 22/01/2012)
Beret export selected.zip (contains obj, mtl and same texture file)
(New link 22/01/2012)

So, start Fragmotion. It is a trial-based "nag-ware", though it will let you run the program in a fully functional manner if you have "typed a prayer" to run it for one week. As said previously, it's made by a small independent developer, so if you're able, I'd suggest you try and support that by purchasing the full version.

Otherwise, type in the "code" as suggested :


Very quickly, you should have a screen roughly as follows


Brief controls / layout overview

Note that it has one of those "drag bits about and reposition them" interfaces, so may be slighly different. Each window / panel can be enabled from the Window menu at the top. All the buttons have tooltips on mouseover, if you feel like exploring. Otherwise, we'll just look at these :

Viewing options

Show backfaces
Show the back of faces from "hollow" shapes.

Show bone assignments with lines / vertices
The coloured lines from the pictures previously, showing connection strengths. On or off / same but with the colour of the dots themselves

Show vertices / skeleton
Vertices or skeleton visible

Show axis / show grid
XYX axes and grid visible

Side panel

The top half of the side panel will contain things like objects, skeletons, animations etc. We will briefly use the "models" tab to select the hat, but otherwise won't need to use it in this example. Beneath should be a section labelled "Tools", including things such as select, transform, skeletal animation etc. Have a look through for future reference, but again we're only going to need "select" and "mesh" in this example.

Very brief control overview
RMB : Rotate
Scroll wheel : Zoom
LMB : select (dependent on select menu in tools section)
MMB : (scroll wheel press down) drag camera panning


Importing and rigging the hat

So, firstly we need to bring the skeleton in.
File > open > human_skeleton_only.ugh

Assuming "view skeleton" is switched on, you should see this :

You should recognise this guy's shape from the earlier diagrams. If you click on the "Skeleton" tab on the upper-right panel, you'll see the skeleton tree, as shown in images earlier

Adding the hat
We add extra things to this "project" by using "Merge", rather than using "open" (which would replace our current skeleton). Note that "merge animation" can be used when testing animations.

File > merge > 3-4 beret export selected.obj
If you exported one of these yourself, then search for that file name.

It will ask which things to import. In future, you may wish to be selective about this, but for now, just take the default.


Hopefully the hat appears now. If you've got "vertices" view button switched on, you'll see the hat covered in the little yellow dots.


At this stage, we must remember that the model is flipped. if we want it to be the other way round, we can change this now. We will select the beret "group" and flip it. Of course we could have done this in the earlier alignment stage if I was better at remembering what I was doing whilst writing tutorials :)

Flipping
Go to the models tab in the upper right and double click on "group > beret_beret". This should highlight the hat in a bright shade of red.

Change Tools (bottom right) to Mesh, and click "Mirror".
In the panel below, click :
Origin 0,0,0
Direction Across X plane
Mirror all is off
Click Invoke

This should flip the model round like so :


Rigging the hat
Now, the actual rigging bit. In this example, you will be pleasantly surprised by its simplicity.

Again, go to this panel in the bottom right and go to :
Tools>Select>Select Bone
Click on the "Head" bone, like so :


Your vertices should already be selected (pink dots instead of yellow). If not go to :
Edit>Select all>Vertices


Now go to the top menu, and select
Bone>Assign selected vertices to bone (or simply press CTRL+B)


A little window should come up. Drag the slider into red until it's as above (Head, 1.000)

Now click "set"

You can close this subwindow now. If you've got the "Show bone assignments with lines" button switched on, you should see this.


This is now rigged. Well done.

Exporting
Go to the top menu, then File> Export > Direct X
Use these settings (other settings may work)


A nice filename might be "armor_male_beret.x"


Testing the model in game

If you've already read the previous SDK ones, you can probably work this out for yourselves, but we'll go through it quickly anyway.

Files and folders
In your 3d testing folder (you do have one, right?), copy these as follows :
armor_male_beret.x to \Client\data\art\critters
armor_all_beret.png to \Client\data\textures

Now we need to edit the fo3d file. Go to
\Client\data\art\critters\_FOHuman.fo3d and open it in notepad or similar.

Scroll down until we get to layer 4 (param 154)

Code: [Select]
# Head --------------------------
Layer 4
  Value 5 Root DisableLayer 7 Attach armor_%anim%_combatarmorhelmet.x
  Value 6 Root Root Attach ATR_PowerArmorhelmet.x
[...]

At the end of this, we add :

Code: [Select]
Value 35 Root Attach armor_%anim%_beret.x Texture 0 armor_all_beret.png
Of course, you may use a different value instead of 35, depending on how much other stuff you've got in there. As explained in previous tutorials, this will attach our model to value 35 on layer 154. The %anim% line will refer to armor_male_beret.x and armor_female_beret.x as necessary (we've only made the male model in this case, but it would be the same for the female).

Codes in game
Start your singleplayer 3d test and follow as indicated in the earlier tutorials.

These lines should give you the hat
Code: [Select]
~getaccess admin password
~ param 0 154 35

He has a hat on.

Obviously, you can also do a
Code: [Select]
~param 0 153 13
~param 0 155 13

Then you get


So, that's a very simple rig - it's difficult to do wrong. At some point in the near future, I'll try and finish writing up and preparing a few extra bits, possibly including :

- Rigging various armours
- More thorough description of how Fragmotion works
- Testing armours against multiple animations
- Reimporting rigs to correct errors

and later on, possibly even :
- Adjusting the existing animations to create your own
- Rigging new base humans
- Rigging new unique critters with animations

Hopefully the more adventurous amongst you can look at what we've gone through so far and learn a little more yourself - it'll be quicker than waiting for me to prep all the files, screenshots etc :P

Of course, as with previous tutorials, please feel free to ask questions, offer recommendations or corrections.
« Last Edit: January 22, 2012, 06:08:34 pm by Luther Blissett »

Offline Luther Blissett

  • Moderator
Re: 3D Tutorials and Links
« Reply #31 on: January 28, 2012, 07:08:20 pm »
Has anyone had a go at this? Does it make any sense? I've got several further stages of rigging and animation to explain, but if I'm not making any sense with the more basic stuff, I think that needs fixing first :)

Any feedback on things which could be made clearer or better? Has anyone tried this and succeeded?

Offline DanteAligheri

  • Sometimes I don't finish all my sandwich.
Re: 3D Tutorials and Links
« Reply #32 on: January 30, 2012, 02:55:44 am »
Yes Luther, it's pretty awesome! Very easy to follow and good to start with I suppose, I mean I don't ever do any of this and I did it is why I say so. To the harder stuff!!!

Offline Luther Blissett

  • Moderator
Re: 3D Tutorials and Links
« Reply #33 on: January 30, 2012, 04:31:03 am »
That's good to hear :)

I'll see about trying to put something together for more complex armours as soon as I have a suitable chunk of free time (could be this week, could be a month).

Re: 3D Tutorials and Links
« Reply #34 on: March 10, 2012, 04:43:06 pm »
I think a little texturing tutorial may come in handy.
This one is a real basic one targeted to those who have used blender before and know its user interface. To make it easier there is an obj that can be used for this tutarial get it from here and import it to the scene.
http://www.2shared.com/file/ESg5O50z/texturing_tutorial.html
And here is what the end result may be.


After importing the object go to front view


To make it simple we will use two materials one for the glass and one for the labbel. Go to the material tab and add materials to the object, you may rename the material to glass and the next one to label. Use the + button to add materials to the object.

After you created 2 materials switch to Edit mode. Select the area that will be the label and use the assign button on the materials tab.

The next step would be making seams. Seams are lines that tells how the uv will look like. Select the following edges then press ctrl+e and choose mark seams.

After this select the whole modell and create an uv map. Press u and choose Unwrap. This will generate an uv map along the seams we created.
The next step is to change the 3d view to UV image editor

As I said I assume that those who try to do the tutorial know the basics of blender. Try to make the uv map look like this:

Now that we have an uv map its time to create a texture. Select uvs and choose export uv layout.

It is time to edit the uv map with your choice of photo editing software.
When you are happy with your label save it and go back to Blender. Select the material of the label. Then go to the texture tab. Add a new texture to it choose image as type then locate your own texture.

After its added scroll down till you see mapping. Select coordinates as uv and on the layer choose your own uv layer.


If you did all as it was written here then you should see the label on the bottle after pressing render. If the picture is too dark add more light to the scence or set enviroment lighting or ambient occlusion on.

Re: 3D Tutorials and Links
« Reply #35 on: March 11, 2012, 11:56:04 am »
Thanks a bunch for that jotisz, it has helped me a alot in advancing my knowledge of getting textures onto my model.

IM EXCITED. :D

Ox
Ranger of the Wastes. The Wastes still needs civilised people.

Offline Karpov

  • Moderator
  • Come Together
Adding specular maps
« Reply #36 on: March 11, 2012, 09:01:58 pm »
How to add a specular map to a weapon (AKA "Polish my gun")
Now that we have the proper weapons I will start importing the rest. But none of them will have specular maps. So I made this tutorial for when that time comes.

First of all I have to explain how the weapons work in the game.

There is a file called _FOhuman.fo3d inside the data/critters folder. Open with text editor.
  Find Right Handle. After "Layer 1" we have a lot of lines beggining with "Value". The number next to it is the Item ID for each weapon, and right
after that it says "attach" and the name of the model file.

Code: [Select]
Value 13   Attach WP_bazooka.x      (some parameters here)
This example shows number 13 which is the rocket launcher. But this is will only show the model and it's default texture in the game.
  If we want to use a different texture, and/or add a specular map to it we will need to create a new config file for this weapon.

We create a simple txt file inside data/critters. Rename it WP_bazooka.fo3d (change the extension too, don't leave it txt).

Inside this file we will write this:

Code: [Select]
Include _VBWeapon.fo3d name WP_bazooka

Effect 3D_SpecularMapping.fx
EffDef Floats Specular_Power 8.0

Texture 0 ITEM_bazooka.tga
Texture 2 ITEM_bazooka_spec.tga

Save it. Now we need to create 2 textures, first one (Texture 0) is the diffuse texture, but it can be skipped if the default texture is fine.
The second one (Texture 2) is the specular map. Both texture files go under data/textures. Specular power value can be changed to make the
 surface more or less polished.

Now we go back to _FOHuman.fo3d and change our line:

Code: [Select]
Value 13   Attach WP_bazooka.xto
Code: [Select]
Value 13   Attach WP_bazooka.fo3d
(don't change the following part of the line)

  This will tell the engine to look for the file we just created instead of a plain 3d model, and the file we created will point to the model itself.



How to create the texture.

It's easy, using the diffuse texture as a guide, paint white where the weapon should shine, and black where it should not. You can play with
 inbetween values to give nice effects. Also, it can be tinted if you want the weapon to shine in a specific color.



From the first texture I created the specular map. Note how I paint black the section of the texture that will be the inside the barrel, because I don't want the inside to shine. Also there is a lighter stripe, which I wanted to make a bit more shiny.
« Last Edit: March 11, 2012, 09:04:45 pm by Karpov »