www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: ErDetEnAnd? on January 03, 2009, 12:02:34 pm

Title: Objects selectable only on visible part
Post by: ErDetEnAnd? 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.
Title: Re: Objects selectable only on visible part
Post by: EgonOlsen on January 03, 2009, 12:53:55 pm
In theory, it should be possible to do something like this:

However, that is quite complex to do. What exactly do you need this for? Maybe there's a simpler solution that covers your case.
Title: Re: Objects selectable only on visible part
Post by: ErDetEnAnd? 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 :-(
Title: Re: Objects selectable only on visible part
Post by: EgonOlsen 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.
Title: Re: Objects selectable only on visible part
Post by: ErDetEnAnd? on January 05, 2009, 09:14:11 am
You sugguest jPCT to autoscale it?
Title: Re: Objects selectable only on visible part
Post by: EgonOlsen 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...
Title: Re: Objects selectable only on visible part
Post by: 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.
Title: Re: Objects selectable only on visible part
Post by: EgonOlsen 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