November 10, 2020, 3:29pm
Just noticed the docs for optimization have been expanded, very nice!
Wanted to mention a minor typo. The second link correctly goes to the docs for
renderNextFrame, but it says
pc.Application#autoRender instead of
Thanks for reporting those, if you feel like it the docs are opensource as well and a typo correcting PR is more than welcome:
This file has been truncated.
title: Optimization Guidelines
Here are some tips and hints on how to achieve good performance in your PlayCanvas app.
* As the value for texture anisotropy increases, visual improve but performance decreases. Be careful to balance visuals against performance.
* Look for opportunities to pack multiple textures into single images. For example, a greyscale opacity map can be stored in the alpha channel of a diffuse map. Or a greyscale gloss map can be stored in the alpha channel of a specular map. This results in lower VRAM usage.
* Be mindful of the number of dynamic lights in your scene. Keep them to a minimum.
* Enabling shadow casting on dynamic lights is expensive. Point light shadows are particularly expensive. For each point light that casts shadow, the scene must be rendered 6 times into a shadow map.
* In PlayCanvas, a mesh instance is a draw call (a command to draw an individual graphical primitive). Each draw call requires some effort on the CPU to dispatch to WebGL. Therefore, keeping the number of draw calls low is advisable, particularly on mobile. You can see a list of the draw calls for a particular Model by selecting the model asset and viewing it in the Inspector. 100-200 draw calls is a rough target for low end mobile devices. High end desktop machines on the other hand can process thousands every frame and still maintain 60fps.
* Use [Batching] to reduce draw calls. By creating Batch Groups in your Project and assigning them to Model and Element components, the engine will try to merge them in as few mesh instances as possible, reducing draw calls and increasing performance.
November 10, 2020, 3:34pm
That’s where they are! Was trying to find a separate repo and I couldn’t find them. Thanks Leo!