Neon Atelier December Progress - Neon Light Shaders

December had been yet another hardworking monthly for our team. While our course on the semester wrapped up as November passed, our early December was still preoccupied by exams and the Phrase 1 report of this project. Fortunate of us, we got half month of winter break after that, giving us time to spearhead on the project's progress. 

Our progress of the month centered around the core element of Neon Atelier - the neon light itself. While our earlier implementation for the prototype only play with the shapes and VR interaction of the tube, this  time we move on the its shiny visual and more. In order to implement this, we had leveraged Unity's Shade Graph module so that we can implement custom visual materials with the convenient of node-based scripting, as compared to traditional code by HLSL shader writing.

Our neon shader begin with its glassy material. While the basic reflection is already built into Unity's Lit material base, the refraction through to the clear glass tube is craft by reading from the game's frame buffer and shifted it according to the polygon's normal vector of the tube. The lighting on the material is implement with the boolean trigger lit, and the lit-on colors defined via the rawLitCol and the injectedLitCol (the two colors are for before and after neon gas injection, which a topic our future implementation).

One interesting fact about neon light is that its color is often only partially contributed by the neon gas, due to the limited option of such gases. More sophisticated colors are instead formed by overlaying the lighten up gas with fluorescent coating on the tubes' lining. To take this accounted in Neon Atelier, our custom neon shader exposed a set of optional color parameters (hasFluoscent, fluoCol)for defining the fluorescent coating.


Apart from the visual of lighting up the neon light, our custom material are also implemented to present torching of the tube interactively. On the shader side, the material can be fed with a TorchGradient texture that overlay the torched area with hot red. As mentioned in our previous update, the 3D models of our neon tubes are built with their running direction unwrapped align to the Y axis of the UV map. Therefore we can pinpoint any arbitrary section on the tube simply by specifying the Y position for the UV map. Our custom TorchSectionShaderController script is implemented to make use of this setup, in order to define and manage the TorchGradient texture, with exposure of handler function for our game logic to call upon. And unsurprisingly, one of the frequent users is our TorchableSection script, with its torching progress forward to the TorchSectionShaderController,

One additional feature of this script is that it automates the substeps generation for consecutive torching steps, and provide simple function to step through these substeps, hence saving us for those manual setups.


We also implement a TorchAtEndShaerController script, which work very similarly to TorchSectionShaderController. However, this script is dedicated for update the torching visual at the welding end of electrodes and neon tube. The automated subdivision generation is irrelevant in this case, and hence stripped down to avoid confusion.
With the above implementation, our neon light tubes its torching and lit-up visual as follows:

And also for the electrode torching :)