FOnline Development > 3D Development

3D Tutorials and Links (20170222 Images Replaced 1/3)

<< < (2/8) > >>

Luther Blissett:
Excellent work, Graf :D

I checked the "google translate to English" version of yours, and it still seems to read fairly well, so it must be a good job. I also noticed there were some extra details which you've clarified in there which were missing from my original - for example, the points about Character ID (from SetCritParam) - I'll add these to the original too. If you see any other bits missing, then let me know, or edit them in to my original post yourself.

Should finish these bits later today :
Adding items to yourself
Armour object / model linking basics
Parameter Summaries

They're almost ready, but I had to stop yesterday to go out for the evening. The next "main" part (testing your own textures in game) will be quick to finish too - so should be ready tonight or tomorrow I think, then hopefully some of our skilled skin texturers (i.e. Johnny Rust and SmartCheetah etc) should be able to test their work in the game.

I'm still finding the rigging quite complex, so I think I'll add an extra step in there, to show how to rig a hat first - because this is very simple (all vertices attach to the same bone, so can be done in about a minute). I can add the more detailed armour ones after I've tested a few more things myself (I'm still learning, of course).

[edit] Added last part of #1 Setting up an SDK

#1 Setting up an SDK (continued, part 3)

Adding items to yourself
To test the model properly we will need to check the animations of different weapons. The in-game objects are not yet linked to the 3D objects, but they are linked to the animations. If you put a rifle in your hand, the character pose changes to the "rifle idle" pose etc. The weapon 3D model itself will be invisible until added by command.

We can get the numbers from the file :


4      PID_KNIFE
5      PID_CLUB

The code for adding an item to oneself is :

~additemself x y
x - item number
y - quantity

For example :

~additemself 1 1 (adds 1 leather armour)
~additemself 2 1 (adds 1 metal armour)
~additemself 3 1 (adds 1 power armour)
~additemself 74 1 (adds 1 leather jacket)
~additemself 41 10000 (Adds 10000 bottle caps)

Hopefully, if you followed the instructions previously, you have a very high carry weight, so we can add a few weapons too :

~additemself 5 1 (adds 1 club)
~additemself 6 1 (adds 1 sledgehammer)
~additemself 8 1 (adds 1 10mm pistol)
~additemself 9 1 (adds 1 10mm smg)
~additemself 23 1 (adds 1 Assault Rifle)

Add any other items of your choosing via the same method. You should be quickly able to equip yourself suitably for easy survival in the wasteland, and therefore the ability to test weapon animations with new armours and textures.

Testing the items
Whilst the objects and models are disconnected, we can wear any armour, and it won't change the visible armour. For the sake of testing, you may as well wear the power armour. It will still look like whichever 3D model you previously set by the "~param 0 153 z" command.

The weapons, however are connected to the animations. If you put the Assault Rifle in your hand, it will switch to the "rifle idle" pose.

The 3D model for the rifle is absent. This must be added in the same manner as we changed the appearance earlier. The layers for the hands are active (right) hand (151), and inactive (left) hand (152) :

~param 0 151 z (active weapon)
~param 0 152 z (holstered weapon)

z=value from _FOHuman.fo3d file

Some of the object and weapon numbers are the same, for example the assault rifle is both object 23 and value 23 :

~param 0 151 23 (Assault Rifle)

Some of the other weapons will also match up with numbers, so it's easier to remember - though make sure to also swap the object in hand to one of the same class (rifle, pistol etc) :

~param 0 151 8 (10mm pistol model)
~param 0 151 9 (10mm smg model)

Most of them don't line up, however. For example, the sledgehammer is object 6, but value 56

~param 0 151 56 (hammer model)

Setting the value to -1 should turn the layer off.

We do have the facility to show a holstered weapon using layer 152. You should check this when testing or aligning weapons.

Armour object / model linking basics
As mentioned previously, none of the work related to linking objects to 3D models has been done yet, though a couple are still loosely connected, possibly from the Van Buren test files. If we set layer 153 to 0, the armour slot will dictate what the attached model is.

~param 0 153 0 (sets no armour, allows armour slot to influence model)

