[Interest] Skybox Qt Quick3D bad performance in Android
joao morgado
joaodeusmorgado at yahoo.com
Sun Oct 3 02:47:50 CEST 2021
Hi
Thank you for your anwser and sorry by my late replay.
Using ktx files instead of hdr is alot better indeed, in my tablet, dropped the load time from 55seconds to aprox. 1 or 2 seconds wich what is expected.I guess the only downside is the file size, the 2.1MB hdr file grown up to 59MB ktx, but I'm ok with that.
In my android mobile, compilation still fails, however I never used idealSurfaceFormat(), I always get an error of:
undefined reference to `QQuick3D::idealSurfaceFormat(int)'
The following example is version 2 with the idealSurfaceFormat() where that error happens, when compiling for linux and for android.
SkyBoxTest2.zip
|
|
| |
SkyBoxTest2.zip
|
|
|
#include <QGuiApplication>#include <QQmlApplicationEngine>
#include <QSurfaceFormat>#include <QtGui>#include <QtQuick3D/qquick3d.h>
int main(int argc, char *argv[]){ // QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QSurfaceFormat::setDefaultFormat(QQuick3D::idealSurfaceFormat(4));
QQmlApplicationEngine engine; const QUrl url(QStringLiteral("qrc:/main.qml")); QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, &app, [url](QObject *obj, const QUrl &objUrl) { if (!obj && url == objUrl) QCoreApplication::exit(-1); }, Qt::QueuedConnection); engine.load(url);
return app.exec();}
Is this a Qt bug, or a bug of mine ? What am I missing ?
ThanksJoão
Em segunda-feira, 2 de agosto de 2021 10:03:00 GMT+1, Laszlo Agocs <laszlo.agocs at qt.io> escreveu:
#yiv7629575724 P {margin-top:0;margin-bottom:0;}Hi,
https://doc.qt.io/qt-6/qtquick3d-requirements.html#opengl-specifics (calling and honoring QQuick3D::idealSurfaceFormat()) is probably required in this case. (otherwise, not sure why it ends up using GLSL ES 100 shaders)
Yet better, in Qt 6.1 and newer the whole pre-filtering process can be, and should be, done offline:https://doc.qt.io/qt-6/quick3d-asset-conditioning-ibl.html#pre-generating-ibl-cubemap
This boils down to, with your example, running 'balsam galaxy.hdr' and referencing the generated galaxy.ktx from qml.
If you were using CMake this could also be automated and left to the build system by adding something like the following to your CMakeLists:
qt6_quick3d_bake_lightprobe_hdri(target "ibl_assets" PREFIX "/" FILES "galaxy.hdr")
and then referencing "galaxy.ktx" from the qml file.
Best regards,Laszlo
From: Interest <interest-bounces at qt-project.org> on behalf of joao morgado via Interest <interest at qt-project.org>
Sent: Saturday, July 31, 2021 3:52 AM
To: Qt Interest <interest at qt-project.org>
Subject: [Interest] Skybox Qt Quick3D bad performance in Android I'm testing Quick3D on Android, all good, but if I use a skybox the performance is really bad or does not work at all.
The following test project with trivial code is just a skybox and a red cilinder.
SkyBoxTest.zip
|
|
| |
SkyBoxTest.zip
|
|
|
Runs fine in desktop linux mint, windows, MacOS, iPhone, but in my 2 android devices:
- tablet Lenovo Tab M10 TB-X306F, OS Android 11, when I run the program, I get a black screen, it takes 55 seconds to load the image of the skybox and the red cylinder
- mobile nokia 5.4 OS Android 10: compilation fails with the following errors:
---------------------------------------------------------------------------------------------------------------E VpsExtension: Failed to get binder for service "vendor.vpsservice"E VpsExtension: Failed to get binder for service "vendor.vpsservice"I AdrenoGLES-0: ERROR: 0:2: '' : GLSL error: extension 'GL_EXT_shader_texture_lod' is not supportedI AdrenoGLES-0: ERROR: 0:77: 'textureCubeLodEXT' : no matching overloaded function foundI AdrenoGLES-0: ERROR: 0:77: 'xyz' : field selection requires structure, vector, or matrix on left hand sideI AdrenoGLES-0: ERROR: 0:77: 'return' : function return is not matching type:I AdrenoGLES-0: ERROR: 4 compilation errors. No code generated.07-31 02:35:03.170 24150 24253 I AdrenoGLES-0:W libSkyBoxTest_arm64-v8a.so: Failed to compile shader: ERROR: 0:2: '' : GLSL error: extension 'GL_EXT_shader_texture_lod' is not supportedW libSkyBoxTest_arm64-v8a.so: ERROR: 0:77: 'textureCubeLodEXT' : no matching overloaded function foundW libSkyBoxTest_arm64-v8a.so: ERROR: 0:77: 'xyz' : field selection requires structure, vector, or matrix on left hand sideW libSkyBoxTest_arm64-v8a.so: ERROR: 0:77: 'return' : function return is not matching type:W libSkyBoxTest_arm64-v8a.so: ERROR: 4 compilation errors. No code generated.07-31 02:35:03.170 24150 24253 W libSkyBoxTest_arm64-v8a.so:07-31 02:35:03.170 24150 24253 W libSkyBoxTest_arm64-v8a.so:W libSkyBoxTest_arm64-v8a.so: Source was:W libSkyBoxTest_arm64-v8a.so: #version 100W libSkyBoxTest_arm64-v8a.so: #extension GL_EXT_shader_texture_lod : requireW libSkyBoxTest_arm64-v8a.so: precision highp float;W libSkyBoxTest_arm64-v8a.so: precision highp int;07-31 02:35:03.170 24150 24253 W libSkyBoxTest_arm64-v8a.so:W libSkyBoxTest_arm64-v8a.so: struct LightSourceW libSkyBoxTest_arm64-v8a.so: {W libSkyBoxTest_arm64-v8a.so: vec4 position;W libSkyBoxTest_arm64-v8a.so: vec4 direction;W libSkyBoxTest_arm64-v8a.so: vec4 diffuse;W libSkyBoxTest_arm64-v8a.so: vec4 specular;W libSkyBoxTest_arm64-v8a.so: float coneAngle;W libSkyBoxTest_arm64-v8a.so: float innerConeAngle;W libSkyBoxTest_arm64-v8a.so: float constantAttenuation;W libSkyBoxTest_arm64-v8a.so: float linearAttenuation;W libSkyBoxTest_arm64-v8a.so: float quadraticAttenuation;W libSkyBoxTest_arm64-v8a.so: };07-31 02:35:03.170 24150 24253 W libSkyBoxTest_arm64-v8a.so:W libSkyBoxTest_arm64-v8a.so: struct cbMainW libSkyBoxTest_arm64-v8a.so: {W libSkyBoxTest_arm64-v8a.so: vec3 qt_cameraPosition;W libSkyBoxTest_arm64-v8a.so: vec4 qt_lightProbeProperties;W libSkyBoxTest_arm64-v8a.so: vec3 qt_light_ambient_total;W libSkyBoxTest_arm64-v8a.so: vec4 qt_material_base_color;W libSkyBoxTest_arm64-v8a.so: vec3 qt_material_emissive_color;W libSkyBoxTest_arm64-v8a.so: vec4 qt_material_properties;W libSkyBoxTest_arm64-v8a.so: vec4 qt_material_properties2;W libSkyBoxTest_arm64-v8a.so: vec4 qt_material_W libSkyBoxTest_arm64-v8a.so: Failed to build graphics pipeline state------------------------------------------------------------------------------------------------------------
It seems that skybox uses an extension that is not available in nokia 5.4 GPU or software.I will report a bug, but before that, maybe someone wants to give theirs 2 cents ?
The code is
Window { visible: true width: 640 height: 480 title: qsTr("Hello World")
View3D { id: view3D visible: true width: parent.width height: parent.height
//SkyBox mode environment: SceneEnvironment { backgroundMode: SceneEnvironment.SkyBox lightProbe: Texture { source: "qrc:/galaxy.hdr" mappingMode: Texture.LightProbe } }
// color mode /*environment: SceneEnvironment { backgroundMode: SceneEnvironment.Color clearColor: "skyblue" }*/
//! [camera] PerspectiveCamera { id: cam position: Qt.vector3d(0, 0, 500) } //! [camera]
DirectionalLight { eulerRotation.x: -45 }
Model { id: ball //source: "#Cylinder" source: "#Cylinder" scale: Qt.vector3d(1, 1, 1) materials: [ DefaultMaterial { diffuseColor: "red" } ] position: Qt.vector3d(-100, -150, 0) onPositionChanged: console.log(position) } }}
CheersJoão
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20211003/d576f535/attachment-0001.html>
More information about the Interest
mailing list