How to include multiple cap/glass options in an AR filter?

We are currently developing an AR Filters application and have come across the DeepAR SDK. We’re impressed with its capabilities and would like to leverage it for our project.

Our specific requirement involves offering users the ability to choose from multiple cap and glass options within the filter. Essentially, we want to provide users with a selection of caps and glasses, allowing them to choose the one they like the most.

We would appreciate any guidance or suggestions on how to implement this functionality using the DeepAR SDK. Are there specific features or techniques within the SDK that we should utilize? Any code snippets, examples, or best practices would be highly valuable.

Thank you in advance for your assistance.

Hi, thanks for your post. It sounds like DeepAR will work great for your use case!

It sounds like the best way to achieve what you want is to create multiple ‘effects’ (using DeepAR Studio) - one for each cap option and one for each glasses option. You will then have a series of files like cap1.deepar, cap2.deepar and glasses1.deepar, glasses2.deepar.

Then, you can use the deepAR.switchEffect method in your application to load different caps and glasses. You can load multiple AR effects into DeepAR at once, defining a slot for each, like so:

Set the ‘cap’ effect:
await deepAR.switchEffect('url/path/to/cap1', {slot: 'cap'});

Change the ‘cap’ effect:
await deepAR.switchEffect('url/path/to/cap2', {slot: 'cap'});

Set the ‘glasses’ effect:
await deepAR.switchEffect('url/path/to/glasses1', {slot: 'glasses'});

and so on.

You can see the API reference for this method on the web here. Our iOS and Android SDK also has an equivalent method.

You can use almost any 3D object to create your effect in Studio, provided it is well optimised for AR (mainly has less than 100k polygons - or 50k for each if you’re loading two effects).

I hope that helps! Please post any more questions or suggestions you may have :slight_smile:

1 Like

Thank you for the helpful information and the suggestion to use DeepAR’s switchEffect method for loading different cap and glasses options. It seems like a feasible approach for our application.

Now, regarding our large number of assets, we currently have 1000+ assets, and there will be weekly additions to our app. Creating individual filters for each asset manually could be quite challenging and time-consuming. Hence, we are interested in automating this process.

We were thinking of creating a base glass filter and then automating the generation of the rest of the glass filters based on the location and rotation of the base glass filter. Is there a way within DeepAR or any recommended approach to achieve this automation? Any suggestions or guidance on how to streamline the process would be highly appreciated.

Thank you once again for your support!

There isn’t yet but this is something we are looking into.The full GLTF support coming very soon will allow you to import models with materials already setup and the approach you’ve described is in consideration for the solution to the issue of setting up a large amount of file.
If you have any more info on how you would like this feature to work in studio we will definitely consider it moving forward.