Picking: shoot through transparent texels (alpha mask/blend) instead of selecting the see-through face #276

Closed
opened 2026-10-04 01:01:10 +00:00 by sky_line · 1 comment
Owner

Bug: clicking or hovering selects a face even where its texture is see-through. The pick ray stops at the first triangle it hits, ignoring texture alpha. Examples:

  • a leaf or fence cut-out you can see straight through;
  • a mostly-transparent decal plane in front of the thing you meant to click;
  • hair, lace or foliage cards;
  • glass panels with transparent regions.

You end up selecting or touching the cut-out card instead of what's visibly behind it.

Expected: the pick ray treats transparent texels as empty and continues through them, so you select what you actually see.

  • Alpha mask (cutout) faces: pass through where the sampled texel alpha < the face's mask cutoff, the same test the renderer uses to discard it.
  • Alpha blend faces: pass through where the effective alpha (texel alpha × face/TE alpha) is below a small threshold (e.g. < 0.1), i.e. visually invisible. Partly transparent but visible pixels still pick.
  • Opaque faces: unchanged.

This is separate from Build > Options > Select Invisible Objects / "pick transparent". That covers objects whose face alpha is 0 (invisiprims, fully transparent prims). This ticket is about normal, visible objects whose texture has transparent areas. When "select invisible" is on, keep today's behaviour (hit everything), so builders can still grab transparent geometry deliberately.

Implementation notes:

  • GPU / RT pick (clean_pick_rt.comp, #255):
    • Treat these faces as non-opaque candidates and alpha-test the candidate hit against the base-colour texture at its interpolated UV (bindless, same as the RT shadow alpha test in clean_rt_common.glsl, including texture transforms / texture animation and the mask cutoff).
    • Commit only if it passes. Respect the per-ray candidate budget (G-7).
  • Skinned fallback (clean_pick_skin.comp): the same alpha test per candidate triangle.
  • CPU pick path (LLCleanInstanceStore::lineSegmentIntersect / LLVOVolume intersect):
    • After a triangle hit, compute the UV and test the texel alpha. Where a CPU copy isn't available (textures are GPU-resident; CPU copies are dropped), either route alpha faces through the GPU pick, or use a coarse per-texture alpha mask (e.g. a 64×64 1-bit mask built at decode time or from the GPU, bounded cache).
    • Continue the ray past rejected hits (iterate hits by distance).
  • Hover cursor and hover highlight use the same logic, so the hand cursor / highlight doesn't appear over empty texture space.
  • Right-click / edit selection: same rule, unless Select Invisible Objects is on.
  • Performance: only alpha-mask and alpha-blend faces need the texel test; opaque faces stay as today.

Test:

  • Click through a tree's leaf cut-outs to the ground or object behind.
  • Click a mesh with a transparent decal plane in front.
  • Click hair cards on an avatar: should hit the head or body behind the transparent parts, but still the hair where it's visible.
  • With Select Invisible Objects on, cut-outs are selectable again.
**Bug:** clicking or hovering selects a face even where its texture is see-through. The pick ray stops at the first triangle it hits, ignoring texture alpha. Examples: - a leaf or fence cut-out you can see straight through; - a mostly-transparent decal plane in front of the thing you meant to click; - hair, lace or foliage cards; - glass panels with transparent regions. You end up selecting or touching the cut-out card instead of what's visibly behind it. **Expected:** the pick ray treats **transparent texels as empty** and continues through them, so you select what you actually see. - **Alpha mask (cutout) faces:** pass through where the sampled texel alpha < the face's mask cutoff, the same test the renderer uses to discard it. - **Alpha blend faces:** pass through where the effective alpha (texel alpha × face/TE alpha) is below a small threshold (e.g. < 0.1), i.e. visually invisible. Partly transparent but visible pixels still pick. - **Opaque faces:** unchanged. This is separate from **Build > Options > Select Invisible Objects / "pick transparent"**. That covers *objects* whose face alpha is 0 (invisiprims, fully transparent prims). This ticket is about normal, visible objects whose *texture* has transparent areas. When "select invisible" is on, keep today's behaviour (hit everything), so builders can still grab transparent geometry deliberately. **Implementation notes:** - **GPU / RT pick (`clean_pick_rt.comp`, #255):** - Treat these faces as non-opaque candidates and alpha-test the candidate hit against the base-colour texture at its interpolated UV (bindless, same as the RT shadow alpha test in `clean_rt_common.glsl`, including texture transforms / texture animation and the mask cutoff). - Commit only if it passes. Respect the per-ray candidate budget (G-7). - **Skinned fallback (`clean_pick_skin.comp`):** the same alpha test per candidate triangle. - **CPU pick path (`LLCleanInstanceStore::lineSegmentIntersect` / LLVOVolume intersect):** - After a triangle hit, compute the UV and test the texel alpha. Where a CPU copy isn't available (textures are GPU-resident; CPU copies are dropped), either route alpha faces through the GPU pick, or use a coarse per-texture alpha mask (e.g. a 64×64 1-bit mask built at decode time or from the GPU, bounded cache). - Continue the ray past rejected hits (iterate hits by distance). - **Hover cursor and hover highlight** use the same logic, so the hand cursor / highlight doesn't appear over empty texture space. - **Right-click / edit selection:** same rule, unless Select Invisible Objects is on. - **Performance:** only alpha-mask and alpha-blend faces need the texel test; opaque faces stay as today. **Test:** - Click through a tree's leaf cut-outs to the ground or object behind. - Click a mesh with a transparent decal plane in front. - Click hair cards on an avatar: should hit the head or body behind the transparent parts, but still the hair where it's visible. - With Select Invisible Objects on, cut-outs are selectable again.
Author
Owner

Verified done: pick rays now pass through transparent texels on alpha-mask/blend faces: compact 4-bit pick alpha map, CPU pick (prims, mesh, attachments, HUD), GPU rigged/animesh pick with PickAlphaThreshold; Select Invisible keeps hitting everything, invisible click zones and HUD buttons stay clickable. Commits: b17814712d, a7b9025ebd, c20bcdc55f, b174026670. Shipped in v1.0.0-beta.4.

Verified done: pick rays now pass through transparent texels on alpha-mask/blend faces: compact 4-bit pick alpha map, CPU pick (prims, mesh, attachments, HUD), GPU rigged/animesh pick with PickAlphaThreshold; Select Invisible keeps hitting everything, invisible click zones and HUD buttons stay clickable. Commits: b17814712d, a7b9025ebd, c20bcdc55f, b174026670. Shipped in v1.0.0-beta.4.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sky_line/Slipstream#276
No description provided.