Author Topic: Objects selectable only on visible part  (Read 4215 times)

Offline ErDetEnAnd?

  • int
  • **
  • Posts: 87
    • View Profile
Objects selectable only on visible part
« on: January 03, 2009, 12:02:34 pm »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Objects selectable only on visible part
« Reply #1 on: January 03, 2009, 12:53:55 pm »
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.

Offline ErDetEnAnd?

  • int
  • **
  • Posts: 87
    • View Profile
Re: Objects selectable only on visible part
« Reply #2 on: January 04, 2009, 09:40:02 pm »
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 :-(

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Objects selectable only on visible part
« Reply #3 on: January 04, 2009, 11:06:15 pm »
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.
« Last Edit: January 04, 2009, 11:09:55 pm by EgonOlsen »

Offline ErDetEnAnd?

  • int
  • **
  • Posts: 87
    • View Profile
Re: Objects selectable only on visible part
« Reply #4 on: January 05, 2009, 09:14:11 am »
You sugguest jPCT to autoscale it?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Objects selectable only on visible part
« Reply #5 on: January 05, 2009, 10:49:19 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...

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: Objects selectable only on visible part
« Reply #6 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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Objects selectable only on visible part
« Reply #7 on: January 06, 2009, 04:36:41 pm »
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