Godot Version
4.3
Question
I am attempting to work on a 3D “telegraph” system, where some area on the terrain will be highlighted red (or any arbitrary color; generally red for hostile effects).
If I wish to represent a cubic telegraph, a Decal works. Easy-peasy. It gets projected on the ground, shows over uneven terrain, climbs slopes appropriately, all within its provided bounds.
I wish to emulate that behavior for any arbitrary 3D shape. If I supplied a tetrahedron (triangular pyramid), there should be a triangular telegraph. If the tetrahedron were to sink lower into the ground, the highlighted area would shrink to a proportionally-smaller triangle, matching where the ground is intersecting the provided volume.
My difficulty is in detecting the area to be colored red. My intuition was to add a render pass where I render the depth from the camera, compare the collision volume(s) to the worldspace in said buffer, and color the albedo of each intersected surface. But I do not know how to add a render pass in godot, nor do I know how to calculate whether any given pixel is within a collision volume.