如何使用three.js检测移动设备上的慢GPU? [英] How to detect slow GPU on mobile device with three.js?

查看:291
本文介绍了如何使用three.js检测移动设备上的慢GPU?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经定义了在旧的移动设备(三星银河S4,iPhone 5)上启用阴影后,我的游戏非常慢.当我关闭阴影时,它可以极大地提高性能.

是否有人知道如何检测速度较慢的GPU以完全关闭速度较慢的设备上的阴影或如何提高阴影性能?

I've define that my games is extremely slow with enabled shadows on old mobile devices (Samsung galaxy S4, IPhone 5). When I turn off shadows it's improving performance greatly.

Does any one know how to detect slow GPU to turn off shadows completely on slow devices or how to improve shadow performance?

我尝试在灯光上使用不同的shadow.mapSize,在渲染器上使用shadowMap.type,但这并不能提高性能.

I've try to use diferrent shadow.mapSize on lights and shadowMap.type on renderer and it dosen't improve performance.

一些细节:

我使用渲染尺寸为1700x667的PerspectiveCameraWebGLRenderer.
二手灯:new THREE.AmbientLight(0xffffff, 0.7)new THREE.SpotLight(0xffffff, 0.4, 4000, 100)
二手材料:MeshPhongMaterial

I use PerspectiveCamera and WebGLRenderer with render size 1700x667.
Used lights: new THREE.AmbientLight(0xffffff, 0.7) and new THREE.SpotLight(0xffffff, 0.4, 4000, 100)
Used materials: MeshPhongMaterial

推荐答案

选项

  1. 正如安德烈(Andrey)指出的那样,进行基准测试

  1. As Andrey pointed out do a benchmark

尝试使用 failIfMajorPerformanceCaveat: true 创建WebGL上下文时.

Try using failIfMajorPerformanceCaveat: true when creating the WebGL context.

制作指纹.查询与GPU限制有关的所有各种gl.getParameter统计信息并创建指纹.看看是否有某些指纹=变慢.

Make a fingerprint. Query all the various gl.getParameter stats related to GPU limits and create a fingerprint. See if there are certain fingerprints that = slow.

尝试获取并使用 WEBGL_debug_renderer_info 扩展程序未屏蔽的渲染器/供应商字符串(实际上只是#3的更多数据).

Try getting and using the WEBGL_debug_renderer_info extension unmasked renderer/vendor strings (this is really just more data for #3).

像大多数PC游戏一样,都有一个选项屏幕,让用户可以选择要使用的图形功能.

Like most PC games, have an options screen that let's users choose which graphics features to use.

这篇关于如何使用three.js检测移动设备上的慢GPU?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