So i've just started using the irrlicht engine i have managed to get get alpha channels working BUT i have run into a problem.
its not on the plane that i want it to be instead it creates a whole new sprite at the camera node start point
i am using the alpha code:
// Alpha Channels
node = smgr->addBillboardSceneNode(node, core::dimension2d<f32>(50, 50));
node->setMaterialFlag(video::EMF_LIGHTING, true);
node->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
node->setMaterialTexture(0, driver->getTexture("textures/factory/crane_pipe.tga"));
Alpha Channel help
-
- Posts: 5
- Joined: Wed Feb 11, 2009 10:56 am
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Reeeeally not following you here. Any chance you could post some code, and explain (ideally with inline comments) what you expect it to do?
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
I think maybe you're not understanding how the engine works or something... The code you showed i would expect to create something similar to the alpha'd grate in the distance...
How is the non-alpha's grate created? is it part of the map geometry? Or is it a seperate model you've loaded? It's clearly not a billboard so it seems you've misunderstood something!
How is the non-alpha's grate created? is it part of the map geometry? Or is it a seperate model you've loaded? It's clearly not a billboard so it seems you've misunderstood something!
Re: Alpha Channel help
Code: Select all
node = smgr->addBillboardSceneNode(node, core::dimension2d<f32>(50, 50));
You need to find the mesh buffer with this texture and set its material type.
Code: Select all
ITexture *tex = driver->getTexture("textures/factory/crane_pipe.tga");
// loop through materials in this node
for (u32 i=0; i < levelNode->getMaterialCount(); ++i)
{
// get the material
SMaterial &mat = levelNode->getMaterial(i);
// if the diffuse texture is the grate then make it transparent
if (mat.TextureLayer[0].Texture == tex)
mat.MaterialType = EMT_TRANSPARENT_ALPHA_CHANNEL_REF;
}
-
- Posts: 5
- Joined: Wed Feb 11, 2009 10:56 am
-
- Posts: 5
- Joined: Wed Feb 11, 2009 10:56 am