Currently, I haven't investigated this thoroughly, so can only explain what it appears to have done :

NOTE : The following info may well be wrong.

If we again look at the PID numbers from \Server\data\ItemNames.lst :


It appears that these are linked to values 1, 2 and 3 from the # Body layer of _FOHuman.fo3d - therefore :

Leather armour (item 1) appears to be connected to layer 153 1, therefore attaches the leather jacket 3d model
Metal armour (item 2) appears to be connected to layer 153 2, therefore attaches the metal armour 3d model
Powered armour (item 3) appears to be connected to layer 153 3, therefore also attached a metal armour 3d model

If anyone has further information about how this sections works, please let us know.

Parameter Summaries
For reference, this is a list of the appearance parameters. There appears to be facility to hold up to 30 different appearance layers.

We can see the different models and textures applied to these layers if we look at :


These layers should all be working :

150 # Skin (Skin tone)
151 # Right Handle (Active weapon)
152 # Left Handle (Holstered weapon)
153 # Body (Armour model)
154 # Head (Helmet / Hat model)
155 # ArmorClothing (clothing texture)
157 # Hair (hair model)
163 # Pants (separate lower body clothing texture)
164 # UpperClothing (separate upper body clothing texture)
165 # Backpack (backpack)

I don't believe these layers have been used so far with the "Karpov era" 3D models. It's possible they can be reappropriated for other uses.

156 # ?
158 # Eye (not tested)
159 # Mustache
160 # Ponytail
161 # Beard
162 # Shoulderpieces

White tiger:
Excellent manual Luther!

Luther Blissett:
Thanks! I have the next one ready now :)

Again, this is a first version, so it needs testing and checking for accuracy. If anyone spots any problems, errors or confusing parts, please point them out. Anyone with editing powers, feel free to edit the post to correct any problems.

#2 - Testing custom body textures
This should cover the steps necessary to test a custom base texture in the game. That covers either skin tones, or clothing layers.

Other than the work in Photoshop or Gimp etc, it basically involves copying files to the correct folder and editing the
_FOHuman.fo3d file. We'll be working with the following layers :

150 # Skin (Skin tone)
155 # ArmorClothing (clothing texture)

Firstly, you'll need to make sure you have a 3D compatible SDK set up. Assuming that's all in order, the rest of this should be straightforward.

Preparation files
The next step is working on the texture itself. You may have done this already. If not, I suggest downloading the following texture guides. These are layered PSD files, which contain overlays to show the models' edges and the subset outlines :

Base Human Male Subset / texture map

1024x1024 layered PSD file, with outline, colour markers and base texture (~4.5MB)
subset map male.psd (New link 22/01/2012)

Base Human female Subset / texture map

1024x1024 layered PSD file, with outline, colour markers and base texture (~3.5MB)
subset map female.psd (New link 22/01/2012)

I won't explain how to make the textures themselves here - that's your own creative process. However, if you're new to this it may be worth looking at some of the existing textures in the \Client\data\textures folder, and then asking questions on the 2238 3D Development forum. There is a good little community of talented and friendly people on there who should be able to help you. Of course, if one of the texturers wants to make a tutorial illustrating their personal technique, that would be very useful.

Testing a skin tone / base layer
If you've set up your 3D compatible SDK according to the previous tutorial, you should have a few currently unimplemented textures. If we look in the \Client\data\textures folder, we should find three tribal designs from user Johnny Rust :


These are skin tones for the bottom layer (150). These can be partially covered by the #armourclothing layer (155), but will always show through on areas designated in the subsets, which we will cover later. In short, this means that the bare skin (normally the head and hands) will always maintain the skin tone underneath, regardless of what colour shirt or trousers is being worn.

Looking at the _FOHuman.fo3d file
So, this should be quite straightforward. Open up your \Client\data\art\critters\_FOHuman.fo3d file and scroll down to the skin section :

# Skin
Layer 0
 Value 1   Root Texture 0 %anim%_Skin_white.jpg Texture 2 %anim%_skin_spec.tga
 Value 2   Root Texture 0 %anim%_Skin_whiteTT.jpg Texture 2 %anim%_skin_spec.tga
 Value 30  Root Texture 0 %anim%_Skin_lbtest.jpg Texture 2 %anim%_skin_spec.tga

