Disabling Noise Calculations

Hi, I am using the excellent Noise patch from @josh_beckwith and it’s perfect for my project.

I have 4 instances that are each attached to image trackers. The issue I am having is that it’s really slugish as SparkAR is doing the math on all 4 at once and the displaying the texture when the image target is found.

Is there a way to disable the noise calculations until the image target is found?

Here is my patch network that I have running 4 times



If you disconnect the noise patch, does it fix the issue?

I think if the object isn’t visible, it won’t run any of the shader stuff for the material that is uses, but I can’t say for sure.

I wonder if you could use some script to assign the correct material after the image tracker is found.

One more option would be to use a scene render pass and then apply the curl noise texture after that. Then you could reuse the single curl noise instance.

Another thing you could try, is setting the noise shader to mediump precision instead of highp. I’m not sure how that will look, but it would help performance.

If I set the scroll to zero and density to 0.5 it looks like there are no distortions… I’ll try that on all my targets and see if that speeds things up… If it does I can put the numbers back to what I really want if the target is found…

I’m not sure if that helped… my test phone is pretty snappy… I need to test on a slower phone…

I’ll report back.

Yeah, even if you set the numbers to zero, the code is still running. Curl noise is super expensive so it’s probably going to run poorly on older phones. If you can use a cheaper noise in place of curl, it might solve your performance issue. Curl is the most expensive in the pack, so any other one should give you a boost.

Another option would be temporal noise, which uses texture animation to fake 3D noise.

@josh_beckwith the temporal noise looks nice and fast, are you say I could use that as a distortion for my project?


Simplex also seems to work well.

Is there a way to find out which of the noises is the least expensive in computational power?

Yeah you could use temporal noise for the distortion input and it should work pretty well for what you are doing.

I’m not sure if there’s a good way to do performance tests, aside from using an FPS counter. There is one built-in to studio, but that’s just testing performance on your PC. We are planning on releasing an FPS counter block (soon), so you could see the FPS on device too.

FWIW there is an FPS meter in the Spark player app, so you could use that to get a better picture of how things are running.

Do you think temporal noise will be less heavy than Simplex ?

I have simpolex looking good


Temporal noise will be barely noticeable in terms of resource consumption. Simplex does look nice, and I think most decent devices should be OK with it.

1 Like

I just figured out I can run one noise patch and pipe it in to 4 different distortion patches… that will also speed things up I’m sure…

1 Like