depth_write off and the release build

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Tassilo
Halfling
Posts: 75
Joined: Thu Apr 28, 2005 9:21 am

depth_write off and the release build

Post by Tassilo »

Hello,

I have some strange problems with the release build only.

I have a small scene with some trees in it. The trees are made out of a few polygons using an albedo texture with an alpha channel (for the transparency of the leaves). Well, the standard way...

Then, in order to display my little "forest" correctly, I use the following material for a tree:

Code: Select all

material SimpleTree
{
	technique
	{
		pass
		{
			scene_blend alpha_blend
			depth_write off
			texture_unit
			{
				texture Textures/Tree.tga 
			}
		}
	}
}
Well, it's really that simple, and there are no problems with the debug build. However, the relaase build seems to screw the trees up - the reuslt is looking a bit like z-fighting. When I move the camera, one tree appears in front of the other, and then, the next frame, everything is back to normal, and then - it changes again....

If I don't use the flag "depth_write off", there are no "pseudo-z-fighting" problems no more, but well - the transparency is screwed up, of course.

I already checked the clipping planes, but they are alright. All the non-transparent objects in the scene are allright - so, this behaviour can't be z-fighting - the problems stay the same even if two trees aren't close at all.

Thanks for your help
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66

Post by sinbad »

Have you checked your own code for uninitialised values, or anything else that could vary in release mode? We see nothing like this in other apps.

One thing to check - note that with depth_write off, the renderables will be sorted by distance to the camera. If you've made your own renderable, you must ensure that you're implementing getSquaredViewDepth correctly. If you're not, you could be getting random values from this in release mode which is what's causing the unpredictable ordering.
Tassilo
Halfling
Posts: 75
Joined: Thu Apr 28, 2005 9:21 am

Post by Tassilo »

Hello,

yes, I checked my code for uninitialized variables. This is by far not the first release build that doesn't work as expected - I'm used to look for stuff like that. And well, I didn't create an own renderable, it's just the ogre stuff.

I simply call createEntity(...), load and create a mesh that way, and well, that's all.
I'll play around a bit with the code or I'll debug and step through the ogre sources until I find the source of the problem. If it persists, I'll assemble a small demonstration and upload it somewhere.

Thanks anyway,
Cheers
User avatar
sevensevens
Gnoblar
Posts: 21
Joined: Sat May 07, 2005 4:41 am

Post by sevensevens »

Did you compile Ogre in release mode?
Tassilo
Halfling
Posts: 75
Joined: Thu Apr 28, 2005 9:21 am

Post by Tassilo »

Yes - that's what I wrote, isn't it ?