We will entertain your mind, enhance your brain, expand your lifestyle.

Spotlight again

In a earlier Hept puzzle, we implemented a spotlight. As we wrote in this article, the implementation was to apply a volume light material to a cone model. Unfortunately, this implementation was not smooth when changing the diameter of the spotlight.

Vertex shader

Therefore, we created a spotlight shader graph using a vertex shader (on the net) that transforms into a cone. This allows Unity’s primitive cylinder to be transformed into a cone.

However, in the original vertex shader, the upper end of the bounding box of the original model is the apex of the cone (=0 diameter). This does not match the diameter of the spotlight at the origin of the light unit, so changed shader so that the diameter of the cone at the top can be specified. The volume light material is also combined into one shader.

Puzzles that used the previous implementation have also changed to this new shader. Transform of the diameter became smooth.


The featured image was generated by DALL.E via Bing Image Creator. This picture because the spotlight does not come in neatly. It is quite difficult to generate as desired with AI.