0
votes

So i am trying to render a small isometric tile-map and just started with a single tile to feel the thing out. But i am running into a problem where if the tile gets "too small" (actually 64x64 which is the exact same size as the texture is) it gets jagged lines, even though it looks ok on the texture itself. The strange thing is that it also appears to be right if i use the Graphics Debugger in Visual Studio. Here is a picture to better visualize what i mean:

enter image description here

The left picture is a part of the rendered frame inside a normal window. The right part is the captured frame for the graphics debugging tool. As you can see the display for the captured frame looks completely ok. The normal rendering inside a window also starts to look good if i scale this tile up by some factor. Any ideas why this might happen? Here is the original texture if it is to any help.

enter image description here

One further note: I create the "texture" by rendering an object in blender while setting up the camera like this: http://flarerpg.org/tutorials/isometric_tiles/ (As my understanding this should be one good way for rendering it in DirectX)

EDIT: Here is my Sampler Desc. I am creating the texture by using the CreateDDSTextureFromFile method provided by the DirectXTK (https://github.com/Microsoft/DirectXTK).

CreateDDSTextureFromFile(gfx->GetGraphicsDevice()->GetDevice(), L"resources/house_tile.DDS", nullptr, shaderResource.GetAddressOf())

g_defaultSamplerDesc.Filter = D3D11_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR;
g_defaultSamplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
g_defaultSamplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
g_defaultSamplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
g_defaultSamplerDesc.MipLODBias = 0.0f;
g_defaultSamplerDesc.MaxAnisotropy = 1;
g_defaultSamplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
g_defaultSamplerDesc.BorderColor[0] = 0;
g_defaultSamplerDesc.BorderColor[1] = 0;
g_defaultSamplerDesc.BorderColor[2] = 0;
g_defaultSamplerDesc.BorderColor[3] = 0;
g_defaultSamplerDesc.MinLOD = 0;
g_defaultSamplerDesc.MaxLOD = D3D11_FLOAT32_MAX;

EDIT 2: I checked the .dds file and there is only 1 Mip-Level. Here is also the Texture description which the DirectXTK method is using. Seems fine to me:

        Width   64  unsigned int
        Height  64  unsigned int
        MipLevels   1   unsigned int
        ArraySize   1   unsigned int
        Format  DXGI_FORMAT_B8G8R8A8_UNORM (87) DXGI_FORMAT
+       SampleDesc  {Count=1 Quality=0 }    DXGI_SAMPLE_DESC
        Usage   D3D11_USAGE_DEFAULT (0) D3D11_USAGE
        BindFlags   8   unsigned int
        CPUAccessFlags  0   unsigned int
        MiscFlags   0   unsigned int

And for what it's worth here is also my Vertex-Setup:

Vertex v[] =
{
    Vertex(-32.f, -32.f, 1.0f, 0.0f, 1.0f),
    Vertex(-32.f, 32.f, 1.0f, 0.0f, 0.0f),
    Vertex(32.0f, -32.f, 1.0f, 1.0f, 1.0f),
    Vertex(32.0f, 32.f, 1.0f, 1.0f, 0.0f)
};

Which should create the quad at a size of 64x64.

EDIT 3: I tried to generate Mip-Maps to see if that works, but it did not. Here are two Mip-Levels of the 7 available:

Mip-Level 1 and 2

And also the new Texture description:

        Width   64  unsigned int
        Height  64  unsigned int
        MipLevels   7   unsigned int
        ArraySize   1   unsigned int
        Format  DXGI_FORMAT_B8G8R8A8_UNORM (87) DXGI_FORMAT
+       SampleDesc  {Count=1 Quality=0 }    DXGI_SAMPLE_DESC
        Usage   D3D11_USAGE_DEFAULT (0) D3D11_USAGE
        BindFlags   8   unsigned int
        CPUAccessFlags  0   unsigned int
        MiscFlags   0   unsigned int

Looks fine to me, but the result is still the same :/.

1
Do you use mipmapping and no point filtering? It looks like a sampling issue to me. - Gnietschow
I am not using Mip-Mapping. Can not check to be sure, but i will as soon as i am home. Thanks! - puelo
@Gnietschow I added my sampler description and how i create the shader resource view. Do you see anything wrong there? - puelo
For me the sampler looks good. Unfortunately I'm not familiar with the DirectXTK, does it generate mipmaps for your texture on load? If not, does you dds contains the mipmaps? - Gnietschow
@Gnietschow : It can create mipmaps if so desired, but it wasn't for me. I checked my .dds file and it only contains 1 Mip-Level. I also checked the texture description for the texture the DirectXTK is creating and using for the ShaderResourceView. See above. - puelo

1 Answers

0
votes

@Gnietschow: Thank you for your effort. The solution was quite simple and it was found by some people in the gamedev.net board:

Quotes:

I had a similiar issue once, and it turned out I was doing windowed mode wrong in terms of calculating the window size to fit the backbuffer size etc., resulting in a vaguely stretched display that was hard to notice for a long while


I was going to say the same thing. You want to make sure that the client area of your window is the same size as your D3D backbuffer, otherwise you'll get really crappy scaling when the backbuffer is blit onto the window. You can use something like this:

RECT windowRect;
SetRect(&windowRect, 0, 0, backBufferWidth, backBufferHeight);

BOOL isMenu = (GetMenu(hwnd) != nullptr);
if(AdjustWindowRectEx(&windowRect, style, isMenu, exStyle) == 0)
    DoErrorHandling();

if(SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, windowRect.right - windowRect.left, windowRect.bottom - windowRect.top, SWP_NOMOVE) == 0)
    DoErrorHandling();

Source: http://www.gamedev.net/topic/677243-iso-dimetric-tile-texture-has-jagged-edges/