With this tiny tutorial you're going to learn:
- How to import and use someone else's script
- Types of segmentations in Lens Studio 4.1
- Create a Lens with a tattoo and prank your parents!
This is my personal approach to keep it simple as possible, if you have any ideas how to improve this Project, please comment below :)
First, start with a clean Lens Studio Project, it should look like that:
After that, add Head Binding to Objects panel and delete Face Occluder (we don't really need it this time):
After that, import this useful Neck Attachement for Tattoo script into Resourses panel.
It will automatically add some things to Objects panel too.
That's what you shoud have for now (my amazing temporary tattoo texture and a error in the logger below):
To fix the error, click on NeckObject in the Objects panel to open its setting in the Inspector panel on the right:
In the Inspector panel, click on Attach To Object and add Head Binding:
By doing so you a helping the script to get the info about head's position!
Now our Tattoo follows the neck! :)
And now the most interesing part – segmentations!!!
We are going to use three different segmentations to make our Lens realistic as possible.
First, add Screen Image in the Objects panel (it will add an Orthographic Camera too!) and set the Stretch Mode to Stretch in the Inspector panel.
Now remove the Default Material on the left and add Unlit Material (rename it to Unlit (Background) to keep everything clean)
For now you will have a white screen. Open new Unlit (Background) material in the Resourses Panel, take a look to the left, and in the Inspector Panel change the Blend Mode to Normal (so we can have an opacity!). Just a bit below, enable Opacity Texture, and check what we have right now:
To hide our Tattoo under the cloth we need to use Segmenations
The first Segmentation Texture we are going to use is Portrait Background, add it in the Resourses Panel
After that, go back to Unlit (Background) Material, in the Inspector Panel, click on Base Texture > Texture and add Device Camera Texture.
Next, click on Opacity Texture > Texture and add Portrait Background Segmentation.
See that? Now we don't have a Tattoo on the background!
As you already understand, we are going to add more Segmentations, but before that, we need more Screen Images and more Unlit Materials and Upper Garment + Portrait Head Segmentations.
Let's keep going! Add a second Screen Image in the Objects Panel, it will appear under Orthographic Camera.
Repeat the same steps as we need for the first Screen Image: set the Stretch Mode to Stretch, delete Default Material, add new Unlit Material, rename it to Unlit (Cloth).
In the Resources Panel add Upper Garment Segmentation
Our screen should be white again. Let's edit Unlit (Cloth) Material in the Inspector Panel on the right:
- Blend Mode = Normal
- Opacity Texture = Tick to Enable it
- Base texture = Device Camera Texture
- Opacity Texture = Upper Garment Segmentation
Amazing! Now our Tattoo is under our T-Shirt \ Tank Top \ Dress
We are almost there.
Add Portrait Head Segmenation in the Resourses Panel
Add one more Screen Image, new Unlit Material which we can rename to Unlit (Head) with Blend mode set to Normal, Opacity being enabled, Device Camera Texture as Base Texture and Portrait Head Segmentation as Opacity Texture!
Our Body Tattoo should look like this:
Now our Tattoo is hidden under Clothes + Hair! You can replace the Tattoo texture to any you want. Add Color Correction, Skin Retouch or other things from Asset Library.
Hope you liked this tutorial!