Color Masking - support for sprites?

Advanced Color Grading for Unity Pro

Color Masking - support for sprites?

Postby PGAKelly » Mon Feb 16, 2015 2:36 pm

Hello,

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).

Image

Any ideas what I could do to fix this?

Thanks :)
PGAKelly
 
Posts: 1
Joined: Mon Feb 16, 2015 2:22 pm

Re: Color Masking - support for sprites?

Postby Diogo Teixeira » Wed Feb 18, 2015 1:45 pm

Hi PGAKelly,

It's perfecly possible, and fairly quick to implement using our dynamic color mask as a basis:
http://amplify.pt/wp-content/download/A ... Sample.zip

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.

Hope this helps.

Cheers
Research & Development at Amplify Creations
User avatar
Diogo Teixeira
 
Posts: 124
Joined: Sat Aug 10, 2013 12:34 am

Color Masking SteamVR/Vive

Postby gregdowning » Sun Oct 01, 2017 4:12 am

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.
gregdowning
 
Posts: 3
Joined: Mon Apr 03, 2017 10:47 pm

Re: Color Masking - support for sprites?

Postby Ricardo Teixeira » Sun Oct 01, 2017 2:58 pm

Thank you for getting in touch. Is the problem completely resolved?

Thanks!
Sales & Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Ricardo Teixeira
 
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: Color Masking - support for sprites?

Postby gregdowning » Mon Oct 02, 2017 1:44 am

Hmmm, think I tricked myself into thinking I had it working but it clearly is not.
gregdowning
 
Posts: 3
Joined: Mon Apr 03, 2017 10:47 pm

Re: Color Masking - support for sprites?

Postby gregdowning » Mon Oct 02, 2017 1:48 am

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
 
Posts: 3
Joined: Mon Apr 03, 2017 10:47 pm

Re: Color Masking - support for sprites?

Postby Ricardo Teixeira » Mon Oct 02, 2017 12:56 pm

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.

Apologies for the inconvenience.
Sales & Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Ricardo Teixeira
 
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm


Return to Amplify Color

Who is online

Users browsing this forum: No registered users and 0 guests

cron