Draw transparent image in 3D- space

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
Nervenbündel
Posts: 4
Joined: Sat Jul 26, 2008 9:06 am

Draw transparent image in 3D- space

Post by Nervenbündel »

Hi,

I'm new in Irrlicht an also in 3D- engine using in general. I need help to create an image, that's able to changing the alpha channel. First i followed the 2D- Tutorial and do it with driver.draw2DImage. So far the tutorials are helpful, but have to positionate this image freely into the 3D space. In the tutorial has been written:
In this example, we are just
doing 2d graphics, but it would be no problem to mix them with 3d graphics.
Just try it out, and draw some 3d vertices or set up a scene with the scene
manager and draw it.
And so I tried hopefully the hole night do combine a Image (as Texture and so on) with 3D Vertices or 3D Positions. It might be possible with an untransparent image, but also with alpha?


ThX for help,

the Nervenbündel
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Re: Draw transparent image in 3D- space

Post by Acki »

I think you're looking for billboards ???
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Nervenbündel
Posts: 4
Joined: Sat Jul 26, 2008 9:06 am

Post by Nervenbündel »

Hi,

maybe I'm looking for a BillBoard, but not in the documentation, nor the intellisense gives me any function or parameter, that allows me to add an image or texture to a BillBoard or an other SceneNode. How can I do this?


Thanks for your patience,

The Nervenbündel
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

i seriously think that we need a huge amount of tutorials and guidelines to be put on the website.
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

you betcha!

Image
Image
Nervenbündel
Posts: 4
Joined: Sat Jul 26, 2008 9:06 am

Post by Nervenbündel »

Ok but this recognation doesnt help me with that problem... :)
but in general it's true, how to combine the SceneManager, Nodes, Meshes and so on are not really clear to me, and I doesnt found a discription of it.

But can you tell me how to create this image in the 3D space? I need it, all others are not so important atm.


Greetings

The Nervenbündel
piiichan
Posts: 59
Joined: Thu May 01, 2008 1:20 am
Location: New Caledonia (France - Pacific)
Contact:

Post by piiichan »

You could use billboards. (IBillboardSceneNode)
Billboards are good if you want the picture to be in your scene, thus positioned in 3d space, and always facing the camera. This way, they are never deformed by perspective. This is commonly called a sprite.

Or you could create / load a plane, made of 2 triangles and 4 vertices. (IMeshSceneNode)
This is the same as billboards, but the picture won't always face the camera. So your picture will be "really" (so to speak) in 3d.

As far as I know, the original alpha channel of your picture is reduced down to 1 bit once displayed by Irrlicht: the pixel is either transparent or not. (EMT_TRANSPARENT_ALPHA_CHANNEL and EMT_TRANSPARENT_ALPHA_CHANNEL_REF)
Nervenbündel
Posts: 4
Joined: Sat Jul 26, 2008 9:06 am

Post by Nervenbündel »

Hi and retrying thanks,

ok I set a texture on a BillBoardScene (I got that before, but I lost it, sry I tried too much), then I load a Texture in it and set the MaterialType, but I dont find the way to set the AlphaChannel. The documentations says i should use the SMaterial::MaterialTypeParam to manipulate it. But I havent found that parameter. Maybe it depends in the .NET Irrlicht wrapper (I use C#). I knew that they have an own forum but i thought its an independent problem of my unexperience. If it's so I change the forum. In C++ i should found it here?:

Code: Select all

Texture landscape = driver->GetTexture("landschaft2.bmp");
landscape->MaterialTypeParam = 100;

Thanks a lot!


The Nervenbündel
piiichan
Posts: 59
Joined: Thu May 01, 2008 1:20 am
Location: New Caledonia (France - Pacific)
Contact:

Post by piiichan »

The doc says irr::video::SMaterial::MaterialTypeParam is mostly ignored.

Normally, if you set the material type to EMT_TRANSPARENT_ALPHA_CHANNEL or EMT_TRANSPARENT_ALPHA_CHANNEL_REF, your alpha channel should be taken into account.

Are you sure your image has got an alpha channel (.png or .tga) and has got transparent pixels?
FreakNigh
Posts: 122
Joined: Thu Oct 19, 2006 7:31 am
Location: Orlando FL, USA
Contact:

Post by FreakNigh »

ya but you guys aren't telling him how to use it..

Code: Select all

IBillboardSceneNode* our_bill_node = smgr->addBillboardSceneNode(NULL, dimension2d<f32>(25.0f, 25.0f), vector3df(0,0,0));
our_bill_node->setMaterialTexture( 0, cv_text_mgr->getTexture() );

//main line your looking for
our_bill_node->getMaterial(0).MaterialType = EMT_TRANSPARENT_ALPHA_CHANNEL;
This code turns on the alpha channel for the texture put on the billboard
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

in prior irrlichtversions u ha to turn of lightning as well otherwise the billboards don't look right.(thats only true if the billboard is supposed to be a light/shiny thing)
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
FreakNigh
Posts: 122
Joined: Thu Oct 19, 2006 7:31 am
Location: Orlando FL, USA
Contact:

Post by FreakNigh »

Code: Select all

our_bill_node->setMaterialFlag(video::EMF_LIGHTING, false);
Post Reply