Drag to switch between two face masks
AnsweredI once saw a lens, I think it was for the super bowl, where there was face paint for each team, and you could drag to which side you were cheering for. I'd like to replicate this effect for my school vs another school, but I'm having trouble figuring out how I could make this work. Does anyone have any suggestions that could point me in the right direction? I tried using a plane with and occluder material that I could drag back and forth, but it just occluded both meshes, and you could see around it if the person turned their head to the side. Essentially, I am trying to recreate the effect from the devil shader lens but with sports face paint look
Hi, Colin!
Really hope i've got the idea correctly, if no there still might be something useful. This lens idea might require some advanced camera set up. First take a look at the Camera and Layers guide.
1. I would suggest to set up two cameras each will render separate set of effects to a separate Render Target Textures (notice how render layer colors are different).
Third camera also have its own render target. This is how scene config might look :
2. The those two Render Textures can be rendered to a Orthographic camera and mixed using a custom post effect shader. This custom shader could be build on the base of the Graph Post Effect material that can is available in the Resources panel
Double click on that material to open Graph Editor and make some edits. It could look like this :
We will modify that value parameter from script so make sure to set Script Name
3. Add this custom material to the scene using Post Effect component (It can be added by pressing add component button in the inspector panel) , set it's parameters and make sure it's rendered to the third camera
4. And now we need a small script to modify this material's parameter based on touch:
And that should be it!
Best
Olha
Olha, thank you so much for your help so far! I have gotten the effect to work on lens studio, however when I send it to snapchat, I get this error:
A link to my project file can found here. Thank you again for all your help!
Hi, Collin Madden
Updating Snapchat App to the latest version should resolve this. You can also disable Shader Optimizer checkbox in the inspector of the material editor
BTW to avoid swiping Snapchat UI you could enable swipe touch blocking using Behavior script:Best
Olha
Thank you so much, Olha. You've been a great help!
Thankyou for sharing.
Thanks Olha. This helped me. 🙂
thanks
good
I have read your article; it is very instructive and valuable to me. I admire the valuable information you offer in your articles. Thanks for posting it.
I would like to comment on this quality content. I can see you have done a lot of homework and given this topic much thought.
thanks for sharing this!