[fixed]RTT

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
irrlichtfan
Posts: 10
Joined: Tue Jan 20, 2009 2:40 pm

[fixed]RTT

Post by irrlichtfan »

is it true, that it is not guranteed that the rendertarget-texture has the size, which i told i want to? i tried to implement post processing by rendering the whole scene in a rtt and placing this scene onto a rectangle on the screen. it works perfectly, but on some pcs just the upper left part of the screen is filled and i found out that this problem also comes up, when i for instance create a rtt with the size of 2048x2048 with a screen resolution of 1280x1024.
if so, which parts of the engine do i have to modify in order to get the right mouse coordinates?
the next problem i have is concerned the highest possible resolution for the monitor with WINDOW-MODE. for instance on 1280x800 on my notebook i see nothing and on my pc the problem is concerned with 1280x1024. when i turn to fullscreen, everything works fine.
Fullscreen-Mode / without pp:
Image
vs.
Windowed-Mode:
Image
thank you for your help!
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

How do you render to into the RTT when the problems arise? If you render with exact pixel positions, the RTT would be filled only in the upper left corner. Also make sure that your viewport is properly set for the RTT.
The maximal resolution should be less than the desktop size, even though larger oes might also work. Your screens look like the zbuffer isn't large enough, which usually happens when rendering to larger buffers than possible. Show the full code.
irrlichtfan
Posts: 10
Joined: Tue Jan 20, 2009 2:40 pm

rtt

Post by irrlichtfan »

thx, i fixed the first bug, it actually was concerned with the problem you mentioned. it normally perfectly works to create a rtt with the same size as the resolution, but when i use 1280x800 windowed it just doesn't work. i stepped through the code and saw that the buffer is shared. it seems rather weired that 1280x785 for instance work. it is also possible to create and use a texture with the size of 2048x2048 (here a new buffer is created as i explored in the code). is it possible that this something to do with the title-bar of windows? i experienced the same problem on other pcs and monitors, but the problem always just turns up in windowed-mode.

Code: Select all

bool CPostRenderer::init( core::dimension2du size )
{
	renderRect = new sktx::CTransformedRect(core::vector2di(0, 0), 
                core::vector2di(SINST->getWidth(), SINST->getHeight()), 
		video::SColor(255, 255, 255, 255), 
		core::vector2df(1.0f, 1.0f),
		(video::E_MATERIAL_TYPE)(SHINST->getShaderId(sktx::EST_POSTP)));
	renderTarget = VIDINST->addRenderTargetTexture (size);
	smallTarget = VIDINST->addRenderTargetTexture (size / (int)(RSFACT));  //RSFACT => 10.f
}
//in the loop sooner or later
VIDINST->setRenderTarget(renderTarget, true, true, video::SColor(255, 0, 0, 0));
//drawing-part of the gui, fonts, ...
VIDINST->setViewPort(rect<s32>(position2di(0, 0), VIDINST->getScreenSize()));
SCEINST->drawAll();
//set size back
VIDINST->setViewPort(rect<s32>(position2di(0, 0), renderTarget->getSize()));
//other 2d-drawings
VIDINST->setRenderTarget(smallTarget, true, true, video::SColor(255, 0, 0, 0));
		renderRect->getMaterial().MaterialType = (video::E_MATERIAL_TYPE)(SHINST->getShaderId(sktx::EST_POSTDWN));

		renderRect->draw();
setRTT(true, NULL);
		
		renderRect->getMaterial().MaterialType = (video::E_MATERIAL_TYPE)(SHINST->getShaderId(sktx::EST_POSTP));
		
		//rfact is calculated by
/*rfact.X = VIDINST->getScreenSize().Width / (float)renderTarget->getSize().Width;
	rfact.Y = VIDINST->getScreenSize().Height / (float)renderTarget->getSize().Height;*/
//renderRect draws the vertexprimitivelist
//and sets the new texture-coordinates given (rfact)
/*
setTCoords(texScale);
	VIDINST->setMaterial(mat);
	VIDINST->drawVertexPrimitiveList((const void*)vertices, 4, (const u16*)indices, 
		2, video::EVT_STANDARD, EPT_TRIANGLES, EIT_16BIT);
*/
		renderRect->draw(rfact);
dimension2du is just an alias, because i tried to change to 1.6, but then postponed it. sorry, it is rather bad formatted :(.
have you ever tried to draw a rtt as big as the maximum resolution of the monitor and display it in windowed-mode? is there any other solution instead of modifying the size?
thanks,
markus
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Is this OpenGL or DirectX? For OpenGL, do you have FBO support and NPOT support?
irrlichtfan
Posts: 10
Joined: Tue Jan 20, 2009 2:40 pm

rtt

Post by irrlichtfan »

our game is just directx
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Are you sure you have Irrlicht 1.5? Before, DirectX RTTs have been rather limited. Moreover, I never saw such distortions with DirectX.
irrlichtfan
Posts: 10
Joined: Tue Jan 20, 2009 2:40 pm

Post by irrlichtfan »

yes, i am using irrlicht 1.5, because i always try to use the newest version of the engine to profit from the bugfixes
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Hmm, strange. I'll try to test this in the next days. I'll also move this thread to bugs forum in order to track this problem. You can also help us by adding the problem to the bug tracker here https://sourceforge.net/tracker/?atid=5 ... unc=browse
irrlichtfan
Posts: 10
Joined: Tue Jan 20, 2009 2:40 pm

Post by irrlichtfan »

thx, i have added it
irrlichtfan
Posts: 10
Joined: Tue Jan 20, 2009 2:40 pm

fix?

Post by irrlichtfan »

are there any news concerned the rtt-"bug?"? i have now "fixed" it in my case and just create now in window-mode a slightly bigger rtt!
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

I didn't have time yet to test it on a Windows system, but it'll be fixed before the next release.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Ok, just tried but couldn't reproduce with example 13. I've changed the RTT size and the window size to maximal screen size. Shouldn't the problem show up then?
irrlichtfan
Posts: 10
Joined: Tue Jan 20, 2009 2:40 pm

Post by irrlichtfan »

thanks for fixing!
in the meantime i maybe found another bug...
is it necessary to do something different than just inheriting from transparent material in order to program a shader which sets transparent colors? sometimes the mesh is transparent and sometimes it isn't... thanks!
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Please post some code and screenshots in another thread.
irrlichtfan
Posts: 10
Joined: Tue Jan 20, 2009 2:40 pm

rtt

Post by irrlichtfan »

i have now copied the parts of the new cd3d9driver.cpp.
is this the new part of the checkDepthBuffer-Method?
depth->Surface->GetDesc(&desc);
depth->Size.set(desc.Width, desc.Height);
with this lines it doesn't appear on most of my pcs, but the bug on my laptop at 1280x800 is not really fixed. has this something to do, that antialising also doesn't work at this resolution windowed?

thx
Post Reply