Making a textscenenode clip?

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
UncleBob
Posts: 106
Joined: Fri May 01, 2009 8:46 am

Making a textscenenode clip?

Post by UncleBob »

Well, clipping might be a bit much to say, really.

I'm having a planet, and now I want to draw some surface markers and labels on it. I don't want to do this with billboards, because they'll be much too large when zoomed in, or much too small when zoomed out. ITextSceneNode seemed pretty much what I needed... except ITextSceneNodes don't recognise when they're behind something, in which case the label should not be drawn (i.e. if the spot on the surface is behind the planet from the camera).

I tried to make a custom text scene node to get the functionality I need. It doesn't need to be fancy. Just when the position of the marker is behind the planet, don't draw the label.
I tried it with simple line of sight collision detection. That works, but we're talking hundreds of markers here... The whole thing slowed down to a crawl.
So what I'd need is to somehow get the node into the Z-order during the drawing. Again, that doesn't sound too complicated, after all it's just one single point per marker that decides if the whole thing gets drawn. So I thought about just drawing a vertex at the marker position, that would be in the z-order...
But then I wouldn't know how to get any feedback on whether the vertex was drawn or not to decide whether or not to draw the text, so that doesn't seem to help me much.

What would you suggest to solve the problem?
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Making a textscenenode clip?

Post by hendu »

Single point, hm, I have heard that somewhere ;)

Point sprites act that way, and their size is specified in pixels by default. So pretty much perfect fit, as long as your text doesn't change too often.
UncleBob
Posts: 106
Joined: Fri May 01, 2009 8:46 am

Re: Making a textscenenode clip?

Post by UncleBob »

The text never ever changes, so that shouldn't be a problem. Just... what are point sprites?
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Making a textscenenode clip?

Post by hendu »

They are a primitive like tris and quads.
UncleBob
Posts: 106
Joined: Fri May 01, 2009 8:46 am

Re: Making a textscenenode clip?

Post by UncleBob »

Hmmm... seems to involve shader programming and stuff, which I've never done. I really didn't think those surface markers would pose such a problem...
UncleBob
Posts: 106
Joined: Fri May 01, 2009 8:46 am

Re: Making a textscenenode clip?

Post by UncleBob »

Solved the problem with a rough approximation based on distances between camera, marker and planet position in the end. Works decently and doesn't harm performance. Thanks for the replies anyways.
Post Reply