Important note for devs: Make sure Razer Synapse is up to date, otherwise some SDK features will not work.
For starters, here's a handy link to Unity Chroma SDK.
One of the most powerful features of the Unity Chroma SDK is the ability to record the view of a camera in the scene and convert that to a chroma animation. A lot of creative opportunities lie within this feature, as chroma animations can, therefore, be made from a camera that sees particle systems, canvas, sprites, meshes with materials, and so on.
For our game Log Jammers, I found particle systems achieved the type of effect we were looking for with far less development time than expected. Following is a description of the process to utilize the camera capture feature of the Unity Chroma SDK.
First, set up a camera in the scene which aims at a particle system. Make sure the orientation of the two is such that the camera will see the particle system.
Open the “Chroma Particle Window” which is dedicated to this Chroma SDK feature. This is located in Unity’s toolbar if you have imported the Chroma SDK package.
Next, drag and drop the following references into their corresponding fields in the particle window:
- Your target chroma animation object. Make this by placing the Chroma SDK animation component of your choice on a GameObject.
- The camera you just configured to point at your particle system.
With the particle window still open, select your particle system in the scene, and press the “Simulate” button in the scene view. You should see the particles of your system in the preview window.
To start recording the camera view, press the “Start” button. I recommend timing your capture to start/stop around your particle system beginning and ending, so the transitions in and out of the chroma animation are smooth. Please note that capturing will add to the end of previously saved/recorded frames in the animation. Therefore, if you don’t like a capture, make sure to press the “Reset” button to clear the bad capture before recording again.
This workflow makes for nice looking chroma animations in little time. Below you can see examples with the above-captured chroma animations in the hardware emulator.
The Chroma Hardware Emulator
To test all of our fancy new chroma effects on Razer hardware that I didn’t have available, I used the ChromaEmulator tool.
This tool shows its emulation of Chroma effects in real-time for all types of Chroma hardware, including ChromaLink. This tool works with Unity without extra effort. Just fire it up, select your hardware of choice to emulate, and select show for each of them. These are some examples:
Here's a helpful link to information for devs on chroma-link (explains the significance of the color channels).
Unity Bloom Post Processing & Emission Maps
- Import this unity package - it will allow us to use post-processing such as bloom
- In the file manager view within unity: Right-click -> Create -> Post-Processing Profile
- Select the newly-made profile, and view its contents in the inspector.
- Check the box next to bloom to enable the following: bloom, chromatic aberration, and vignette. Copy these settings for now:
- Select your main camera in the scene's hierarchy, and add the script called 'Post Processing Behaviour'. For its 'Profile' element in the inspector, assign the post-processing profile you created earlier.
- The result should look a bit like this
If you want to directly control how a specific sprite behaves in regards to bloom/emission, you need to make a Sprite Pixel-Lit material just for it with an emission map.
- Download the shaders from this GitHub: https://github.com/traggett/UnitySpriteShaders
- Put this folder in your assets folder. It has shaders for the materials we'll be using.
In the file manager again, Right-click -> Create -> Material. Select the material. At the top in the inspector, select Shader -> Sprite (Pixel Lit).
Configure the material as follows:
- Set 'Blend Mode' to Standard Alpha.
- Check the "Emission" box. This will enable you to control its bloom output via an emission map
- When emission is checked, under it is a box with 'Emission' next to it. This is where you will place the artist-provided emission map for the sprite you want to define the bloom for. An emission map will be black and white. See below for an example.
- The color box is where you can set the hue and intensity of the bloom/glow. I recommend putting it to pure white, which means no hue shift and maximum emission. You can use this to control the bloom intensity for a sprite without having an emission map, but an emission map will control which pixels emit and which don't.
- Once that's done, select your sprite's game object and set the material component of its sprite renderer to the new material you made.
For emission maps made for sprite sheets that are sliced (such as animations) the emission maps will be automatically sliced/indexed in the same way as a referenced sprite sheet.
Some notes about emission:
- Unless you want all of a sprite to emit bloom, you should use an emission map. Without an emission map, the intensity of bloom from a specific pixel will be based on the intensity of the RGB color of that pixel. As a result, sprites which are a bright color will emit a lot of bloom, which may be undesirable.
- An emission map won't decide the final color - it just describes how much bloom emission happens per pixel. The hue part of the emission material’s configuration will affect the color, otherwise, when left white, it will use each pixel’s color for emission color.
- The final emission intensity appears to be (RGB Intensity of pixel * Corresponding Pixel intensity in Emission map), where the pixel emission map intensity is 0 to 1.
- Example emission map and base. Here, only the windows will emit any bloom.
Keep your paw on the pulse of all our unity tricks by joining our Discord!