We developed a new shader for puzzles. The puzzle involves arranging multiple objects that move periodically into the correct sequence. To determine the movement of these objects, we use the light trails they leave on the floor.
Initially, we considered using a shader graph, but it proved difficult to capture object position information, so we decided to implement it using a shader script. We initially tried to detect the object’s position by using raycasting to determine where it would hit the floor, but this didn’t work. Ultimately, we calculated and applied the object’s position using the coordinates of both the object and the floor.
The shader itself was initially a standalone custom shader, but the solution involved separating the shader that receives coordinates and writes the trajectory from the shader that fades over time.
The result is shown in the video below.