cloud billboard

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
stryker1
Posts: 5
Joined: Mon May 01, 2006 1:16 am

cloud billboard

Post by stryker1 »

I'm trying to render a billboard with a cloud on it. I have two questions. First, why does my billboard only render a single,solid color?

Code: Select all

	IBillboardSceneNode * cloud =  _smgr->addBillboardSceneNode(0,dimension2d<f32>(1000.00,1000.00),_player->GetPosition(),-1);
	video::ITexture * cloudTex = _driver->getTexture("./Texture/cloud.bmp");
	_driver->makeColorKeyTexture(cloudTex,SColor(0,255,69,222));
	cloud->setMaterialFlag(video::EMF_LIGHTING, false);
	cloud->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
	cloud->setMaterialTexture(1,cloudTex);
and what does the line "cloud->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);" do? I can't find an explanation of what this line does anywhere in the forum or the tutorial. thanks in advance.
mR.haHN
Posts: 49
Joined: Wed May 03, 2006 5:37 pm

Post by mR.haHN »

Second Question: This is a Material-Type declaration. I think it uses the T&L Pipeline of the graphics card. It makes the node wich is it added to transparent.
jam
Posts: 409
Joined: Fri Nov 04, 2005 3:52 am

Post by jam »

Taken straight from the doc's
A transparent material. Only the first texture is used. The new color is calculated by simply adding the source color and the dest color. This means if for example a billboard using a texture with black background and a red circle on it is drawed with this material, the result is that only the red circle will be drawn a little bit transparent, and everything which was black is 100% transparent and not visible. This material type is useful for e.g. particle effects.
$L!M
Posts: 28
Joined: Thu May 04, 2006 1:21 pm
Location: Ukraine :)

Post by $L!M »

Try to read documentation :wink:
Last edited by $L!M on Sat May 06, 2006 6:09 pm, edited 1 time in total.
$L!M
Posts: 28
Joined: Thu May 04, 2006 1:21 pm
Location: Ukraine :)

Post by $L!M »

EMT_TRANSPARENT_ADD_COLOR A transparent material. Only the first texture is used. The new color is calculated by simply adding the source color and the dest color. This means if for example a billboard using a texture with black background and a red circle on it is drawed with this material, the result is that only the red circle will be drawn a little bit transparent, and everything which was black is 100% transparent and not visible. This material type is useful for e.g. particle effects.
EMT_TRANSPARENT_ALPHA_CHANNEL Makes the material transparent based on the texture alpha channel. The final color is blended together from the destination color and the texture color, using the alpha channel value as blend factor. Only first texture is used. If you are using this material with small textures, it is a good idea to load the texture in 32 bit mode (video::IVideoDriver::setTextureCreationFlag()). Also, an alpha ref is used, which can be manipulated using SMaterial::MaterialTypeParam. If set to 0, the alpha ref gets its default value which is 0.5f and which means that pixels with an alpha value >127 will be written, others not. In other, simple words: this value controls how sharp the edges become when going from a transparent to a solid spot on the texture.
EMT_TRANSPARENT_ALPHA_CHANNEL_REF Makes the material transparent based on the texture alpha channel. If the alpha channel value is greater than 127, a pixel is written to the target, otherwise not. This material does not use alpha blending and is a lot faster than EMT_TRANSPARENT_ALPHA_CHANNEL. It is ideal for drawing stuff like leafes of plants, because the borders are not blurry but sharp. Only first texture is used. If you are using this material with small textures and 3d object, it is a good idea to load the texture in 32 bit mode (video::IVideoDriver::setTextureCreationFlag()).
Post Reply