Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Using UVAtlas (Direct3D 9) Packed charts are separated by a user-specified gutter width. The gutter width is the amount of separation between charts, and allows for bilinear interpolation and mip-mapping to avoid rendering artifacts at chart boundaries. D3DX provides an interface for automatically filling in these gutters - see ID3DXTextureGutterHelper for more information.

How I can do that? I call ApplyGuttersTex, after calling ResampleTex but nothing changed.

share|improve this question
up vote 1 down vote accepted

There was a code sample on the subject, I've seen it some time ago, just can't remember where. Anyway, I guess you have already called D3DXUVAtlasCreate and got your new mesh with UVs for the optimized version of the original texture. Let's call it UVAtlasMesh.

Well, rest of the stuff is relatively simple. Just as one of your links says, gutter helper needs its mesh's D3DDECLUSAGE_TEXCOORD 0 to contain new set of UVs and D3DDECLUSAGE_TEXCOORD 1 to contain original set of UVs. So check that declaration of your mesh have both of these texcoords. Then the general idea is as follows:

  1. Prepare a mesh with those 2 texcoords — just clone the mesh you got from AtlasCreate, so it will be your clonedMesh. Original mesh (the one you passed to AtlasCreate) will be called originalMesh in the same imaginative fashion.
  2. Copy UVs from UVAtlasMesh to clonedMesh into D3DDECLUSAGE_TEXCOORD 0.
  3. Copy UVs from originalMesh to clonedMesh into D3DDECLUSAGE_TEXCOORD 1.
  4. Create a blank texture with same width, height and format as the original mesh texture, it'll be called optimizedTexture.
  5. D3DXCreateTextureGutterHelper(originalMeshTextureWidth, originalMeshTextureHeight, clonedMesh, gutterSize, &gutterHelper);
  6. gutterHelper->ResampleTex(originalMeshTexture, clonedMesh, D3DDECLUSAGE_TEXCOORD, 1, optimizedTexture);

Scrap clonedMesh and save the optimizedTexture. If it will look blank, recheck everything related to the D3DXUVAtlasCreate and its returned mesh's UVs.

share|improve this answer
Thanks a lot! But... it's correct procedure of building atlas texture, but i need to fill gutter on atlas texture for seamless mip-mapping. A already have atlas and try to use ApplyGuttersTex() immediately after gutterHelper->ResampleTex(). But nothing changed. :( – KindDragon Sep 5 '11 at 8:41
It also can be used as a correct procedure for filling gutter as well, if you regenerate the atlas texture :) ApplyGutterTex() can only recompute all of the gutter texels of class "2", which means gutter needs to know the face texel belongs to along with barycentric coordinates of the first two vertices of that face, so its used in a complex conjunction with SetBary/Gutter/Face/TexelMap. Why bother when you can just supply a mesh for which atlas was generated and a large gutter size to the to the D3DXCreateTextureGutterHelper(). – EnoughTea Sep 5 '11 at 10:21
thank you! I simply do not saw gutter, because I had gutterSize equal to one. – KindDragon Sep 5 '11 at 14:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.