An example of Loading Large Games with TWaver and an example of twaver

Source: Internet
Author: User

An example of Loading Large Games with TWaver and an example of twaver

In games, there are often some large outdoor scenarios, such as a small town or an ancient city. Generally, this type of scenario contains many elements such as buildings, roads, and bridges. the 3D model is large and complex. When loading with TWaver, you can use some tips to make loading faster and display smoother.

TWaver 3D supports importing 3D scenes in json or obj format. If it is in obj format, you can upload the obj file, mtl file, and all texture files as string parameters to TWaver for loading. Of course, these files can also be URL strings on the network.

?
12 varloader = newmono.OBJMTLLoader();loader.load(obj, mtl, images);

TWaver supports further processing of each object during loading. For example, material textures and features. The following code forces each loaded object to be displayed in white mode:

?
123456 varloader = newmono.OBJMTLLoader();loader.load(obj, mtl, images,function (object) {  box.addByDescendant(object);  box.forEach(function(element){    element.setStyle('m.texture.image',null);  });

Alternatively, you can directly use wireframe to ignore the object surface and directly display the line shape of the object:

?
123456 varloader = newmono.OBJMTLLoader();loader.load(obj, mtl, images,function (object) {  box.addByDescendant(object);  box.forEach(function(element){    element.setStyle('m.wireframe',true);  });

The obj file exceeds 16 MB, and the TWaver parsing process cannot exceed 5 seconds. However, in practical applications, resource files may exist on the network, and network transmission takes some time. You can compress obj files or json files to accelerate transmission efficiency. You can also reduce the accuracy of materials. After the scene is displayed, you can load the texture with high precision or dynamically change the texture as needed.

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.