Aleksoid1978 / VideoRenderer

Внешний видео-рендерер
GNU General Public License v3.0
1.03k stars 115 forks source link

SetAlphaBitmap - opaque #38

Closed vdrfan closed 2 years ago

vdrfan commented 2 years ago

SetAlphaBitmap is not working as expected. for example, with full transparent Bitmap (ARGB 0,0,0,0), resulting image is opaque black.

change of following code would fix it: (also original comment is wrong "// ... inverse alpha channel for dst")

Function AlphaBlt in DX9VideoProcessor.cpp hr = pD3DDev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_SRCALPHA); // ... inverse alpha channel for dst should be: pD3DDev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);

and in Function, CDX11VideoProcessor::AlphaBlt(... we should do: m_pDeviceContext->OMSetBlendState(m_pAlphaBlendStateInv, nullptr, D3D11_DEFAULT_SAMPLE_MASK);

regards, onur

Aleksoid1978 commented 2 years ago

DX11 use D3D11_DEFAULT_SAMPLE_MASK. https://github.com/Aleksoid1978/VideoRenderer/blob/master/Source/DX11VideoProcessor.cpp#L256

Aleksoid1978 commented 2 years ago

Full transparent(ARGB) = 0xFF, 0, 0, 0.

vdrfan commented 2 years ago

when using OMSetBlendState m_pAlphaBlendStateInv(not m_pAlphaBlendState) then Full transparent(ARGB) = 0, 0, 0, 0. otherwise transparancy is not working as expected.

mpc-be has a variable for this in CDX9SubPic::AlphaBlt (see m_bInvAlpha) and mpc-be sets this to SetInverseAlpha(true); in LookupSubPic i think that DX11 Renderer should behave the same.

also EVR Renderer is mixing in this behaviour.

Aleksoid1978 commented 2 years ago

I do not understand what you want. Subtitles and OSD working, include transparent. If something is not right, show screenshots of what is wrong, as it should be.

v0lt commented 2 years ago

We will not invert the alpha channel, because this will break compatibility with MPC-BE, MPC-HC and other players.