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

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