I'm currently evaluating Amplify Color for use in a 2D mobile game. Essentially what we want to do is edit the colors of a few select objects in the scene to match the background.
I've taken the color mask sample and copied the setup into my own project. Unfortunately the sample does not take the Alpha of the sprite into account - leading to color correction being applied to transparent areas of the texture.
see below image for the problem (using an invert lut texture).
In this project, we're rendering unfocused objects as white, a focused object as black, both on a white background render texture, in order to create a grading mask that excludes the focused object only.
In your case you want to write the alpha value to the mask, and also exclude pixels that aren't visible (cutout) to avoid sprite overlapping issues. Here's a modified version of the shader that supports alpha and cutout. It assumes that the opacity is in Base texture alpha channel: https://dl.dropboxusercontent.com/u/140 ... der.shader
This should be all you need to create dynamic masks that are sensible to alpha.
I found that these scripts do not work with SteamVR and Vive using the standard [CameraRig] prefab from SteamVR and unity 2017.1.
I set up a volume and I tried re-creating what was in the example using the ColorMask script on the Camera(eye) removing my target object from the layers then duplicating the Camera(eye) and putting it under primary Camera(eye) and dropping it into the Mask camera field. The scene worked but would not respond to the color volume.
If instead I create duplicate camera (head)s and have each (eye) renderer a different layer it does put the two layers together but even if I remove amplify from one of the (eye)s it still applies the LUT to the whole scene. This is not how I would expect it to behave, why is the script having an effect on a camera that it is not attached to?
UPDATE, The whole camera rig had to be duplicated rather than just the head, now I can get the lut to only effect the objects on a given layer.
One other bug to report. I tried to work around the problem of the LUT being applied to cameras that did not have the script attached by using the depth masking. When Depth masking is on it will not apply the lut to an unlit texture. I tried a few different shaders and found it happening consistently.
gregdowning wrote:One other bug to report. I tried to work around the problem of the LUT being applied to cameras that did not have the script attached by using the depth masking. When Depth masking is on it will not apply the lut to an unlit texture. I tried a few different shaders and found it happening consistently.
Hello,
Thank you for elaborating, can you share a simple example with the problem present for further testing on our side? if you have not already I recommend picking up the revamped masking sample from our website.
We recently updated our masking technique, I'll share a sample with you via pm as the current version is not yet available via our website.