Hi @MatheuzDreher
Very interesting use case indeed!
Optimizing for mobile has not been one of our main focuses, however there are some things you can do in order to boost performance on low power devices especially. Several things come to mind actually, some already available in the viewer’s API, some less so but still achievable. I’ve made this live code example which compiles all of them together. Here’s what it contains:
Resolution Scaling
This has a big impact on performance, and even though it does not exist as a distinct feature in the viewer API, you can easily be implemented as shown in the live code example by extending the Viewer
and overwriting it’s resize
function to use scaled width and height, while keeping the underlying canvas style size the same so that it gets automatically scaled up/down. The value you scale the resolution by can vary based on your needs. In the example I’ve had it set to half res for example’s sake.
Render Output
By reducing the rendering pipeline output to just the color, you save a lot of GPU time by not rendering AO and it’s required additional passes. This is already available in the viewer API and it’s show in the live code example
/** Have the pipeline output only the color */
viewer.getRenderer().pipelineOptions = {
...viewer.getRenderer().pipelineOptions,
pipelineOutput: 2, // PipelineOutput.COLOR
};
Disable Shadows
By disabling shadows you generally save GPU time by not requiring the fragment programs to sample the shadow texture. It’s already available in the API and it’s shown in the live code example
/** Disable shadows */
viewer.getRenderer().setSunLightConfiguration({ castShadow: false });
Disable Multisampling
This is another thing that would go a long way to improving performance especially on low power devices like phones. Unfortunately, the viewer currently always employs multisampling and there is no (sane) way to turn it off.
I’ve tried the above steps while running the default model from your site on my shitty phone and from an unusable experience it became decent. By disabling multisampling it got beyond decent and even good however because that’s not yet available to turn off we’ll leave it out for now.
Resolution scaling and disabling multisampling are something we should definitely have available in the API as explicit options. Contributions are always welcomed, so if you fancy giving these a shot, feel free to do so!
This feature is a frontend specific one, so it the viewer library has nothing to do with it. I’m not the best person to give advice on how to implement it yourself, but maybe there is a way to use the already exiting implementation from our fronetend? Perhaps @dimitrie can provide more details here
Cheers