Raycast node that can detect volume(grid) in geometry nodes
Currently raycast nodes in geometry nodes can get information regarding a hit position and more from target geometry, but only if the geometry has a surface (is a mesh). With the introduction of the grid (volume) node, a lot can be done with volumetrics, and making the raycast node able to detect grids would open a lot of opportunities. And this would be different from the normal raycast because it would not just detect the surface but also the in-between parts of the volume, like light passing through a volume, as the raycast is shot between the entry point and the exit point, and this would easily help create a laser effect using volume and raycast and so much more. Because the grid raycast node can collect data of the grids that are hit when a ray is shot into the volume. And if it is possible, the raycast node in the shader editor will also be able to get the ability to detect volume.
3 Comments
I like the concept, but what would the raycast node return in this case? The amount of data that would be returned in one ray moving through a volume is so much as to be useless. We already know the density. Should it return the first point where the density is greater than zero? Perhaps with an epsilon value to vary the density it first recognizes?
It is more than enough if it returns (is hit data). What I mean is if the ray is shot from, let's say for example, a plane mesh to the volume, the voxel grids in the volume that the rays pass through will have a 1 value on them, and the ones that don't will have 0 on them, and the resolution matters because if it is low resolution (low voxel volume), then only a small amount of the volume needs to be calculated if the ray from the raycast hits them. In summary, it will return the voxels in the volume grid that the ray passes through as 1 in the grid data, and this can help create laser-like effects where the grid voxel is 1 and more.
I would want such a "raycast volume" node to return the optical depth. This is equivalent to
sum(hit.depth * hit.density for hit in grid.trace(ray)), and can be used for volume absorption or out-scattering using:exp(-optical_depth * extinction_coefficient)