A quick description of the components here :

Layer 0
All the layers in the fo3d start from 150, so this corresponds to layer 150, as you will recognise from the previous tutorial.

Value z
This is the value to use when selecting this skin via in game command.

Command which merely says this goes on the base model

Texture 0
This is our diffuse layer, to use the texture specified.

The %anim% refers to the anim line from the model fo3d files (i.e. VbMaleStrong.fo3d and VbFemaleNormal.fo3d). If you open VbMaleStrong.fo3d, you will see it specify "anim male". As well as this selecting which animation files to use, it also refers to the texture files, so for example :

%anim%_Skin_lbtest.jpg (code from fo3d file)
male_Skin_lbtest.jpg (the file it will search for when the model is male)
female_Skin_lbtest.jpg (the file it will search for when the model is female)

When other body types are implemented, they will refer to whichever file corresponds to their animation set. If the fat man uses the "male" animations, it would look for the same file. If he has his own "malefat" animations, it would look for "malefat_Skin_lbtest.jpg".

Texture 2
This is our specular layer (the shinyness, affecting highlight and shadow), and will use the texture specified, with the %anim% command working exactly as above. User Karpov has kindly supplied us with a selection of base skin speculars.

Texture 1
This is not mentioned here yet, but is currently in development by user JohnnyBravo. This layer will be used for normal maps (super bump maps, to add extra detail for the shaders to use for highlights and shadows). When implemented, the normal map will be specified in the same manner as the other two layers.

Implementing the files into the _FOHuman.fo3d file
From this, we can now look at adding our three textures here. If we scroll to the bottom of the # Skin section, and add some new lines below value 30 :

Value 31  Root Texture 0 %anim%_Skin_rust_shaman.jpg Texture 2 %anim%_skin_spec.tga
Value 32  Root Texture 0 %anim%_Skin_rust_headhunter.jpg Texture 2 %anim%_skin_spec.tga
Value 33  Root Texture 0 %anim%_Skin_rust_urban.jpg Texture 2 %anim%_skin_spec.tga

Now save your _FOHuman.fo3d file. Note that currently we only have male textures, so you won't be able to test these with the female model yet.

Testing in game
If you've gone through the previous tutorial, you will probably know how to do this already, so we will make the assumption that you have your SDK running, and you have a save game with your character ready for testing.

Run the FOnlineSingleplayer.exe
Load your saved game
Run the code ~getaccess admin password

Now follow the same parameter codes as previously :

~param x y z

x = Use 0 for this.
y = parameter number. 150-165 are our appearance parameters.
z = value of parameter y

Let's remove the hat / hair / armour / clothes (on the 3D model, it is not necessary to remove your own clothes) :

~param 0 154 -1 (hat off)
~param 0 157 -1 (hair off)
~param 0 153 -1 (armour off)
~param 0 155 -1 (clothes texture off)

Now we can try the three new skin tones :

~param 0 150 31
~param 0 150 32
~param 0 150 33

If you want, you can give him a pair of tribal trousers :

~param 0 155 28

Notice that the trousers cover the skin up, but leave the head, chest, arms and feet? That's the subsets from the clothing layer, which we will look at next.

Testing a clothing layer
Again, this is mostly text editing. We're going to be using layer 155, specified in the fo3d as :

# ArmorClothing --------------------------------------
Layer 5
   Value 1 Root
                Subset 4 Texture 0 Male_baseblack.tga Texture 2 no_spec.tga
                Subset 3 Texture 0 %anim%_leatherpants.tga
                Subset 6 Texture 0 %anim%_leatherpants.tga
                Subset 7 Texture 0 %anim%_leatherpants.tga
                Subset 8 Texture 0 %anim%_leatherpants.tga
                Subset 10 Texture 0 %anim%_leatherpants.tga                 

This should all look quite familiar - the value, the root, the texture 0, the %anim% and the texture 2 all working exactly as above. The one difference here is the subsets.

