Page 1 of 1

cloud billboard

Posted: Sat May 06, 2006 5:44 pm
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.

Posted: Sat May 06, 2006 5:57 pm
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.

Posted: Sat May 06, 2006 6:05 pm
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.

Posted: Sat May 06, 2006 6:07 pm
by $L!M
Try to read documentation :wink:

Posted: Sat May 06, 2006 6:08 pm
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()).