|
|
(5 intermediate revisions not shown) |
Line 1: |
Line 1: |
- | A little texturing tutorial by mcreed
| + | EzhB6t Hey, thanks for the blog article. Cool. |
- | | + | |
- | When I started to figure out how the texturing works I found it a bit difficult. I want to try to write a small tutorial on what each part means and how to use it. Theres some stuff on the wiki but its not yet complete.
| + | |
- | | + | |
- | You probably know these parts:
| + | |
- | | + | |
- | <pre>
| + | |
- | submesh
| + | |
- | texcoords
| + | |
- | 3, 0.0, 1.0
| + | |
- | 6, 0.0, 1.0
| + | |
- | 8, 0.0, 0.0
| + | |
- | 11, 0.0, 0.0
| + | |
- | 15, 1.0, 1.0
| + | |
- | 18, 1.0, 1.0
| + | |
- | 20, 1.0, 0.0
| + | |
- | 23, 1.0, 0.0
| + | |
- | cab
| + | |
- | 3,23,11,c
| + | |
- | 3,15,23,c
| + | |
- | </pre>
| + | |
- | | + | |
- | | + | |
- | | + | |
- | These lines define the texture, the skin of an object.
| + | |
- | "Submesh" introduces a new group of triangles, later I will try to explain why you need more than one group.
| + | |
- | Under "texcoords" you fill in all nodes that are involved in this group. The number beside each node represent its position on the texture image. Where "0.0, 0.0" would be top-left and "1.0, 1.0" always means bottom-right no matter what size the texture is. This is important to know! The position on the texture is relative to the size of the texture and not absolute. That can be a bit tricky sometimes!
| + | |
- | On the example image below you can see the crate texture in the upper right. Left of it there is an example of a "Submesh" group (red) with all texture coordinates for each node involved.
| + | |
- | How to know at what relative coordinates the position I need is? If you got photoshop turn on the ruler and set it to percent then position the cursor at the position you want and read out the percentages, these divided by 100 are your coordinates. If you don't have photoshop look if your favorite drawing program has rulers. You can always calculate the rel. coordinates yourself ( "actual x or y position"/"width or height" ) but it will be a bit more work.
| + | |
- | | + | |
- | When you start texturing your truck you will want to set all coordinates to 0.0. Doing that the triangles will have a solid color. When you did all triangles and checked for leaks ingame you can start to adjust the texture coordinates.
| + | |
- | | + | |
- | To get the texture on all sides you need different submesh groups. Why? Look at the example in the upper left, the front side uses 4 nodes on the upper-front edge, the top side texture uses these as well but in top-view they will need a different position on the texture image. If you don't perfectly understand what I mean make simple block or start texturing your truck, you will see what I mean when you need to assign two different coordinates to the same node.
| + | |
- | In this very example I made the feet a different submesh group because I had to "reuse" some parts of the original crate texture that has no feet in it. I am aware that you could go with fewer submesh groups but I took the easiest and most understandable way. I put front and backside in the same group.
| + | |
- | | + | |
- | [[Image:texturingtut.jpg]]
| + | |
- | | + | |
- | The model is built of triangles, for each submesh group you have to define all triangles that should be textured. That is done in the "cab" section.
| + | |
- | You could span a texture triangle betwen any three nodes. For a simple truck for example that means you could texture the top by doing just two triangles involving two front nodes and two back nodes BUT don't be tempted, stick to the physical structure because in case of deformation (which are a major part of the game) the texture would be only affected by the nodes its attached to.
| + | |
- | | + | |
- | The texture is only one sided, so when you look from behind it will be invisible. So you have to define in what direction the triangle is facing. How? By the order you put the nodes in. Counter-clockwise means facing to us, clockwise means facing away from us.
| + | |
- | When you add a ",c" behind the triangle it becomes contactable by, you guess it, contacter nodes.
| + | |
- | | + | |
- | [[Image:facing.jpg]]
| + | |
- | | + | |
- | Happy texturing!
| + | |
- | | + | |
- | ---
| + | |
- | | + | |
- | An additional important note :
| + | |
- | Also, another subtle effect of submeshes : a set of triangles defined in a submesh have a "blended" shading, that means that it looks like if it is a smooth surface.
| + | |
- | So to have hard edges between different skin planes you must subdivide them into different
| + | |
- | submeshes (one submesh for each set of coplanar triangles)
| + | |
- | The editor has an integrated submesh cutter : load a textured truck with it, save it, and the resulting truck will have its texture triangles grouped into coplanar submesh automatically. (but beware of bugs)
| + | |
- | | + | |
- | To illustrate a "blended" submesh, look at the back of the top of the scania cab. It looks round, even if its not, because I used the same submesh to do the top and the back of the cab.
| + | |