Extra/Custom Antialiasing in Lens Studio

Hey there! I am using quite a lot of assets (2d and 3d) in one of my lenses in Lens Studio v4.1.1 and I am facing pretty annoying jaggedness in most of my assets when previewed in the Snapchat app in spite of using MSAA Antialiasing on my render targets. Any Idea how can I solve this? Is there a way to implement a custom anti-aliasing method in Lens Studio?

I don’t have an exact answer, but have you tried a newer version of lens studio? 4.1.1 is pretty old. I think the current version is 4.16.0 or something like that.

The drag is I am working on an older camera kit version that’s on the production build which uses only the 4.1.1 version of lens studio. I was wondering if there was a way to explicitly introduce custom antialiasing to get better results until the kit is upgraded.

Oh that makes sense. It looks like they reworked the docs site and now I can’t find the actual API reference any more, but you could try setting the resolution on the render target to be double the screen size.

Here’s a shot of it in the inspector panel.

Screen Shot 2022-04-28 at 12.24.21 PM

Another approach could be to write your own post processing shader that does image based anti aliasing.

Are there any tutorials here to write such code or make such shaders? Haven’t made a post processing shader ever.

Also, doubling the resolution doesn’t help…
image

Does this probably have to do with the pixel density of a mobile display? I am thinking anti-aliasing would help it…

Check these outputs…

On Mobile:

In Preview window:
image

It might be dependent on some GPU feature on the device hardware. Here’s a shot of my pixel 6 rendering a sphere with mxaa applied on the left, and without on the right. I can see it’s working

It’s kind of a lot to port into a shader graph, but here’s some code from spark.
imageBasedAntiAliasingShader.sca (2.6 KB)

1 Like