<p>I have a voxel grid and a conic surface (hollow cone) placed in the grid.</p>
<p>I want to know <strong>which voxels intersect with the cone surface and how much</strong>.</p>
<p>So far I have tried sampling points on the conic surface and then match them to the voxels but this solution is quiet cumbersome.</p>
<p>Is there some cone tracing algorithm that would only consider the surface of it?</p>

CC BY-SA 4.0
2022-10-06T09:13:39.773Z
When you say "how much" what do you mean? how far it is away from the center of the voxel? Or how much volume of the voxel is inside the cone?
Thomas
CC BY-SA 4.0
2022-10-06T09:23:52.863Z
How far is it from the center of the voxel.
Vojtooo
CC BY-SA 4.0
2022-10-06T09:57:54.133Z
by having the hessian plane equation you can use the dot product to calculate the distance of a point to a plane. So when each triangle stores it's plane equation (vec4) you can easily calculate the distance to the voxels center.
To figure out which voxel is hit, you can use rasterization technique and render from all three sides (x, y and z direction). when doing so, deactivate culling and depthtest
Thomas
CC BY-SA 4.0
2022-10-06T10:24:25.677Z
Hmm, I have an analytical representation of the cone, without any faces. What do you mean by planes?
Vojtooo
CC BY-SA 4.0
2022-10-06T10:54:50.903Z
ahh okay, I thought the cone is a triangle mesh... so your cone has a position, direction and an opening angle?
Thomas
CC BY-SA 4.0
2022-10-06T11:06:03.420Z
Exactly! xyz position of the cone apex, xyz cone axis and half-apex angle.
Vojtooo
CC BY-SA 4.0
2022-10-06T11:16:23.277Z
you can align a coordinate system, so that your cone always opens into "z" direction and the position (cone apex) is on (0,0,0).
The voxels need to be recalculated into that coordinate system by basis change.
With your angle you can calculate: tan(angle) * z = coneRadius at distance z. The Voxel position (in your aligned coordinate system) can use Pythagoras to calculate the distance to the (0,0,z) point. So if the distance is smaller or grather the voxel diagonal size / 2, it is outside of the cone surface. Otherwise the Voxel is close to the cones surface and need to be checked again.
Thomas
CC BY-SA 4.0
2022-10-06T11:20:51.357Z
Then, for each voxel which is close, you can calculate the distance of all 8 corners and compare if at least one of the 8 values is smaller and one of the 8 values is larger than the coneRadius. If this condition is true, the voxel intersects the cone surface.
Thomas
CC BY-SA 4.0
2022-10-06T12:21:32.080Z
Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
Community
<raytracing>
Tracing conic surface through voxel grid
Vojtooo
# Tracing conic surface through voxel grid

(Asked by: username_0 on 2022-10-06)

I have a voxel grid and a conic surface (hollow cone) placed in the grid.

I want to know **which voxels intersect with the cone surface and how much**.

So far I have tried sampling points on the conic surface and then match them to the voxels but this solution is quiet cumbersome.

Is there some cone tracing algorithm that would only consider the surface of it?

**Tags:** raytracing

> **Comments:**
> **username_1**: When you say "how much" what do you mean? how far it is away from the center of the voxel? Or how much volume of the voxel is inside the cone?  
> **username_0**: How far is it from the center of the voxel.  
> **username_1**: by having the hessian plane equation you can use the dot product to calculate the distance of a point to a plane. So when each triangle stores it's plane equation (vec4) you can easily calculate the distance to the voxels center. To figure out which voxel is hit, you can use rasterization technique and render from all three sides (x, y and z direction). when doing so, deactivate culling and depthtest  
> **username_0**: Hmm, I have an analytical representation of the cone, without any faces. What do you mean by planes?  
> **username_1**: ahh okay, I thought the cone is a triangle mesh... so your cone has a position, direction and an opening angle?  
> **username_0**: Exactly! xyz position of the cone apex, xyz cone axis and half-apex angle.  
> **username_1**: you can align a coordinate system, so that your cone always opens into "z" direction and the position (cone apex) is on (0,0,0). The voxels need to be recalculated into that coordinate system by basis change. With your angle you can calculate: tan(angle) * z = coneRadius at distance z. The Voxel position (in your aligned coordinate system) can use Pythagoras to calculate the distance to the (0,0,z) point. So if the distance is smaller or grather the voxel diagonal size / 2, it is outside of the cone surface. Otherwise the Voxel is close to the cones surface and need to be checked again.  
> **username_1**: Then, for each voxel which is close, you can calculate the distance of all 8 corners and compare if at least one of the 8 values is smaller and one of the 8 values is larger than the coneRadius. If this condition is true, the voxel intersects the cone surface.  
> **username_2**: Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.  

---

## 0 answers

