Difference between revisions of "Fixing facial texture on decompiled human models"

From Obsidian Conflict Wiki
Jump to: navigation, search
 
Line 2: Line 2:
 
It was written by Wunderboy.
 
It was written by Wunderboy.
  
 +
[[Image:Problemfk7.jpg]]
  
 
The problem comes from the fact that when Cannonfodder's decompiler creates the UV map, instead of keeping the values in the range 0 to 1, it moves the vertical, V, axis down into the -1 to 0 range. Effectively this makes your UV map appear below the normal UV mapping space.
 
The problem comes from the fact that when Cannonfodder's decompiler creates the UV map, instead of keeping the values in the range 0 to 1, it moves the vertical, V, axis down into the -1 to 0 range. Effectively this makes your UV map appear below the normal UV mapping space.

Latest revision as of 04:16, 3 May 2008

This tutorial has been ripped from the steampowered forums to be kept archived. It was written by Wunderboy.

Problemfk7.jpg

The problem comes from the fact that when Cannonfodder's decompiler creates the UV map, instead of keeping the values in the range 0 to 1, it moves the vertical, V, axis down into the -1 to 0 range. Effectively this makes your UV map appear below the normal UV mapping space.

The diagram from 3DS Max shows what I mean:

Cfvsnormuveb1.png

The UV map should be within the blue bordered square as show on the right. The left shows what CF's importer does, it moves it down below the square.

Now, normally in Source a texture will tile vertically and horizontally so this isn't too much of an issue. The face texture would be repeated vertically and line up with the misplaced UV so everything would appear normal.

However, if a texture has it's S and T clamp flags set, instead of tiling, it will repeat the edge pixels meaning anything not within the center 0 to 1 UV range gets the striped texture problem.

The picture below explains what I mean:

Clampedvsnonclampedgd3.jpg

As you can see with a clamped texture and an out of bounds UV map your mesh gets covered with the repeated edge pixels a.k.a your "candy cane" problem.

While removing the S and T clamp flags on the texture is a quick solution the proper way to fix it would be to move the UV map back up into the position it's meant to be in.

In 3DS Max is actually fairly easy to fix. You just select your entire UV map, switch to relative co-ordinates and set the V value to 1. This will push your UV map back up into the correct co-ordinate space.

Maxuvfixqe1.png

Hope that helps explain it!