0

This is a png from Aseprite, rendered with DirectX TK.

enter image description here

This is the png, as seen in Aseprite.

enter image description here

The code to render the scene:

void Graphics::BeginScene()
{
    m_d3dDeviceContext->ClearRenderTargetView(m_renderTargetView.Get(), BackColor);
    m_d3dDeviceContext->OMSetRenderTargets(1, m_renderTargetView.GetAddressOf(), nullptr);

    CD3D11_VIEWPORT viewport(0.0f, 0.0f, static_cast<float>(m_backBufferWidth), static_cast<float>(m_backbufferHeight));
    m_d3dDeviceContext->RSSetViewports(1, &viewport);
    
    m_spriteBatch->Begin(SpriteSortMode_FrontToBack, NULL, m_samplerState.Get());
}
ball
  • 39
  • 7
  • This is a programming site, please show some code of yours that you use to reproduce what's in the question: https://stackoverflow.com/help/minimal-reproducible-example – Simon Mourier Sep 08 '22 at 06:31
  • I added a code snippet of how the graphics is rendered – ball Sep 08 '22 at 08:57
  • Btw, I tried Pyxel Edit to export instead and it renders as intended. – ball Sep 08 '22 at 09:49
  • The ``SpriteBatch`` class defaults to Premultiplied Alpha rendering, so if your PNG is using straight-alpha that will cause problems. You can configure ``SpriteBatch`` to use straight-alpha or fix the PNG. See [the wiki](https://github.com/microsoft/DirectXTK/wiki/SpriteBatch#alpha-blending). – Chuck Walbourn Sep 10 '22 at 22:50

2 Answers2

1

Pro tip: Use Pyxel Edit to export png instead of Aseprite.

ball
  • 39
  • 7
1

solution : aseprite -> [Sprite -> Properties -> Color Profile: None] set.