8000 Way to determine if object is partially exposed? · Issue #868 · Zylann/godot_voxel · GitHub
[go: up one dir, main page]

Skip to content

Way to determine if object is partially exposed? #868

Open

Description

@wehoit
  • Mesher - Waves or Flat
  • Generator - Transvoxel

Is there a way to determine if an object is exposed from the voxel terrain?

For example, take a cube and set it partially below the voxel surface and another completely below.
Is there way to distinguish between the two in terms of which is exposed or "more visible" ?

Activity

  1. Zylann commented on Jun 9, 2026

    @Zylann
    Owner

    Not in a precise way. You could be burying any shape of any size, and terrain could be complex, so determining this could get quite involved.
    You could try to approximate using raycasts, shape casts (to see if it intersects the surface, I wonder if that would work?), or interpolating the SDF at one or multiple points with get_voxel_f_interpolated, which will return < 0 if the point is underground (with values further away from zero the deeper it is). That function is only available on VoxelToolLodTerrain though, you'd have to implement it over get_voxel_f if you use VoxelToolTerrain.

  2. wehoit commented on Jun 9, 2026

    @wehoit
    Author

    Again - thanks for taking the time to respond.

    I ended up using multiple RayCast3D in a close pattern (5, like on a die), plus collision Layers/Masks, then counted how many hit the obscured object.
    If 3 or more hit, I assumed it was uncovered enough for my purpose.
    Seems ok for now - I'll tweak the params as needed...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0