[SOLVED] Transparency and fire

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
Amt0571
Posts: 128
Joined: Mon Mar 06, 2006 6:29 pm

[SOLVED] Transparency and fire

Post by Amt0571 »

Hello,

I have managed to load a 3d environment using my3d format in Irrlicht.

I created a window in the 3d model, so in 3D Studio I set the glass material opacity to 30%, and in Irrlicht it appears transparent, but depending on the angle, the color changes slightly as you can see in this screenshot:

http://i22.photobucket.com/albums/b339/ ... window.jpg

I've trying to fix it but after some hours I'm at the same point, can anyone tell me what I'm doing wrong?


In the same scene I created a fire using the same code (copy/paste) from the SpecialFX tutorial, but depending on the angle it sometimes appears black as can be seen on this screenshot:

http://i22.photobucket.com/albums/b339/Amt0571/fire.jpg

I'm sure that it's not my graphics card, since I tested it on two computers with different cards. By the way, I'm using OpenGL.

Thanks in advance :)
Last edited by Amt0571 on Wed Mar 08, 2006 6:25 pm, edited 2 times in total.
bearSoft
Posts: 165
Joined: Fri Apr 01, 2005 9:55 pm
Location: Denmark

Post by bearSoft »

the color changes slightly as you can see in this screenshot:
eh the first got a sky.. the scond does not!
thats more than slightly!
if u look at the egde of the windowf rame , then the colors are actually very close in both img.
It is the part where the sky 'blend in' that are different

..perhaps the no-sky img is taken just outside the far-distance for the scene??

does the skybox disapear in some posisteion in ur game?
Regards.
Tech: win98se| 320mb ram| abitbe6| 433mhzceleron| atiRadeon7000.64mb| soundblaster125| dx9.0b | devCPP | IRR 0.12.0 |
Guest

Post by Guest »

There's no sky and no skybox... just a black background, nothing else.

Thanks a lot :)
Amt0571
Posts: 128
Joined: Mon Mar 06, 2006 6:29 pm

Post by Amt0571 »

Sorry, that guest was me...
bearSoft
Posts: 165
Joined: Fri Apr 01, 2005 9:55 pm
Location: Denmark

Post by bearSoft »

neh.. when i cranked my light on my monitor up to 90% i could see a blueish color on the 'black'...
so.. both -are- the same but apear so different..
I have NO idea why
sorry :(
Regards.
Tech: win98se| 320mb ram| abitbe6| 433mhzceleron| atiRadeon7000.64mb| soundblaster125| dx9.0b | devCPP | IRR 0.12.0 |
r3i
Posts: 147
Joined: Wed Jun 29, 2005 10:15 am
Location: Sorrento
Contact:

Hi

Post by r3i »

For window: have you tried to set the material flag EMF_LIGHTING off?
For Fire: Maybe you lost the texture: try to control it using an ITexture pointer and chack in every loop: maybe something goes wrong.
"We work in the dark, we do what we can, we give what we have, Our doubt is our passion and our passion is our task. The rest: is art of Madness" (H.James)
Amt0571
Posts: 128
Joined: Mon Mar 06, 2006 6:29 pm

Post by Amt0571 »

I finally managed to solve the fire problem, it was caused by some unnecessary code from the collision tutorial that I accidentally forgot to delete. That code I think switched on and off the EMF_LIGHTING flag.

I'm going to try if the window problem is also related with EMF_LIGHTING.

Thanks to all!
r3i
Posts: 147
Joined: Wed Jun 29, 2005 10:15 am
Location: Sorrento
Contact:

Post by r3i »

Good work! Take us updated and if you solve the question, please edit this post adding "[SOLVED]" :D
"We work in the dark, we do what we can, we give what we have, Our doubt is our passion and our passion is our task. The rest: is art of Madness" (H.James)
Guest

Post by Guest »

Ok, I found the window problem is somehow related to the particle system (the fire).

The code I'm using for the fire is exactly the same used in the SpecialFX tutorial. I found that the problem is related to this line:

ps->setMaterialType(video::EMT_TRANSPARENT_VERTEX_ALPHA);

If I delete or comment this line, the window appears fine, but the fire appears without transparency. On the other hand, if I use this line, the fire is ok, but I have the window problem...

The whole code for the particle system is this one:

scene::IParticleSystemSceneNode* ps = 0;
ps = smgr->addParticleSystemSceneNode(false);
ps->setPosition(core::vector3df(2996,295,-524));
ps->setScale(core::vector3df(2,2,2));
ps->setParticleSize(core::dimension2d<f32>(20.0f, 20.0f));
scene::IParticleEmitter* em = ps->createBoxEmitter(
core::aabbox3d<f32>(-7,0,-7,7,1,7),
core::vector3df(0.0f,0.06f,0.0f),
80,100,
video::SColor(0,255,255,255), video::SColor(0,255,255,255),
800,2000);
ps->setEmitter(em);
em->drop();
scene::IParticleAffector* paf =
ps->createFadeOutParticleAffector();
ps->addAffector(paf);
paf->drop();
ps->setMaterialFlag(video::EMF_LIGHTING, false);
ps->setMaterialTexture(0, driver->getTexture("./data/fire.bmp"));
ps->setMaterialType(video::EMT_TRANSPARENT_VERTEX_ALPHA);

Thanks again :D
Guest

Post by Guest »

Solved :)

I suppose there must be a better solution, but in the end I replaced "ps->setMaterialType(video::EMT_TRANSPARENT_VERTEX_ALPHA);" with "ps->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR );" and it worked.

The result is very similar, and the window problems go away :D
Post Reply