google-ar / sceneform-android-sdk

Sceneform SDK for Android
https://developers.google.com/sceneform/develop/
Apache License 2.0
1.23k stars 604 forks source link

Chromakey video sample invert effect #631

Closed BenjaminFaal closed 5 years ago

BenjaminFaal commented 5 years ago

In https://github.com/google-ar/sceneform-android-sdk/blob/master/samples/chromakeyvideo/app/sampledata/models/chroma_key_video_material.mat

It removes the green color from the video, how to reverse the effect to keep specified colors in the video and remove all other colors?

tpsiaki commented 5 years ago

The chromakey video sample simply sets the alpha based on the green color. In order to negate the behavior in the material that you linked, instead of setting alpha to smoothstep(edge0, threshold, distance) like that sample does, set it to 1.0 - smoothstep(edge0, threshold, distance) and you should see the opposite behavior.