Heptod has a spotlight puzzle. There are lights of several colors, and you can solve puzzles by changing their position, ON / OFF, and the spread of light.
We wanted to apply a volume light to this light, but it wasn’t a standard feature of Unity and there wasn’t one that just fits the Asset Store, so we created it ourself. Referring to the net information, we just pasted the material with Shader Graph to the ‘Cone’ object. Shadows when the light is blocked are not implemented.
However, there was a problem when deforming the cone according to the spread of the light. If it is enlarged or reduced according to the size of the irradiation surface, it will not match the aperture of the emission surface of the light. The cause is that the injection part of the light is a surface, not a point.
Instead of a cone object, we placed a group of plates arranged in a conical shape and tried to change the direction, but the overlapping part of the plates was unnatural and not adopted.
As a result of the examination, we decided that the height direction of the cone was also deformed at the time of deformation, and the position was adjusted to match the diameter. As shown in the figure below, the cone for yellow light in the upper figure is deformed so that it pops out long behind.
Of course, this method has its drawbacks: the volume light is displayed even behind the body of the light.
Therefore, we decided to add a cutoff function in the height direction to the previous Shader Graph and adjust the cutoff distance at the time of deformation.