CN117274457A - A 3D model hierarchical compression and display method, device, storage medium and equipment - Google Patents
A 3D model hierarchical compression and display method, device, storage medium and equipment Download PDFInfo
- Publication number
- CN117274457A CN117274457A CN202311232372.2A CN202311232372A CN117274457A CN 117274457 A CN117274457 A CN 117274457A CN 202311232372 A CN202311232372 A CN 202311232372A CN 117274457 A CN117274457 A CN 117274457A
- Authority
- CN
- China
- Prior art keywords
- model
- file
- target
- definition
- user client
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000007906 compression Methods 0.000 title claims abstract description 115
- 230000006835 compression Effects 0.000 title claims abstract description 112
- 238000000034 method Methods 0.000 title claims abstract description 77
- 238000003860 storage Methods 0.000 title claims abstract description 39
- 238000011068 loading method Methods 0.000 claims abstract description 33
- 230000004044 response Effects 0.000 claims abstract description 11
- 238000010422 painting Methods 0.000 claims description 12
- 238000004590 computer program Methods 0.000 claims description 7
- 238000007667 floating Methods 0.000 claims description 7
- 238000013507 mapping Methods 0.000 claims 3
- 230000007613 environmental effect Effects 0.000 claims 2
- 238000010586 diagram Methods 0.000 description 10
- 238000012545 processing Methods 0.000 description 10
- 230000008569 process Effects 0.000 description 8
- 230000005540 biological transmission Effects 0.000 description 7
- 239000000306 component Substances 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 6
- 230000006870 function Effects 0.000 description 5
- 238000013139 quantization Methods 0.000 description 5
- 230000003287 optical effect Effects 0.000 description 4
- 238000004891 communication Methods 0.000 description 3
- 238000009877 rendering Methods 0.000 description 3
- 238000011161 development Methods 0.000 description 2
- 230000002452 interceptive effect Effects 0.000 description 2
- 238000004519 manufacturing process Methods 0.000 description 2
- 238000005457 optimization Methods 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 238000000926 separation method Methods 0.000 description 2
- 208000003028 Stuttering Diseases 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 239000004020 conductor Substances 0.000 description 1
- 239000008358 core component Substances 0.000 description 1
- 238000012937 correction Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000011156 evaluation Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000006855 networking Effects 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 239000004984 smart glass Substances 0.000 description 1
- 238000005303 weighing Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
Landscapes
- Engineering & Computer Science (AREA)
- Computer Graphics (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Information Transfer Between Computers (AREA)
Abstract
Description
技术领域Technical field
本说明书的实施方式涉及计算机技术领域,更具体地,本说明书的实施方式涉及一种3D模型分级压缩与展示方法、装置、存储介质和设备。The embodiments of this specification relate to the field of computer technology, and more specifically, the embodiments of this specification relate to a 3D model hierarchical compression and display method, device, storage medium and equipment.
背景技术Background technique
随着计算机图形学和计算能力的不断发展,在物品和场景展示,例如博物馆藏品展示、商家商品展示时,除了传统的文字、图片、视频等常规的展示方式,越来越多的平台和用户开始关注使用3D模型的物体展示方式。但是,3D模型制作和传输通常需要较高的成本,并且3D模型在加载时通常也需要较大的资源开销。With the continuous development of computer graphics and computing power, when displaying objects and scenes, such as museum collections and merchant merchandise displays, in addition to traditional display methods such as text, pictures, and videos, more and more platforms and users Start paying attention to the way objects are displayed using 3D models. However, 3D model production and transmission usually require high costs, and 3D models usually require large resource overhead when loading.
发明内容Contents of the invention
为克服相关技术中存在的问题,本说明书提供了以下方法及装置。In order to overcome the problems existing in related technologies, this specification provides the following methods and devices.
在本说明书实施方式的第一方面中,提供了一种3D模型分级展示方法,应用于用户客户端;与所述用户客户端对应的服务端维护了按照预设的多个清晰度等级针对所述3D模型对应的原始模型文件进行分级压缩后得到的,与所述多个清晰度等级分别对应的模型文件;所述方法包括:In the first aspect of the implementation of this specification, a 3D model hierarchical display method is provided, which is applied to the user client; the server corresponding to the user client maintains multiple preset definition levels for all objects. The original model files corresponding to the 3D model are obtained after hierarchical compression, and the model files respectively corresponding to the multiple definition levels are obtained; the method includes:
响应于针对所述3D模型的模型展示请求,确定与所述用户客户端的运行环境对应的目标清晰度等级;In response to a model display request for the 3D model, determining a target clarity level corresponding to the operating environment of the user client;
从所述服务端获取所述目标清晰度等级对应的目标模型文件;Obtain the target model file corresponding to the target clarity level from the server;
加载获取到的所述目标模型文件,以向用户进行展示所述3D模型。Load the obtained target model file to display the 3D model to the user.
在本说明书实施方式的第二方面中,提供了一种3D模型分级展示装置,应用于用户客户端;与所述用户客户端对应的服务端维护了按照预设的多个清晰度等级针对所述3D模型对应的原始模型文件进行分级压缩后得到的,与所述多个清晰度等级分别对应的模型文件;所述装置包括:In the second aspect of the implementation of this specification, a 3D model hierarchical display device is provided, which is applied to a user client; the server corresponding to the user client maintains a plurality of preset definition levels for all objects. The original model files corresponding to the 3D model are obtained after hierarchical compression, and the model files respectively corresponding to the multiple definition levels are obtained; the device includes:
确定单元,用于响应于针对所述3D模型的模型展示请求,确定与所述用户客户端的运行环境对应的目标清晰度等级;a determining unit configured to determine a target clarity level corresponding to the running environment of the user client in response to a model display request for the 3D model;
获取单元,用于从所述服务端获取所述目标清晰度等级对应的目标模型文件;An acquisition unit, configured to acquire the target model file corresponding to the target clarity level from the server;
加载单元,用于加载获取到的所述目标模型文件,以向用户进行展示所述3D模型。A loading unit is used to load the obtained target model file to display the 3D model to the user.
在本说明书实施方式的第三方面中,还提供了一种3D模型分级压缩方法,应用于服务端;所述方法包括:In the third aspect of the implementation of this specification, a 3D model hierarchical compression method is also provided, which is applied to the server; the method includes:
获取3D模型对应的原始模型文件,并按照预设的多个清晰度等级针对所述原始模型文件进行分级压缩,得到与所述多个清晰度等级分别对应的模型文件;Obtain the original model file corresponding to the 3D model, and perform hierarchical compression on the original model file according to multiple preset definition levels to obtain model files corresponding to the multiple definition levels;
响应于用户客户端发送的针对所述3D模型的文件获取请求,确定与目标清晰度等级对应的目标模型文件;其中,所述目标清晰度等级为与所述用户客户端的运行环境对应的清晰度等级;In response to the file acquisition request for the 3D model sent by the user client, determine the target model file corresponding to the target definition level; wherein the target definition level is the definition corresponding to the running environment of the user client grade;
将所述目标模型文件返回给所述用户客户端,以使所述用户客户端加载获取到的所述目标模型文件,向用户展示所述3D模型。The target model file is returned to the user client, so that the user client loads the obtained target model file and displays the 3D model to the user.
在本说明书实施方式的第四方面中,还提供了一种3D模型分级压缩装置,应用于服务端;所述装置包括:In the fourth aspect of the implementation of this specification, a 3D model hierarchical compression device is also provided, which is applied to the server; the device includes:
压缩单元,用于获取3D模型对应的原始模型文件,并按照预设的多个清晰度等级针对所述原始模型文件进行分级压缩,得到与所述多个清晰度等级分别对应的模型文件;A compression unit, used to obtain the original model file corresponding to the 3D model, and perform hierarchical compression on the original model file according to multiple preset definition levels to obtain model files corresponding to the multiple definition levels;
选择单元,用于响应于用户客户端发送的针对所述3D模型的文件获取请求,确定与目标清晰度等级对应的目标模型文件;其中,所述目标清晰度等级为与所述用户客户端的运行环境对应的清晰度等级;A selection unit configured to determine a target model file corresponding to a target clarity level in response to a file acquisition request for the 3D model sent by the user client; wherein the target clarity level is the same as the operation of the user client. The clarity level corresponding to the environment;
返回单元,用于将所述目标模型文件返回给所述用户客户端,以使所述用户客户端加载获取到的所述目标模型文件,向用户展示所述3D模型。A return unit is used to return the target model file to the user client, so that the user client loads the obtained target model file and displays the 3D model to the user.
在本说明书实施方式的第五方面中,提供了一种存储介质;所述存储介质上存储有计算机程序,该计算机程序执行时实现如上所述方法的步骤。In a fifth aspect of the embodiment of this specification, a storage medium is provided; a computer program is stored on the storage medium, and when the computer program is executed, the steps of the above method are implemented.
在本说明书实施方式的第六方面中,提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其中,所述处理器执行所述程序时实现如上方法。In a sixth aspect of the embodiment of this specification, a computer device is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein when the processor executes the program Implement the above method.
本说明书以上的实施方式,至少具有如下的有益效果:The above embodiments in this specification have at least the following beneficial effects:
在以上技术方案中,通过预先对3D模型对应的模型文件进行分级压缩,并根据用户客户端的运行环境,权衡质量损失和文件大小的收益,确定的目标清晰度等级,从服务端获取对应的模型文件进行加载;在中低端设备中或者网络环境较差时,可以减小网络和设备内存压力,提升加载速度;而在高端设备或网络环境较好时,可以保证模型质量,最大程度展示3D模型的细节;因此,本说明书中的技术方案可以提升3D模型在不同设备和网络环境下的使用体验。In the above technical solution, the model files corresponding to the 3D model are compressed in stages in advance, and according to the running environment of the user client, the quality loss and file size gain are weighed, and the target definition level is determined, and the corresponding model is obtained from the server. The file is loaded; in low-end devices or when the network environment is poor, the network and device memory pressure can be reduced and the loading speed is improved; while in high-end devices or when the network environment is good, the model quality can be ensured and 3D display can be maximized The details of the model; therefore, the technical solutions in this manual can improve the experience of using 3D models on different devices and network environments.
附图说明Description of the drawings
为了更清楚地说明本说明书实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍。显而易见地,下面描述中的附图仅仅是本说明书中记载的一些实施例,对于本领域普通技术人员来讲,还可以根据这些附图获得其他的附图。In order to more clearly explain the embodiments of this specification or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments recorded in this specification. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings.
图1示意性地示出了根据本说明书实施方式的一种3D模型分级展示方法的架构示意图;Figure 1 schematically shows an architectural diagram of a 3D model hierarchical display method according to an embodiment of this specification;
图2示意性地示出了根据本说明书实施方式的一种3D模型分级展示方法的流程图;Figure 2 schematically shows a flow chart of a 3D model hierarchical display method according to an embodiment of this specification;
图3示意性地示出了根据本说明书实施方式的一种3D模型文件的结构示意图;Figure 3 schematically shows a structural diagram of a 3D model file according to an embodiment of this specification;
图4示意性地示出了根据本说明书实施方式的一种3D模型分级压缩方法的交互流程图;Figure 4 schematically shows an interactive flow chart of a 3D model hierarchical compression method according to an embodiment of this specification;
图5示意性地示出了根据本说明书实施方式的一种3D模型分级压缩方法的流程图;Figure 5 schematically shows a flow chart of a 3D model hierarchical compression method according to an embodiment of this specification;
图6示意性地示出了根据本说明书实施方式的一种3D模型分级展示装置的框图;Figure 6 schematically shows a block diagram of a 3D model hierarchical display device according to an embodiment of this specification;
图7示意性地示出了根据本说明书实施方式的一种3D模型分级压缩装置的框图;Figure 7 schematically shows a block diagram of a 3D model hierarchical compression device according to an embodiment of this specification;
图8示意性地示出了根据本说明书实施方式的一种3D模型分级展示方法所在计算机设备的一种硬件结构图。FIG. 8 schematically shows a hardware structure diagram of a computer device in which a 3D model hierarchical display method is implemented according to an embodiment of this specification.
在附图中,相同或对应的标号表示相同或对应的部分。In the drawings, the same or corresponding reference numerals represent the same or corresponding parts.
具体实施方式Detailed ways
下面将参考若干示例性实施方式来描述本说明书的原理和精神。应当理解,给出这些实施方式仅仅是为了使本领域技术人员能够更好地理解进而实现本说明书,而并非以任何方式限制本说明书的范围。相反,提供这些实施方式是为了使本说明书更加透彻和完整,并且能够将本说明书的范围完整地传达给本领域的技术人员。The principles and spirit of the present specification will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided only to enable those skilled in the art to better understand and implement the present specification, and are not intended to limit the scope of the present specification in any way. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
本领域技术人员知道,本说明书的实施方式可以实现为一种系统、装置、设备、方法或计算机程序产品。因此,本说明书可以具体实现为以下形式,即:完全的硬件、完全的软件(包括固件、驻留软件、微代码等),或者硬件和软件结合的形式。Those skilled in the art know that the embodiments of this specification can be implemented as a system, device, equipment, method or computer program product. Therefore, this specification can be implemented in the following form, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
首先介绍一些说明书中可能涉及的相关概念:First, we will introduce some related concepts that may be involved in the manual:
SoC(System on a Chip,片上系统),是一种集成了多个关键组件和功能的芯片,包括中央处理器(CPU)、图形处理器(GPU)、内存控制器、存储控制器、多媒体处理单元、通信模块(如无线网络和蓝牙)、传感器接口、安全模块等等。在手机中,SOC是负责处理手机的主要计算和控制任务的核心部件。它集成了CPU来执行计算任务、GPU用于图形渲染、多媒体加速器来处理音视频数据、通信模块用于网络通信,以及其他必要的接口和模块来实现手机的各种功能。SoC (System on a Chip) is a chip that integrates multiple key components and functions, including central processing unit (CPU), graphics processing unit (GPU), memory controller, storage controller, and multimedia processing. units, communication modules (such as wireless networking and Bluetooth), sensor interfaces, security modules, etc. In a mobile phone, the SOC is the core component responsible for handling the main computing and control tasks of the mobile phone. It integrates the CPU to perform computing tasks, the GPU for graphics rendering, the multimedia accelerator to process audio and video data, the communication module for network communication, and other necessary interfaces and modules to realize various functions of the mobile phone.
URL(Uniform Resource Locator,统一资源定位符),俗称网页地址,简称网址,是因特网上标准的资源的地址,通常每个有效的URL都可以指向一个唯一的资源。URL (Uniform Resource Locator, Uniform Resource Locator), commonly known as web page address, or URL for short, is the address of a standard resource on the Internet. Usually, each valid URL can point to a unique resource.
随着计算机图形学和计算能力的不断发展,在物品和场景展示,例如博物馆藏品展示、商家商品展示时,除了传统的文字、图片、视频等常规的展示方式,越来越多的平台和用户开始关注使用3D模型的物体展示方式。但是,3D模型制作和传输通常需要较高的成本,并且3D模型在加载时通常也需要较大的资源开销。With the continuous development of computer graphics and computing power, when displaying objects and scenes, such as museum collections and merchant merchandise displays, in addition to traditional display methods such as text, pictures, and videos, more and more platforms and users Start paying attention to the way objects are displayed using 3D models. However, 3D model production and transmission usually require high costs, and 3D models usually require large resource overhead when loading.
相对于图片和视频等二维的展现形式,由于3D模型需要展示对象的在三维空间中的更多细节,并且需要支持多角度的查看,3D模型通常具备较大的数据量和较为复杂的数据结构,通常需要调用用户客户端的3D引擎进行实时渲染,因此需要消耗用户客户端更多的资源。Compared with two-dimensional display forms such as pictures and videos, because 3D models need to display more details of objects in three-dimensional space and support multi-angle viewing, 3D models usually have a larger amount of data and more complex data. Structure usually requires calling the 3D engine of the user client for real-time rendering, thus consuming more resources of the user client.
当3D模型包含较多的细节时,其模型文件可能较大,加载时需要消耗较多的网络和内存资源。尤其是在手机上对3D模型展示时,由于手机的性能和网络情况复杂;在中低端手机或者网络环境差时,加载较大的3D模型可能需要比较长的时间,并且展示时可能会出现卡顿、掉帧等不流畅的情况。When a 3D model contains more details, its model file may be larger and consume more network and memory resources when loading. Especially when displaying 3D models on mobile phones, due to the complexity of mobile phone performance and network conditions; on mid- to low-end mobile phones or when the network environment is poor, it may take a long time to load larger 3D models, and errors may occur during display. Stuttering, frame drops and other unsmooth situations.
有鉴于此,本说明书旨在提出一种针对不同用户客户端的运行环境,提供不同等级的3D模型文件,以适应不同运行环境进行3D模型压缩与展示的技术方案。In view of this, the purpose of this manual is to propose a technical solution that provides different levels of 3D model files for different user client operating environments to adapt to different operating environments for 3D model compression and display.
在实现时,服务端可以预先按照预设的多个清晰度等级,对3D模型的原始模型文件进行分级压缩,得到多个清晰度等级的多级模型文件;During implementation, the server can perform hierarchical compression on the original model files of the 3D model according to multiple preset definition levels in advance to obtain multi-level model files with multiple definition levels;
进一步地,在用户客户端需要对3D模型进行展示时,可以根据用户客户端的运行环境,确定需要进行展示的3D模型的清晰度等级,并从服务端获取对应的模型文件,加载以进行展示。Further, when the user client needs to display the 3D model, the definition level of the 3D model that needs to be displayed can be determined according to the running environment of the user client, and the corresponding model file can be obtained from the server and loaded for display.
由此可见,在本说明书中的技术方案中,通过预先对3D模型对应的模型文件进行分级压缩,并根据用户客户端的运行环境,权衡质量损失和文件大小的收益,确定的目标清晰度等级,从服务端获取对应的模型文件进行加载;在中低端设备中或者网络环境较差时,可以减小网络和设备内存压力,提升加载速度;而在高端设备或网络环境较好时,可以保证模型质量,最大程度展示3D模型的细节;因此,本说明书中的技术方案可以提升3D模型在不同设备和网络环境下的使用体验。It can be seen that in the technical solution in this manual, the model file corresponding to the 3D model is compressed in stages in advance, and the target definition level is determined by weighing the quality loss and file size gain according to the running environment of the user client. Obtain the corresponding model file from the server and load it; in low-end devices or when the network environment is poor, it can reduce the network and device memory pressure and improve the loading speed; and in high-end devices or when the network environment is good, it can ensure Model quality, showing the details of the 3D model to the greatest extent; therefore, the technical solutions in this manual can improve the use experience of the 3D model in different devices and network environments.
下面结合附图对本说明书的方案进行详细说明。The solutions of this specification will be described in detail below with reference to the accompanying drawings.
请参见图1,图1是一示例性实施例提供的一种3D模型分级展示系统的架构示意图。如图1所示,该系统可以包括网络10、服务器11、若干电子设备,如电脑12、电脑13和电脑14等。Please refer to FIG. 1 , which is a schematic architectural diagram of a 3D model hierarchical display system provided by an exemplary embodiment. As shown in Figure 1, the system may include a network 10, a server 11, and several electronic devices, such as computers 12, 13, and 14.
服务器11可以为包含一独立主机的物理服务器,或者该服务器11可以为主机集群承载的虚拟服务器、云服务器等。电脑12-14只是用户可以使用的一种类型的电子设备。实际上,用户显然还可以使用诸如下述类型的电子设备:平板设备、手机、掌上电脑(PDAs,Personal Digital Assistants)、可穿戴设备(如智能眼镜、智能手表等)等,本说明书一个或至少一个实施例并不对此进行限制。网络10可以包括多种类型的有线或无线网络。The server 11 may be a physical server including an independent host, or the server 11 may be a virtual server, cloud server, etc. hosted by a host cluster. Computers 12-14 are just one type of electronic device available to users. In fact, users can obviously also use electronic devices such as the following types: tablet devices, mobile phones, PDAs (Personal Digital Assistants), wearable devices (such as smart glasses, smart watches, etc.), etc., one or at least one of this manual An embodiment is not limited in this regard. Network 10 may include various types of wired or wireless networks.
在一实施例中,服务器11可以与电脑12-14进行配合;其中,可由电脑12-14接受用户操作,并将接受到的命令和文件通过网络10上传至服务器11,然后由服务器11基于本说明书的方案对文件进行处理。在另一实施例中,电脑12-14可以独立实现本说明书的方案;其中,由电脑12-14接受用户操作,并基于本说明书的方案对接受的命令和文件进行处理,以实现3D模型分级展示。In one embodiment, the server 11 can cooperate with the computers 12-14; the computers 12-14 can accept user operations and upload the received commands and files to the server 11 through the network 10, and then the server 11 can The file is processed according to the program in the instructions. In another embodiment, the computer 12-14 can independently implement the solution of this description; wherein, the computer 12-14 accepts user operations and processes the accepted commands and files based on the solution of this description to achieve 3D model grading. exhibit.
请参见图2,图2是一示例性实施例提供的一种3D模型分级展示方法的流程图,该方法应用于处理设备,该处理设备可以为图1所示的服务器11或电脑12-14等。Please refer to Figure 2. Figure 2 is a flow chart of a 3D model hierarchical display method provided by an exemplary embodiment. The method is applied to a processing device. The processing device can be the server 11 or computers 12-14 shown in Figure 1. wait.
与所述用户客户端对应的服务端维护了由所述3D模型对应的原始模型文件按照预设的多个清晰度等级,进行分级压缩后得到的与所述多个清晰度等级分别对应的模型文件;The server corresponding to the user client maintains the original model file corresponding to the 3D model according to multiple preset definition levels, and the models corresponding to the multiple definition levels are obtained after hierarchical compression. document;
该方法可以包括以下步骤:The method may include the following steps:
步骤202:响应于针对所述3D模型的模型展示请求,确定与所述用户客户端的运行环境对应的目标清晰度等级。Step 202: In response to a model display request for the 3D model, determine a target clarity level corresponding to the running environment of the user client.
通常,用户客户端待展示的3D模型对应的模型文件保存在与用户客户端对应的服务端中,当用户需要查看3D模型时,用户客户端可以向服务端发送请求,服务端接收到请求后,可以将3D模型对应的模型文件发送到用户客户端。用户客户端加载接收到的模型文件,以向用户进行展示。Usually, the model file corresponding to the 3D model to be displayed on the user client is stored in the server corresponding to the user client. When the user needs to view the 3D model, the user client can send a request to the server. After the server receives the request , the model file corresponding to the 3D model can be sent to the user client. The user client loads the received model file to display it to the user.
模型文件较大时,传输和加载都会消耗较多的资源,可能影响用户体验。因此,可以预先在服务端对模型文件进行压缩,得到清晰度较低的模型文件。通常,清晰度越高的模型文件,能展示更多细节,但是其文件大小也越大,加载消耗的资源也越多;清晰度越低的模型文件,能展示较少细节,但是其文件大小也越小,加载消耗的资源也越少。When the model file is large, more resources will be consumed for transmission and loading, which may affect the user experience. Therefore, the model file can be compressed on the server in advance to obtain a model file with lower definition. Generally, a model file with higher definition can show more details, but its file size is larger and consumes more resources to load; a model file with lower definition can show less details, but its file size is larger. The smaller it is, the fewer resources it consumes to load.
可见,清晰度较低的模型文件适合在运行环境较差的用户客户端中进行加载;但是,对于运行环境较好的用户客户端,使用清晰度较低的模型文件,也会使其损失模型细节,降低用户体验。It can be seen that model files with lower definition are suitable for loading in user clients with poor running environments; however, for user clients with better running environments, using model files with lower definition will also cause them to lose the model. details, reducing user experience.
因此,需要针对不用运行环境的用户客户端,准备不同清晰度等级的多个模型文件。具体的,可以采用分级压缩的方式,基于不同的压缩参数,对原始模型文件进行多个等级的压缩,得到多个清晰度等级的模型文件,以适应不同运行环境中的用户客户端。Therefore, it is necessary to prepare multiple model files with different resolution levels for user clients that do not require a running environment. Specifically, a hierarchical compression method can be used to compress the original model file at multiple levels based on different compression parameters to obtain model files with multiple definition levels to adapt to user clients in different operating environments.
当用户客户端需要展示待展示的3D模型时,例如用户打开该3D模型所在的页面,用户执行与该3D模型对应的触发式操作等,可以视作用户客户端获取到针对该3D模型的展示请求;When the user client needs to display the 3D model to be displayed, for example, the user opens the page where the 3D model is located, the user performs a trigger operation corresponding to the 3D model, etc., it can be regarded as the user client obtains the display of the 3D model. ask;
当用户客户端获取到该展示请求时,用户客户端可以确定当前用户客户端的运行环境,并根据当前运行环境确定3D模型展示时的目标清晰度等级。When the user client obtains the display request, the user client can determine the current running environment of the user client, and determine the target clarity level for 3D model display based on the current running environment.
其中,用户客户端的运行环境可以包括用户客户端所在设备的设备性能参数,当前网络性能参数,以及用户制定的偏好设定等,本说明书不对此进行具体限定。Among them, the operating environment of the user client may include device performance parameters of the device where the user client is located, current network performance parameters, and user-set preference settings, etc. This specification does not specifically limit this.
用户客户端的当前运行环境可以是由用户客户端进行实时检测得到,也可以是存储在该用户客户端中的,本说明书不进行具体限定。The current running environment of the user client may be detected in real time by the user client, or may be stored in the user client, which is not specifically limited in this specification.
在本说明示出的一个示例性的实施例中,用户客户端直接维护了用户客户端的运行环境和目标清晰度等级的对应关系。In an exemplary embodiment shown in this description, the user client directly maintains the corresponding relationship between the user client's running environment and the target clarity level.
根据用户客户端的运行环境,即可以唯一确定对应的目标清晰度等级。According to the running environment of the user client, the corresponding target definition level can be uniquely determined.
在用户客户端的运行环境中,对加载速度影响最大的因素通常是网络环境。由于需要将模型文件从服务端下载到用户客户端,网络传输速度较慢时,模型需要等待较长的时间从服务端下载,消耗较多时间和用户的耐心。In the running environment of the user client, the factor that has the greatest impact on loading speed is usually the network environment. Since the model file needs to be downloaded from the server to the user client, when the network transmission speed is slow, the model needs to wait for a long time to be downloaded from the server, which consumes more time and the user's patience.
因此,可以根据用户客户端的网络性能参数,来确定目标清晰度等级。网络性能参数可以包括网络性能,网络性能表示网络传输速度时的速度快慢。Therefore, the target clarity level can be determined based on the network performance parameters of the user client. Network performance parameters may include network performance, which represents the speed of network transmission.
在用户客户端的网络性能较高时,确定为较高的清晰度等级;在用户客户端的网路性能较低时,确定为较低的清晰度等级。When the network performance of the user client is high, a higher definition level is determined; when the network performance of the user client is low, a lower definition level is determined.
网络性能参数还可以包括网络类型。Network performance parameters may also include network type.
此外,用户的网络类型,也可以影响目标清晰度等级的确定。例如,当用户使用流量计费的网络,如移动数据时,可能对数据流量使用量比较敏感,可以确定为较低的清晰度等级,以使用文件较小的模型数据;而用户使用非流量计费数据,例如WIFI网络时,对文件大小不敏感,可以确定为较高的清晰度等级,以使用质量较高的模型数据。In addition, the user's network type can also affect the determination of the target clarity level. For example, when users use traffic metered networks, such as mobile data, they may be more sensitive to data traffic usage and can be determined to a lower resolution level to use model data with smaller files; while users using non-metered traffic meters When using low-cost data, such as WIFI networks, it is not sensitive to file size and can be determined to a higher definition level to use higher quality model data.
除了网络性能参数外,还可以使用设备性能参数评价用户客户端的运行环境。In addition to network performance parameters, device performance parameters can also be used to evaluate the operating environment of the user client.
用户客户端所在的设备,其设备性能越高,则加载模型文件越快,3D模型运行越流畅。设备性能较低的设备,在加载文件大小较大的,包含模型细节较多的模型文件时,可能需要花费较长的时间进行加载,并且运行时可能会出现卡顿、掉帧等现象,影响用户体验;而加载文件大小较小,包含模型细节较少的模型文件时,由于其需求的设备性能较低,加载更快,运行更流畅,用户反而能获得更好的体验。The higher the performance of the device where the user client is located, the faster the model file will be loaded and the smoother the 3D model will run. Devices with lower device performance may take a longer time to load model files with larger file sizes and more model details, and may experience lags, frame drops, etc. during runtime, affecting the User experience; when loading model files with smaller file sizes and less model details, users can get a better experience because they require lower device performance, faster loading, and smoother operation.
因此,可以将用户客户端所在的设备性能较高时,确定为较高的清晰度等级;将用户客户端所在的设备性能较低时,确定为较低的清晰度等级。Therefore, when the performance of the device where the user client is located is high, it can be determined to be a higher definition level; when the performance of the device where the user client is located is low, it can be determined to be a lower definition level.
确定用户客户端所在的设备性能高低,可以获取其设备型号、分辨率、SOC参数等,对其进行综合评价;通常,用户客户端中可以维护设备型号与对应的设备性能参数,或者清晰度等级的对应关系。To determine the performance of the device where the user client is located, you can obtain its device model, resolution, SOC parameters, etc., and conduct a comprehensive evaluation of it; usually, the device model and corresponding device performance parameters, or clarity level, can be maintained in the user client corresponding relationship.
此外,还可以采用多种参数,对用户客户端的运行环境进行综合评价,共同确定用户客户端对应的目标清晰度等级。In addition, a variety of parameters can also be used to comprehensively evaluate the operating environment of the user client and jointly determine the target clarity level corresponding to the user client.
例如,在本说明示出的一个示意性的实施例中,可以使用用户客户端所在设备使用的网络类型,和设备性能参数,共同确定目标清晰度等级。For example, in an illustrative embodiment shown in this description, the network type used by the device where the user client is located and the device performance parameters can be used to jointly determine the target clarity level.
用客户端所在的设备为手机为例,在实现时,可以基于预设的规则,将手机根据设备性能参数从高到低分为高端机、中端机和低端机;将手机使用的网络分为流量网络和WIFI网络。Taking the device where the client is located as a mobile phone as an example, during implementation, based on preset rules, mobile phones can be divided into high-end machines, mid-range machines and low-end machines according to device performance parameters from high to low; the network used by the mobile phone It is divided into traffic network and WIFI network.
清晰度等级从高到低可以分为三个等级,原画OD,高清HD和标清SD。The definition level can be divided into three levels from high to low, original picture OD, high definition HD and standard definition SD.
其中,清晰度等级为原画OD时,其对应的模型文件为未压缩的原始模型文件。Among them, when the definition level is the original painting OD, the corresponding model file is the uncompressed original model file.
确定目标清晰度等级的对应关系如下:The corresponding relationship for determining the target clarity level is as follows:
对于低端机,以及使用流量的中端机,确定为标清SD;对于使用WIFI的中端机,或使用流量的高端机,确定为高清HD;对应使用WIFI的高端机,确定为原画OD。For low-end machines and mid-range machines using data traffic, determine it as standard definition SD; for mid-range machines using WIFI or high-end machines using data traffic, determine it as high definition; for high-end machines using WIFI, determine it as original painting OD.
如下表所示:As shown in the following table:
步骤204:从所述服务端获取所述目标清晰度等级对应的目标模型文件。Step 204: Obtain the target model file corresponding to the target definition level from the server.
3D模型对应的模型文件在服务端进行分级压缩后,分别进行保存。当用户客户端确定3D模型展示时的目标清晰度等级后,即可以向服务端发送请求以获取与目标清晰度等级对应的模型文件。The model files corresponding to the 3D model are hierarchically compressed on the server side and then saved separately. After the user client determines the target clarity level for 3D model display, it can send a request to the server to obtain the model file corresponding to the target clarity level.
服务端接收到请求后,可以将目标清晰度等级对应的模型文件发送给用户客户端。After receiving the request, the server can send the model file corresponding to the target clarity level to the user client.
步骤206:加载获取到的所述目标模型文件,以向用户进行展示所述3D模型。Step 206: Load the obtained target model file to display the 3D model to the user.
接收到服务端发送的目标清晰度对应的模型文件后,用户客户端可以记载该模型文件,进行实时渲染,以向用户展示上述待展示的3D模型文件。After receiving the model file corresponding to the target definition sent by the server, the user client can record the model file and perform real-time rendering to display the above-mentioned 3D model file to be displayed to the user.
在以上实施例中,通过预先对3D模型对应的模型文件进行分级压缩,并根据用户客户端的运行环境,权衡质量损失和文件大小的收益,确定的目标清晰度等级,从服务端获取对应的模型文件进行加载;在中低端设备中或者网络环境较差时,可以减小网络和设备内存压力,提升加载速度;而在高端设备或网络环境较好时,可以保证模型质量,最大程度展示3D模型的细节;因此,本说明书中的技术方案可以提升3D模型在不同设备和网络环境下的使用体验。In the above embodiment, the model files corresponding to the 3D model are compressed hierarchically in advance, and according to the running environment of the user client, the quality loss and the file size gain are weighed, and the corresponding model is obtained from the server based on the determined target definition level. The file is loaded; in low-end devices or when the network environment is poor, the network and device memory pressure can be reduced and the loading speed is improved; while in high-end devices or when the network environment is good, the model quality can be ensured and 3D display can be maximized The details of the model; therefore, the technical solutions in this manual can improve the experience of using 3D models on different devices and network environments.
在压缩、存储、传输、加载等过程中,模型文件可能发生错误和损坏,因此,上述模型文件在用户客户端上加载时,可能发生错误。Errors and damage to model files may occur during compression, storage, transmission, loading, etc. Therefore, errors may occur when the above model files are loaded on the user client.
当模型文件加载失败时,可以重新进行加载,包括重新加载已获取的模型文件,和重新从服务端获取模型文件进行加载等。When the model file fails to load, you can reload it, including reloading the obtained model file, and re-obtaining the model file from the server for loading, etc.
如果多次重新加载,模型文件仍加载失败,说明可能是存储在服务端的模型文件有错误,例如可能是在压缩时发生了错误,导致文件无法正常加载。If the model file still fails to load after reloading multiple times, it means that there may be an error in the model file stored on the server. For example, an error may occur during compression, causing the file to fail to load normally.
可以预设一个加载失败次数的阈值,例如3次/5次等,当加载失败次数超过该阈值时,可以认为重新加载无法解决加载失败的问题。You can preset a threshold for the number of loading failures, such as 3 times/5 times, etc. When the number of loading failures exceeds the threshold, it can be considered that reloading cannot solve the problem of loading failures.
此时,可以从服务端获取未经压缩的清晰度等级为原画的模型文件,并进行加载。At this time, you can obtain the uncompressed model file with the resolution level of the original painting from the server and load it.
在本说明示出的一个示例性的实施例中,3D模型对应的模型文件由两部分构成,模型主体文件,和模型外部数据。模型外部数据又称远程资源,存储在外部的存储空间中,模型主体文件中仅保存模型外部数据所存储的地址,当模型主体文件需要加载时,可以根据该地址,从对应的地址中获取模型外部数据。In an exemplary embodiment shown in this description, the model file corresponding to the 3D model consists of two parts, the model main file and the model external data. Model external data, also known as remote resources, are stored in external storage space. Only the address where the model external data is stored is saved in the model main file. When the model main file needs to be loaded, the model can be obtained from the corresponding address based on this address. external data.
使用这种分离的模式对模型文件进行存储,可以减小模型主体文件的大小。Using this separated mode to store model files can reduce the size of the main model file.
模型主体文件通常是一种描述文件,用于描述构成3D模型的三维场景的内容。其中,部分内容可以以远程模型外部数据的形式进行表示,例如描述3D模型的形状的模型几何数据,描述3D模型表面的模型贴图数据,描述3D模型随时间运动方式的模型动画数据等,本说明不对此进行具体限定。The model body file is usually a description file used to describe the content of the three-dimensional scene that makes up the 3D model. Some of the content can be represented in the form of external data of the remote model, such as model geometry data describing the shape of the 3D model, model texture data describing the surface of the 3D model, model animation data describing the movement of the 3D model over time, etc., this description This is not specifically limited.
通常,占用文件大小较多的部分,可以使用模型外部数据的形式进行表示,以减小模型主体文件的大小。Usually, the parts that occupy a larger file size can be represented in the form of data external to the model to reduce the size of the main model file.
因此,模型主体文件占用的空间通常较小,对其进行压缩处理的效率不高。在对模型文件进行分级压缩时,可以主要针对模型外部数据进行压缩。Therefore, the model main file usually occupies a small space, and the efficiency of compressing it is not high. When performing hierarchical compression on model files, you can mainly compress the external data of the model.
具体的,在按照预设的多个清晰度等级对模型文件进行分级压缩时,各个清晰度等级可以分别对应预设的压缩参数,压缩参数可以包括压缩方法,压缩目标大小,压缩率等具体参数,本说明书不对此进行具体限定。Specifically, when the model file is hierarchically compressed according to multiple preset definition levels, each definition level can correspond to the preset compression parameters, and the compression parameters can include specific parameters such as compression method, compression target size, compression rate, etc. , this manual does not specifically limit this.
分级压缩得到的多个模型外部数据可以分别存储在服务端的文件服务中,并将外部模型数据所在的存储地址保存在模型主体文件中。Multiple model external data obtained through hierarchical compression can be stored in the file service on the server side respectively, and the storage address of the external model data is saved in the model main file.
在本说明示出的一种示意性的实施例中,可以针对每个清晰度等级生成一个对应的模型主体文件,模型主体文件中保存对应的清晰度等级的压缩后的模型外部数据所在的存储地址。In an illustrative embodiment shown in this description, a corresponding model main file can be generated for each definition level, and the model main file stores the storage where the compressed model external data of the corresponding definition level is located. address.
例如,当存在3个清晰度等级原画OD,高清HD和标清SD时,可以分别针对这3个清晰度等级生成一份模型主体文件,不同清晰度等级对应的模型主体文件相同。For example, when there are three definition levels of the original painting OD, high definition HD and standard definition SD, a model main file can be generated for these three definition levels respectively. The model main files corresponding to different definition levels are the same.
在将该3个清晰度等级分别对应模型外部数据分别存储在服务端的文件服务中后,分别在3个清晰度等级对应的模型主体文件中存储与其清晰度等级对应的模型外部数据所在的存储地址。After the model external data corresponding to the three definition levels are stored in the file service of the server, the storage addresses of the model external data corresponding to the definition levels are stored in the model main files corresponding to the three definition levels. .
通过上述方法,即可以得到3个分别存储了各自对应的外部数据所在的存储地址的模型主体文件。Through the above method, you can obtain three model main files that respectively store the storage addresses of the corresponding external data.
当某一清晰度等级对应的模型主体文件加载时,可以基于其保存的存储地址获取到对应的模型外部数据,以完成该清晰度等级的3D模型的加载。When the model main file corresponding to a certain definition level is loaded, the corresponding model external data can be obtained based on its saved storage address to complete the loading of the 3D model of this definition level.
在本说明示出的另一种示意性的实施例中,可以将各个不同的清晰度等级对应的压缩后的模型外部数据所在的存储地址,都存储在一个模型主体文件中。In another illustrative embodiment shown in this description, the storage addresses of the compressed model external data corresponding to different definition levels can be stored in one model main file.
当该模型主体文件加载时,可以根据目标清晰度等级,确定需要加载的外部模型数据对应的存储地址,并基于该该存储地址获取到对应的模型外部数据,以完成目标清晰度等级的3D模型的加载。When the model main file is loaded, the storage address corresponding to the external model data that needs to be loaded can be determined according to the target definition level, and the corresponding model external data is obtained based on the storage address to complete the 3D model of the target definition level. of loading.
在本说明书中,不对3D模型对应的模型文件的格式进行限定,例如,模型文件的格式可以是fbx格式,gltf格式,obj格式,x3d格式等。In this specification, the format of the model file corresponding to the 3D model is not limited. For example, the format of the model file can be fbx format, gltf format, obj format, x3d format, etc.
在本说明示出的一个示例性的实施例中,3D模型对应的模型文件的格式可以是gltf格式。In an exemplary embodiment shown in this description, the format of the model file corresponding to the 3D model may be gltf format.
Gltf(GL Transmission Format)格式是一种用于传输和加载三维模型的开放标准格式,具备轻量、高效、开放等特点,是当今互联网上广泛使用的三维模型格式之一。The Gltf (GL Transmission Format) format is an open standard format for transmitting and loading 3D models. It is lightweight, efficient, and open. It is one of the 3D model formats widely used on the Internet today.
Gltf格式的模型文件可以采用如上述描述的分离的存储格式。Model files in Gltf format can be stored in separate storage formats as described above.
请参见图3,图3是一示例性实施例提供的一种3D模型文件的结构示意图。Please refer to Figure 3, which is a schematic structural diagram of a 3D model file provided by an exemplary embodiment.
Gltf格式的模型文件可以包括作为模型主体文件的gltf文件,以及作为模型外部数据的模型几何数据和模型贴图数据。Model files in Gltf format can include gltf files as model main files, and model geometry data and model texture data as model external data.
其中,模型几何数据可以用于描述3D模型的模型形状;而模型贴图数据可以用于描述3D模型的表面。Among them, the model geometry data can be used to describe the model shape of the 3D model; and the model texture data can be used to describe the surface of the 3D model.
模型几何数据通常可以用bin文件的形式存储,而模型贴图数据通常可以用png文件的形式进行存储。Model geometry data can usually be stored in the form of bin files, while model texture data can usually be stored in the form of png files.
Bin文件和png文件分别存储在服务端对应的文件服务中,并以URL的形式在gltf文件中表示其存储位置。Bin files and png files are stored in the corresponding file service on the server side, and their storage locations are represented in the gltf file in the form of URLs.
Gltf文件、bin文件、png文件三部分可以组合成一个完整可用的gltf格式的模型文件,在用户客户端进行加载。The three parts of Gltf file, bin file, and png file can be combined into a complete and usable model file in gltf format, which can be loaded on the user client.
针对gltf格式的模型文件进行分级压缩,可以包括对模型几何数据(bin文件)和模型贴图数据(png文件)的分级压缩两部分进行。The hierarchical compression of model files in gltf format can include hierarchical compression of model geometry data (bin files) and model texture data (png files).
以下分别针对模型几何数据和模型贴图数据的分级压缩,进行讨论。The following discusses the hierarchical compression of model geometry data and model texture data respectively.
对于描述3D模型的模型形状的模型几何数据,主要包括描述3D模型对应的多边形网格结构的mesh数据。The model geometry data that describes the model shape of the 3D model mainly includes mesh data that describes the polygon mesh structure corresponding to the 3D model.
在计算机中实现的3D模型,通常都是采用多边形网格结构来表示物体的表面,使用的多边形越多,则模型越精细,模型文件也越大。3D models implemented in computers usually use polygonal mesh structures to represent the surface of objects. The more polygons used, the more detailed the model and the larger the model file.
在gltf格式的文件中,模型几何数据中的mesh数据通常采用三角形网格结构,即3D模型的表面由若干个三角形构成。In gltf format files, the mesh data in the model geometry data usually adopts a triangular mesh structure, that is, the surface of the 3D model is composed of several triangles.
描述多边形网格的mesh数据中,包括了一系列坐标数据,包括多边形顶点坐标、法线坐标、纹理坐标等。Mesh数据中的坐标数据通常采用浮点型数据进行表示。The mesh data describing the polygon mesh includes a series of coordinate data, including polygon vertex coordinates, normal coordinates, texture coordinates, etc. The coordinate data in Mesh data is usually represented by floating point data.
一种压缩mesh数据的方法,可以将mesh数据中的坐标数据由浮点型数据转化为整型数据。整型数据占用的空间比浮点型数据小,通过这种方法,可以通过降低多边形网格中坐标精度的方式,压缩mesh数据。通常可以采用KHR_mesh_quantization技术来实现该压缩方式。A method of compressing mesh data that can convert the coordinate data in the mesh data from floating point data to integer data. Integer data takes up less space than floating point data. In this way, mesh data can be compressed by reducing the coordinate accuracy in the polygon grid. This compression method can usually be achieved using KHR_mesh_quantization technology.
除了降低mesh数据中多边形网格中坐标的精度外,还可以通过降低多边形网格中多边形的数量,来压缩mesh数据。In addition to reducing the accuracy of the coordinates in the polygon grid in the mesh data, the mesh data can also be compressed by reducing the number of polygons in the polygon grid.
通常,可以将相邻的,并且相互之间的夹角很小,如小于某个预设的阈值的多边形进行合并,合并成较大的多边形,以减少多边形网络中多边形的数量。多边形数量的降低会使3D模型丢失表面的一些细节,但也能有效压缩mesh数据的大小。通常可以采用mesh_quantization技术来实现该压缩方式。Usually, adjacent polygons with small angles between each other, such as less than a certain preset threshold, can be merged into larger polygons to reduce the number of polygons in the polygon network. Reducing the number of polygons will cause the 3D model to lose some surface details, but it can also effectively compress the size of the mesh data. This compression method can usually be achieved using mesh_quantization technology.
通过降低坐标数据精度和降低多边形数量,可以有效压缩mesh数据,从而压缩模型集合数据。By reducing the accuracy of coordinate data and reducing the number of polygons, mesh data can be effectively compressed, thereby compressing model collection data.
模型贴图数据,通常可以包括color贴图(基础颜色贴图),normal贴图(法线贴图),orm贴图(材质纹理贴图)等几类。其中,某一类贴图的数量可能是0张,1张,或者多张。Model map data can usually include color map (basic color map), normal map (normal map), orm map (material texture map), etc. Among them, the number of a certain type of texture may be 0, 1, or multiple.
贴图数据通常为png文件,png文件的压缩技术较为成熟和常见,本说明书中不对其进行具体的说明。Texture data is usually a png file. The compression technology of png files is relatively mature and common, and will not be explained in detail in this manual.
具体的,可以采用以下一种或多种方式实现png格式的贴图文件的压缩:Specifically, one or more of the following methods can be used to compress texture files in png format:
采用pngquant进行压缩;pngquant是一种主要使用中值切割量化算法的改进版和K-means颜色校正的图片压缩算法,可以显著减小文件大小,并保持完全的alpha透明度;Use pngquant for compression; pngquant is an image compression algorithm that mainly uses an improved version of the median cut quantization algorithm and K-means color correction, which can significantly reduce the file size and maintain full alpha transparency;
将png格式的图片转换为jpg格式;会损失alpha透明度通道,并减小文件大小;Convert images in png format to jpg format; the alpha transparency channel will be lost and the file size will be reduced;
将png格式的贴图文件转换为ktx2格式;可以减小文件大小。Convert texture files in png format to ktx2 format; the file size can be reduced.
根据实际压缩需要,还可以使用将png格式的贴图文件转化为webp格式,对png格式的贴图文件进行尺寸压缩等常见的图片压缩方法,本说明不对此进行具体限定。Depending on actual compression needs, you can also use common image compression methods such as converting texture files in png format to webp format and performing size compression on texture files in png format. This description does not specifically limit this.
在本说明示出的一个示意性的实施例中,可以采用以下压缩策略:In an illustrative embodiment shown in this description, the following compression strategy can be adopted:
仍然采用OD/HD/SD三个清晰度等级,对OD等级的模型文件不进行压缩;The three definition levels of OD/HD/SD are still used, and OD level model files are not compressed;
HD等级:对png格式的贴图文件进行pngquant 75%质量压缩,以及将png格式的贴图文件转换为jpg格式,对比pngquant 75%质量压缩后的png格式贴图文件和转换后的jpg格式的贴图文件,对较小的文件进行保留;对mesh数据采用mesh_quantization技术进行处理;HD level: perform pngquant 75% quality compression on png format texture files, and convert png format texture files to jpg format, compare png format texture files after pngquant 75% quality compression and converted jpg format texture files, Keep smaller files; use mesh_quantization technology to process mesh data;
SD等级:将png格式的贴图文件转换成ktx2格式;对mesh数据采用mesh_quantization以及三角面合并优化处理,其中,bin文件小于2MB时不进行面优化,bin文件2-4MB时设定面压缩率0.9;bin文件4-6MB时设定面压缩率0.8,bin文件大于6MB时设定面压缩率0.6。SD level: Convert texture files in png format to ktx2 format; use mesh_quantization and triangle surface merging and optimization processing for mesh data. Among them, surface optimization is not performed when the bin file is less than 2MB. When the bin file is 2-4MB, the surface compression rate is set to 0.9 ;Set the surface compression rate to 0.8 when the bin file is 4-6MB, and set the surface compression rate to 0.6 when the bin file is larger than 6MB.
以下结合图4对模型文件分级压缩的过程进行详细说明。The process of hierarchical compression of model files will be described in detail below with reference to Figure 4.
如图4所示,图4示意性地示出了根据本说明书实施方式的一种3D模型分级压缩方法的交互流程图。As shown in Figure 4, Figure 4 schematically shows an interactive flow chart of a 3D model hierarchical compression method according to an embodiment of this specification.
仍以gltf格式的模型文件为例,对模型文件的压缩过程进行说明。Still taking the model file in gltf format as an example, the compression process of the model file will be explained.
3D模型的模型文件的压缩过程均在服务器端提前进行。服务器端可以包括进行分级压缩过程的工作区,实际对文件进行压缩的压缩工具,以及作为文件服务保存远程资源文件的媒体服务。The compression process of the 3D model model files is performed in advance on the server side. The server side can include a workspace that performs the hierarchical compression process, a compression tool that actually compresses the files, and a media service that saves the remote resource files as a file service.
Gltf格式的原始模型文件,以gltf文件,bin文件以及png文件分离保存的形式保存在媒体服务中。The original model file in Gltf format is saved in the media service in the form of gltf file, bin file and png file.
以下为工作区、压缩工具和媒体服务交互的形式进行分级压缩的详细过程:The following is the detailed process of hierarchical compression in the form of interaction between workspace, compression tool and media service:
步骤401:工作区向媒体服务请求原始模型文件;Step 401: The workspace requests the original model file from the media service;
步骤402:媒体服务接受请求,将gltf文件,bin文件以及png文件发送到工作;Step 402: The media service accepts the request and sends the gltf file, bin file and png file to the job;
步骤403:确定多个清晰度等级,以及配置各清晰度等级对应的压缩参数;Step 403: Determine multiple definition levels, and configure compression parameters corresponding to each definition level;
针对每个目标清晰度等级,进行以下步骤404-步骤412:For each target clarity level, the following steps 404 - 412 are performed:
步骤404:读取目标清晰度等级对应的压缩配置;Step 404: Read the compression configuration corresponding to the target definition level;
步骤405:将模型几何数据对应的压缩参数传入压缩工具;Step 405: Pass the compression parameters corresponding to the model geometry data to the compression tool;
步骤406:压缩工具将bin文件根据传入的压缩参数进行压缩,并将压缩后的bin文件返回到工作区;Step 406: The compression tool compresses the bin file according to the incoming compression parameters, and returns the compressed bin file to the workspace;
步骤407:将模型贴图数据对应的压缩参数传入压缩工具;Step 407: Pass the compression parameters corresponding to the model texture data into the compression tool;
步骤408:压缩工具将png文件根据传入的压缩参数进行压缩,并将压缩后的png文件返回到工作区;Step 408: The compression tool compresses the png file according to the incoming compression parameters, and returns the compressed png file to the workspace;
步骤409:将压缩后的bin文件和png文件上传到媒体服务;Step 409: Upload the compressed bin file and png file to the media service;
步骤410:媒体服务将bin文件和png文件的资源远程地址发送给工作区;Step 410: The media service sends the resource remote addresses of the bin file and png file to the workspace;
步骤411:更新gltf文件中bin文件和png文件对应的URL;Step 411: Update the URLs corresponding to the bin file and png file in the gltf file;
步骤412:将更新后的gltf上传到媒体服务。Step 412: Upload the updated gltf to the media service.
步骤413:删除工作区缓存文件。Step 413: Delete the workspace cache file.
在本说明书示出的一个的示意性的实施例中,还提供了一种3D模型分级压缩方法。In an exemplary embodiment shown in this specification, a 3D model hierarchical compression method is also provided.
请参见图5,图5是根据本说明书实施方式的一种3D模型分级压缩方法的流程图。该方法应用于处理设备,该处理设备可以为如图1所示的服务器11或电脑12-14等。Please refer to Figure 5. Figure 5 is a flow chart of a 3D model hierarchical compression method according to an embodiment of this specification. This method is applied to a processing device, which may be a server 11 or a computer 12-14 as shown in Figure 1.
该方法可以包括以下步骤:The method may include the following steps:
步骤502:获取3D模型对应的原始模型文件,并按照预设的多个清晰度等级针对所述原始模型文件进行分级压缩,得到与所述多个清晰度等级分别对应的模型文件。Step 502: Obtain the original model file corresponding to the 3D model, and perform hierarchical compression on the original model file according to multiple preset definition levels to obtain model files corresponding to the multiple definition levels.
在本说明示出的一个示意性的实施例中,所述模型文件包含模型主体文件和模型外部数据;其中,所述模型外部数据存储在服务端的文件服务中,所述模型主体文件中保存了所述模型外部数据对应的存储地址;In an illustrative embodiment shown in this description, the model file includes a model main file and model external data; wherein, the model external data is stored in the file service of the server, and the model main file saves The storage address corresponding to the external data of the model;
按照预设的多个清晰度等级针对所述原始模型文件进行分级压缩,得到与所述多个清晰度等级分别对应的模型文件,包括:Perform hierarchical compression on the original model file according to multiple preset definition levels to obtain model files corresponding to the multiple definition levels, including:
按照预设的多个清晰度等级分别针对所述模型外部数据进行分级压缩,并分别存储在服务端的文件服务中;Perform hierarchical compression on the external data of the model according to multiple preset definition levels, and store them in the file service on the server side respectively;
分别将与各清晰度等级对应的压缩后的模型外部数据的存储地址保存到所述3D模型对应的模型主体文件中,得到与所述多个清晰度等级分别对应的模型文件。The storage addresses of the compressed model external data corresponding to each definition level are respectively saved into the model main file corresponding to the 3D model, thereby obtaining model files corresponding to the plurality of definition levels respectively.
在本说明示出的一个示意性的实施例中,所述3D模型包括gltf格式的3D模型;In an illustrative embodiment shown in this description, the 3D model includes a 3D model in gltf format;
所述模型主体文件包括gltf模型文件;所述模型外部数据包括用于描述模型形状的模型几何数据,和/或,用于描述模型表面的模型贴图数据;The model main file includes a gltf model file; the model external data includes model geometry data used to describe the shape of the model, and/or model texture data used to describe the model surface;
所述按照预设的多个清晰度等级分别针对所述模型外部数据进行分级压缩,包括:The step of performing hierarchical compression on the external data of the model according to multiple preset definition levels includes:
按照预设的多个清晰度等级分别针对所述模型几何数据,和/或,所述模型贴图数据,进行分级压缩。The model geometric data and/or the model texture data are compressed hierarchically according to a plurality of preset definition levels.
在本说明示出的一个示意性的实施例中,所述模型几何数据包括用于描述所述3D模型对应的多边形网格结构的mesh数据。In an illustrative embodiment shown in this description, the model geometry data includes mesh data used to describe the polygon mesh structure corresponding to the 3D model.
在本说明示出的一个示意性的实施例中,针对所述模型几何数据进行压缩,包括:In an illustrative embodiment shown in this description, compression of the model geometry data includes:
将mesh数据包含的坐标数据,由使用浮点型数据描述,转换为使用整型数据进行描述,以实现压缩。The coordinate data contained in the mesh data is converted from floating point data to integer data to achieve compression.
在本说明示出的一个示意性的实施例中,针对所述模型几何数据进行压缩,包括:In an illustrative embodiment shown in this description, compression of the model geometry data includes:
将mesh数据包含的多边形网格中的相邻且夹角小于预设值的至少部分多边形网络进行合并,以实现压缩。Merge at least part of the adjacent polygonal networks in the polygonal meshes contained in the mesh data that have an angle smaller than the preset value to achieve compression.
在本说明示出的一个示意性的实施例中,所述模型贴图数据包括png格式的贴图文件;In an exemplary embodiment shown in this description, the model texture data includes a texture file in png format;
针对所述模型贴图数据进行压缩,包括以下一种或多种:Compression of the model texture data includes one or more of the following:
将所述png格式的贴图文件进行pngquant压缩,以实现压缩;Perform pngquant compression on the texture file in png format to achieve compression;
将所述png格式的贴图文件转换为jpg格式,以实现压缩;Convert the texture file in png format to jpg format to achieve compression;
将所述png格式的贴图文件转换为ktx2格式,以实现压缩。Convert the texture file in png format to ktx2 format to achieve compression.
步骤504:响应于用户客户端发送的针对所述3D模型的文件获取请求,确定与目标清晰度等级对应的目标模型文件;其中,所述目标清晰度等级为与所述用户客户端的运行环境对应的清晰度等级。Step 504: In response to the file acquisition request for the 3D model sent by the user client, determine the target model file corresponding to the target definition level; wherein the target definition level is corresponding to the running environment of the user client. clarity level.
在本说明示出的一个示意性的实施例中,所述文件获取请求包含与所述用户客户端的运行环境对应的运行环境参数;In an exemplary embodiment shown in this description, the file acquisition request includes running environment parameters corresponding to the running environment of the user client;
所述确定与目标清晰度等级对应的目标模型文件,包括:Determining the target model file corresponding to the target clarity level includes:
基于所述文件获取请求包含的运行环境参数确定与所述用户客户端对应的目标模型清晰度等级,并确定与目标清晰度等级对应的目标模型文件。The target model definition level corresponding to the user client is determined based on the running environment parameters included in the file acquisition request, and the target model file corresponding to the target definition level is determined.
所述文件获取请求包含由所述用户客户端确定出的与所述用户客户端的运行环境对应的目标清晰度等级的等级标识;The file acquisition request includes a level identifier of a target clarity level determined by the user client and corresponding to the running environment of the user client;
在本说明示出的一个示意性的实施例中,所述确定与目标清晰度等级对应的目标模型文件,包括In an exemplary embodiment shown in this description, determining the target model file corresponding to the target clarity level includes:
基于所述文件获取请求包含的所述等级标识确定与所述用户客户端对应的目标模型清晰度等级,并确定与目标清晰度等级对应的目标模型文件。The target model definition level corresponding to the user client is determined based on the level identifier included in the file acquisition request, and the target model file corresponding to the target definition level is determined.
上述目标清晰度等级,可以由用户客户端确定,也可以由与用户客户端对应的服务端进行确定。The above target clarity level can be determined by the user client or by the server corresponding to the user client.
当目标清晰度等级由客户端确定时,用户客户端向服务端发送的文件获取请求中包含由用户客户端确定的目标清晰度等级对应的等级标识;When the target clarity level is determined by the client, the file acquisition request sent by the user client to the server contains the level identifier corresponding to the target clarity level determined by the user client;
当目标清晰度等级由服务端确定时,用户客户端向服务端发送的文件获取请求中包含用于确定目标清晰度等级的上述用户客户端的运行环境对应的运行环境参数;When the target clarity level is determined by the server, the file acquisition request sent by the user client to the server contains the operating environment parameters corresponding to the operating environment of the user client used to determine the target clarity level;
当服务端接收到上述运行环境参数后,可以根据运行环境参数确定目标清晰度。After the server receives the above running environment parameters, it can determine the target clarity based on the running environment parameters.
在本说明示出的一个示意性的实施例中,所述运行环境参数包括:In an exemplary embodiment shown in this description, the operating environment parameters include:
所述用户客户端的网络性能参数;和/或,The network performance parameters of the user client; and/or,
所述用户客户端的设备性能参数。Device performance parameters of the user client.
步骤506:将所述目标模型文件返回给所述用户客户端,以使所述用户客户端加载获取到的所述目标模型文件,向用户展示所述3D模型。Step 506: Return the target model file to the user client, so that the user client loads the obtained target model file and displays the 3D model to the user.
对于3D模型的具体压缩方法,请参见上述实施例,此处不在进行具体赘述。For the specific compression method of the 3D model, please refer to the above embodiment, and will not be described in detail here.
在本说明书的示意性的实施例中,还提供了一种3D模型分级展示装置。请参见图6,图6是本说明书实施方式的3D模型分级展示装置的框图。In the illustrative embodiment of this specification, a 3D model hierarchical display device is also provided. Please refer to FIG. 6 , which is a block diagram of a 3D model hierarchical display device according to an embodiment of this specification.
与所述用户客户端对应的服务端维护了由所述3D模型对应的原始模型文件按照预设的多个清晰度等级,进行分级压缩后得到的与所述多个清晰度等级分别对应的模型文件;The server corresponding to the user client maintains the original model file corresponding to the 3D model according to multiple preset definition levels, and the models corresponding to the multiple definition levels are obtained after hierarchical compression. document;
所述装置可以包括以下组成单元:The device may include the following components:
确定单元610,用于响应于针对所述3D模型的模型展示请求,确定与所述用户客户端的运行环境对应的目标清晰度等级;Determining unit 610, configured to determine a target clarity level corresponding to the running environment of the user client in response to a model display request for the 3D model;
获取单元620,用于从所述服务端获取所述目标清晰度等级对应的目标模型文件;The obtaining unit 620 is used to obtain the target model file corresponding to the target definition level from the server;
加载单元630,用于加载获取到的所述目标模型文件,以向用户进行展示所述3D模型。The loading unit 630 is used to load the obtained target model file to display the 3D model to the user.
可选的,所述用户客户端的运行环境包括用户客户端的网络性能参数;Optionally, the operating environment of the user client includes network performance parameters of the user client;
所述确定单元610,具体用于:The determining unit 610 is specifically used for:
获取所述用户客户端的运行环境;Obtain the operating environment of the user client;
确定与所述运行环境对应的目标模型清晰度等级。Determine the target model clarity level corresponding to the operating environment.
可选的,所述用户客户端的运行环境还包括用户客户端的设备性能参数。Optionally, the running environment of the user client also includes device performance parameters of the user client.
可选的,所述模型清晰度等级包括:原画等级;Optionally, the model definition level includes: original painting level;
其中,所述原画等级对应的模型文件为未进行压缩的所述原始模型文件。Wherein, the model file corresponding to the original painting level is the original model file that has not been compressed.
可选的,所述装置还包括:Optionally, the device also includes:
重载单元640,用于:Overload unit 640 for:
确定所述模型文件加载失败的次数是否达到预设的阈值;Determine whether the number of failed loadings of the model file reaches a preset threshold;
如果所述模型文件加载失败的次数达到预设的阈值,重新确定目标清晰度等级为原画等级,并获取原画等级对应的模型文件;If the number of failed loadings of the model file reaches a preset threshold, re-determine the target clarity level as the original painting level, and obtain the model file corresponding to the original painting level;
加载获取到的所述原画等级对应的模型文件,以向用户进行展示所述待展示的3D模型。Load the obtained model file corresponding to the original painting level to display the 3D model to be displayed to the user.
可选的,所述模型文件包含模型主体文件和模型外部数据;其中,所述模型外部数据存储在服务端的文件服务中,所述模型主体文件中保存了所述模型外部数据对应的存储地址;Optionally, the model file includes a model main file and model external data; wherein the model external data is stored in the file service of the server, and the model main file stores the storage address corresponding to the model external data;
所述由所述3D模型对应的原始模型文件按照预设的多个清晰度等级,进行分级压缩后得到的与所述多个清晰度等级分别对应的模型文件,包括:The original model file corresponding to the 3D model is hierarchically compressed according to multiple preset definition levels, and the model files corresponding to the multiple definition levels obtained include:
由所述3D模型对应的原始模型主体文件,分别生成的与预设的多个清晰度等级对应的多个模型主体文件;其中,每个清晰度等级对应的模型主体文件中,分别保存了与清晰度等级对应的压缩后的模型外部数据的存储地址;所述压缩后的模型外部数据,由所述3D模型对应的原始模型外部数据基于与清晰度等级对应的预设的压缩参数进行分级压缩后得到。From the original model main file corresponding to the 3D model, multiple model main files corresponding to multiple preset definition levels are respectively generated; wherein, in the model main file corresponding to each definition level, the corresponding main model files are respectively saved. The storage address of the compressed model external data corresponding to the definition level; the compressed model external data is hierarchically compressed by the original model external data corresponding to the 3D model based on the preset compression parameters corresponding to the definition level. get later.
可选的,所述获取单元620,具体用于:Optionally, the acquisition unit 620 is specifically used for:
从所述服务端获取所述目标清晰度等级对应的模型主体文件;Obtain the model main file corresponding to the target clarity level from the server;
所述加载单元630,具体用于:The loading unit 630 is specifically used for:
基于获取到的所述模型主体文件中保存的存储地址,从所述服务端获取与所述模型主体文件对应的模型外部文件;Based on the obtained storage address saved in the model main file, obtain the model external file corresponding to the model main file from the server;
加载所述模型主体文件和所述模型外部文件,以向用户进行展示所述待展示的3D模型。Load the model main file and the model external file to display the 3D model to be displayed to the user.
可选的,所述3D模型包括gltf格式的3D模型;Optionally, the 3D model includes a 3D model in gltf format;
所述模型主体文件包括gltf模型文件;所述模型外部数据包括用于描述模型形状的模型几何数据,和用于描述模型表面的模型贴图数据;The model main file includes a gltf model file; the model external data includes model geometry data used to describe the shape of the model, and model texture data used to describe the model surface;
所述压缩后的模型外部数据,包括压缩后的模型几何数据,和压缩后的模型贴图数据。The compressed model external data includes compressed model geometry data and compressed model map data.
可选的,所述模型几何数据包括用于描述所述3D模型对应的多边形网格结构的mesh数据。Optionally, the model geometry data includes mesh data used to describe the polygon mesh structure corresponding to the 3D model.
可选的,所述压缩后的模型几何数据,包括:Optional, the compressed model geometry data includes:
将所述模型几何数据中的mesh数据包含的坐标数据,由使用浮点型数据描述,转化为使用整型数据进行描述,以实现压缩后的模型几何数据。The coordinate data contained in the mesh data in the model geometric data is converted from being described using floating point data to being described using integer data to achieve compressed model geometric data.
可选的,所述对所述模型几何数据进行压缩,包括:Optionally, compressing the model geometric data includes:
将所述模型几何数据中的mesh数据包含的多边形网格中的相邻且夹角小于预设值的至少部分多边形网络进行合并,以实现压缩后的模型几何数据。Merge at least part of the adjacent polygonal networks in the polygon meshes contained in the mesh data in the model geometry data and whose included angles are smaller than a preset value to achieve compressed model geometry data.
可选的,所述模型贴图数据包括png格式的贴图文件;Optionally, the model texture data includes texture files in png format;
所述压缩后的模型贴图数据,包括以下一种或多种:The compressed model map data includes one or more of the following:
将所述png格式的贴图文件进行pngquant压缩,以实现压缩后的模型贴图数据;Perform pngquant compression on the texture file in png format to achieve compressed model texture data;
将所述png格式的贴图文件转换为jpg格式,以实现压缩后的模型贴图数据;Convert the texture file in png format to jpg format to achieve compressed model texture data;
将所述png格式的贴图文件转换为ktx2格式,以实现压缩后的模型贴图数据。Convert the texture file in png format to ktx2 format to achieve compressed model texture data.
在本说明书的示意性的实施例中,还提供了一种3D模型分级压缩装置。请参见图7,图7是本说明书实施方式的3D模型分级压缩装置的框图。In the illustrative embodiment of this specification, a 3D model hierarchical compression device is also provided. Please refer to FIG. 7 , which is a block diagram of a 3D model hierarchical compression device according to an embodiment of this specification.
所述装置可以包括以下组成单元:The device may include the following components:
压缩单元710,用于获取3D模型对应的原始模型文件,并按照预设的多个清晰度等级针对所述原始模型文件进行分级压缩,得到与所述多个清晰度等级分别对应的模型文件;The compression unit 710 is used to obtain the original model file corresponding to the 3D model, and perform hierarchical compression on the original model file according to multiple preset definition levels to obtain model files corresponding to the multiple definition levels;
选择单元720,用于响应于用户客户端发送的针对所述3D模型的文件获取请求,确定与目标清晰度等级对应的目标模型文件;其中,所述目标清晰度等级为与所述用户客户端的运行环境对应的清晰度等级;The selection unit 720 is configured to respond to the file acquisition request for the 3D model sent by the user client, and determine the target model file corresponding to the target definition level; wherein the target definition level is the same as the target definition level of the user client. The clarity level corresponding to the operating environment;
返回单元730,用于将所述目标模型文件返回给所述用户客户端,以使所述用户客户端加载获取到的所述目标模型文件,向用户展示所述3D模型。The return unit 730 is used to return the target model file to the user client, so that the user client loads the obtained target model file and displays the 3D model to the user.
可选的,所述文件获取请求包含与所述用户客户端的运行环境对应的运行环境参数;Optionally, the file acquisition request includes running environment parameters corresponding to the running environment of the user client;
所述选择单元720,具体用于:The selection unit 720 is specifically used for:
基于所述文件获取请求包含的运行环境参数确定与所述用户客户端对应的目标模型清晰度等级,并确定与目标清晰度等级对应的目标模型文件。The target model definition level corresponding to the user client is determined based on the running environment parameters included in the file acquisition request, and the target model file corresponding to the target definition level is determined.
可选的,所述文件获取请求包含由所述用户客户端确定出的与所述用户客户端的运行环境对应的目标清晰度等级的等级标识;Optionally, the file acquisition request includes a level identifier of the target clarity level determined by the user client and corresponding to the running environment of the user client;
所述选择单元720,具体用于:The selection unit 720 is specifically used for:
基于所述文件获取请求包含的所述等级标识确定与所述用户客户端对应的目标模型清晰度等级,并确定与目标清晰度等级对应的目标模型文件。The target model definition level corresponding to the user client is determined based on the level identifier included in the file acquisition request, and the target model file corresponding to the target definition level is determined.
可选的,所述环境运行参数包括:Optionally, the environment operating parameters include:
所述用户客户端的网络性能参数;和/或,The network performance parameters of the user client; and/or,
所述用户客户端的设备性能参数。Device performance parameters of the user client.
可选的,所述模型文件包含模型主体文件和模型外部数据;其中,所述模型外部数据存储在服务端的文件服务中,所述模型主体文件中保存了所述模型外部数据对应的存储地址;Optionally, the model file includes a model main file and model external data; wherein the model external data is stored in the file service of the server, and the model main file stores the storage address corresponding to the model external data;
所述压缩单元710,具体用于:The compression unit 710 is specifically used for:
按照预设的多个清晰度等级分别针对所述模型外部数据进行分级压缩,并分别存储在服务端的文件服务中;Perform hierarchical compression on the external data of the model according to multiple preset definition levels, and store them in the file service on the server side respectively;
分别将与各清晰度等级对应的压缩后的模型外部数据的存储地址保存到所述3D模型对应的模型主体文件中,得到与所述多个清晰度等级分别对应的模型文件。The storage addresses of the compressed model external data corresponding to each definition level are respectively saved into the model main file corresponding to the 3D model, thereby obtaining model files corresponding to the plurality of definition levels respectively.
可选的,所述3D模型包括gltf格式的3D模型;Optionally, the 3D model includes a 3D model in gltf format;
所述模型主体文件包括gltf模型文件;所述模型外部数据包括用于描述模型形状的模型几何数据,和/或,用于描述模型表面的模型贴图数据;The model main file includes a gltf model file; the model external data includes model geometry data used to describe the shape of the model, and/or model texture data used to describe the model surface;
所述压缩单元710,具体用于:The compression unit 710 is specifically used for:
按照预设的多个清晰度等级分别针对所述模型几何数据,和/或,所述模型贴图数据,进行分级压缩。The model geometric data and/or the model texture data are compressed hierarchically according to a plurality of preset definition levels.
可选的,所述模型几何数据包括用于描述所述3D模型对应的多边形网格结构的mesh数据。Optionally, the model geometry data includes mesh data used to describe the polygon mesh structure corresponding to the 3D model.
可选的,所述压缩单元710,具体用于:Optionally, the compression unit 710 is specifically used for:
将所述mesh数据包含的坐标数据,由使用浮点型数据描述,转换为使用整型数据进行描述,以实现压缩。The coordinate data contained in the mesh data is converted from floating point data to integer data to achieve compression.
可选的,所述压缩单元710,具体用于:Optionally, the compression unit 710 is specifically used for:
将所述mesh数据包含的多边形网格中的相邻且夹角小于预设值的至少部分多边形网络进行合并,以实现压缩。Merge at least part of the polygonal networks contained in the mesh data that are adjacent and have an included angle smaller than a preset value to achieve compression.
可选的,所述模型贴图数据包括png格式的贴图文件;Optionally, the model texture data includes texture files in png format;
所述压缩单元710,具体用于以下一种或多种:The compression unit 710 is specifically used for one or more of the following:
将所述png格式的贴图文件进行pngquant压缩,以实现压缩;Perform pngquant compression on the texture file in png format to achieve compression;
将所述png格式的贴图文件转换为jpg格式,以实现压缩;Convert the texture file in png format to jpg format to achieve compression;
将所述png格式的贴图文件转换为ktx2格式,以实现压缩。Convert the texture file in png format to ktx2 format to achieve compression.
上述装置中各个单元的功能和作用的实现过程具体详见上述方法中对应步骤的实现过程,在此不再赘述。For details on the implementation process of the functions and effects of each unit in the above device, please refer to the implementation process of the corresponding steps in the above method, and will not be described again here.
对于装置实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到至少一个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本说明书方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。As for the device embodiment, since it basically corresponds to the method embodiment, please refer to the partial description of the method embodiment for relevant details. The device embodiments described above are only illustrative. The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they may be located in One location, or it can be distributed to at least one network unit. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution in this specification. Persons of ordinary skill in the art can understand and implement the method without any creative effort.
在本说明书的示例性实施例中,还提供了一种装置及其所应用的终端的实施例。In the exemplary embodiments of this specification, embodiments of a device and a terminal to which it is applied are also provided.
本说明书装置的实施例可以应用在计算机设备上,例如服务器或终端设备。装置实施例可以通过软件实现,也可以通过硬件或者软硬件结合的方式实现。以软件实现为例,作为一个逻辑意义上的装置,是通过其所在的处理器将非易失性存储器中对应的计算机程序指令读取到内存中运行形成的。从硬件层面而言,如图8所示,图8为本说明书实施方式的一种装置所在计算机设备80的一种硬件结构图,除了图8所示的处理器810、内存830、网络接口820、以及非易失性存储器840之外,实施例中装置所在的服务器或电子设备,通常根据该计算机设备的实际功能,还可以包括其他硬件,对此不再赘述。The embodiments of the apparatus in this specification can be applied to computer equipment, such as servers or terminal equipment. The device embodiments may be implemented by software, or may be implemented by hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, it is formed by reading the corresponding computer program instructions in the non-volatile memory into the memory and running it through its processor. From a hardware level, as shown in Figure 8, Figure 8 is a hardware structure diagram of a computer device 80 in which a device according to an embodiment of this specification is located. In addition to the processor 810, memory 830, and network interface 820 shown in Figure 8 , and non-volatile memory 840, the server or electronic equipment where the device in the embodiment is located may also include other hardware based on the actual functions of the computer equipment, which will not be described again.
在本说明书的示例性实施例中,还提供了一种计算机可读存储介质,其上存储有能够实现本说明书上述方法的程序产品。在一些可能的实施例中,本说明书的各个方面还可以实现为一种程序产品的形式,其包括程序代码,当所述程序产品在终端设备上运行时,所述程序代码用于使所述终端设备执行本说明书上述“示例性方法”部分中描述的根据本说明书各种示例性实施例的步骤。In an exemplary embodiment of this specification, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of this specification is stored. In some possible embodiments, various aspects of this specification can also be implemented in the form of a program product, which includes program code. When the program product is run on a terminal device, the program code is used to cause the The terminal device performs the steps according to various exemplary embodiments of this specification described in the above-mentioned "Exemplary Method" section of this specification.
根据本说明书的实施例用于实现上述方法的程序产品,其可以采用便携式紧凑盘只读存储器(CD-ROM)并包括程序代码,并可以在终端设备,例如个人电脑上运行。然而,本说明书的程序产品不限于此,在本文件中,可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。The program product used to implement the above method according to the embodiment of the present specification can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of this specification is not limited thereto. In this document, a readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus or device.
所述程序产品可以采用一个或至少一个可读介质的任意组合。可读介质可以是可读信号介质或者可读存储介质。可读存储介质例如可以为但不限于电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。可读存储介质的更具体的例子(非穷举的列表)包括:具有一个或至少一个导线的电连接、便携式盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。The program product may take the form of one or any combination of at least one readable medium. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: electrical connection with one or at least one conductor, portable disk, hard disk, random access memory (RAM), read only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了可读程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。可读信号介质还可以是可读存储介质以外的任何可读介质,该可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave carrying readable program code therein. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A readable signal medium may also be any readable medium other than a readable storage medium that can send, propagate, or transport the program for use by or in connection with an instruction execution system, apparatus, or device.
可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于无线、有线、光缆、RF等等,或者上述的任意合适的组合。Program code embodied on a readable medium may be transmitted using any suitable medium, including but not limited to wireless, wireline, optical cable, RF, etc., or any suitable combination of the foregoing.
可以以一种或多种程序设计语言的任意组合来编写用于执行本说明书操作的程序代码,所述程序设计语言包括面向对象的程序设计语言——诸如Java、C++等,还包括常规的过程式程序设计语言——诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算设备上执行、部分地在用户设备上执行、作为一个独立的软件包执行、部分在用户计算设备上部分在远程计算设备上执行、或者完全在远程计算设备或服务器上执行。在涉及远程计算设备的情形中,远程计算设备可以通过任意种类的网络,包括局域网(LAN)或广域网(WAN),连接到用户计算设备,或者,可以连接到外部计算设备(例如利用因特网服务提供商来通过因特网连接)。Program code for performing the operations of this specification may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., as well as conventional procedures programming language - such as "C" or a similar programming language. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server execute on. In situations involving remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device, such as provided by an Internet service. (business comes via Internet connection).
本申请所涉及的用户信息(包括但不限于用户设备信息、用户个人信息等)和数据(包括但不限于用于分析的数据、存储的数据、展示的数据等),均为经用户授权或者经过各方充分授权的信息和数据,并且相关数据的收集、使用和处理需要遵守相关国家和地区的相关法律法规和标准,并提供有相应的操作入口,供用户选择授权或者拒绝。The user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all authorized by the user or Information and data that have been fully authorized by all parties, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation portals for users to choose to authorize or refuse.
虽然本说明书包含许多具体实施细节,但是这些不应被解释为限制任何发明的范围或所要求保护的范围,而是主要用于描述特定发明的具体实施例的特征。本说明书内在至少一个实施例中描述的某些特征也可以在单个实施例中被组合实施。另一方面,在单个实施例中描述的各种特征也可以在至少一个实施例中分开实施或以任何合适的子组合来实施。此外,虽然特征可以如上所述在某些组合中起作用并且甚至最初如此要求保护,但是来自所要求保护的组合中的一个或至少一个特征在一些情况下可以从该组合中去除,并且所要求保护的组合可以指向子组合或子组合的变型。Although this specification contains many specific implementation details, these should not be construed to limit the scope of any invention or what is claimed, but rather serve primarily to describe features of specific embodiments of particular inventions. Certain features described in this specification in the context of at least one embodiment can also be combined in a single embodiment. On the other hand, various features that are described in a single embodiment can also be implemented in at least one embodiment separately or in any suitable subcombination. Furthermore, while features may function in certain combinations as described above and may even be originally claimed as such, one or at least one feature from a claimed combination may in some cases be removed from that combination and as claimed A protected combination can point to a subcombination or a variant of a subcombination.
类似地,虽然在附图中以特定顺序描绘了操作,但是这不应被理解为要求这些操作以所示的特定顺序执行或顺次执行、或者要求所有例示的操作被执行,以实现期望的结果。在某些情况下,多任务和并行处理可能是有利的。此外,上述实施例中的各种系统单元和组件的分离不应被理解为在所有实施例中均需要这样的分离,并且应当理解,所描述的程序组件和系统通常可以一起集成在单个软件产品中,或者封装成至少一个软件产品。Similarly, although operations are depicted in a specific order in the drawings, this should not be construed as requiring that the operations be performed in the specific order shown, or sequentially, or that all illustrated operations be performed to achieve desired results. result. In some cases, multitasking and parallel processing may be advantageous. Furthermore, the separation of various system units and components in the above embodiments should not be construed as requiring such separation in all embodiments, and it should be understood that the described program components and systems may generally be integrated together in a single software product , or packaged into at least one software product.
由此,主题的特定实施例已被描述。其他实施例在所附权利要求书的范围以内。在某些情况下,权利要求书中记载的动作可以以不同的顺序执行并且仍实现期望的结果。此外,附图中描绘的处理并非必需所示的特定顺序或顺次顺序,以实现期望的结果。在某些实现中,多任务和并行处理可能是有利的。Thus, specific embodiments of the subject matter have been described. Other embodiments are within the scope of the appended claims. In some cases, the actions recited in the claims can be performed in a different order and still achieve desirable results. Furthermore, the processes depicted in the figures do not necessarily require the specific order shown, or sequential order, to achieve desirable results. In some implementations, multitasking and parallel processing may be advantageous.
以上所述仅为本说明书的较佳实施例而已,并不用以限制本说明书,凡在本说明书的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本说明书保护的范围之内。The above are only preferred embodiments of this specification and are not intended to limit this specification. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of this specification shall be included in this specification. within the scope of protection.
Claims (21)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311232372.2A CN117274457A (en) | 2023-09-21 | 2023-09-21 | A 3D model hierarchical compression and display method, device, storage medium and equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311232372.2A CN117274457A (en) | 2023-09-21 | 2023-09-21 | A 3D model hierarchical compression and display method, device, storage medium and equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117274457A true CN117274457A (en) | 2023-12-22 |
Family
ID=89200323
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311232372.2A Pending CN117274457A (en) | 2023-09-21 | 2023-09-21 | A 3D model hierarchical compression and display method, device, storage medium and equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117274457A (en) |
-
2023
- 2023-09-21 CN CN202311232372.2A patent/CN117274457A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105263050B (en) | Mobile terminal real-time rendering system and method based on cloud platform | |
US8253732B2 (en) | Method and system for remote visualization client acceleration | |
CN102148818B (en) | Method and system for realizing distributed virtual reality and visualization on mobile device | |
US9865077B2 (en) | Redundant pixel mitigation | |
US20140139513A1 (en) | Method and apparatus for enhanced processing of three dimensional (3d) graphics data | |
CN112316433B (en) | Game picture rendering method, device, server and storage medium | |
US11948338B1 (en) | 3D volumetric content encoding using 2D videos and simplified 3D meshes | |
WO2022100663A1 (en) | Method, apparatus and device for selecting anti-aliasing algorithm and readable storage medium | |
CN113368492A (en) | Rendering method and device | |
CN118606396A (en) | A method, system, device and storage medium for high-dimensional data visualization rendering | |
CN116758201B (en) | Three-dimensional scene rendering processing method, equipment, system and computer storage medium | |
CN115238345A (en) | BIM (building information modeling) model processing method and device, storage medium and electronic device | |
CN116737852A (en) | Vector tile data-based vector drawing method and device and electronic equipment | |
CN111008934B (en) | Scene construction method, device, equipment and storage medium | |
CN114491352A (en) | Model loading method and device, electronic equipment and computer readable storage medium | |
CN114745570B (en) | Image rendering method, electronic device and storage medium | |
Terrace et al. | Unsupervised conversion of 3D models for interactive metaverses | |
US9183663B1 (en) | System for and method of classifying and translating graphics commands in client-server computing systems | |
CN114663566A (en) | Loading rendering processing method and system for three-dimensional model | |
US8203567B2 (en) | Graphics processing method and apparatus implementing window system | |
CN102239484B (en) | Improved command remoting techniques | |
CN117274457A (en) | A 3D model hierarchical compression and display method, device, storage medium and equipment | |
CN114904274B (en) | Cloud game screen rendering method, device, electronic device and storage medium | |
CN113992679B (en) | Automobile image display method, system and equipment | |
CN111243069B (en) | Scene switching method and system of Unity3D engine |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
TA01 | Transfer of patent application right | ||
TA01 | Transfer of patent application right |
Effective date of registration: 20241022 Address after: Room 1140, 11th Floor, No. 447 Nanquan North Road, China (Shanghai) Pilot Free Trade Zone, Pudong New Area, Shanghai, 200120 Applicant after: Whale Exploration Technology (Shanghai) Co.,Ltd. Country or region after: China Address before: Room 803, floor 8, No. 618 Wai Road, Huangpu District, Shanghai 200010 Applicant before: Ant blockchain Technology (Shanghai) Co.,Ltd. Country or region before: China |