Cross-platform display MMD model

Source: Internet
Author: User

Cross-platform display MMD model

Chinese New Year, I wish you all beaming, everything!

Then, after the Chinese New year, still carries on the QT and the 3D research. Recently, the previous technical research results have been rolled out, and it took nearly one months to successfully display the MMD model on the mobile platform.

Saiyang original article, starting address: http://blog.csdn.net/gamesdev/article/details/43912325. Welcome to come to discuss the peer.

First, it took a few weeks to script the MMD model, that is, you can use QML to define a MMD class that specifies the parameters to display. The transplant here refers to the previous experience of writing QML and C + + mixes, which is good to write, but sometimes there are many twists and turns.

Then, in previous studies, I implemented a method with a light rendering model, when I wrote two blog posts:

Simulation of illumination using GLSL (i)

Simulation of illumination using GLSL (ii)

These two posts describe the application of three light sources to the rendering of the model. At that time, the shader just adapted to the desktop environment, without considering the mobile environment, and the use of the framework is QT Graphics-view, on the mobile platform is not feasible, must be replaced by QT recommended QT quick framework. So I did a lot of argument, so after the completion of the second independent game, it began to be related to the early argument. For this I have also written some blog posts:

Research on the new rendering of Qt bottom scene graph (i.)

Research on the new rendering of Qt bottom scene graph (ii.)

Study on the new rendering of Qt bottom scene graph (iii.)

Then, feeling from the scene graph this level of 3D model display, there are some inconvenient, such as clip frustum Znear and Zfar is based on the number of items stacked, if the zfar–znear too small, then the model is not complete, will be cut off. So give up scene Graph and look directly for the native OpenGL rendering in Qt quick. At first, let my rendering framework rely on Qtquick, let the related class inherit Qquickitem, but found that Qquickitem may be more complex, the analogy is large, and then try to let related classes directly inherit Qobject, after a long time the default property, Finally found directly inherit Qobject, unexpectedly can not achieve animation that set of framework, and qquickitem easily can achieve. The technical details in this is really deep. Back still honestly back to the inheritance of Qquickitem. In other words, the framework is now dependent on QT quick.

At the end of the migration, shaders must also be considered. On OpenGL ES 2, you must specify the precision for some types of variables (uniform, varying). Fortunately, QT has pre-processing symbols, when the operating environment does not support HIGHP, we write HIGHP will be converted to mediump, so I in the shader, the need to specify the accuracy of the place is specified HIGHP. In the Windowsphon 8.1 transplant, because QT uses angle to convert GLSL, I think this one of the capability is reduced, I tried to call the Glgetintegerv (Gl_max_vertex_attribs, &m_maxattribute); Glgetintegerv (Gl_max_varying_vectors, &m_maxvarying);, found in my Lumia 530,maxattribute is 16 (normal), maxvarying only 6 (not normal). According to Opengles 2, the maxvarying minimum is 8. So I wrote the shader code that uses more than 6 of the varying in the lighting process. So there was a "Could not pack varying spotambient" issue at the time of the link. So I had to delete the code that handles the lighting and keep the rest. I think that the processing of light and the display of details may later be handled by deferred rendering. The most simple version, do not light well first.

In the study, learned that QT 3D news, and began to study Qt3d. Qt 3D is really good, using data driven to solve a rather troublesome rendering problem, and from OpenGL1.0 has been supported to the highest specifications. It's not easy. Now, however, the effect on the mobile platform is now unknown. This time also wrote several QT 3D articles, it seems that Qt 3D still need long-term attention.

Last offer I run on my laptop (Windows 8.1), A10HD (Android) and the Lumia 530 (Windows Phone 8.1) Machine:

The code aspect of the action has been ported, but has not yet been tested.

Cross-platform display MMD model

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.