Subsets are how we control which areas to apply the clothes to, and which should be left empty for the skin to show through underneath. Assuming you took the texture guides from above, you will have seen the coloured and numbered sections of the subsets. These correspond to certain areas on the body, clarified here :

So, we can choose any of these subsets to apply the clothing texture to, based on the lines from the _FOHuman.fo3d file. If we look at subset example man below, we can also specify different textures to different subsets :

If you look at the lines on the right of the image, we have different textures applied to different subsets. In practice, this means we could take the trousers from one texture, the shirt from another texture and the shoes from another etc. The section names and colours should correspond to those in the guides we looked at earlier.

Example code
This is probably pretty clear already, but we will try a little example. In your \Client\data\textures folder, you should have a test file for a generic yellow costume :


We will now add 3 variations to our _FOHuman.fo3d file. Scroll to the bottom of the  # ArmorClothing section. The last layer should be 34. We're going to add a 35, 36 and 37 to it :

Value 35 Root
            Subset 1 Texture 0 Armor_%anim%_yellow_body.png Texture 2 no_spec.tga
            Subset 6 Texture 0 Armor_%anim%_yellow_body.png Texture 2 no_spec.tga

This one will just cover subsets 1 and 6 - a costume which you probably shouldn't wear unless you're in the circus.

Value 36 Root
            Subset 1 Texture 0 Armor_%anim%_yellow_body.png Texture 2 no_spec.tga
            Subset 3 Texture 0 Armor_%anim%_yellow_body.png Texture 2 no_spec.tga
            Subset 4 Texture 0 Armor_%anim%_suit_clothing.jpg Texture 2 no_spec.tga
            Subset 6 Texture 0 Armor_%anim%_yellow_body.png Texture 2 no_spec.tga
            Subset 7 Texture 0 Armor_%anim%_yellow_body.png Texture 2 no_spec.tga
            Subset 8 Texture 0 Armor_%anim%_yellow_body.png Texture 2 no_spec.tga

This should give us a full pair of trousers (6, 8, 3, 7), with a sleeveless vest (1). Note that we're also using the shoes (4) from the "suit clothing" texture.

Value 37 Root
            Subset 0 Texture 0 Armor_%anim%_yellow_body.png Texture 2 no_spec.tga
            Subset 1 Texture 0 Armor_%anim%_yellow_body.png Texture 2 no_spec.tga
            Subset 3 Texture 0 Armor_%anim%_yellow_body.png Texture 2 no_spec.tga
            Subset 6 Texture 0 Armor_%anim%_yellow_body.png Texture 2 no_spec.tga
            Subset 7 Texture 0 Armor_%anim%_yellow_body.png Texture 2 no_spec.tga
            Subset 8 Texture 0 Armor_%anim%_yellow_body.png Texture 2 no_spec.tga

This should give us a pair of trousers (6, 8, 3, 7), with a short sleeved shirt (0, 1). He will be wearing no shoes.

Copy the relevant lines into the _FOHuman.fo3d file and save it.

Testing in game
We can now test these files via commands. This should be probably quite familiar to you now.

If the game is already running, you'll have to quit and restart, as currently there's no way to refresh the fo3d files and textures.

Run the FOnlineSingleplayer.exe
Load your saved game
Run the code ~getaccess admin password

Firstly, let's change to a simple skin texture, as it will make the example clearer :

~param 0 150 30

Now we can try our three new values :

~param 0 155 35
~param 0 155 36
~param 0 155 37

This should all be clear now, but just to illustrate the interaction between layers 150 and 155, let's change the skin tone underneath :

~param 0 150 4

now check the values 35 and 36 again :

That's basically it. Now we have seen and tested this, we can look at one of the potential problems.

Problematic textures
As I'm sure you've noticed, the subsets are reliant upon the different parts of the texture stopping at specific edges. If there is to be visible skin, the seam between the skin and clothing must end at the edge of a subset. If we try to add a 3/4 length sleeve, or cut a "v neck" into the shirt, we will end up with the "skin" part of the clothing layer being used, which will ultimately end up with problems such as black skinned characters having patches of white skin. This is most problematic on some of the female textures, where a "V neck" is required to replicate the sprite correctly.

