The forum on this site is closed for new comments and posts. Continue the conversation in our Snap AR Discord server.

Drag to switch between two face masks

Answered
  • 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: 

    // @input Asset.Material splitMaterial

    function updateMaterial(eventData){
    var x = eventData.getTouchPosition().x;
    script.splitMaterial.mainPass['value'] = x; //this name is a script name of parameter from material editor
    }

    script.createEvent("TouchStartEvent").bind(updateMaterial);
    script.createEvent("TouchMoveEvent").bind(updateMaterial);

    And that should be it! 

    Best

    Olha

     

    Comment actions Permalink
  • 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!

    Comment actions Permalink
  • 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

     

     

    Comment actions Permalink
  • Thank you so much, Olha. You've been a great help!

    Comment actions Permalink
  • Thankyou for sharing.

    Comment actions Permalink
  • Thanks Olha. This helped me. 🙂

    Comment actions Permalink
  • thanks

    Comment actions Permalink
  • good

    Comment actions Permalink
  • 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.

    Comment actions Permalink
  • 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.

    Comment actions Permalink
  • thanks for sharing this!

    Comment actions Permalink

We're here to help! We just need a little bit of information...

What system are you using?

Have you downloaded the latest version of Lens Studio?

Please download the latest version of Lens Studio. If you still run into this issue, please come back and report it!

Is this issue causing Lens Studio to crash?

What system do you run Lens Studio on?

Version

Graphics

Follow the next steps to help us solve your issue:

  • Copy and paste this text into your TerminalCommand Window
    open ~/Library/Preferences/Snap/Lens\ Studio/ %LOCALAPPDATA%\Snap\Lens Studio Copy Text
  • Press ReturnEnter to run the command. The Lens Studio folder will automatically open
  • Prepare to upload your files: zip the "Log" Folder by right-clicking and choosing "compress."
    Locate the Log.txt file right above it.

    Attach a screenshot of the issue:

Name:

Email:

What is this most relevant to?

Please enter a brief description of your issue:

Thanks for submitting this issue.

Unfortunately, it's likely due to the operating system or hardware you're using – since they don't meet the system requirements for Lens Studio.

Still, we hear you loud and clear, and are logging the issue in case there's ever a workaround we can provide!

Minimum Requirements

Operating System: Windows 10 (64 bit); MacOS 10.11+

Hardware: Minimum of Intel Core i3 2.5Ghz or AMD Phenom II 2.6Ghz with 4 GB RAM; Intel HD Graphics 4000 / Nvidia GeForce 710 / AMD Radeon HD 6450 or better; screen resolution of 1280x768 or higher

We'll try to resolve this issue as soon as possible. Thanks for letting us know about it!

Keep an eye out for a followup email from us. We may have a couple more questions for you, or we might already have a solution to offer.

Happy creating!