Hmm so I experienced a weird behaviour when using direct 3d 9 and transparent textures. The transparent part of the texture doesn't seem to draw other parts of the same node through the transparency.
This is probably a bad example, but oh well. Here is a screenshot showing what I mean. (models/textures arent mine, took them from some game)
First without transparency (see the white part at the top of the weapon - this is the part on each screenshot which I am referring to)
http://www.anime-fansubs.com/~reiko/tra ... _trans.jpg
Now with transparency on and using direct 3d 9. A little hard to see but the part that should show through on the same node isnt being drawn, instead whats behind (in this case the floor) is being drawn.
http://www.anime-fansubs.com/~reiko/tra ... _trans.jpg
Now with transparency on and using openGL, its drawn exactly as it should be.
http://www.anime-fansubs.com/~reiko/tra ... _trans.jpg
In this particular case it hardly seems like a big deal, but for other cases it can look kinda bad.
Here's a bit clearer example of what I mean:
http://www.anime-fansubs.com/~reiko/kel ... _front.jpg
http://www.anime-fansubs.com/~reiko/kellel_set_back.jpg
The skirt, arms and legs are part of the one mesh. At the bottom of the skirt at the frill part there is some transparency in the texture, but the legs/knees dont show through at that part, instead the background does.
So.. my question is, since I would prefer to use direct 3d 9, how can I get the same behaviour as the way it appears with opengl? Is there some flag I need to set somewhere?
Thanks.
Transparency on textures with direct 3d 9
-
- Competition winner
- Posts: 1123
- Joined: Sun Jun 10, 2007 11:14 pm
I remember having a problem almost exactly like this. Hold on while I look for the thread.
EDIT: Here's a link to that thread: http://irrlicht.sourceforge.net/phpBB2/ ... ht=#172372
If you don't get an answer from there I'll try to solve your problem.
EDIT: Here's a link to that thread: http://irrlicht.sourceforge.net/phpBB2/ ... ht=#172372
If you don't get an answer from there I'll try to solve your problem.
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
If ALPHA_CHANNEL_REF works, it'S a problem with the z-ordering. Since transparent materials need to be ordered by depth, and rendered back-to-front, failure to do this inside meshes can lead to erroneous behavior. It's strange, though, to see nothing being rendered at that position. I'd have expected a wrong material maybe, but not nothing (besides background).
-
- Competition winner
- Posts: 1123
- Joined: Sun Jun 10, 2007 11:14 pm
When you use REF, you need to set the parameters for the alpha. So
Also try turning off lighting if it's still black.
Code: Select all
node->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
for (int x = 0; x < node->getMaterialCount(); x++) {
node->getMaterial(x).MaterialTypeParam = 127;
}