FOnline Development > 3D Development

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

<< < (8/8)

Thanks a bunch for that jotisz, it has helped me a alot in advancing my knowledge of getting textures onto my model.



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: --- Value 13   Attach WP_bazooka.x      (some parameters here)
--- End code ---

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: ---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
--- End code ---

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: ---Value 13   Attach WP_bazooka.x
--- End code ---

--- Code: ---Value 13   Attach WP_bazooka.fo3d
--- End code ---

(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.


[0] Message Index

[*] Previous page

Go to full version