ZBuffer problem after applying texture

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Hydrael
Posts: 7
Joined: Thu Jan 18, 2007 6:09 pm

ZBuffer problem after applying texture

Post by Hydrael »

Hello everyone,

first of all, I have to mention, that I'm using the Irrlicht .Net CP Wrapper - that's why I'm not sure if I should post in this forum, the .Net forum or directly over at the CP forum...so sorry if I'm in the wrong place here ;)

Being inspirated by IrrEdit, I currently working on a selfmade map editor using Irrlicht.
I recently implemented the functionality to apply textures to a given model, which works fine.
My problem now is, that right after I apply the new texture, something gets all screwy with the ZBuffer, which is best shown with these two screenshots:

This is a screenshot of the model, with the original texture, that's automatically being loaded, when the model is loaded:
Image
Everything is looking good...take notice of the movement tool, which is rendered with ZWrite disabled, so that it's always on top.

Now after applying the new texture the scene looks like this:
Image
Notice, that the movement tool is not on top anymore.

The piece of code, that causes that behaviour looks like this:

Code: Select all

Node.SetMaterialTexture((int)TextureLayerID.Value-1, Device.VideoDriver.GetTexture(ListViewTextures.SelectedItems[0].Tag.ToString()));
That effect only occours, when applying a texture to texture layer 0.

I don't really have any idea what could go wrong here.
Can anyone help?

Thanks a lot in advance.
Greets
Hydrael
Posts: 7
Joined: Thu Jan 18, 2007 6:09 pm

Post by Hydrael »

Anyone? :(
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You're writing to different texture layers, but which material is set?
Hydrael
Posts: 7
Joined: Thu Jan 18, 2007 6:09 pm

Post by Hydrael »

Doesn't SetMaterialTexture() apply to all materials?
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

I think he means are you changing the materialType? I think he might be getting to the point, that it's possibly a materialType problem and you're setting a material type that is transparent, which disable ZWrite and ZBuffer stuff.
Image
Hydrael
Posts: 7
Joined: Thu Jan 18, 2007 6:09 pm

Post by Hydrael »

Materialtype is set to solid.
I even tried setting it to solid again manually right after applying the texture, but that didn't work either :?
Post Reply