Potential solutions to this are :
- Adding some extra subsets
- Restricting some clothing to certain skin colours
- Create separate textures for different skin colours
- Adjusting the textures so all lines end at a subset edge (i.e. for a V neck shirt, we put a white vest underneath)
- Including v neck style clothing on the base skin layer (150)
- Making some of the clothing as separate 3D models

If you have any thoughts on ways to do this, please discuss them with us on the 2238 3D Development forum.

File names and formats
Hopefully the naming patterns are quite clear from the previous examples. The key part is that the %anim% section can related to a male or female equivalent in the file name. For my test stuff, I have been using the format :

Clothing layers :
Armor_%anim%_[NAME]_body.[FILE FORMAT]

Skin tones :
%anim%_Skin_[NAME].[FILE FORMAT]

Texture for armours and hats :
Armor_all_[NAME].[FILE FORMAT] (note the "all" rather than %anim%, if the texture is the same for both genders)

Note that this is my personal preference, and not necessarily the "offical" naming method. Ultimately, all the files in the repository can be sorted and renamed once a standard is agreed upon, which would make locating the files much easier for future adjustments or modding.

File types
For textures, the engine seems quite flexible and will happily use jpg, png, bmp, tga, dds. It will probably accept many other formats. My personal preference is png, but this is not necessarily the "official" file format. Again, once a standard is agreed upon, all files will later be converted as necessary. This may require a lot of testing relating to memory usage between different files types.

I will be busy at "real life" for the next week, so there might be a slight delay before the next tutorials. The main one being the model rigging / skeleton tutorial. I'll still have enough free time to check the forum and answer questions, but probably won't have time to prepare files, screenshots and write up the next sections until a few weeks.

If anyone is feeling particularly adventurous, and doesn't mind a bit of "self-powered learning", they might want to try this quick tutorial. Note that for the "proper one" I'll have many of these files pre-prepared for you, making the process much simpler.

The very, very short guide to basic skeleton rigging
- Download Fragmotion and Wings 3D
- Import CR_HumanMaleStrong.X into Fragmotion and export as an .obj to make a "correctly aligned man"
- import this obj into wings, then import your 3d model
- align and resize the model in Wings3D, so it fits with the human
- delete the human and export the aligned model as an obj
- Load fragmotion and import some existing .x files to examine the rigging. Learn how it works.
- Import CR_HumanMaleStrong.X, then merge with a load of animations (walk, run, pickup, punch).
- Delete all the no_name bones and save this merged animation test file
- Read Fragmotion rigging tutorials from the internet
- Merge your "animation test file" with your 3d model and rig your model to the skeleton (hats are easy - attach all vertices to Head).
- Test the different animations in fragmotion. Adjust until it works. Save it.
- Delete human, and all animation data, leaving just your model rigged to skeleton.
- Export this as an .x file, using these settings or something similar.
- Put this x file and relevant textures in the right folders
- Look in the fo3d at how the other armours are attached
- Write something similar linking your files
- Test in game as in previous tutorials
- Reimport to Fragmotion and correct mistakes

I may have missed bits out, and lines such as "Read Fragmotion rigging tutorials from the internet" will obviously require a bit of work, but if anyone's got the time to learn a bit more themselves, there might be just enough there to work with. Otherwise, I'll write up a clearer step-by-step guide when I next have enough free time :)

Thanks for the wall of text. It's very useful.

Luther Blissett:
It all still needs testing, checking and improving in places - then once it's definitely working and correct, we can look at putting the same info onto the wiki.

I definitely wouldn't consider any of it to be "written in stone" - there are likely to be mistakes and incorrect information in there, and likely whole sections that are missing. Corrections and suggestions would be very welcome.

Ideally if someone who's not tried any of this before can volunteer to follow it all from start to finish, then report back here, we can hopefully find any problems and errors and correct them.

Alternative tutorials using different software or methods would also be very useful, as would bits covering any areas that have been missed so far.


[0] Message Index

[#] Next page

[*] Previous page

Go to full version