You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Way to determine if object is partially exposed? #868
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" ?
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.
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...
Activity
Zylann commentedon Jun 9, 2026
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
< 0if the point is underground (with values further away from zero the deeper it is). That function is only available onVoxelToolLodTerrainthough, you'd have to implement it overget_voxel_fif you useVoxelToolTerrain.wehoit commentedon Jun 9, 2026
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...