Advanced Optimization Options?

https://playcanvas.com/project/994988/overview/the-mellow-tiger

So I am approaching completion of my Mellow Tiger interactive environment and want to get it as streamlined and functional as possible. Currently it doesn’t work on most mobile and on many less powerful computers.

I’ve worked to keep the VRAM relatively low (currently around 245) but maybe I need to cut this down more?

I’ve also seen references to AMMO being a sledgehammer solution that isn’t necessary for many projects (probably like mine) and could cause issues with mobile? How might one bypass this and maintain necessary collisions?

I’ve worked through the optimization guidelines but feel I must be missing some specific issues inherent in this experience. Any feedback/input/guidance would be happily appreciated. Thanks!

Is the latest work on the master branch? Only team members can see other branches, everyone else just sees master.

Also, which scene people should be using?

Mellow Tiger 3-- should be the Master. Let me know if I’m in a branch again.

We can’t, only you can see this in your own profile/project

If I’m reading this properly, I’m in the master. Yes? Screen-Shot-2022-11-22-at-9-04-25-AM

Best to check the top left of the view port

1 Like

Does this look right?
Screen-Shot-2022-11-22-at-9-16-40-AM

Yep, that looks like you are on master

1 Like

I think you use clustered lighting and plenty of spot lights?
If so, have a look at this section:

https://developer.playcanvas.com/en/user-manual/graphics/lighting/clustered-lighting/#tuning-clustered-lighting

Particularly atlas split could be handy, to set up only few nearest lights to have shadows:
https://developer.playcanvas.com/en/user-manual/graphics/lighting/clustered-lighting/#configuring-manual-atlas-split

Maybe set it the way to only have 4 shadows - so specify 2.

Also, if your shadows don’t need to be dynamic (render each frame), set them up to update once maybe, that can save a lot of rendering each frame.

Thanks! I tried simply disabling clustered lighting, and visually it made very little difference (although when testing in editor I get the warning: “Turning on disabled clustered lighting is not currently supported”). Should that help it run better on lesser systems?

I will address your other suggestions as well. Thanks much!

EDIT: attempted to load on either iPhone or iPad still no worky. Back to the drawing board.

If you disable clustered lights, it might not work on some older devices, as the number of shadow casting lights you have is too large. So I’d suggest to leave it on, and use the other suggestions. Those other suggestions are only applicable if the clustered lighting is enabled.

1 Like

Done and done. Stupid question, but where do I find the manual atlas split options? I can’t find them anywhere in the global settings or light-specific settings.

Ah yeah, those are not exposed as are advanced only, and you need to set them using script. For example

this.app.scene.lighting.atlasSplit = [2]; // for 4 shadows

1 Like

BTW: I’ve currently duplicated the problem with Cubemap not working when the cube facet images are compressed with BASIS. It significantly cuts the VRAM, but they simply don’t work when tested in editor (this is for the interior cubemap).

No optimization I attempt makes it run on mobile (or lesser computers), it just makes it look worse. So I’m just abandoning mobile, cranking the settings up, and warning people it’ll only work on good computers.

BUT if you still have any genius ideas about how to optimize it for mobile, I’m willing to give it a shot.

For now, try out the latest and greatest version and let me know how it works for you. How long to load? How does it run? What are you running it on?

Running the Play version on my phone and performance seems to be quite good. Loading time wasn’t so bad, ~20 sec.

Tested on a Samsung Galaxy S10.

1 Like

And looks great, very well done! Things I’d optimize:

  1. Definitely use static batching on some entities e.g. corns. That will reduce draw calls and improve performance. Draw calls are your main issue right now.

  2. A more advanced optimization to reduce draw calls would be some form of occlusion zones. For example when you are inside a building you could automatically turn off several of the outside world entities. And vice versa.

2 Likes

I created an earlier fork of this and compressed everything down to Basis to get the VRAM to 130MB

I also noticed that enabling Device Pixel Ratio crashes on mobile (iPhone 8 iOS 15)

So I’ve added a quick small script that changes the pixel ratio on desktop (read more here: Device Pixel Ratio | Learn PlayCanvas)

Fork project: https://playcanvas.com/project/1011537/overview/f-the-mellow-tiger (let me know if you want me to make it private

Build: F@ The Mellow Tiger - PLAYCANVAS (runs on iPhone 8, iOS 15)

2 Likes

Thanks so much, guys. I am going to dig in and implement these ideas now. I’ll post here my progress. Onward!

1 Like

I must be doing this all wrong, because creating batch groups results in hilariously wonky, glitchy environment. The Mellow Tiger - PLAYCANVAS

:sweat_smile:

EDIT: So what I’m learning is that skeletal animated objects (the animated corn) don’t work in batches. But non-animated entities do. I’ve cut the draw calls by some using this method…

1 Like