How To Create a Jewelry Try On Effect
This tutorial will guide you on how to construct the virtual jewelry try on effect in the Banuba Filter Editor. Our effect example includes a pair of earrings and a necklace.
#
Step 1. Resource preparationDesign the models of your jewelry items in any 3D graphical editor like MAYA.
The earrings come with a 3D rig which transfers physics. Rig branches are placed vertically along the direction of gravity. Assign the mat_earrings
material to the earrings.
For the necklace, we assign the material mat_necklace
.
Create a set of textures for each of these objects including BaseColor, Metallic, Normal and Roughness. To make sure the items position correctly on the face, configure their size and location with respect to the head model.
You will also need a matting object that follows the outline of the head. It will hide the overlapped models. Assign the mat_cut
material to this object.
#
Step 2. Export effect filesCreate Effect Folder and name it.
Create the src folder inside Effect Folder where we place the source files. Place the environment texture for IBL (image based lighting) in HDR format.
Export the geometry to the.fbx file and place it to the scr folder. We save the earrings to the earrings.fbx file and make sure that the export skin data option is enabled.
Save the matting geometry to the
cut.fbx
file.We split the necklace geometry into two files because the limit of the allowed number of vertices in one file is exceeded. The Filter Editor will notify you if it happens when importing such geometries.
Split the necklace into left and right parts and export them as two files
necklace_l.fbx
andnecklace_r.fbx
.
#
Step 3. Effect ConstructionLaunch the Filter Editor and press Open to show the path to your effect folder. You’ll see another folder appear in the effect folder and it has the same name. The new folder contains the effect build and there, you need to put the BaseColor, Metallic, Normal and Roughness texture for each object.
In the Rendering tab find the Draw Order and place the layers in a way that the matting material comes on top.
Pick the needed material in the Draw Order and set the Material options choosing the options and assigning textures.
Set the physics for the earrings. Open the FBX MODELS tab in the Filter Editor. Choose the FBX file for which we set physics (1) and pick Apply Physics (2).
Set the weight for each node in the list (3). Pick the zero value for the nodes with the _root and _0 suffix. It means that the node has no weight, and it will align with the head turns. For the rest of the nodes, we set a value other than zero. The value of the weight will be equal to one divided by the set value. This way, the higher the value, the lower the node weight.
In the Gravity field, set the gravity vector (4). In our case, it is directed downwards in the opposite direction to the Y-axis with a force of 900.
In the Damping field, set the vibration damping strength (5). Select values in the range from 100 to 1, the lower the value, the stronger the attenuation will be. At values of 0 and 100, there will be no attenuation.
Add the collision sphere by pressing ADD SPHERE (6).
In the Banuba real-time engine, we can set up a collision sphere, which will prevent the earrings from falling into the head. You need to get the position of the sphere in X Y Z space and its radius R. Let's build such a sphere in the 3D editor space, in our case MAYA.
That’s it. If you want to improve the effect, you can additionally use the final color correction or custom shaders for jewelry. Delete the generated cubemap texture
env.ktx
file as we did not use it in this example.
Download jewelry try on effect with sources