[SOLVED]Make node transp using other transp node|xray effect
[SOLVED]Make node transp using other transp node|xray effect
Hello,
first off: this may sound really dumb - it may be anyway...
Ok, I did achieve this previously, but later testing it (I don't know what I changed there..., from my Backups, it seems like I changed nothing, so I am probably observing the wrong properties...) it does no longer work.
What I want is the following: Let's say we have object A: a cube and object B a smaller (in diameter) circle (or even sphere, if you prefer)
B is given a texture with Alpha channel and it is in front of A (between the camera and A)
Obviously you can look through the transparent parts of B. Usually you would see A through it (this is happening now) - but earlier I somehow managed to see through A too, where B is transparent (this is what I want...)
As I have no idea, how it worked, not even how it is called, if it has a name, I am asking for help on how to achieve this (again), respectively, how I could have achieved it earlier.
thanks a lot in advance
user-r3
first off: this may sound really dumb - it may be anyway...
Ok, I did achieve this previously, but later testing it (I don't know what I changed there..., from my Backups, it seems like I changed nothing, so I am probably observing the wrong properties...) it does no longer work.
What I want is the following: Let's say we have object A: a cube and object B a smaller (in diameter) circle (or even sphere, if you prefer)
B is given a texture with Alpha channel and it is in front of A (between the camera and A)
Obviously you can look through the transparent parts of B. Usually you would see A through it (this is happening now) - but earlier I somehow managed to see through A too, where B is transparent (this is what I want...)
As I have no idea, how it worked, not even how it is called, if it has a name, I am asking for help on how to achieve this (again), respectively, how I could have achieved it earlier.
thanks a lot in advance
user-r3
Last edited by user-r3 on Tue Feb 12, 2013 6:15 pm, edited 2 times in total.
Re: Make node transparent using transp. node on top
Do you mean the X-ray glasses effect?
(most SFW picture I could find )
(most SFW picture I could find )
Re: Make node transparent using transp. node on top
Haha, did not really think of that , but yes something like that...
Is that possible or are you making fun of me... Well.. it must be possible because I achieved it earlier... (Maybe it was a bug in Irrlicht?)
Anyway, I am not trying to create x-ray glasses, but I want to use it for an optical sight on my gun, in my game. The perspective really looks bad with a correctly modelled sight (they are long tubes...) so this effect really worked like a charm^^ (RTT would work too, but consumes too much processing power.)
Thanks anyway for your reply
But this did not help me find, how to achieve this in irrlicht... I can only tell you, that it must have been done using vanilla methods, no shaders or anything like that...
Thanks in advance for any further help
Is that possible or are you making fun of me... Well.. it must be possible because I achieved it earlier... (Maybe it was a bug in Irrlicht?)
Anyway, I am not trying to create x-ray glasses, but I want to use it for an optical sight on my gun, in my game. The perspective really looks bad with a correctly modelled sight (they are long tubes...) so this effect really worked like a charm^^ (RTT would work too, but consumes too much processing power.)
Thanks anyway for your reply
But this did not help me find, how to achieve this in irrlicht... I can only tell you, that it must have been done using vanilla methods, no shaders or anything like that...
Thanks in advance for any further help
Re: Make node transparent using node alpha on top (x-ray eff
I guess something like that could happen when the rendering order is wrong. It should first draw the opaque object, and then the transparant one. If not then the z-test will make the part of the opaque object not drawn at all, which could indeed look like a hole. Problem with that is: it is not guaranteed that the rest of your scene IS drawn behind the transparant object.
I think to make x-ray you have to take control of the drawing order. First draw the scene, then draw the transparant object, then draw the opaque object. It will then not draw any parts of the opaque object which is behind the transparant object...
but I'm not expert at this... and I don't know HOW to exactly achieve this in irrlicht.
I think to make x-ray you have to take control of the drawing order. First draw the scene, then draw the transparant object, then draw the opaque object. It will then not draw any parts of the opaque object which is behind the transparant object...
but I'm not expert at this... and I don't know HOW to exactly achieve this in irrlicht.
Re: Make node transparent using node alpha on top (x-ray eff
You can do that by removing the node from the scene manager, and then calling render on it after smgr->drawall.
ie
node->grab
node->setparent(NULL)
...
loop {
smgr->drawall
specialsolidnode->render
}
ie
node->grab
node->setparent(NULL)
...
loop {
smgr->drawall
specialsolidnode->render
}
Re: Make node transparent using node alpha on top (x-ray eff
Thank you very much for your interest!
@hendu
this really is a nice method, but is it possible to keep the parent of the node and still not render it in drawAll(), but via render()?
Thanks again and also thanks again in advance
user-r3
@hendu
this really is a nice method, but is it possible to keep the parent of the node and still not render it in drawAll(), but via render()?
Thanks again and also thanks again in advance
user-r3
Re: Make node transparent using node alpha on top (x-ray eff
Only if the parent is also not in the scene manager. Otherwise the manager will render it in drawall.
edit: Or by making it invisible before drawall and visible before render.
edit: Or by making it invisible before drawall and visible before render.
Re: Make node transparent using node alpha on top (x-ray eff
hmm. ok, I tried your "edit", making the node invisible immediately bevore drawall, setting it to visible afterwards, before calling "render", but it is not showing at all... can you reproduce this error?
Thanks for your help anyway
Thanks for your help anyway
Re: Make node transparent using node alpha on top (x-ray eff
Works for me. Maybe post your code.
Re: Make node transparent using node alpha on top (x-ray eff
After creating my weaponry I call:
in my loop function I call:
where weapon is a pointer to the currently selected weapon in weapons[]
the weapon is not drawn at all... (but the lens of the sight, which is a seperate scenenode, and should cause the x-ray effect, is drawn... looks strange^^)
Code: Select all
for (int i=0; i<weapons.size(); i++)
{
// here are other methods with weapons[i]->
weapons[i]->node->grab();
}
Code: Select all
weapon->node->setVisible(false);
smgr->drawAll();
weapon->node->setVisible(true);
weapon->node->render();
the weapon is not drawn at all... (but the lens of the sight, which is a seperate scenenode, and should cause the x-ray effect, is drawn... looks strange^^)
Re: Make node transparent using node alpha on top (x-ray eff
I'm sorry for bumping, but can nobody say why my code doesn't work?
Could you, hendu, post your working code, so that I may find a fatal difference?
Greeetz
user-r3
EDIT Nevermind, I finally found this thread:
http://irrlicht.sourceforge.net/forum/v ... hp?t=32045
which showed me how to do it, instead of my:
I have to replace the render and do the following:
Could you, hendu, post your working code, so that I may find a fatal difference?
Greeetz
user-r3
EDIT Nevermind, I finally found this thread:
http://irrlicht.sourceforge.net/forum/v ... hp?t=32045
which showed me how to do it, instead of my:
Code: Select all
weapon->node->setVisible(false);
smgr->drawAll();
weapon->node->setVisible(true);
weapon->node->render();
Code: Select all
weapon->node->updateAbsolutePosition();
IMesh* mesh = weapon->node->getMesh();
driver->setTransform(video::ETS_WORLD, weapon->node->getAbsoluteTransformation());
for (unsigned int i=0; i<mesh->getMeshBufferCount(); ++i)
{
scene::IMeshBuffer* mb = mesh->getMeshBuffer(i);
if (mb)
{
const video::SMaterial& material = weapon->node->isReadOnlyMaterials() ? mb->getMaterial() : weapon->node->getMaterial(i);
driver->setMaterial(material);
driver->drawMeshBuffer(mb);
}
}
Re: [SOLVED]Make node transp using other transp node|xray ef
I suppose it was since I had nothing transparent in my simple test app, so the pass never changed to transparent. But yeah, taking more control works well too, like you found.