
Does anyone know how to manipulate the rendertarget-Texture to make the colored texture-parts black and to blur the projected image a bit? I searched in the forum and didn't find a real solution. Is it at all possible to show the manipulations in the texture after the image is rendered? Can I access the buffer directly before rendering it to the texture? Telling the camera it should see everything black?
Please note I am a newbie in both c++ programming and Irrlicht

Thank you so far.
This is the code I have so far:
//creation of shadow plane
IAnimatedMesh* pShdMesh = pSmgr->getMesh("../media/shadowPlane.X");
IAnimatedMeshSceneNode* mShdNode = pSmgr->addAnimatedMeshSceneNode(pShadowMesh);
mShdNode ->setPosition(pBikeNode->getPosition());
mShdNode ->setRotation(vector3df(0,-90,0));
mShdNode ->setMaterialType(EMT_TRANSPARENT_ALPHA_CHANNEL);
//render target texture creation
ITexture* pRtTexture = pDriver->createRenderTargetTexture(dimension2d<s32>(256,256));
mShdNode ->setMaterialTexture(0, pRtTexture);
//projectionCam
ICameraSceneNode* pFixedCam = pSmgr->addCameraSceneNode(pSmgr->getRootSceneNode(), (pBicycleNode->getPosition() + vector3df(200,200,0)), pBicycleNode->getPosition(), 1);
//drawing scene
while(pDevice->run()){
if(pRtTexture){
pDriver->beginScene(true, true, 0);
pDriver->setRenderTarget(pRtTexture , true, true, SColor(0,0,0,0));
pSmgr->setActiveCamera(pFixedCam);
pSmgr->drawAll();
//Here I wanted to manipulate the texture
colorizeShadow();
// set back old render target
pDriver->setRenderTarget(0);
pSmgr->setActiveCamera(pCameraNode);
}
}
pSmgr->drawAll();
pGuienv->drawAll();
pDriver->endScene();
void colorizeShadow(){
//locking works because of the fix of TURBOFERRET
u32* pixel = (u32*)pRtTexture->lock();
int pitch = mrtTexture->getPitch();
for (int y=0; y < 256; y++){
for (int x=0; x < 256; x++) {
//this doesn't work really, doesn't show result, A8R8G8B8
pixel[y * pitch/4 + x] = 16164555;
}
}
pRtTexture->unlock();
}
Is this a cheap method at all? I mainly do it because the bicycle has a high poly count and Stencil buffer shadows are so slow.