Hello, I have a manual image which I am rendering to screen. This image is square, but some pixels should not be rendered, and are therefore alpha=0. This seems to work. The problem is that the filtering is blending these pixels (black+transparent) into the colored visible pixels, darkening them. I tried disabling filtering like so:
Code: Select all
void createDataBlock(Graphics& graphics) {
static std::size_t idCounter = 0;
Ogre::HlmsManager* hlmsManager = graphics.getRoot()->getHlmsManager();
Ogre::HlmsUnlit* hlmsUnlit = static_cast<Ogre::HlmsUnlit*>(hlmsManager->getHlms(Ogre::HLMS_UNLIT));
Ogre::HlmsMacroblock macroBlock;
macroBlock.mDepthCheck = false;
Ogre::HlmsBlendblock blendBlock;
blendBlock.setBlendType(Ogre::SceneBlendType::SBT_TRANSPARENT_ALPHA);
mName = "ManualTextureBox" + std::to_string(idCounter++);
mDataBlock = static_cast<Ogre::HlmsUnlitDatablock*>(
hlmsUnlit->createDatablock(mName,
mName,
macroBlock,
blendBlock,
Ogre::HlmsParamVec()
));
mDataBlock->setTexture(0, mManualTexture.getTexture());
Ogre::HlmsSamplerblock samplerblock;
samplerblock.mU = Ogre::TextureAddressingMode::TAM_WRAP;
samplerblock.mV = Ogre::TextureAddressingMode::TAM_WRAP;
samplerblock.mW = Ogre::TextureAddressingMode::TAM_WRAP;
samplerblock.mMaxAnisotropy = 0;
samplerblock.mMagFilter = Ogre::FO_NONE;
samplerblock.mMinFilter = Ogre::FO_NONE;
samplerblock.mMipFilter = Ogre::FO_NONE;
samplerblock.setFiltering(Ogre::TextureFilterOptions::TFO_NONE);
mDataBlock->setSamplerblock(Ogre::TextureTypes::Type2D, samplerblock);
}
However, this does not work. This is what the troublesome area of the image looks like:
https://pasteboard.co/PKjyGzE7V3eH.png
How can this be resolved?