Objects selectable only on visible part

Started by ErDetEnAnd?, January 03, 2009, 12:02:34 PM

Previous topic - Next topic

ErDetEnAnd?

Hello again.

Selection works on polygons, so if a selectable object carries a (partial) transparent texture, it would also be selected when clicked on the invisible part. Is there some kind of solution for this?

Regards.

EgonOlsen

In theory, it should be possible to do something like this:


  • determine the picking point in camera space
  • transform that point into object space
  • transform that point into texture space
  • perform a look up on the texture if that point is transparent or not
However, that is quite complex to do. What exactly do you need this for? Maybe there's a simpler solution that covers your case.

ErDetEnAnd?

In my program billboards sometimes work as labels which should be selectable. The label surrounds some text, and fits hardly into a 2^x texture size. So the transparent part of the texture (outside the label) becomes selectable :-(

EgonOlsen

#3
But why are you using the whole 2^x pixels of the texture for texturing the label if only a part of it is actually used? Maybe a screen shot helps to understand better what you are doing.

ErDetEnAnd?


EgonOlsen

Quote from: ErDetEnAnd? on January 05, 2009, 09:14:11 AM
You sugguest jPCT to autoscale it?
Autoscale what? What i meant was, that there should be no parts of the texture used for the label quad except for the label itself. It's difficult to explain...that's why i was asking for a picture to see if we are talking about the same thing...

paulscode

Depending on what you are using this for, you might be able to make the polys smaller and change your UV coordinates so that only the non-transparent part of the texture is drawn.

EgonOlsen

Quote from: paulscode on January 06, 2009, 12:30:43 AM
Depending on what you are using this for, you might be able to make the polys smaller and change your UV coordinates so that only the non-transparent part of the texture is drawn.
That's what i tried to describe and wasn't really able to... ;D