Mouse Picking and Alpha ( transparent objects)

Would it be useful to add an option so that meshes with opacity set to 0.0 or below a threshold opacity are not picked?

example: mouse picking

My interest in this is that as part of a project to rig and animate a human skeleton I am using pick as a debug tool, I can pick a part, have its name pop up, set its texture to a “picked colour” etc, very useful with so many small objects on the screen.

I also have debug tools to change opacity of groups of objects so that I can see the things I want to see but not have other objects adding visual complexity.

When I pick it is counter-intuitive to have objects with opacity 0.0 be selected in the pick rather than the non-transparent object lying behind.

I do not rate this as a high priority - I simply orientate my view before starting to pick.

I include it only as a suggestion because…

  1. It might be useful to others.
  2. It is counter intuitive to pick invisible objects.

It’s probably a messy thing to define since identical equal to zero is an unsafe test etc etc…so quite possibly not worth the hassle.

Hi jonnie,

yes and no :slight_smile:

The default predicate (mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.isEnabled()) already ignores meshes that are invisible (isVisible = false), but does not check opacity, or material parameters. this is due to the basic fact that… it will be very heavy to compute that for each and every mesh. What happens if someone is using an opacity texture? or manipulated a shader? or highlight the mesh?

You can always define your own predicate that fits your use-case (and change the default ones)

1 Like

@RaananW - thanks for that, I think the existing flags ‘isPickable’ should be fine for my needs - I am already reducing opacity in steps for a group of meshes under simple keypress control - it is a simple matter to add a few lines of code to set isVisible when opacity hits zero to within a small tolerance and similar setting when opacity increases.

1 Like