[MED] Skin editor texture coordinate distortion

Posted By: YellowAfterlife

[MED] Skin editor texture coordinate distortion - 05/11/11 00:06

Reproduction:
1. Open MED
2. Open Skin Editor
3. Import a small (for the best effect, <16px) skin
4. 'Enjoy' - half of pixel at each side of texture is not taken into account.

This effect is the most noticable if you will try to wrap a cube with 4x4 texture. This is how it looks:

Notable thing is that preview window displays texture correctly - it's only a bug in 'textured rectangle' drawing on left side.
A image of 8x8 image (just the same one tiled 2x2) can be seen below. For better comparsion, I replaced one quarter of texture with a stretched version of original image (that is aproximately how it should look):


While this is not a critical bug, it causes (different) precision loss when mapping models with MED.
Models with large textures barely suffer from this, while on small textures it may confuse the viewer about placement of contents (vertices and triangles), causing one to re-arrange them and find out that they don't match on 3d model now.
Posted By: ratchet

Re: [MED] Skin editor texture coordinate distortion - 05/11/11 10:47

Just use a Blender ,Wings 3D or any free modeler if you plan to make
Low Poly stuff laugh
Posted By: jcl

Re: [MED] Skin editor texture coordinate distortion - 05/12/11 08:48

As you see, editing 3D models is sometimes not as simple as it seems.

The reason for that strange cutting off half the pixel is the way how 3D engines map textures to surfaces. They always render from the center of the first to the center of the last pixel. Thus the render area is one pixel smaller than the actual texture size. For compensating this, the texture scale is a little enlarged.

If the engine would render from the start of the first to the end of the last pixel, as one would normally assume, the surface would get visible seams because the last pixel mixes with the first. So for displaying mapping you must always make a compromise. The 2D window shows the correct mapping, even if it may look strange to you.
Posted By: YellowAfterlife

Re: [MED] Skin editor texture coordinate distortion - 05/12/11 10:55

Originally Posted By: jcl
As you see, editing 3D models is sometimes not as simple as it seems.

The reason for that strange cutting off half the pixel is the way how 3D engines map textures to surfaces. They always render from the center of the first to the center of the last pixel. Thus the render area is one pixel smaller than the actual texture size. For compensating this, the texture scale is a little enlarged.

If the engine would render from the start of the first to the end of the last pixel, as one would normally assume, the surface would get visible seams because the last pixel mixes with the first. So for displaying mapping you must always make a compromise.

Probably transforming texture coordinates accordingly or not displaying that last 1/2pixel would be a better solution?
Originally Posted By: jcl
The 2D window shows the correct mapping, even if it may look strange to you.

Topic can be closed if you'll say how this happens to be correct mapping in 2d window:

All editors but MED skin editor display texture in the same way.
© 2024 lite-C Forums