Picking Invisible Objects

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
spidersharma
Posts: 50
Joined: Thu Aug 13, 2009 7:16 am
Location: India

Picking Invisible Objects

Post by spidersharma »

Hi,

I am Interested in picking invisible objects in Irrlicht.
Is it possible?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

I think you can pick the triangles of invisible nodes, but you can't use the functions which are using CSceneCollisionManager::getPickedNodeBB (basically all functions for picking nodes) as that has an isVisible check. If you remove that it would work.

I think we should separate visibility from collision some day as I do in my games a lot more checks for invisible nodes and triangles than for visible nodes as I usually have an own collision geometry. And I suppose other people do the same.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
spidersharma
Posts: 50
Joined: Thu Aug 13, 2009 7:16 am
Location: India

Post by spidersharma »

Hi,
Can we make the object of intrest 100% transparent and pick?
Right now Idon't need more than 3 pickable planes.
My Idea is to do 3dsmax style translation gizmos.
for that I need 3 invisible planes which are pickable.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

You can use some mesh make that invisible and use selectors. The problem with invisibility happens only with node-picking functions. Selectors will work.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
spidersharma
Posts: 50
Joined: Thu Aug 13, 2009 7:16 am
Location: India

Post by spidersharma »

If we make a meshNode invisible, will it be even registered for rendering?
garrittg
Posts: 117
Joined: Wed Apr 20, 2005 6:17 pm
Location: Iowa, USA
Contact:

Post by garrittg »

greetings :) for RetroTank3D i needed invisible tanks but still needed collision support. instead of ISceneNode.setVisible, i used:

ISceneNode.setMaterialType(EMT_TRANSPARENT_ALPHA_CHANNEL)

to make them invisible and

ISceneNode.setMaterialType(EMT_SOLID)

to make them visible again. i think the same should work for you well.

HTH.
spidersharma
Posts: 50
Joined: Thu Aug 13, 2009 7:16 am
Location: India

Post by spidersharma »

Thanks a lot.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

spidersharma wrote:If we make a meshNode invisible, will it be even registered for rendering?
Very good point. I've currently static collision geometry so that didn't matter. But you are right - it won't register, but probably you could call registerNodeForRendering from ISceneManager to force it to register.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

If you want to make a scene node invisible, it's much simpler with 1.6 to use the OverrideMaterial. Also, to speed things up, you should disable the color planes instead, which would render only to depth buffer, or also disable that one. Both can be changed with only one (resp. two) calls to the SMaterial Flags, which is much faster than changing all materials. Moreover, it won't mess with transparent materials etc. Hope this helps.
spidersharma
Posts: 50
Joined: Thu Aug 13, 2009 7:16 am
Location: India

Post by spidersharma »

Thanks a lot for this valuable suggestion.
johann_gambolputty
Posts: 28
Joined: Mon Nov 02, 2009 9:51 am

Post by johann_gambolputty »

setMaterialFlag(video::EMF_FRONT_FACE_CULLING, true);
works fine for me :D
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Post by Lonesome Ducky »

johann_gambolputty wrote:setMaterialFlag(video::EMF_FRONT_FACE_CULLING, true);
works fine for me :D
Ah yes, but you'd have to be sure back face culling is enabled too, otherwise the back would be drawn.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Please note, though, that this only handles faces, i.e. lines and points might still be drawn, and DirectX cannot handle this mode at all. Moreover, disabling the framebuffer should be much faster.
Post Reply