[SOLVED]Occlusion errors with quake map and transparency

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
SuperElectric
Posts: 19
Joined: Fri May 13, 2005 7:20 am
Location: New York, NY

[SOLVED]Occlusion errors with quake map and transparency

Post by SuperElectric »

I've loaded a quake level with some trees in it, where the leaves are just textures painted on two crossed billboards. At first the billboards were showing up as black squeares with leaf textures, since the materialType was being set to EMT_SOLID. I made the following change in CQ3LevelMesh.cpp:

Code: Select all

if (!b->Material.Texture2){
   // replaced this line...
   //b->Material.MaterialType = video::EMT_SOLID;
   // with this line:
   b->Material.MaterialType = video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
}
Outside of CQ3LevelMesh.cpp, I turned the backface culling off for the quake map's SceneNode, so the leaf node textures would show up from both sides.

Now there's a new problem. The mountains in the background seem to occlude the leaf textures in the foreground. This didn't happen before I changed everybody's material type. Turning off the back face culling doesn't seem to be the problem. I tried turning it back on and the problem persisted.

Here's a screen shot of the scene before I changed the MaterialType:
Image

Here's the same scene with everybody's material type changed to video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF:
Image

Notice how the brown mountains are now occludig the tree leaves.

I'm using version 0.10.0. This occlusion problem didn't happen in 0.9, when I was using ZDimitor's patch (link) for transparency.

Any idea why this could be happening? Any suggestions on what I could try to narrow down source of the problem would be appreciated.

Thanks,
-- Matt
SuperElectric
Posts: 19
Joined: Fri May 13, 2005 7:20 am
Location: New York, NY

update

Post by SuperElectric »

For what it's worth, using EMT_TRANSPARENT_ALPHA_CHANNEL doesn't cause this problem; just EMT_TRANSPARENT_ALPHA_CHANNEL_REF.
don_Pedro
Posts: 84
Joined: Fri Jun 10, 2005 1:34 pm
Location: Poland
Contact:

Post by don_Pedro »

I think it's a bug in EMT_TRANSPARENT_ALPHA_CHANNEL_REF under OpenGL. In COpenGLMaterialRenderer.h, COpenGLMaterialRenderer_TRANSPARENT_ALPHA_CHANNEL_REF::OnSetMaterial(...) should be deleted line

Code: Select all

material.ZWriteEnable = false;
SuperElectric
Posts: 19
Joined: Fri May 13, 2005 7:20 am
Location: New York, NY

Post by SuperElectric »

Awesome; that seems to have fixed it.

Thanks!
-- Matt
Post Reply