Display MMD models and mmd models across platforms

Source: Internet
Author: User

Display MMD models and mmd models across platforms

Display MMD models across platforms

 

Happy New Year!

Then, after the Chinese New Year, we will continue to study Qt and 3D. It took nearly a month to show the MMD model on the mobile platform.

Jiang caiyang's original article, first published at: http://blog.csdn.net/gamesdev/article/details/43912325. Welcome to the discussion.

First, it takes several weeks to script the MMD model. That is to say, you can use QML to define an MMD class and specify the parameter to display it. Here, the transplantation refers to the previous experience of QML and C ++ hybrid writing, but it is still good, but sometimes there are many twists and turns.

Next, in my previous studies, I implemented the method of rendering models with illumination. I wrote two blog posts:

Use GLSL to simulate illumination (1)

Use GLSL to simulate illumination (2)

These two blog posts describe how to apply three light sources to model rendering. At that time, the coloring tool only adapted to the running environment of the desktop without considering the mobile environment. The framework used was Qt Graphics-View, which was not feasible on the mobile platform, it must be replaced with the Qt Quick framework recommended by Qt. So I made a lot of arguments, so after the second independent game was completed, I started the preliminary arguments. For this reason, I also wrote some blog posts:

Research on the bottom layer Scene Graph of Qt new rendering (I)

Research on the bottom layer Scene Graph of Qt new rendering (2)

Research on the underlying Scene Graph of Qt new rendering (III)

Then, it seems inconvenient to display 3D models at the Scene Graph level. For example, zNear and zFar of clip frustum are determined based on the number of Item stacks, if zFar-zNear is too small, the model will be dropped if it is not displayed completely. So I gave up Scene Graph and directly sought native OpenGL rendering in Qt Quick. In the beginning, I made my rendering framework dependent on QtQuick to inherit QQuickItem from the related classes. However, I found that QQuickItem may be complicated and the class is large. Later I tried to let the related classes inherit QObject directly, after a long time of tossing the default attribute, we finally found that we could not implement the Animation framework by directly inheriting the QObject, and QQuickItem could be easily implemented. The technical details here are really deep ...... Later, I honestly went back to inherit QQuickItem. That is to say, the current framework depends on Qt Quick.

Finally, you must consider the coloring tool during transplantation. On OpenGL ES 2, precision must be specified for some types of variables (uniform, varying. Fortunately, Qt has a preprocessing symbol. When the runtime environment does not support highp, The highp we write will be converted to mediump, so in the coloring tool, highp is specified for all the places where precision needs to be specified. On the port of WindowsPhon 8.1, due to Qt's use of ANGLE to convert GLSL, I think the capability is reduced. I tried to call glGetIntegerv (GL_MAX_VERTEX_ATTRIBS, & m_maxAttribute ); and glGetIntegerv (GL_MAX_VARYING_VECTORS, & m_maxVarying); In My Lumia 530, maxAttribute is 16 (normal), and maxVarying is only 6 (abnormal ). According to OpenGLES 2, the minimum value of maxVarying is 8. So the shadow code I wrote uses more than 6 varying. Therefore, the "cocould not pack varying spotAmbient" issue occurs during the link. So I deleted the code for processing the light and kept the rest. I think lighting processing and detailed display may be processed by delayed rendering in the future. For the simplest version, Do not light it first.

During the study, I learned the message of Qt 3D and began to study Qt3D again. Qt 3D is really good. It uses the data driven method to solve the troublesome rendering problem, and supports the highest specification from OpenGL1.0. This is not easy. However, it is not clear how it works on mobile platforms. I wrote several articles on Qt 3D during this time. It seems that Qt 3D still needs to be paid attention to for a long time.

At last, I presented my run on my laptop (Windows 8.1), taobaoa10hd (Android), and Lumia 530 (Windows Phone 8.1) machines:

The operation code has been transplanted, but the test has not yet been conducted.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.