possible bug found: rendering to texture

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.
Post Reply
dehseth
Posts: 130
Joined: Wed Dec 09, 2009 11:05 am
Contact:

possible bug found: rendering to texture

Post by dehseth »

hi guys,
in my application, if I use SetRenderTarget function and render scene to a custom texture I get a nice colorful visual render :) If I render it to screen directly I do not get the same render...

I figured out if I draw my texture image without using alpha channel I get this same bad render:

Code: Select all

/* same as directly rendering to back buffer */
driver->draw2DImage(texture, rect1, rect2, 0, 0, false); 


If I use alpha channel of texture I got a nice render:

Code: Select all

/* different than directly rendering to back buffer */
driver->draw2DImage(texture, rect1, rect2, 0, 0, TRUE); 


So how can I get the same result when rendering to backbuffer directly? thank you all....


I see no comment on this topic... So no idea ppl? :?
Last edited by dehseth on Tue Nov 16, 2010 5:46 pm, edited 1 time in total.
greenya
Posts: 1012
Joined: Sun Jan 21, 2007 1:46 pm
Location: Ukraine
Contact:

Post by greenya »

Maybe post two screenshots with the result renderings, so we will see the differece and the meaning of "nice colorful visual render".
dehseth
Posts: 130
Joined: Wed Dec 09, 2009 11:05 am
Contact:

Post by dehseth »

here's the render I got when I use backbuffer directly:

Image

and this is the nice texture rendering I got:

Image
dehseth
Posts: 130
Joined: Wed Dec 09, 2009 11:05 am
Contact:

Post by dehseth »

is this might be the problem:
present.BackBufferFormat = D3DFMT_X8R8G8B8

any idea?
dehseth
Posts: 130
Joined: Wed Dec 09, 2009 11:05 am
Contact:

Post by dehseth »

well everything has changed suddenly when I realized my shader takes alpha channel variable as last value... and now I have a problem with texture target.. I would like to have my texture without alpha blending...
The problem is when I set

Code: Select all

		driver->setRenderTarget(texture);
I got alpha blended render.. And When I render to backbuffer directly I do not get any alpha blending cause I set

Code: Select all

SIrrlichtCreationParameters
to

Code: Select all

false
so how can I turn off alha blending on rendering to texture target?

and this is how I render the render target texture to backbuffer:

Code: Select all

driver->draw2DImage(texture, rect, recti(vector2di(0,0), dimension), 0,0,false);
dehseth
Posts: 130
Joined: Wed Dec 09, 2009 11:05 am
Contact:

possible bug found, please check here..

Post by dehseth »

OK I think the problem is when I am rendering to texture the depth buffer is not working and if I render the closer element to cam after others everything's fine, but if I render the closer element before further elements than it overrides pixels..

But If I render the same scene using backbuffer everything is fine!
SO I guess we have a possible bug in here...
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Could you please post the full code of a minimal example reproducing this problem? Also with some image I have access to, in order to check the difference here as well.
dehseth
Posts: 130
Joined: Wed Dec 09, 2009 11:05 am
Contact:

Post by dehseth »

ok I will prepare a small app. and post source code link here when it's ready..
dehseth
Posts: 130
Joined: Wed Dec 09, 2009 11:05 am
Contact:

Post by dehseth »

FINALLY!!! I found THE BUG!

If you create your device (directx 9 device) using antialiasing

Code: Select all

SIrrlichtCreationParameters cp;	
	cp.AntiAlias = 2; // can be some other value
and use a render texture target... than device fails on computing z-buffer (it draws every single mesh to texture over and over in given order)... It does not fail on rendering to backbuffer.. If I close anti-aliasing mode, device succeeds on rendering both texture and backbuffer.

I uploaded small code here:

http://jump.fm/AEPRN

you can easily see rendering to backbuffer does not have any problem and rendering to texture has and z-buffer problem. And please remove anti-aliasing in main function and see texture rendering is fine...
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Ah yeah. That's a problem which occurs on some configurations, probably due to a wrongly chosen, unsupported render texture format. Unfortunately it never happens on my machines, so it's not fixable by me. It would help to create an example which reproduces this problem, and hope for someone to have such a configuration and can debug the dx driver.
Post Reply