Module 6

Creating and Submitting a Lens

Creating a new project and importing your garment

If you are a visual learner, watch this tutorial and pause at each step to complete the process we outlined below.
  1. Open the latest version of Lens Studio on your computer. 
  2. In Lens Studio select “New Project.”  
  3. Import your 3D asset/assets
    -If you created a unique item, export the asset in the FBX format and follow the 3D object export guide to achieve maximum Lens performance. If you purchased or downloaded assets in the OBJ format, please review this asset import guide.
    -When your asset is ready, navigate to the Resources Panel of Lens Studio to click on the Plus (+) sign and select “From Files.” 
    -Select your asset’s FBX or OBJ file and add it to Lens Studio.
    -As an alternative workflow, you can drag your asset into the Resource Panel from your desktop.
  4. If you are using an asset from Asset Library Try-On Assets, navigate to the Asset Library, type in “Try On” in the search bar and download an asset you would like to use. We recommend downloading the hoodie to follow along with this tutorial.

Setting up Body Mesh

  1. Adding Body Mesh: In the Objects Panel, click the plus (+) sign. In Search type in “Full Body Mesh.”
  2. Selecting Full Body Mesh: In the Resources panel select the Full Body Mesh and rename, so you know that this is your garment. This step helps you to better organize your project.
  3. Selecting Internal Mesh: Click on your renamed garment mesh.Navigate to the Inspector panel and select External Mesh, then select your 3D garment’s mesh.
  4. Mesh Poses: Select a mesh pose that fits the pose of your garment. There are two available options: T-pose and A-pose.
5. Applying Meshes to Garment: In the Inspector, select subsets of meshes that apply to your garment. Select or deselect from Body, Left Hand, Right Hand, and Head. Observe how this selection changes the way your garment interacts with the Body Mesh.
6. Proximity  Matching: Now that your garment is in Lens Studio and it’s attached to the Lens Studio model, we recommend that you experiment with Proximity Matching to achieve best garment alignment to body deforming. Make sure to test a few simple body poses in video preview or webcam preview.

Setting up Body Occluder

  1. Navigating Asset Library: In the Asset Library, search and import the Body Mesh Occluder component.
  2. Creating Garment Occluder: In the Resources panel, duplicate your garment’s Body Mesh by right clicking it. Rename the duplicated garment as Garment Occluder.
  3. Clearing Garment Occluder Mesh:In the Inspector panel, make sure the Garment Occluder doesn’t have an External Mesh or any other meshes attached to it. If a mesh appears in the window, right click it and “Clear.”
4. Attaching Body Mesh to Occluder: In the Objects panel, duplicate Garment Scene Object. Rename it (in the image below, we’ve renamed it to “Occluder”). Select the Occluder in the Inspector Panel, and attach Body_Mesh_Occluder material (from step 10) under Render Mesh -> Material 1.
5. Managing Project Hierarchy: In the Objects panel, place the Occluder before a garment.

Set up Garment Material

  1. Material Editing: If you want to experiment with a garment’s material, you can do so by using Lens Studio Material Editor, or by importing assets from Lens Studio Asset Library. You can also import your own PBR files. To find available materials go to Asset Library -> Materials.

Setup Body Inpainting

  1. Adding Body Eraser: Setup Body Inpaintingby addingthe Body Eraser asset from the Asset Library.
  2. Setting up Orthographic Camera: Create a new orthographic camera and add Body Eraser prefab from the Resources Panel.
    -To create an Orthographic Camera, navigate to the Objects Panel, select the Plus (+) button and select “Add a Camera.”
    -Select Camera in the Objects Panel and in the Inspector Panel, switch Camera Type to Orthographic.
  3. You should now see the upper body part of a person in the Preview is now erased and matching the background. By default the provided mask covers the upper area of the body, matching to a long sleeve shirt.

Adjusting the UV Mask

  1. Adjusting the UV Mask to fit your garment. To adjust the mask, open reference UV map — you should already have it if you downloaded the reference model shared in the earlier module (the file name is bodymesh_UV.png). In your favorite image editor, paint the areas on the map you want to erase in white, and leave everything else in black.
2. Saving the map: Save the map from the previous step as a new .png file and import to Lens Studio.
3. Setting up UV Mask: Attach the new map in the UV Body Segmentation component to “Body UV Mask.” You should now see your new mask is being used to erase the specified body parts.

Saving and submitting your project

  1. Saving Project: Make sure to save your project throughout the process to avoid losing your progress. To save a project, go to File and select “Save” or “Save As.” Save your project in your preferred folder. 
  2. Optimizing Project: Optimizing your project is a simple step that helps optimize your project by removing unused resources. To complete this step, click File -> Optimize Project. When the pop-up appears click Optimize.
3. Test and Publish Lens
  • Testing a Lens: When your Lens is ready to be tested on your device, make sure that your Lens Studio account is connected with your Snapchat account. If you have not connected Lens Studio to Snapchat, please visit the Pairing to Snapchat guide.
  • If you are submitting a sponsored Lens, make sure that you are signed in to the Business Account that will be publishing the Lens. For additional instructions please check out this page.
  • Press “Send to Snapchat.” Interact with your Lens to make sure the garment is tracking to the body and is responsive to movement. Ensure the Lens is exactly what you envisioned before you submit it to Snapchat. 
  • Tip: make a clear icon for the Lens to let Snapchatters know what the Lens will do. Clear stills or a short video of the Lens will help Snapchatters understand the Lens and improve Lens performance. 
  • Extra Credit
    Spend more time finishing up your Lens and see if your Lens can stand out if you add a simple particle effect. If you think so, then follow these instructions.
By completing this course, you have a better understanding of how AR is shaping the future of fashion, virtual try-on, and shopping. For more inspiration and examples of AR Shopping Lenses, visit the AR Shopping page. 

And, creation of a Fashion Lens that enables virtual try-on doesn’t have to stop at the tools that we covered in this course. 

To make the garment in your Lens look even more realistic, you can use Lens Studio’s Cloth Simulation and Light Estimation. To make the experience more engaging, you can use Snap’s Voice ML and Body UI to enable users to switch a garment or change garment color using voice, or a button that is triggered with the user's hand. To create a special ambiance for the Lens, add music from Lens Studio’s Asset Library. If you want to link Snapchatters to a shop, Snap offers a seamless shopping integration via Shopify. 

If you want to use what you created and bring it to audiences outside of Snapchat, you can leverage Snap’s Camera Kit.