Model processing method and apparatus, computer device, storage medium, and program product
Patent Information
- Application Number
- CN202211143406.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-20
- Publication Date
- 2026-09-25
- Estimated Expiration
- 2042-09-20
AI Technical Summary
但由于游戏引擎自带的减面功能或外部插件,通常设置固定的模型规格或处理规范,且开发过程中无法对游戏引擎本身的功能或者外部插件进行自定义修改,进而导致游戏引擎或外部插件提供的减面功能,无法完全贴合实际开发过程中得到的不同模型,进而针对各模型进行优化处理时,仍然存在模型破损变形、优化效果差的问题
[0043]上述模型处理方法、装置、计算机设备、存储介质和程序产品中,通过获取待优化模型的多个模型零件,并基于各模型零件进行重复零件识别处理,确定出外形相同的模型零件,以及确定外形相同的模型零件的点序号,进而将相同点序号的模型零件划分为同一零件类别,可快速确定出待优化模型中的重复零件,进而无需针对重复零件进行相同的实例化渲染以及减面优化处理操作,而是通过从每一零件类别下的各模型零件中,确定出与每一零件类别对应的目标零件,对目标零件进行原点回归处理,确定每一目标零件的原始位置,同时获取每一目标零件在原始位置上的原始零件点云数据,进而可基于原始零件点云数据进行实例化渲染,获得与目标零件对应的实例对象,由于是针对目标零件进行的实例化渲染处理和减面优化处理,而无需对重复出现的模型进行重复处理,可提升对待优化模型的渲染处理效率,减少系统资源占用。进一步地,通过对待优化模型中的符合减面优化处理条件的各实例对象,分别进行减面优化处理,以获得优化处理后的模型,实现了在保证模型本身完整的前提下,对符合减面优化处理条件的各实例对象进行减面优化处理,进一步减少各模型零件的对系统资源的占用,从而提升模型优化效果,减少项目开发对系统资源的占用。
Smart Images

Figure CN117786866B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a model processing method, apparatus, computer equipment, computer storage medium, and computer program product. Background Technology
[0002] With the development of computer technology and the widespread application of various online games, the requirements for game scenes and game performance are increasing day by day. As a result, it is necessary to iterate and develop games according to the actual needs of different users, including updating game scenes, adding game characters / levels, and developing new features.
[0003] During game development, game scenes contain a massive amount of data due to the models of different objects such as buildings, items, environments, and game characters. Therefore, updating game scenes usually requires a lot of system resources, and real-time rendering of game scenes is prone to problems such as rendering lag and slow transmission speed. Thus, it is necessary to reduce the use of system resources and improve the efficiency of game scene updates.
[0004] In traditional techniques, during game iterative development, the game engine's built-in polygon reduction function or existing external plugins are typically used to optimize the models of different objects in the game scene. However, because the game engine's built-in polygon reduction function or external plugins usually have fixed model specifications or processing standards, and the game engine's own functions or external plugins cannot be customized during development, the polygon reduction function provided by the game engine or external plugins cannot fully fit the different models obtained in the actual development process. As a result, when optimizing each model, problems such as model damage and deformation and poor optimization effects still exist. Summary of the Invention
[0005] Therefore, it is necessary to provide a model processing method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve the model optimization effect and reduce the system resource consumption of project development in order to address the above-mentioned technical problems.
[0006] Firstly, this application provides a model processing method. The method includes:
[0007] Obtain multiple model parts of the model to be optimized, and perform duplicate part identification processing based on each model part to determine the model parts with the same shape;
[0008] Determine the point number of the model parts with the same shape, and classify the model parts with the same point number into the same part category;
[0009] From each model part under each part category, determine the target part corresponding to each part category;
[0010] The target parts are subjected to origin regression processing to determine the original position of each target part, and the original part point cloud data of each target part at the original position is obtained.
[0011] Instantiated rendering is performed based on the original part point cloud data to obtain an instance object corresponding to the target part;
[0012] For each instance object in the model to be optimized that meets the conditions for surface reduction optimization, surface reduction optimization is performed to obtain the optimized model.
[0013] In one embodiment, before performing surface reduction optimization on each instance object in the model to be optimized that meets the surface reduction optimization conditions to obtain the optimized model, the method further includes:
[0014] If a boundary preservation operation triggered by each of the target parts is detected, the model boundary corresponding to the target part is obtained; a model boundary protection requirement is generated based on the model boundary and the boundary preservation operation, and the model boundary protection requirement is added to the surface reduction optimization processing requirement; the model boundary protection requirement is used to adjust the surface reduction ratio and protect the model boundary when performing surface reduction optimization processing.
[0015] Secondly, this application also provides a model processing apparatus. The apparatus includes:
[0016] The duplicate part identification and processing module is used to acquire multiple model parts of the model to be optimized, and to perform duplicate part identification processing based on each of the model parts to determine the model parts with the same shape.
[0017] The model parts classification module is used to determine the point number of model parts with the same shape and classify model parts with the same point number into the same part category;
[0018] The target part determination module is used to determine the target part corresponding to each of the model parts under each of the part categories;
[0019] The origin regression processing module is used to perform origin regression processing on the target parts, determine the original position of each target part, and obtain the original part point cloud data of each target part at the original position.
[0020] The instantiation rendering module is used to perform instantiation rendering based on the original part point cloud data to obtain an instance object corresponding to the target part;
[0021] The optimization processing module is used to perform surface reduction optimization processing on each instance object in the model to be optimized that meets the surface reduction optimization processing conditions, so as to obtain the optimized model.
[0022] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:
[0023] Obtain multiple model parts of the model to be optimized, and perform duplicate part identification processing based on each model part to determine the model parts with the same shape;
[0024] Determine the point number of the model parts with the same shape, and classify the model parts with the same point number into the same part category;
[0025] From each model part under each part category, determine the target part corresponding to each part category;
[0026] The target parts are subjected to origin regression processing to determine the original position of each target part, and the original part point cloud data of each target part at the original position is obtained.
[0027] Instantiated rendering is performed based on the original part point cloud data to obtain an instance object corresponding to the target part;
[0028] For each instance object in the model to be optimized that meets the conditions for surface reduction optimization, surface reduction optimization is performed to obtain the optimized model.
[0029] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:
[0030] Obtain multiple model parts of the model to be optimized, and perform duplicate part identification processing based on each model part to determine the model parts with the same shape;
[0031] Determine the point number of the model parts with the same shape, and classify the model parts with the same point number into the same part category;
[0032] From each model part under each part category, determine the target part corresponding to each part category;
[0033] The target parts are subjected to origin regression processing to determine the original position of each target part, and the original part point cloud data of each target part at the original position is obtained.
[0034] Instantiated rendering is performed based on the original part point cloud data to obtain an instance object corresponding to the target part;
[0035] For each instance object in the model to be optimized that meets the conditions for surface reduction optimization, surface reduction optimization is performed to obtain the optimized model.
[0036] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:
[0037] Obtain multiple model parts of the model to be optimized, and perform duplicate part identification processing based on each model part to determine the model parts with the same shape;
[0038] Determine the point number of the model parts with the same shape, and classify the model parts with the same point number into the same part category;
[0039] From each model part under each part category, determine the target part corresponding to each part category;
[0040] The target parts are subjected to origin regression processing to determine the original position of each target part, and the original part point cloud data of each target part at the original position is obtained.
[0041] Instantiated rendering is performed based on the original part point cloud data to obtain an instance object corresponding to the target part;
[0042] For each instance object in the model to be optimized that meets the conditions for surface reduction optimization, surface reduction optimization is performed to obtain the optimized model.
[0043] In the aforementioned model processing methods, apparatus, computer equipment, storage media, and program products, by acquiring multiple model parts of the model to be optimized and performing duplicate part identification processing based on each model part, model parts with the same shape are identified, and the point numbers of model parts with the same shape are determined. Then, model parts with the same point number are classified into the same part category. This can quickly identify duplicate parts in the model to be optimized, thus eliminating the need to perform the same instantiation rendering and polygon reduction optimization processing operations on duplicate parts. Instead, by identifying the target part corresponding to each part category from the model parts under each part category, performing origin regression processing on the target part, determining the original position of each target part, and acquiring the original part point cloud data of each target part at the original position, instantiation rendering can be performed based on the original part point cloud data to obtain the instance object corresponding to the target part. Since the instantiation rendering processing and polygon reduction optimization processing are performed on the target part, there is no need to repeat the processing of duplicate models, which can improve the rendering processing efficiency of the model to be optimized and reduce the system resource consumption. Furthermore, by performing face reduction optimization on each instance object in the model to be optimized that meets the face reduction optimization conditions, an optimized model is obtained. This achieves face reduction optimization on each instance object that meets the face reduction optimization conditions while ensuring the integrity of the model itself, thereby further reducing the system resource occupation of each model part, thus improving the model optimization effect and reducing the system resource occupation of project development. Attached Figure Description
[0044] Figure 1 This is a diagram illustrating the application environment of the model processing method in one embodiment;
[0045] Figure 2 This is a flowchart illustrating a model processing method in one embodiment;
[0046] Figure 3 This is a schematic diagram illustrating the loading of the model to be optimized in a game engine in one embodiment;
[0047] Figure 4 This is a schematic diagram of the structure of the model to be optimized in one embodiment;
[0048] Figure 5 This is a schematic diagram of model parts with the same shape in the model to be optimized in one embodiment;
[0049] Figure 6 This is a schematic diagram of the node network for identifying model parts with the same shape in one embodiment;
[0050] Figure 7 This is a schematic diagram of a node network used to determine the point numbers of model parts with the same shape in one embodiment.
[0051] Figure 8 This is a schematic diagram of a node network used in one embodiment to calculate random values for model parts with identical shapes;
[0052] Figure 9 This is a flowchart illustrating the process of determining the inverse matrix and orientation data corresponding to a model part with the same shape in one embodiment.
[0053] Figure 10 This is a schematic diagram of the inverse matrix corresponding to a model part with the same shape and the node network for orientation data, as shown in one embodiment.
[0054] Figure 11 This is a flowchart illustrating the process of obtaining an instance object corresponding to the target part in one embodiment.
[0055] Figure 12 This is a schematic diagram of the target part in the model to be optimized in one embodiment;
[0056] Figure 13 This is a schematic diagram of multiple sets of hierarchical parameters corresponding to each target part in the model to be optimized in one embodiment;
[0057] Figure 14 This is a schematic diagram illustrating the correspondence between target parts and multiple sets of hierarchical parameters in one embodiment.
[0058] Figure 15 This is a schematic diagram of an instance object corresponding to the target part in one embodiment;
[0059] Figure 16 This is a schematic diagram of the node network for obtaining the instance object corresponding to the target part in one embodiment.
[0060] Figure 17 This is a schematic diagram of the node network for determining the target parts corresponding to each part category in one embodiment;
[0061] Figure 18 This is a schematic diagram of the node network for performing origin regression processing and instantiation rendering processing on the target part in one embodiment;
[0062] Figure 19 This is a flowchart illustrating the process of obtaining the optimized model in one embodiment;
[0063] Figure 20 This is a schematic diagram of the node network of the optimized model obtained in one embodiment;
[0064] Figure 21 This is a flowchart illustrating the model processing method in another embodiment;
[0065] Figure 22This is a schematic diagram of a node network for model structure detection based on each target part in one embodiment;
[0066] Figure 23 This is a schematic diagram of the boundaries of model parts in the model to be optimized in one embodiment;
[0067] Figure 24 This is a flowchart illustrating the model processing method in another embodiment;
[0068] Figure 25 This is a structural block diagram of the model processing device in one embodiment;
[0069] Figure 26 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0070] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0071] The model processing method provided in this application relates to artificial intelligence (AI) technology. AI utilizes digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceiving the environment, acquiring knowledge, and using that knowledge to obtain optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce new intelligent machines that can react in a way similar to human intelligence. AI studies the design principles and implementation methods of various intelligent machines, enabling them to possess perception, reasoning, and decision-making capabilities. As a comprehensive discipline, AI technology involves a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly include computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0072] Computer vision (CV) is a science that studies how to enable machines to "see." More specifically, it refers to using cameras and computers to replace human eyes in recognizing, detecting, and measuring targets, and further processing images to create images more suitable for human observation or transmission to instruments. As a scientific discipline, computer vision studies related theories and technologies, attempting to build artificial intelligence systems capable of extracting information from images or multidimensional data. Computer vision technologies typically include image processing, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content / behavior recognition, 3D object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous localization and mapping (SLAM), and common biometric recognition technologies such as facial recognition and fingerprint recognition. Machine learning (ML) is a multidisciplinary field involving probability theory, statistics, approximation theory, convex analysis, and algorithm complexity theory. It specifically studies how computers can simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence (AI) and the fundamental way to endow computers with intelligence. Its applications span all areas of AI. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and instructional learning. With the research and advancement of AI technology, it is being researched and applied in multiple fields, such as smart homes, wearable devices, virtual assistants, smart speakers, smart marketing, autonomous driving, drones, robots, smart healthcare, and smart customer service. It is believed that with further technological development, AI will be applied in even more fields and play an increasingly important role.
[0073] The model processing method provided in this application specifically involves computer vision technology and machine learning technology in artificial intelligence, and can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or located in the cloud or on other network servers. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart vehicle devices, aircraft, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted devices, etc. Server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.
[0074] Furthermore, both terminal 102 and server 104 can be used independently to execute the model processing method provided in this embodiment, or they can work together to execute the model processing method provided in this embodiment. For example, taking the collaborative execution of the model processing method provided in this embodiment by terminal 102 and server 104 as an example, server 104 obtains multiple model parts of the model to be optimized, and performs duplicate part identification processing based on each model part to determine model parts with the same shape. The multiple model parts of the model to be optimized can be stored in the local storage of terminal 102, or in the cloud storage or data storage system of server 104. When model optimization processing is required, they are obtained from the local storage of terminal 102, the cloud storage of server 104, or the data storage system. Then, server 104 determines the point number of model parts with the same shape and classifies model parts with the same point number into the same part category, so as to determine the target part corresponding to each part category from the model parts under each part category. Furthermore, server 104 determines the original position of each target part by performing origin regression processing on the target parts, and obtains the original part point cloud data at the original position for each target part. Based on the original part point cloud data, server 104 performs instantiation rendering to obtain an instance object corresponding to the target part. After obtaining the instance object, server 104 can send the instance object to the game application of terminal 102 for display. Similarly, server 104 can further perform polygon reduction optimization processing on each instance object in the model to be optimized that meets the polygon reduction optimization processing conditions to obtain an optimized model. Likewise, server 104 can send the obtained optimized model to the game application of terminal 102 for display in different game scenes, game characters, etc.
[0075] In one embodiment, such as Figure 2 As shown, a model processing method is provided. This is illustrated using an example where the method is executed by a computer device. It can be understood that the computer device can be... Figure 1 The terminal 102 shown can also be a server 104, or a system composed of terminal 102 and server 104, and is implemented through interaction between terminal 102 and server 104. In this embodiment, the model processing method specifically includes the following steps:
[0076] Step S202: Obtain multiple model parts of the model to be optimized, and perform duplicate part identification processing based on each model part to determine the model parts with the same shape.
[0077] Specifically, the model to be optimized can be a game model to be optimized in different game scenarios, different game levels, or different game stages in a game development project. For example, the game environment (such as buildings, natural environment, plants and animals, etc.), game characters, and game props included in a certain game scenario.
[0078] For example, large-scale game development projects typically require building a massive number of game models to support the operation of the game application and provide game users with high-quality realistic scenes and game graphics. In order to reduce the consumption of system resources during the game development process, it is necessary to filter out duplicate game models in different scenarios to avoid consuming a lot of resources for repeated building and rendering operations.
[0079] Similarly, for multiple model parts of a game model in a specific game scene, since there are also duplicate model parts, it is also necessary to identify duplicate model parts to avoid consuming system resources to construct and render duplicate model parts in a game model, thereby further reducing resource consumption.
[0080] In one embodiment, such as Figure 3 The diagram illustrates loading a model to be optimized into an engine. Figure 3 It is known that by encapsulating the model to be optimized into HAD data (i.e., Houdini Digital Asset, which represents a reusable digital asset in 3D computer graphics software), and by calling the engine plugin that matches the game engine (such as Houdini Engine, which is the engine plugin for 3D computer graphics software), the HAD data obtained by encapsulating the model to be optimized is loaded into the game engine. Based on the game engine loading HAD data, optimization processing can be performed based on the loaded game model.
[0081] Specifically, for the loaded model to be optimized, each model part needs to be converted into a wireframe, and the total wireframe length corresponding to each model part needs to be obtained. Then, based on the total wireframe length, duplicate parts are identified, and model parts with the same total wireframe length are identified as model parts with the same shape. Each model part usually includes multiple edges, corresponding to multiple wireframes, so the length of each wireframe needs to be counted to obtain the total wireframe length.
[0082] To determine if model parts are identical, the first step is to check if their shapes are the same. This is done by converting each model part into a wireframe and calculating the total length of the wireframe for each part. Further, the total wireframe lengths of two model parts are compared. If they are identical, the two compared model parts are considered to have the same shape.
[0083] Similarly, for other model parts that have not undergone comparison processing, a pairwise comparison process also needs to be performed, that is, to identify multiple batches of model parts with the same wireframe length and multiple batches of model parts with the same shape. The unit of wireframe length can be meters, and the unit of the total wireframe length obtained is also meters.
[0084] In one embodiment, such as Figure 4 As shown, a schematic diagram of the structure of the model to be optimized is provided, referring to... Figure 4 It is known that for a game model to be optimized, such as a game model to be optimized in a specific game scene of a game development project, including multiple model parts that make up the game model to be optimized, including model parts with the same shape and other model parts with different shapes, in order to save system resources, it is necessary to further identify duplicate model parts to avoid repeatedly performing model building and rendering processing operations.
[0085] Furthermore, such as Figure 5 As shown, a schematic diagram of model parts with the same shape in the model to be optimized is provided, for reference. Figure 5 It is known that for the multiple model parts that constitute the game model to be optimized, further identification processing is needed to determine the model parts with the same shape. Specifically, for example... Figure 5 The multiple model parts indicated by arrows are model parts with the same shape.
[0086] The process of determining whether the shapes of each model part are the same, that is, the process of calculating the total wireframe length of each model part, is specifically completed by executing a foreach loop (that is, a loop that executes the traversal function), and the result of the loop calculation, that is, the total wireframe length (that is, the tolen value, the totallength value throughout), is cached in the detail (that is, the specific number used to return the event details) property.
[0087] In one embodiment, such as Figure 6 As shown, a schematic diagram of a node network for determining model parts with the same shape is provided. Figure 6It can be seen that by executing the first foreach loop, the total wireframe length of each model part is continuously calculated and stored, so as to further compare based on the total wireframe length and determine that the model parts with the same total wireframe length are model parts with the same shape.
[0088] Among them, reference Figure 6 As can be seen, the first foreach loop involves multiple processing nodes, which are provided by the Houdini application (i.e., 3D computer graphics software). These include the foreach_begin node (loop start node), the convertline node (used to convert model parts into wireframes), the measure node (calculation node, used to calculate the total length of the wireframes), the attribute promote node (attribute transfer node, used to convert attributes; the conversion process can take average, maximum, and minimum values, etc.), the attribwrangle node (attribute modification node, used to modify attributes, such as the pointer of the model part), the attribcopy node (attribute copy node, used to copy the attributes of the model part), the attribdelete node (attribute deletion node, used to delete the attributes of the model part), and the foreach_end node (loop end node).
[0089] Understandably, by executing the first foreach loop, the total wireframe length of each model part can be continuously calculated, so as to further determine the model parts with the same shape based on the total wireframe length of each model part.
[0090] Step S204: Determine the point number of model parts with the same shape, and classify model parts with the same point number into the same part category.
[0091] Specifically, by determining the inverse matrix corresponding to each model part with the same shape, and then performing origin regression processing on each model part with the same shape based on the inverse matrix, the original position of each model part with the same shape is determined. Further, by obtaining the center point of each model part with the same shape, and sequentially extracting any two points on each model part with the same shape, numerical calculations are performed based on the center point and a random vector generated from the two random points to generate a random value corresponding to each model part with the same shape. This random value is then fed back to the original position of the model part and determined as the point number of each model part with the same shape.
[0092] For model parts with identical shapes, further classification is required to identify those with the same point index. Specifically, for each model part with the same shape, the corresponding point vector needs to be further calculated to generate a random value that corresponds one-to-one with each model part with the same shape. This random value, as an attribute value, is calculated based on the vector characteristics of the model parts, after determining whether the total wireframe length is the same. If two model parts are completely identical—that is, they have the same shape and the same wiring—then the random values obtained for the two model parts will also be the same.
[0093] Furthermore, before calculating random values, it is necessary to obtain the inverse matrix corresponding to the model parts with the same shape. Specifically, this involves obtaining three adjacent points on the model part, calculating three mutually perpendicular vectors based on these three adjacent points, converting these three mutually perpendicular adjacent vectors into a matrix, and then converting the matrix into an inverse matrix, thus obtaining the inverse matrix corresponding to the model parts with the same shape. The purpose of the inverse matrix is to perform origin regression processing on the model parts, that is, to return the model parts to the origin, determining the original position of each model part with the same shape.
[0094] If the model parts are identical, the original positions of the two model parts after returning to the origin will be consistent, and the generated random values will also be the same. The reason for returning the random values to the original position of the model parts is that subsequent instantiation and rendering operations are required based on the point cloud data of the original model parts. Since the random values are calculated after the position is changed, it is necessary to return the random values to the original position of the model parts for application in subsequent operations.
[0095] In one embodiment, such as Figure 7 As shown, a node network diagram is provided for determining the point sequence numbers of model parts with the same shape. (Refer to...) Figure 7 It can be seen that by executing the second foreach loop, which iterates based on the determined attribute information tolen value (i.e., the total wireframe length), the second foreach loop further calculates the point vectors corresponding to each identically shaped model part based on the center point of the model part and two randomly selected points from the model part. This generates a random value corresponding to each identically shaped model part. Before calculating the random value, the inverse matrix corresponding to the identically shaped model part needs to be obtained, and the model parts are subjected to origin regression processing based on the inverse matrix to determine the original position of each identically shaped model part.
[0096] Among them, reference Figure 7 As can be seen, when looping based on the determined attribute information tolen value, i.e., the total wireframe length, the current second foreach loop also involves multiple processing nodes. These nodes are provided by the Houdini application (i.e., 3D computer graphics software), including the foreach_begin node (loop start node), the pointvop_set_orient node (origin regression processing node, used to perform origin regression processing on the model parts, so that the model parts return to the origin), the pointvop_set_check_value node (random numerical calculation node, used to calculate the random values corresponding to the model nodes, i.e., based on the center point of the model part and two points randomly selected from the model part, determine the model part point vector corresponding to each model part with the same shape, perform numerical calculation, and generate a random value corresponding to each model part with the same shape), the attribcopy node (attribute copy node, used to copy the attributes of the model parts, such as copying the random values of the model parts, i.e., the point number, to the original position of the model parts, so that the original part point cloud data of the target part at the original position can be determined later based on the point number and orientation data), and the foreach_end node (loop end node).
[0097] Understandably, by executing such Figure 7 The second foreach loop continuously calculates random values for each model part with the same shape, copies these random values back to the original location of the model part, and assigns each random value as the point number of each model part with the same shape. Further, after determining the point number of each model part with the same shape, a comparison process is performed based on these point numbers to identify model parts with the same point number and classify them into the same part category.
[0098] In one embodiment, such as Figure 8 As shown, a node network diagram is provided for calculating random values of model parts with the same shape. (Refer to...) Figure 8 It can be seen that inside the second foreach loop, for the model parts with the same shape determined by the tolen value, the center point of each of these model parts with the same shape is obtained, as well as two points randomly selected from each model part with the same shape. Based on the extracted center point and the two randomly selected points, the model part point vector corresponding to each model part with the same shape is calculated. Then, based on the model part point vector, numerical calculation is performed to obtain a random value corresponding to each model part with the same shape.
[0099] Among them, reference Figure 8As can be seen, several processing functions are used during random numerical calculations. These functions are provided by the Houdini application (i.e., 3D computer graphics software). Specifically, these include the `geometryvopglobal` function (used to provide the global variables needed, such as the position vector of the center point on the model part, or the position vectors of two randomly selected points during random numerical calculations), the `pointbbox` function (used to obtain the relative position of a given point), the `add` function (used for summation), the `divconst` function (used to divide the vector value of a given point by a preset constant), the `radom` function (used to generate random numbers), the `mulconst` function (used to multiply the vector value of a given point by a preset constant), and the `bind` function (used to increment the parameters of a given point). The functions include: parameter name, ptnum (to provide the point number of a given point), neighbornum (to represent the number of random points adjacent to the center point), neighborfile (to provide the nth neighbor point of a given point in a file of a given model part), importpoint (to retrieve the attribute values of points on an imported model part), subtract (to perform subtraction), normalize (to perform normalization), vecgetcompon (to input data), floor (to perform rounding), floattoint (to perform data format conversion), and geometryvopoutput (to output global variables).
[0100] It is understandable that the adoption Figure 8 The multiple processing functions shown can respectively obtain the center point of each model part with the same shape, and two points randomly selected from each model part with the same shape. Based on the extracted center point and the two randomly selected points, the point vector of each model part with the same shape is calculated. Further, based on the point vector of the model part, numerical calculation is performed to calculate a random value corresponding to each model part with the same shape, and the random value is determined as the point index of each model part with the same shape.
[0101] Step S206: Determine the target part corresponding to each part category from the model parts under each part category.
[0102] For each part category, a target part representing each part category needs to be determined from the multiple model parts included in the corresponding part category. That is, each part category corresponds to one target part. By performing subsequent rendering processing and polygon reduction optimization on the target part, the repetitive processing of the same or repeated model parts can be reduced, thus reducing the cumbersome processing process and the occupation of system resources.
[0103] Specifically, nested loops are obtained based on the tolen value generated by the first foreach loop and the checkvalue (i.e., random value) generated by the second foreach loop. Pack and instance operations (i.e., packaging and instantiation rendering operations) are performed within these nested loops. The first foreach loop calculates the tolen value and identifies model parts with the same shape based on it. Therefore, within the first foreach loop, the model parts have the same shape in each iteration. The second foreach loop is nested within the first foreach loop. That is, based on the identical shape of the model parts, the second foreach loop calculates the checkvalue (i.e., random value) and performs a second loop based on the checkvalue, determining which model parts with the same random value have the same point index.
[0104] It is understandable that among all the model parts in the nested loops obtained by the first and second foreach loops, the first model part in each loop is unique. This model part has the same shape and random value as the other parts in the loop. Specifically, it is the part representative used to generate the instance (i.e., the instance object) and is determined as the target part.
[0105] In this scenario, if a nested loop can include all model parts of the model to be optimized, then all model parts within that loop are identical. Only the target part determined in that loop needs to be instantiated, rendered, and optimized for reduced polygon count. However, if multiple nested loops are executed, the model parts in each loop are different. Each loop determines a target part, and based on the number of loops, an `id` attribute is set for the part category of each different model part. This means that the `id` value of model parts within each part category is the same.
[0106] Step S208: Perform origin regression processing on the target parts to determine the original position of each target part and obtain the original part point cloud data of each target part at the original position.
[0107] Specifically, before performing origin regression processing on the target parts, it is necessary to first determine the inverse matrix and orientation data corresponding to the model parts with the same shape. Then, after determining the inverse matrix and orientation data corresponding to the model parts with the same shape, origin regression processing is performed on the target parts based on the inverse matrix to determine the original position of each target part. Furthermore, based on the orientation data and the point sequence number of the target parts, the original part point cloud data of each target part at the original position is determined.
[0108] The subsequent instantiation and rendering process involves processing the original point cloud data of each target part at its original position. After processing the model part, a random value corresponding to that part is calculated. When applying this random value (i.e., the point number of the model part) to the subsequent instantiation and rendering process, the random value needs to be returned to the original position of the model part. Specifically, the inverse matrix needs to be determined first, and origin regression processing is performed on the target parts based on the inverse matrix to determine the original position of each target part. Then, the random value is returned to the original position of the model part. Further, based on the random value (i.e., the point number of the model part) and orientation data, the original point cloud data of each target part at its original position is determined, achieving the goal of instantiation and rendering based on the original point cloud data.
[0109] Step S210: Instantiate and render based on the original part point cloud data to obtain an instance object corresponding to the target part.
[0110] Since objects are composed of points, lines, and surfaces, a certain number of individual points can form point cloud data. Each point in the point cloud data can store a lot of information, such as its position in world space and its corresponding scaling ratio. Instantiated rendering refers to converting the original part's point cloud data into corresponding instance objects. Instantiation is an efficient method for generating a large number of 3D objects; during rendering, it replaces one object with another. For example, point instantiation generates point clouds in a game scene, and during rendering, these points are replaced with specific model objects, thus quickly creating a large number of copies of certain game models. For instance, if many points scattered on a surface represent a forest, in instantiated rendering, the scattered points are replaced with specific tree models to achieve the purpose of instantiated rendering and obtaining instance objects.
[0111] Specifically, by acquiring multi-level detail information of each target part in the model to be optimized, and determining multiple sets of hierarchical parameters corresponding to each target part based on the multi-level detail information, the game engine is then called to instantiate and render the original part point cloud data based on the multiple sets of hierarchical parameters, thereby obtaining the instance object corresponding to the target part.
[0112] Furthermore, Level of Detail (LOD) information can be understood as allocating rendering resources based on the object's position and importance in the display environment. This reduces the polygon count and detail of less important objects, resulting in more efficient rendering computation. For example, objects close to the user can have many details and a high polygon count, while objects far away can have fewer polygons to reduce rendering resource consumption. A game engine represents the core components of a pre-written, editable computer game system or interactive real-time graphics application. It provides various tools for game development, aiming to quickly develop game programs and avoid starting from scratch, thus improving development efficiency.
[0113] When performing instantiation rendering based on the Houdini engine (a 3D computer graphics software), the copy node provided by the Houdini engine is specifically called to generate instance objects. The copy node has pack and instance functions, allowing instantiation rendering based on the original part's point cloud data to obtain an instance object corresponding to the target part.
[0114] Step S212: Perform surface reduction optimization on each instance object in the model to be optimized that meets the surface reduction optimization conditions to obtain the optimized model.
[0115] Before performing surface reduction optimization on the model to be optimized, it is necessary to first identify instance objects that meet the surface reduction optimization conditions. This involves performing model structure detection on the target part, obtaining the model structure detection results, and identifying instance objects that meet the surface reduction optimization conditions based on the detection results. Then, surface reduction optimization is performed on the instance objects that meet the surface reduction optimization conditions to obtain the optimized model.
[0116] Similarly, before performing surface reduction optimization on the model to be optimized, it is also necessary to check whether there is a boundary preservation operation triggered on the target part, that is, to determine whether the model boundary of the target part needs to be preserved. If the model boundary of the target part needs to be preserved, the surface reduction ratio and the model boundary of the target part need to be adjusted during surface reduction optimization.
[0117] Specifically, based on multiple sets of hierarchical parameters and the connectivity between model parts in the model to be optimized, the surface reduction optimization method corresponding to each level of the instance objects that meet the surface reduction optimization conditions is determined. The surface reduction optimization method includes the surface reduction optimization requirements and the surface reduction ratio. Further, based on the surface reduction optimization method, surface reduction optimization is sequentially performed on each level of the instance objects that meet the surface reduction optimization conditions, resulting in multiple optimized instance objects. Then, based on these multiple optimized instance objects, the optimized model is obtained.
[0118] Furthermore, by nesting the polygon reduction optimization operation into the instantiation rendering process during instantiation rendering, and setting different LOD level parameters for each polygon reduction optimization operation (i.e., multiple sets of level parameters determined based on multi-level detail information), Houdini engine can automatically generate LOD objects (i.e., instance objects after polygon reduction optimization) when performing polygon reduction optimization in the game engine.
[0119] In the above model processing method, multiple model parts of the model to be optimized are obtained, and duplicate parts are identified based on each model part. Model parts with the same shape are identified, and their point numbers are determined. Model parts with the same point number are then classified into the same part category. This method can quickly identify duplicate parts in the model to be optimized, thus eliminating the need to perform the same instantiation rendering and polygon reduction optimization operations on duplicate parts. Instead, the method identifies the target part corresponding to each part category from the model parts under each part category, performs origin regression processing on the target part to determine the original position of each target part, and obtains the original part point cloud data of each target part at its original position. Instantiation rendering can then be performed based on the original part point cloud data to obtain the instance object corresponding to the target part. Since the instantiation rendering and polygon reduction optimization are performed on the target part, there is no need to repeat the processing of duplicate models, which can improve the rendering efficiency of the model to be optimized and reduce the system resource consumption. Furthermore, by performing face reduction optimization on each instance object in the model to be optimized that meets the face reduction optimization conditions, an optimized model is obtained. This achieves face reduction optimization on each instance object that meets the face reduction optimization conditions while ensuring the integrity of the model itself, thereby further reducing the system resource occupation of each model part, thus improving the model optimization effect and reducing the system resource occupation of project development.
[0120] In one embodiment, such as Figure 9 As shown, the steps for determining the inverse matrix and orientation data corresponding to model parts with the same shape include:
[0121] Step S902: Obtain any point of each model part with the same shape, and extract two adjacent points of any point on each model part with the same shape in sequence.
[0122] Specifically, when determining the inverse matrix corresponding to a model part with the same shape, it is necessary to obtain three adjacent points on the model part, and calculate three mutually perpendicular vectors based on the obtained three adjacent points, and then convert the three mutually perpendicular adjacent points into a matrix. Specifically, the three adjacent points to be obtained include any point on each model part with the same shape, and two adjacent points of that arbitrary point.
[0123] Step S904: Perform a cross product operation based on any point and any two adjacent points to generate model part point vectors corresponding to each model part with the same shape. Each model part corresponds to multiple model part point vectors.
[0124] Specifically, for any extracted point and any two adjacent points, the cross function (i.e., the cross product function) is used to perform a cross product operation on the extracted point and its two adjacent points to generate pairwise perpendicular model part point vectors. Specifically, based on three adjacent points, three pairwise perpendicular model part point vectors can be generated.
[0125] Step S906: Convert the point vectors of each model part into matrices corresponding to each model part with the same shape.
[0126] Specifically, for each obtained model part corresponding to a model part point vector, that is, three pairwise perpendicular model part point vectors, they are sequentially converted into matrices corresponding to each model part with the same shape. Each model part corresponds to a separate matrix.
[0127] Step S908: Perform an inverse transformation on the matrix to obtain the inverse matrix corresponding to each model part with the same shape, and obtain the orientation data corresponding to the point vector of the model part during the transformation process.
[0128] Specifically, by performing an inverse transformation on the matrix, the inverse matrix corresponding to each model part with the same shape can be obtained.
[0129] Furthermore, during the conversion process, it is necessary to obtain the orientation data corresponding to the point vectors of the model parts. The orientation data, or orientation attribute, is represented as a quaternion, which is obtained from matrix conversion and is specifically used to represent the orientation.
[0130] In one embodiment, such as Figure 10 As shown, a diagram illustrating the inverse matrix corresponding to a model part with the same shape and the node network diagram for orientation data is provided. Figure 10 As can be seen, determining the inverse matrix and orientation data involves several processing functions provided by the Houdini application (i.e., 3D computer graphics software). These functions may include the geometryvopglobal function (used to provide global variables that need to be applied, such as the position vectors of any point on the model part and its two adjacent points when determining the matrix), the ptnum function (used to provide the point number of a given point), the neighbornum function (used to represent the number of random points near the center point), the neighborfile function (used to provide the nth neighbor point of a given point in a file of a given model part), and the importpoint function (used to retrieve imported model parts). The functions include: attribute values of points on the model, subtract (for subtraction), normalize (for normalization), cross (for cross product), translate (for transformation and returning a transformation matrix), vectomatx (for converting vector values of points on the model part into matrix values), matxtoquat (for converting matrix values into quaternions, i.e., obtaining the orientation attribute value), multiply (for product), bind (for adding parameter names to parameters of given points), and geometryvopoutput (for outputting global variables).
[0131] Understandably, by adopting Figure 10 The multiple processing functions shown can obtain any point of each model part with the same shape, as well as two adjacent points of that arbitrary point. Based on the arbitrary point and its two adjacent points, a cross product operation is performed to generate model part point vectors corresponding to each model part with the same shape. Further, by sequentially converting each model part point vector into a matrix corresponding to each model part with the same shape, and then performing an inverse transformation on the matrices, the inverse matrix corresponding to each model part with the same shape is obtained. Simultaneously, during the transformation process, the orientation data corresponding to the model part point vectors is obtained.
[0132] In this embodiment, arbitrary points of each model part with the same shape are obtained, and two adjacent points of each arbitrary point on each model part with the same shape are extracted sequentially. Then, a cross product operation is performed based on the arbitrary point and the two adjacent points to generate model part point vectors corresponding to each model part with the same shape. Further, by converting each model part point vector into a matrix corresponding to each model part with the same shape, and performing an inverse transformation on the matrix, the inverse matrix corresponding to each model part with the same shape can be obtained. At the same time, the orientation data corresponding to the model part point vectors during the transformation process is obtained. This realizes the generation of the corresponding inverse matrix for each model part and the acquisition of orientation data during the transformation process. This allows for the rapid determination of the original position of the target part and the extraction of the original part point cloud data at the original position based on the inverse matrix and orientation data, further improving the efficiency of model optimization processing.
[0133] In one embodiment, such as Figure 11 As shown, the steps to obtain the instance object corresponding to the target part, that is, the steps to obtain the instance object corresponding to the target part by instantiating and rendering based on the original part point cloud data, specifically include:
[0134] Step S1102: Obtain multi-level information of each target part in the model to be optimized.
[0135] Among them, the level of detail information, or LOD information for short, can be understood as determining the resource allocation for object rendering based on the position and importance of the object model in the display environment, reducing the face count and detail of unimportant objects, thereby achieving high-efficiency rendering computation.
[0136] Specifically, when generating instance objects corresponding to target parts, it is first necessary to determine the rendering resource allocation for different target parts, as well as the face count and level of detail of the target parts. Then, it is necessary to obtain the multi-level detail information of each target part in the model to be optimized. This multi-level detail information of each target part in the model to be optimized can be provided in advance by developers or designers, or it can be adjusted and set according to the actual game project development needs. This aims to reduce the system resource consumption of non-critical object models while meeting the game project development requirements, thereby improving game project development efficiency.
[0137] In one embodiment, such as Figure 12 As shown, this is a schematic diagram illustrating the multi-level detail information of a target part in the model to be optimized. Figure 12It is known that by encapsulating the model to be optimized into HAD data and loading the HAD data obtained from the encapsulated model into the game engine by calling the engine plugin that matches the game engine, the duplicate parts can be identified based on the loaded HAD data, and each model part can be converted into an instance object (i.e., an instance object).
[0138] Specifically, refer to Figure 12 It is known that the HAD data loaded in the game engine can generate multiple instance objects. Multiple model parts under each part category correspond to one instance folder. That is, one instance folder contains multiple instance objects under the same part category.
[0139] For example, such as Figure 12 As shown, Figure 12 The instance folder marked in the box is instance1_328, which contains multiple instance objects. This instance folder corresponds to... Figure 12 The collection of instantiated pillar models, a subset of which is the instance object corresponding to each pillar, i.e., the multiple instance objects included in this instance file. Figure 12 Specifically, there are 8 instance objects, each corresponding to... Figure 12 The various column models in the model.
[0140] Step S1104: Based on the multi-level detail information, determine multiple sets of hierarchical parameters corresponding to each target part.
[0141] Specifically, different target parts have different levels of detail information, and therefore, based on this level of detail information, different sets of hierarchical parameters are determined for each target part. In particular, different sets of hierarchical parameters are set for each target part according to the actual game project development requirements.
[0142] For example, such as Figure 13 This diagram illustrates multiple sets of hierarchical parameters corresponding to each target part in a model. Figure 13 It can be seen that the value in the output box corresponding to the LOD level amount (i.e., the number of levels of detail information) is 5, so information from LOD0 to LOD4 is automatically generated, for a total of 5 LOD levels. Meanwhile, the polygon reduction information for each LOD level is specifically determined by the level parameter corresponding to the polygon reduction optimization method. For example, the level parameter lod_0settings corresponding to LOD0 is used to determine the polygon reduction information for LOD0. Similarly, for LOD1, LOD2, LOD3, and LOD4 (where LOD2, LOD3, and LOD4 are not included in the polygon reduction optimization method), the polygon reduction information is also determined. Figure 13(as shown in the image), the corresponding hierarchical parameters are lod_1settings, lod_2settings, lod_3settings, and lod_4settings respectively (where lod_2settings, lod_3settings, and lod_4settings are not shown in the image). Figure 13 (As shown in the image). It is understandable that the number of levels of multi-level detail information corresponds to the number of groups of level parameters; that is, when there are 5 levels of multi-level detail information, there are 5 groups of level parameters.
[0143] In one embodiment, such as Figure 14 This diagram illustrates the correspondence between a target part and multiple sets of hierarchical parameters. Figure 14 As you can see, the boxes indicate instances of multiple model parts within the same part category. Each instance has multiple sets of different LOD information, such as for a specific part category (i.e., Figure 14 If there are 3 model parts set under model_to_instance1_8 as shown, then there are 3 corresponding instance objects (including...). Figure 14 The model_to_instance 1_8_instance1 to model_to_instance 1_8_instance3 shown are examples. Additionally, each instance object has 5 levels of LOD information, including... Figure 14 The information shown is from lod0 to lod4.
[0144] Step S1106: Call the game engine and instantiate the original part point cloud data according to multiple sets of hierarchical parameters to obtain the instance object corresponding to the target part.
[0145] Among them, multiple sets of hierarchical parameters are determined based on multiple levels of detail information and correspond to different LOD levels. For example, each instance object has 5 levels of LOD information, including LOD0 to LOD4. Each level corresponds to its own hierarchical parameters. For example, LOD0 corresponds to the hierarchical parameters of LOD_0settings, and so on. Each LOD level has its own set of hierarchical parameters.
[0146] Specifically, by calling a game engine, such as a pre-written editable computer game system or the core components of an interactive real-time graphics application, and using the development tools provided by the system or component, combined with multiple sets of hierarchical parameters, the original part point cloud data is instantiated and rendered according to different hierarchical parameters to obtain instance objects corresponding to the target part. During the instantiation rendering process, the resource allocation for object rendering is determined based on the object model's position and importance in the display environment (i.e., multiple sets of hierarchical parameters). This reduces the face count and detail of less important objects, thereby achieving high-efficiency rendering computation and improving the efficiency of instantiation rendering processing.
[0147] In one embodiment, such as Figure 15 As shown, a schematic diagram of an instance object corresponding to the target part is provided. Figure 15 As can be seen, for the instance objects corresponding to each target part, taking the set of pillar models in the actual game scene as an example for explanation, refer to... Figure 15 The instantiated column shown has multiple levels of LOD information, including LOD0 to LOD4, as well as the level parameters of each level of LOD information and the proportion of each level of LOD information (e.g., the proportion corresponding to LOD0 is 100%, the proportion corresponding to LOD1 is 83%, the proportion corresponding to LOD2 is 67%, the proportion corresponding to LOD3 is 50%, and the proportion corresponding to LOD4 is 33%).
[0148] In one embodiment, such as Figure 16 As shown, a node network diagram for obtaining an instance object corresponding to a target part is provided. (Refer to...) Figure 16 It can be seen that a nested loop is provided, consisting of a first foreach loop, a second foreach loop, and a third foreach loop. The purpose of the first foreach loop is to calculate the tolen value and determine the model parts with the same shape based on the tolen value. The second foreach loop is nested inside the first foreach loop. That is, the second foreach loop calculates the checkvalue (i.e., random value) based on the model parts with the same shape and performs a second loop based on the checkvalue. That is, it determines which model parts with the same shape have the same random value and determines the model parts with the same point number.
[0149] Within the second foreach loop, after identifying model parts with the same point number, the model parts with the same shape are categorized according to their point number, resulting in different part categories and multiple model parts included in each category. Further, from these multiple model parts in different part categories, a target part representing each part category is selected. Similarly, within the first foreach loop, a third foreach loop is nested. By executing the third foreach loop, the orientation data corresponding to the target part can be determined.
[0150] Specifically, after obtaining the target parts through the second foreach loop, the first foreach loop further performs origin regression processing on the target parts based on the inverse matrix to determine the original position of each target part, thus returning the target parts to the origin. By obtaining the point index of the target parts, and using the orientation data determined by the third foreach loop, the original point cloud data of each target part at its original position is determined. Finally, by instantiating and rendering the original point cloud data, an instance object corresponding to the target part can be obtained.
[0151] Among them, reference Figure 16 It can be seen that during instantiation rendering, the polygon reduction optimization operation can be nested into the instantiation rendering process. That is, during the execution of the first foreach loop, the function of calling the corresponding processing node to perform polygon reduction optimization can also be achieved. This allows each instance object in the model to be optimized that meets the polygon reduction optimization conditions to be optimized separately, and the optimized model can be obtained.
[0152] Furthermore, referring to Figure 16As can be seen, the second foreach loop nested within the first foreach loop involves multiple processing nodes. These nodes are provided by the Houdini application, including the foreach_begin node (loop start node), the connectivity_class node (connectivity calculation node, used to calculate the connectivity between model parts in the model to be optimized; that is, if model parts are connected, they have the same class attribute; it can be used as the loop condition for the second foreach loop nested within the first foreach loop, i.e., determining whether to execute the second foreach loop based on the class attribute), the attribwrangle_set_id node (attribute modification node, used to set the id value of different model part categories according to the number of loops), the attribwrangle_get_single_one node (target part filtering node, used to filter out the target part of each part category from each loop; that is, since the second foreach loop nested within the first foreach loop is executed based on random values, the first part entering the second foreach loop nested within the loop can be determined as the target part), the attribdelete node (attribute deletion node, used to delete the attributes of model parts), and the foreach_end node (loop end node).
[0153] Understandably, based on the second foreach loop, random values can be determined as the point number of each model part with the same shape, model parts with the same point number can be filtered out, and model parts with the same point number can be divided into the same part category. By further calling the attribwrangle_set_id node and the attribwrangle_get_single_one node, the target part of each model part category can be determined.
[0154] Before performing instantiation rendering, it is necessary to determine the inverse matrix and orientation data corresponding to the model parts with the same shape. Based on the inverse matrix and orientation data, the original part point cloud data of the target part at its original position is determined, so as to perform instantiation rendering on the original part point cloud data. Then, after determining the target part for each model part category, based on the multiple processing nodes involved in the first foreach loop, including: foreach_begin node (loop start node), blast node (used to obtain the target part corresponding to each model part category determined in the second foreach loop), tansformbyattrib node (used to perform origin regression processing on the target part based on the inverse matrix to determine the original position of each target part and return the target part to the origin), attribdelete node (attribute deletion node, used to delete the attributes of the model part), groupdelete node (group deletion node, used to delete the groups in the loop process), copytopoints node (copy node, used to copy the target part at the original position to the model part with the determined orientation data, that is, based on the point number of the model part and the orientation data, further determine the original part point cloud data of the target part with the corresponding point number at the original position), attribwrangle_store_iter_for_debug node (used to modify the attribute information returned by the debug iterator), and foreach_end node (loop end node), the original part point cloud data is instantiated and rendered to obtain the instance object corresponding to the target part.
[0155] Furthermore, in response to the requirement of nesting the polygon reduction optimization operation into the instantiation rendering process, the first foreach loop also includes a generate_lod node (used to perform polygon reduction optimization). By calling the generate_lod node, instance objects that meet the polygon reduction optimization conditions are identified. Based on multiple sets of hierarchical parameters and the connectivity between the model parts in the model to be optimized, the polygon reduction optimization method corresponding to each level of the instance objects that meet the polygon reduction optimization conditions is determined. Then, according to the determined polygon reduction optimization method, polygon reduction optimization is performed on each level of the instance objects that meet the polygon reduction optimization conditions in sequence to obtain multiple optimized instance objects.
[0156] Similarly, refer to Figure 16As can be seen, the third foreach loop nested within the first foreach loop involves multiple processing nodes, also provided by the Houdini application. These nodes include: the foreach_begin node (loop start node), the delete node (used to obtain the model part corresponding to the point number based on the point number of the model part), the attribute promote node (attribute transfer node, used to transform attributes, i.e., to transfer the attributes of the model part to the points entering the loop, i.e., the points entering the loop have the attributes of the model part), the attribcopy node (attribute copy node, used to copy the attributes of the model part, for example, to copy the attributes of the points entering the loop to the points used for instantiation rendering, for subsequent instantiation rendering based on the attributes and the determined original part point cloud data), and the foreach_end node (loop end node). Specifically, by executing the third foreach loop, the orientation data corresponding to the target part can be determined, and the point number of the target part corresponding to the determined orientation data can be obtained simultaneously.
[0157] In one embodiment, such as Figure 17 As shown, a node network diagram is provided to determine the target part corresponding to each part category. (Refer to...) Figure 17 It can be seen that the second foreach loop is nested inside the first foreach loop. The purpose of the first foreach loop is to calculate the tolen value and determine the model parts with the same shape based on the tolen value. The second foreach loop, based on the model parts with the same shape, calculates the checkvalue (i.e., random value) and performs a second loop based on the checkvalue. That is, it determines which model parts with the same shape have the same random value. Model parts with the same random value are determined as model parts with the same point number. After determining the model parts with the same point number, the model parts with the same shape are classified according to the point number to obtain different part categories and multiple model parts included in each part category. Further, from the multiple model parts under different part categories, the target part used to represent each part category is selected.
[0158] Specifically, the second foreach loop includes multiple processing nodes. By calling these nodes, the target part is determined. These include the `attribwrangle_get_single_one` node, which filters the target parts. Specifically, by calling the `attribwrangle_get_single_one` node, the target part for each part category can be selected from each iteration. It can be understood that since the second foreach loop, nested within the first foreach loop, executes based on random values, the first part entering the nested second foreach loop can be identified as the target part. It also includes the `attribwrangle_set_id` node, which sets the ID value for different model part categories based on the number of iterations in the second foreach loop. In other words, by calling the `attribwrangle_set_id` node, the ID value for different model part categories can be set according to the number of iterations in the second foreach loop.
[0159] In the second foreach loop based on the checkvalue (i.e., a random value), subsequent instantiation and rendering operations are performed based on the id value provided in each loop. Different model part categories correspond to different id values, and when the id values are different, instantiation and rendering are performed separately for each part category. For example, if the model parts entering the second foreach loop include three different part categories, each with its own id value, then the three part categories correspond to three id values, requiring three loops to determine the target part for each part category. Subsequent instantiation and rendering operations are then performed separately for each target part.
[0160] In one embodiment, such as Figure 18 As shown, a schematic diagram of a node network is provided for performing origin regression processing and instantiation rendering processing on a target part. (Refer to...) Figure 18 As can be seen, since the second foreach loop is nested inside the first foreach loop, after obtaining the target part through the second foreach loop, the first foreach loop further performs origin regression processing on the target part based on the inverse matrix to determine the original position of each target part, thus returning the target part to the origin. By obtaining the point index of the target part, and using the orientation data determined by the third foreach loop, the original point cloud data of each target part at its original position is determined. Finally, by instantiating and rendering the original point cloud data, the instance object corresponding to the target part can be obtained.
[0161] Specifically, in the first foreach loop, multiple processing nodes are called to perform origin regression processing on the target parts and to instantiate and render the original point cloud data of the target parts. This includes: obtaining the target part blast node corresponding to each model part category determined in the second foreach loop; the tansformbyattrib node for performing origin regression processing on the target parts, that is, by calling the tansformbyattrib node, the origin regression processing of the target parts can be performed according to the inverse matrix to determine the original position of each target part and return the target parts to the origin; and the copytopoints node for copying the target parts at the original positions to the model parts with determined orientation data, that is, by calling the copytopoints node, the original point cloud data of the target parts with the corresponding point numbers can be further determined at the original positions according to the point numbers of the model parts and the orientation data.
[0162] Furthermore, in response to the need to nest the polygon reduction optimization operation into the instantiation rendering process, the first foreach loop also includes a generate_lod node for performing polygon reduction optimization. By calling the generate_lod node, instance objects that meet the polygon reduction optimization conditions can be identified, and polygon reduction optimization is performed on each level of the instance objects that meet the polygon reduction optimization conditions according to the polygon reduction optimization method corresponding to the instance objects, thereby obtaining multiple optimized instance objects.
[0163] Similarly, refer to Figure 18 As can be seen, the third foreach loop nested within the first foreach loop involves multiple processing nodes, including: a delete node for deleting model parts, an attributeepromote node for transferring the attributes of model parts, and an attribcopy node for copying the attributes of model parts. It can be understood that by executing the third foreach loop, the orientation data corresponding to the target part can be determined, and simultaneously, the point number of the target part corresponding to the determined orientation data can be obtained.
[0164] In this embodiment, multi-level detail information of each target part in the model to be optimized is obtained, and multiple sets of hierarchical parameters corresponding to each target part are determined based on this information. Then, by calling the game engine, the original part point cloud data is instantiated and rendered according to the multiple sets of hierarchical parameters to obtain instance objects corresponding to the target parts. This allows for flexible multi-level rendering of target parts based on multiple sets of hierarchical parameters determined by different levels of detail information, rather than being limited to a single rendering method. It can ensure the realistic effect of the rendered instance objects while reducing the allocation of rendering resources to unimportant model parts, further reducing the occupation of system resources during project development.
[0165] In one embodiment, such as Figure 19 As shown, the steps to obtain the optimized model, namely, to perform surface reduction optimization on each instance object in the model to be optimized that meets the surface reduction optimization conditions, and to obtain the optimized model, specifically include:
[0166] Step S1902: Based on multiple sets of hierarchical parameters and the connectivity between model parts in the model to be optimized, determine the surface reduction optimization method corresponding to each level of the instance object that meets the surface reduction optimization conditions.
[0167] The polygon reduction optimization process includes polygon reduction requirements and reduction ratios. Specific requirements include whether polygon reduction optimization is needed, not needed, model boundaries need to be protected, or not. The reduction ratio represents the degree of polygon reduction optimization for different target parts, or the specific number of polygons to be reduced at different levels of different target parts. For example, if a certain level of a model part needs to reduce its polygon count to 50% of its original size, and that level has 10 polygons, then the number of polygons after optimization is 5, and the reduction is 5. The reduction ratios for different model parts at different levels can be adjusted according to actual project development needs and are not limited to specific values.
[0168] Specifically, to avoid damage to the model and its parts during polygon reduction optimization, polygon reduction is performed during the instantiation and rendering loop based on the connectivity between the model parts. Simultaneously, based on multiple sets of hierarchical parameters corresponding to different target parts and the connectivity between model parts, the polygon reduction optimization method for each level of the instance object that meets the conditions for polygon reduction optimization is determined. In particular, polygon reduction optimization based on connectivity can preserve the details of small parts, preventing damage to the shape of the model parts when the polygon reduction ratio is too high.
[0169] In one embodiment, during the instantiation and rendering loop, while performing polygon reduction optimization based on the connectivity between model parts in the model to be optimized, developers are provided with the option to retain model boundaries. Specifically, if a boundary retention operation triggered by each target part is detected, the model boundary corresponding to the target part is obtained, and a model boundary protection requirement is generated based on the model boundary and the boundary retention operation. This model boundary protection requirement is then added to the polygon reduction optimization requirement so that subsequent polygon reduction optimization can be performed based on the model boundary protection requirement to avoid damaging the model boundaries.
[0170] Step S1904: Based on the face reduction optimization method, face reduction optimization is performed on each level of the instance objects that meet the face reduction optimization conditions in sequence to obtain multiple optimized instance objects.
[0171] The surface reduction optimization process includes surface reduction optimization requirements and surface reduction ratios. Surface reduction optimization requirements specifically include whether surface reduction optimization is required, whether surface reduction optimization is not required, whether model boundaries need to be protected, and whether model boundaries do not need to be protected. The surface reduction ratio represents the degree of surface reduction optimization for different target parts, or the specific number of surfaces to be reduced for different levels of different target parts.
[0172] Specifically, based on the polygon reduction optimization method, such as when polygon reduction optimization is required or when model boundaries need to be protected, a specific polygon reduction ratio is obtained. Based on this ratio, polygon reduction optimization is performed on each level of the instance object that meets the optimization conditions. For example, the polygon reduction ratio for the first level of the instance object that meets the optimization conditions is 20%, the ratio for the second level is 50%, and so on. Other levels also have their own polygon reduction ratios. This achieves flexible and rapid polygon reduction optimization of instance objects, ensuring realistic effects in actual game scenes while minimizing the number of polygons at different levels, thereby reducing the consumption of system resources during project development.
[0173] Step S1906: Obtain the optimized model based on the multiple optimized instance objects.
[0174] Specifically, by performing face reduction optimization on instance objects corresponding to different target parts, and simultaneously performing face reduction optimization on other model parts in the same part category as the target parts, a comprehensive optimization process is achieved for the model to be optimized, so as to obtain the optimized model.
[0175] The optimized models can specifically be optimized game models that can be used in specific game scenes of specific game development projects. For example, optimized building models, animal and plant models, and environmental models can be used in actual game scenes to provide game users with high-quality game graphics with low system resource consumption.
[0176] In one embodiment, such as Figure 20 As shown, a schematic diagram of the node network for obtaining the optimized model is provided. Figure 20 It can be seen that, for each instance object in the model to be optimized that meets the conditions for surface reduction optimization, the following call is made: Figure 20 The multiple processing nodes shown perform polygon reduction optimization to obtain optimized instance objects. These processing nodes specifically include: the `group_del_maskgrp` node (used to determine whether to use a mask object, i.e., whether a mask needs to be used to pre-process the model parts, such as covering a certain area of the input model part), the `foreach_begin` node (loop start node), the `polyreduce` node (node used for polygon reduction optimization, performing polygon reduction optimization on different levels of the model part; this needs to be executed multiple times, reducing the model part from high-poly to low-poly, reducing resource consumption), the `switch` node (switch node, used to switch between different input model parts that need optimization), the `merge` node (merge instance objects that need polygon reduction optimization and those that don't, to obtain the complete optimized model), the `null` node (node used to declare global variables), the `delete` node (delete node), and the `foreach_end` node (loop end node), etc.
[0177] Among them, reference Figure 20 It can be seen that by calling multiple processing nodes involved, it is possible to determine whether an instance object needs to undergo surface reduction optimization. Based on multiple sets of hierarchical parameters corresponding to different target parts and the connectivity between model parts, the surface reduction optimization method corresponding to each level of the instance object that meets the surface reduction optimization conditions is determined. Then, based on the surface reduction optimization method, surface reduction optimization is performed on each level of the instance object that meets the surface reduction optimization conditions in sequence to obtain multiple optimized instance objects.
[0178] Furthermore, targeting Figure 20The `group_del_maskgrp` node provides a mask object input interface based on whether a mask object is needed. Based on this interface, basic objects such as boxes created in the engine can be directly called. The region enclosed by the called basic object is determined based on the developer's dragging operations. Then, polygon reduction optimization is performed based on this region. This achieves the goal of polygon reduction optimization based on multiple model parts in the region, without having to perform polygon reduction optimization for each different model part individually.
[0179] In this embodiment, based on multiple sets of hierarchical parameters and the connectivity between model parts in the model to be optimized, the polygon reduction optimization method corresponding to each level of the instance object that meets the polygon reduction optimization conditions is determined. This includes the polygon reduction optimization requirements and the polygon reduction ratio. Then, based on the determined polygon reduction optimization method, polygon reduction optimization is performed sequentially on each level of the instance object that meets the polygon reduction optimization conditions, resulting in multiple optimized instance objects. Finally, the optimized model can be obtained from these multiple optimized instance objects. This achieves fast and flexible polygon reduction optimization for different instance objects, ensuring the realistic effect of the instance objects in the actual game scene while reducing the number of polygons at different levels, thereby reducing the consumption of system resources during project development.
[0180] In one embodiment, such as Figure 21 As shown, a model processing method is provided, which specifically includes the following steps:
[0181] Step S2102: Perform model structure detection based on each target part, and generate structure detection results that correspond one-to-one with each target part.
[0182] Before performing surface reduction optimization on the instance object of the target part, it is necessary to perform model structure detection on the target part to determine whether the target part is the simplest model. If the target part is the simplest model, there is no need to perform further surface reduction optimization. If surface reduction optimization is performed on the simplest model, it will change the original shape of the model part and cause the model to break.
[0183] Specifically, by performing model structure detection on the target part, generating a structure detection result corresponding to the target part, and then determining whether the target part is a simplified model based on the detection result. Here, the simplified model can be understood as the model part being a single facet. In more detail, it determines whether the model part is in the form of a facet to determine whether the model part can undergo facet reduction optimization.
[0184] If a model part is a facet, the number of adjacent points of any point on the model part does not exceed a preset threshold. In this embodiment, the preset threshold is set to 5. That is, if the number of adjacent points of any point on the model part does not exceed 5, it indicates that the model part is a facet and belongs to the simplest model. Therefore, no further facet reduction optimization is needed, and it needs to be separated out as a part that does not need facet reduction optimization.
[0185] Furthermore, if the structural inspection results determine that the model part does not belong to the simplest model, it indicates that the model part can be further optimized by reducing its surface area. Then, the instance object corresponding to the target part that needs to be optimized by reducing its surface area can be determined as an instance object that meets the conditions for optimization by reducing its surface area.
[0186] Step S2104: If, based on the structural detection results, it is determined that the number of adjacent points of any point on the target part is less than a preset threshold, the surface reduction optimization requirement of the target part is determined to be that surface reduction optimization is not required, and the target part that does not require surface reduction optimization is separated from the model to be optimized.
[0187] Specifically, by performing model structure detection on the target part, the corresponding structure detection results are obtained. When the number of adjacent points of any point on the target part is less than a preset threshold, it indicates that the target part is the simplest model and does not need further surface reduction optimization. The target part that does not need surface reduction optimization is separated from the model to be optimized and stored separately as a part that does not need surface reduction optimization. This avoids the problem of model surface breakage caused by performing surface reduction optimization on the target part that does not need surface reduction optimization.
[0188] In this embodiment, based on the definition of the simplest model, that is, the definition of a facet, the preset threshold can be set to 5. That is, if the number of adjacent points of any point on the model part does not exceed 5, it indicates that the model part is a facet and belongs to the simplest model, and therefore no further face reduction optimization processing is needed.
[0189] Step S2106: If, based on the structural detection results, it is determined that the number of adjacent points of any point on the target part is greater than a preset threshold, then the surface reduction optimization processing requirement of the target part is determined to be that surface reduction optimization processing is required.
[0190] Specifically, by performing model structure detection on the target part, the corresponding structure detection results are obtained. When the number of adjacent points of any point on the target part is greater than a preset threshold according to the structure detection results, it indicates that the target part is not the simplest model and can be further optimized by reducing the number of surfaces.
[0191] For example, if the number of adjacent points of any point on the target part is greater than a preset threshold, that is, the number of adjacent points of any point is greater than 5, it indicates that the target part is not the simplest model and can be further optimized by reducing the number of faces. Then, the instance object corresponding to the target part that needs to be optimized by reducing the number of faces can be determined as an instance object that meets the conditions for optimization by reducing the number of faces.
[0192] Step S2108: Determine the instance object corresponding to the target part that needs to be optimized by reducing the surface area as an instance object that meets the conditions for reducing the surface area.
[0193] Specifically, by identifying the instance objects corresponding to the target part requiring surface reduction optimization as those meeting the surface reduction optimization conditions, surface reduction optimization can be performed on these instance objects. Specifically, this involves determining the surface reduction optimization method corresponding to each level of the instance objects meeting the conditions, and then sequentially performing surface reduction optimization on each level of the instance objects meeting the conditions based on these methods, resulting in multiple optimized instance objects.
[0194] In one embodiment, such as Figure 22 As shown, a node network diagram for model structure detection based on each target part is provided. (Refer to...) Figure 22 It can be seen that by executing the fourth foreach loop, the model structure of the target part is detected. The third foreach loop involves multiple processing nodes, which are provided by the Houdini application (i.e., 3D computer graphics software). These nodes include: the foreach_begin node (loop start node), the attribwrangle node (attribute modification node, used to modify the properties of the model part, such as modifying the surface reduction processing property of the model part, i.e., whether the model part can be optimized by surface reduction, or modifying the storage location of the model part, such as dividing it into storage parts that need surface reduction processing and storage parts that do not need surface reduction processing), the blast node (used to obtain the target part that meets the conditions for surface reduction processing), and the foreach_end node (loop end node).
[0195] Specifically, through execution Figure 22The code snippet on the right checks if the number of neighboring points of any point on the target part is greater than a preset threshold, specifically if the number of neighboring points of any point on the target part is greater than 5. If the number of neighboring points of any point on the target part is less than 5, then the target part is determined to be the simplest model, i.e., a single facet. Similarly, if the number of neighboring points of any point on the target part is greater than the preset threshold, i.e., greater than 5, then the target part is not the simplest model and can be further optimized by reducing the number of facets. This allows the instance object corresponding to the target part requiring facet reduction optimization to be identified as an instance object that meets the facet reduction optimization conditions.
[0196] Among the methods for optimizing surface reduction, there are also: for example, reducing the surface area proportionally based on the size of the model parts, deleting small model parts when they are far away, merging points that are relatively close together when they are far away to achieve the effect of reducing the surface area, or further optimizing the surface reduction of model parts with the same orientation based on their orientation.
[0197] In one embodiment, before performing surface reduction optimization on each instance object in the model to be optimized that meets the surface reduction optimization conditions, and obtaining the optimized model, the method further includes:
[0198] If a boundary preservation operation triggered by each target part is detected, the model boundary corresponding to the target part is obtained; a model boundary protection requirement is generated based on the model boundary and the boundary preservation operation, and the model boundary protection requirement is added to the surface reduction optimization processing requirement; the model boundary protection requirement is used to adjust the surface reduction ratio and protect the model boundary during surface reduction optimization processing.
[0199] In this process, to avoid damage to the model and its parts during polygon reduction optimization, polygon reduction optimization is performed during the instantiation and rendering loop based on the connectivity between the various model parts in the model to be optimized. Simultaneously, during the polygon reduction optimization process based on the connectivity between the various model parts in the model to be optimized, developers are provided with the option to choose whether or not to preserve the model boundaries.
[0200] Specifically, if a boundary preservation operation triggered by each target part is detected, i.e. when the developer triggers the function selection that requires the model boundary to be preserved, the model boundary corresponding to the target part is obtained, and a model boundary protection requirement is generated based on the model boundary and the boundary preservation operation.
[0201] Furthermore, the model boundary protection requirement is used to adjust the reduction ratio and protect the model boundary during the reduction optimization process. By adding the model boundary protection requirement to the reduction optimization process requirement, the reduction optimization process can be performed according to the model boundary protection requirement in subsequent reduction optimization processes to avoid damaging the model boundary.
[0202] In one embodiment, such as Figure 23 As shown, a schematic diagram of the boundaries of model parts in a model to be optimized is provided. During game project development, the boundaries of different model parts can be obtained based on the group node (i.e., the node used for selection and grouping) provided by the Houdini program. Since there are irregular models, it is necessary to obtain the boundaries of the model parts during the polygon reduction optimization process. Furthermore, the model boundaries of the model parts must be preserved during the polygon reduction optimization process to ensure that the model does not have broken surfaces after polygon reduction.
[0203] If a boundary preservation operation triggered by each target part is detected, it indicates that the model boundary of the target part needs to be preserved during the polygon reduction optimization process. This requires adjusting the polygon reduction ratio to avoid excessive polygon reduction leading to broken surfaces. If the model boundary of the target part needs to be preserved, the polygon reduction ratio usually needs to be reduced, i.e., the polygon reduction ratio for the polygon variables of the target part at different levels should be decreased.
[0204] In this embodiment, model structure detection is performed on each target part, generating a structure detection result corresponding to each target part. If, based on the structure detection result, the number of adjacent points of any point on a target part is less than a preset threshold, the target part is determined to not require surface reduction optimization, and the target part that does not require surface reduction optimization is separated from the model to be optimized. Conversely, if, based on the structure detection result, the number of adjacent points of any point on a target part is greater than a preset threshold, the target part is determined to require surface reduction optimization, and the instance object corresponding to the target part requiring surface reduction optimization is identified as an instance object that meets the surface reduction optimization conditions. This achieves pre-screening of each target part based on the surface reduction optimization conditions before surface reduction optimization, avoiding the problem of model surface breakage caused by performing surface reduction optimization on instance objects of model parts that cannot be optimized, reducing redundant operations in the surface reduction optimization process, and thus improving the processing efficiency in the game project development process.
[0205] In one embodiment, such as Figure 24 As shown, a model processing method is provided, which specifically includes:
[0206] Step S2401: Obtain multiple model parts of the model to be optimized, convert each model part into a wireframe, and obtain the total wireframe length of the wireframe corresponding to each model part.
[0207] Step S2402: Based on the total wireframe length, perform duplicate part identification processing on each model part, and identify model parts with the same total wireframe length as model parts with the same shape.
[0208] Step S2403: Obtain any point of each model part with the same shape, and extract two adjacent points of any point on each model part with the same shape in sequence.
[0209] Step S2404: Perform a cross product operation based on any point and any two adjacent points to generate model part point vectors corresponding to each model part with the same shape, and convert each model part point vector into a matrix corresponding to each model part with the same shape.
[0210] Step S2405: Perform an inverse transformation on the matrix to obtain the inverse matrix corresponding to each model part with the same shape, and obtain the orientation data corresponding to the point vector of the model part during the transformation process.
[0211] Step S2406: Based on the inverse matrix, perform origin regression processing on each model part with the same shape to determine the original position of each model part with the same shape.
[0212] Step S2407: Obtain the center point of each model part with the same shape, and extract any two points on each model part with the same shape in sequence.
[0213] Step S2408: Based on the center point and the random vector generated from any two points, perform numerical calculations to generate random values corresponding to each model part with the same shape.
[0214] Step S2409: The random value is sent back to the original position of the model part, and the random value is determined as the point number of each model part with the same shape.
[0215] Step S2410: Based on the point number of each model part with the same shape, a comparison process is performed to determine the model parts with the same point number. The model parts with the same point number are divided into the same part category, and the target part corresponding to each part category is determined from each model part under each part category.
[0216] Step S2411: Based on the inverse matrix, perform origin regression processing on the target parts to determine the original position of each target part.
[0217] Step S2412: Based on the orientation data and the point sequence number of the target part, determine the original part point cloud data of each target part at its original position.
[0218] Step S2413: Obtain multi-level detail information of each target part in the model to be optimized, and determine multiple sets of hierarchical parameters corresponding to each target part based on the multi-level detail information.
[0219] Step S2414: Call the game engine to instantiate and render the original part point cloud data according to multiple sets of hierarchical parameters, and obtain the instance object corresponding to the target part.
[0220] Step S2415: Perform model structure detection based on each target part, and generate structure detection results that correspond one-to-one with each target part.
[0221] Step S2416: Based on the structural detection results, determine whether the number of adjacent points of any point on the target part is less than a preset threshold.
[0222] Step S2417: If the number of adjacent points of any point on the target part is less than a preset threshold, the surface reduction optimization requirement of the target part is determined to be that no surface reduction optimization is required, and the target part that does not require surface reduction optimization is separated from the model to be optimized.
[0223] Step S2418: If the number of adjacent points of any point on the target part is greater than a preset threshold, the surface reduction optimization processing requirement of the target part is determined to be that surface reduction optimization processing is required, and the instance object corresponding to the target part that needs to be surface reduction optimization processing is determined to be an instance object that meets the surface reduction optimization processing conditions.
[0224] Step S2419: Based on multiple sets of hierarchical parameters and the connectivity between model parts in the model to be optimized, determine the surface reduction optimization method corresponding to each level of the instance object that meets the surface reduction optimization conditions.
[0225] Step S2420: Based on the face reduction optimization method, face reduction optimization is performed on each level of the instance objects that meet the face reduction optimization conditions in sequence to obtain multiple optimized instance objects, and the optimized model is obtained based on the multiple optimized instance objects.
[0226] In the above model processing method, multiple model parts of the model to be optimized are obtained, and duplicate parts are identified based on each model part. Model parts with the same shape are identified, and their point numbers are determined. Model parts with the same point number are then classified into the same part category. This method can quickly identify duplicate parts in the model to be optimized, thus eliminating the need to perform the same instantiation rendering and polygon reduction optimization operations on duplicate parts. Instead, the method identifies the target part corresponding to each part category from the model parts under each part category, performs origin regression processing on the target part to determine the original position of each target part, and obtains the original part point cloud data of each target part at its original position. Instantiation rendering can then be performed based on the original part point cloud data to obtain the instance object corresponding to the target part. Since the instantiation rendering and polygon reduction optimization are performed on the target part, there is no need to repeat the processing of duplicate models, which can improve the rendering efficiency of the model to be optimized and reduce the system resource consumption. Furthermore, by performing face reduction optimization on each instance object in the model to be optimized that meets the face reduction optimization conditions, an optimized model is obtained. This achieves face reduction optimization on each instance object that meets the face reduction optimization conditions while ensuring the integrity of the model itself, thereby further reducing the system resource occupation of each model part, thus improving the model optimization effect and reducing the system resource occupation of project development.
[0227] In one embodiment, a model processing method is provided, which specifically includes the following processing parts:
[0228] P1. Identify model parts with identical shapes:
[0229] For the loaded model to be optimized, each model part needs to be converted into a wireframe, and the total wireframe length of each model part needs to be obtained. Then, based on the total wireframe length, duplicate parts are identified, and model parts with the same total wireframe length are determined to be model parts with the same shape. Specifically, this is done by judging whether the total wireframe length of two model parts is the same. If the total wireframe length of two model parts is the same, it means that the two model parts being compared are model parts with the same shape.
[0230] Specifically, by executing a foreach loop, the total wireframe length of each model part is continuously calculated and stored. This allows for further comparison based on the total wireframe length, identifying model parts with the same total wireframe length as model parts with the same shape.
[0231] P2. Classify model parts with the same shape and determine the model parts with the same serial number:
[0232] By determining the inverse matrix corresponding to each model part with the same shape, and then performing origin regression processing on each model part with the same shape based on the inverse matrix, the original position of each model part with the same shape is determined. Further, by obtaining the center point of each model part with the same shape, and sequentially extracting any two points on each model part with the same shape, numerical calculations are performed based on the center point and the random vector generated from the two random points to generate random values corresponding one-to-one with each model part with the same shape. These random values are then fed back to the original position of the model part, and the random values are determined as the point numbers of each model part with the same shape. After determining the point numbers of each model part with the same shape, a comparison process is performed based on the point numbers of each model part with the same shape to identify model parts with the same point numbers, and these model parts with the same point numbers are classified into the same part category.
[0233] Before calculating random values, it is necessary to obtain the inverse matrix corresponding to the model parts with the same shape. Specifically, this involves obtaining three adjacent points on the model part, calculating three mutually perpendicular vectors based on these three points, converting these three mutually perpendicular vectors into a matrix, and then converting the matrix into its inverse matrix. This yields the inverse matrix corresponding to the model parts with the same shape. The purpose of the inverse matrix is to perform origin regression processing on the model parts, that is, to return the model parts to the origin, thus determining the original position of each model part with the same shape.
[0234] Specifically, by iterating through the entire loop based on the total wireframe length, the current foreach loop, for model parts with the same shape determined by the total wireframe length, further determines the point vectors corresponding to each model part with the same shape based on the center point of the model part and two randomly selected points from the model part. Numerical calculations are then performed to generate a random numerical value (i.e., point number) corresponding to each model part with the same shape. Further, after determining the point number of each model part with the same shape, a comparison process is performed based on these point numbers to identify model parts with the same point number, and these model parts with the same point number are classified into the same part category.
[0235] P3. Calculate the inverse matrix used for origin regression processing, and the orientation data:
[0236] When determining the inverse matrix corresponding to a model part with the same shape, it is necessary to obtain any point of each model part with the same shape, as well as two adjacent points of the arbitrary point. Specifically, for the extracted arbitrary point and two adjacent points, the cross function (i.e., cross product function) is used to perform a cross product operation on the extracted arbitrary point and two adjacent points of the arbitrary point to generate a pairwise perpendicular point vector of the model part.
[0237] Furthermore, for each obtained model part's point vector (i.e., three pairwise perpendicular point vectors), these are sequentially converted into matrices corresponding to each model part with the same shape. Then, by performing an inverse transformation on these matrices, the inverse matrix corresponding to each model part with the same shape can be obtained. During this conversion process, it is necessary to obtain the orientation data corresponding to the model part's point vectors. This orientation data, represented as a quaternion, is obtained from the matrix transformation and is specifically used to represent the orientation.
[0238] P4. Instantiate and render the target part to generate an instance object:
[0239] When it is necessary to instantiate and render a target part to generate an instance object corresponding to the target part, it is first necessary to determine the allocation of rendering resources for different target parts, as well as the number of faces and the level of detail of the target parts. Then, it is necessary to obtain the multi-level detail information of each target part in the model to be optimized.
[0240] Specifically, different target parts have different levels of detail information, and therefore, based on this level of detail information, different sets of hierarchical parameters are determined for each target part. In particular, different sets of hierarchical parameters are set for each target part according to the actual game project development requirements.
[0241] Furthermore, by invoking a game engine, such as a pre-written editable computer game system or the core components of an interactive real-time graphics application, and using the development tools provided by the system or component, combined with multiple sets of hierarchical parameters, the original part point cloud data is instantiated and rendered according to different hierarchical parameters to obtain instance objects corresponding to the target part. During the instantiation rendering process, the resource allocation for object rendering is determined based on the object model's position and importance in the display environment (i.e., multiple sets of hierarchical parameters). This reduces the face count and detail of less important objects, thereby achieving high-efficiency rendering computation and improving the efficiency of instantiation rendering processing.
[0242] In one embodiment, the target part is instantiated and rendered by executing nested loops derived from a first foreach loop, a second foreach loop, and a third foreach loop, generating instance objects. The purpose of the first foreach loop is to calculate the tolen value and determine model parts with the same shape based on that tolen value.
[0243] Specifically, the second foreach loop is nested within the first foreach loop. That is, based on the model parts having the same shape, the second foreach loop calculates a checkvalue (i.e., a random value) and performs a second loop based on the checkvalue, determining which model parts with the same shape have the same random value. These model parts with the same random value are then identified as having the same point number. Within the second foreach loop, after identifying the model parts with the same point number, the model parts with the same shape are categorized according to the point number, resulting in different part categories and multiple model parts included in each category. Furthermore, from the multiple model parts under each part category, the target part representing each part category is selected.
[0244] Similarly, within the first foreach loop, there is a nested third foreach loop. By executing the third foreach loop, the orientation data corresponding to the target part can be determined, and at the same time, the point number of the target part corresponding to the determined orientation data can be obtained.
[0245] Furthermore, after obtaining the target parts through the second foreach loop, the first foreach loop performs origin regression processing on the target parts based on the inverse matrix to determine the original position of each target part, thus returning the target parts to the origin. Using the obtained point index of the target parts and the orientation data determined by the third foreach loop, the original point cloud data of each target part at its original position is determined. Finally, by instantiating and rendering the original point cloud data, an instance object corresponding to the target part can be obtained.
[0246] P5. Perform facet reduction optimization based on instance objects to obtain the optimized model:
[0247] In response to the need to nest the polygon reduction optimization operation into the instantiation rendering process, the first foreach loop in the nested loop also includes a generate_lod node for performing polygon reduction optimization. By calling the generate_lod node, instance objects that meet the polygon reduction optimization conditions can be identified, and polygon reduction optimization is performed on each level of the instance objects that meet the conditions according to the polygon reduction optimization method corresponding to the instance objects, resulting in multiple optimized instance objects.
[0248] Specifically, since it is necessary to avoid damage to the model and its parts during polygon reduction optimization, polygon reduction optimization is performed during the instantiation and rendering loop based on the connectivity between the model parts to be optimized. Simultaneously, based on multiple sets of hierarchical parameters corresponding to different target parts, and combined with the connectivity between model parts, the polygon reduction optimization method corresponding to each level of the instance object that meets the polygon reduction optimization conditions is determined.
[0249] The surface reduction optimization process includes surface reduction optimization requirements and surface reduction ratios. Surface reduction optimization requirements specifically include whether surface reduction optimization is required, whether surface reduction optimization is not required, whether model boundaries need to be protected, and whether model boundaries do not need to be protected. The surface reduction ratio represents the degree of surface reduction optimization for different target parts, or the specific number of surfaces to be reduced for different levels of different target parts.
[0250] Furthermore, based on the polygon reduction optimization method, such as when polygon reduction optimization is required or when model boundaries need to be protected, a specific polygon reduction ratio is obtained. Based on this ratio, polygon reduction optimization is performed on each level of the instance objects that meet the optimization conditions, resulting in optimized instance objects. Specifically, when performing polygon reduction optimization on instance objects corresponding to different target parts, polygon reduction optimization is simultaneously performed on other model parts belonging to the same part category as the target parts, achieving comprehensive optimization of the model to be optimized, thus obtaining the optimized model.
[0251] In one embodiment, before performing polygon reduction optimization on an instance of the target part, it is necessary to perform model structure detection on the target part to determine whether the target part is a simplified model. The simplified model can be understood as the model part being a single facet. Specifically, it is to determine whether the model part is in the form of a single facet to determine whether the model part can be subjected to polygon reduction optimization. If the target part is a simplified model, then no further polygon reduction optimization is required.
[0252] If a model part is a facet, the number of adjacent points of any point on the model part does not exceed a preset threshold. In this embodiment, the preset threshold is set to 5. That is, if the number of adjacent points of any point on the model part does not exceed 5, it indicates that the model part is a facet and belongs to the simplest model. Therefore, no further facet reduction optimization is needed. It needs to be separated and stored separately as a part that does not need facet reduction optimization. This can avoid the problem of broken model faces caused by facet reduction optimization of target parts that do not need facet reduction optimization.
[0253] Similarly, if the structural detection results determine that the model part does not belong to the simplest model, that is, if the number of adjacent points of any point on the target part is greater than the preset threshold, that is, the number of adjacent points of any point is greater than 5, it indicates that the target part is not the simplest model and can be further optimized by reducing the number of faces. Then, the instance object corresponding to the target part that needs to be optimized by reducing the number of faces can be determined as an instance object that meets the conditions for reducing the number of faces.
[0254] In one embodiment, during the polygon reduction optimization process in the instantiation rendering loop based on the connectivity between the model parts in the model to be optimized, developers are provided with the option to choose whether to preserve the model boundaries.
[0255] Specifically, if a boundary preservation operation triggered by each target part is detected, i.e., when a developer triggers a function selection that requires preserving model boundaries, the model boundary corresponding to the target part is obtained, and a model boundary protection requirement is generated based on the model boundary and the boundary preservation operation. This model boundary protection requirement is used to adjust the reduction ratio and protect the model boundary during polygon reduction optimization. By adding the model boundary protection requirement to the polygon reduction optimization requirement, subsequent polygon reduction optimization processes are performed according to the model boundary protection requirement, avoiding damage to the model boundary.
[0256] If a boundary preservation operation triggered by each target part is detected, it indicates that the model boundary of the target part needs to be preserved during the polygon reduction optimization process. This requires adjusting the polygon reduction ratio to avoid excessive polygon reduction leading to broken surfaces. If the model boundary of the target part needs to be preserved, the polygon reduction ratio usually needs to be reduced, i.e., the polygon reduction ratio for the polygon variables of the target part at different levels should be decreased.
[0257] In the above model processing method, multiple model parts of the model to be optimized are obtained, and duplicate parts are identified based on each model part. Model parts with the same shape are identified, and their point numbers are determined. Model parts with the same point number are then classified into the same part category. This method can quickly identify duplicate parts in the model to be optimized, thus eliminating the need to perform the same instantiation rendering and polygon reduction optimization operations on duplicate parts. Instead, the method identifies the target part corresponding to each part category from the model parts under each part category, performs origin regression processing on the target part to determine the original position of each target part, and obtains the original part point cloud data of each target part at its original position. Instantiation rendering can then be performed based on the original part point cloud data to obtain the instance object corresponding to the target part. Since the instantiation rendering and polygon reduction optimization are performed on the target part, there is no need to repeat the processing of duplicate models, which can improve the rendering efficiency of the model to be optimized and reduce the system resource consumption. Furthermore, by performing face reduction optimization on each instance object in the model to be optimized that meets the face reduction optimization conditions, an optimized model is obtained. This achieves face reduction optimization on each instance object that meets the face reduction optimization conditions while ensuring the integrity of the model itself, thereby further reducing the system resource occupation of each model part, thus improving the model optimization effect and reducing the system resource occupation of project development.
[0258] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0259] Based on the same inventive concept, this application also provides a model processing apparatus for implementing the model processing method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more model processing apparatus embodiments provided below can be found in the limitations of the model processing method described above, and will not be repeated here.
[0260] In one embodiment, such as Figure 25As shown, a model processing device is provided, including: a duplicate part identification processing module 2502, a model part classification module 2504, a target part determination module 2506, an origin regression processing module 2508, an instantiation rendering module 2510, and an optimization processing module 2512, wherein:
[0261] The duplicate part identification and processing module 2502 is used to acquire multiple model parts of the model to be optimized, and to perform duplicate part identification processing based on each model part to determine the model parts with the same shape.
[0262] The model parts classification module 2504 is used to determine the point number of model parts with the same shape and classify model parts with the same point number into the same part category.
[0263] The target part determination module 2506 is used to determine the target part corresponding to each part category from the model parts under each part category.
[0264] The origin regression processing module 2508 is used to perform origin regression processing on the target parts, determine the original position of each target part, and obtain the original part point cloud data of each target part at the original position.
[0265] The instantiation rendering module 2510 is used to perform instantiation rendering based on the original part point cloud data to obtain an instance object corresponding to the target part;
[0266] The optimization processing module 2512 is used to perform surface reduction optimization processing on each instance object in the model to be optimized that meets the surface reduction optimization processing conditions, so as to obtain the optimized model.
[0267] In the aforementioned model processing device, multiple model parts of the model to be optimized are acquired, and duplicate parts are identified based on each model part. This process determines model parts with the same shape and their point numbers, and then classifies model parts with the same point numbers into the same part category. This allows for the rapid identification of duplicate parts in the model to be optimized, eliminating the need for the same instantiation rendering and polygon reduction optimization operations on duplicate parts. Instead, the device identifies the target part corresponding to each part category from the model parts under each part category, performs origin regression processing on the target part to determine the original position of each target part, and acquires the original part point cloud data of each target part at its original position. Instantiation rendering can then be performed based on the original part point cloud data to obtain the instance object corresponding to the target part. Since the instantiation rendering and polygon reduction optimization are performed on the target part, there is no need to repeat the processing of duplicate models, which improves the rendering efficiency of the model to be optimized and reduces system resource consumption. Furthermore, by performing face reduction optimization on each instance object in the model to be optimized that meets the face reduction optimization conditions, an optimized model is obtained. This achieves face reduction optimization on each instance object that meets the face reduction optimization conditions while ensuring the integrity of the model itself, thereby further reducing the system resource occupation of each model part, thus improving the model optimization effect and reducing the system resource occupation of project development.
[0268] In one embodiment, the duplicate part identification processing module is further configured to: convert each model part into a wireframe and obtain the total wireframe length of the wireframe corresponding to each model part; based on the total wireframe length, perform duplicate part identification processing on each model part, and identify model parts with the same total wireframe length as model parts with the same shape.
[0269] In one embodiment, a model processing apparatus is provided, further comprising an orientation data determination module for: determining the inverse matrix corresponding to a model part with the same shape, and orientation data.
[0270] In one embodiment, the origin regression processing module is further configured to: perform origin regression processing on the target parts based on the inverse matrix to determine the original position of each target part; and determine the original part point cloud data of each target part at its original position based on the orientation data and the point number of the target part.
[0271] In one embodiment, the orientation data determination module is further configured to: obtain any point of each model part with the same shape, and sequentially extract two adjacent points of any point on each model part with the same shape; perform a cross product operation based on the arbitrary point and any two adjacent points to generate model part point vectors corresponding to each model part with the same shape; each model part corresponds to multiple model part point vectors; convert each model part point vector into a matrix corresponding to each model part with the same shape; perform an inverse transformation on the matrix to obtain the inverse matrix corresponding to each model part with the same shape, and obtain the orientation data corresponding to the model part point vectors during the transformation process.
[0272] In one embodiment, the model part classification module is further configured to: perform origin regression processing on each model part with the same shape according to the inverse matrix to determine the original position of each model part with the same shape; obtain the center point of each model part with the same shape, and extract any two points on each model part with the same shape in sequence; perform numerical calculation based on the center point and the random vector generated based on the random two points to generate a random value corresponding to each model part with the same shape; transmit the random value back to the original position of the model part, and determine the random value as the point number of each model part with the same shape; perform comparison processing based on the point number of each model part with the same shape to determine the model parts with the same point number, and classify the model parts with the same point number into the same part category.
[0273] In one embodiment, the instantiation rendering module is further configured to: obtain multi-level detail information of each target part in the model to be optimized; determine multiple sets of hierarchical parameters corresponding to each target part based on the multi-level detail information; and call the game engine to instantiate and render the original part point cloud data based on the multiple sets of hierarchical parameters to obtain an instance object corresponding to the target part.
[0274] In one embodiment, the optimization processing module is further configured to: determine, based on multiple sets of hierarchical parameters and the connectivity between model parts in the model to be optimized, a surface reduction optimization method corresponding to each level of the instance object that meets the surface reduction optimization processing conditions; the surface reduction optimization processing method includes surface reduction optimization processing requirements and surface reduction ratio; based on the surface reduction optimization processing method, sequentially perform surface reduction optimization processing on each level of the instance object that meets the surface reduction optimization processing conditions to obtain multiple optimized instance objects; and obtain the optimized model based on the multiple optimized instance objects.
[0275] In one embodiment, a model processing apparatus is provided, further comprising:
[0276] The model structure detection module is used to perform model structure detection based on each target part and generate a structure detection result corresponding to each target part. The model part separation module is used to determine that the target part does not need to be optimized if the number of adjacent points of any point on the target part is less than a preset threshold based on the structure detection results, and separates the target part that does not need to be optimized from the model to be optimized. The surface reduction requirement determination module is used to determine that the target part needs to be optimized if the number of adjacent points of any point on the target part is greater than a preset threshold based on the structure detection results. The instance object filtering module is used to determine the instance objects corresponding to the target parts that need to be optimized as instance objects that meet the surface reduction optimization conditions.
[0277] In one embodiment, a model processing apparatus is provided, further comprising:
[0278] The model boundary acquisition module is used to acquire the model boundary corresponding to the target part if a boundary preservation operation triggered by each target part is detected; the model boundary protection requirement addition module is used to generate model boundary protection requirements based on the model boundary and the boundary preservation operation, and add the model boundary protection requirements to the surface reduction optimization processing requirements; the model boundary protection requirements are used to adjust the surface reduction ratio and protect the model boundary during surface reduction optimization processing.
[0279] Each module in the aforementioned model processing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0280] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 25As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs in the non-volatile storage media. The database stores data such as multiple model parts of the model to be optimized, model parts with identical shapes, point numbers of model parts with identical shapes, target parts corresponding to each part category, the original positions of the target parts, original part point cloud data, instance objects, and the optimized model. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a model processing method.
[0281] Those skilled in the art will understand that Figure 25 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0282] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0283] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0284] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0285] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0286] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0287] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0288] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A model processing method, characterized in that, The method includes: Obtain multiple model parts of the model to be optimized, and perform duplicate part identification processing based on each model part to determine the model parts with the same shape; Determine the point number of the model parts with the same shape, and classify the model parts with the same point number into the same part category; From each model part under each part category, determine the target part corresponding to each part category; Determine the inverse matrix and orientation data corresponding to the model parts with the same shape; Based on the inverse matrix, origin regression processing is performed on the target parts to determine the original position of each target part; Based on the orientation data and the point number of the target part, determine the original part point cloud data of each target part at the original position; Instantiated rendering is performed based on the original part point cloud data to obtain an instance object corresponding to the target part; For each instance object in the model to be optimized that meets the conditions for surface reduction optimization, surface reduction optimization is performed to obtain the optimized model.
2. The method according to claim 1, characterized in that, Based on the aforementioned model parts, duplicate part identification processing is performed to determine model parts with the same shape, including: Each of the model parts is converted into a wireframe, and the total wireframe length of the wireframe corresponding to each model part is obtained. Based on the total wireframe length, duplicate part identification processing is performed on each of the model parts, and model parts with the same total wireframe length are identified as model parts with the same shape.
3. The method according to claim 1, characterized in that, Determining the inverse matrix and orientation data corresponding to the model part with the same shape includes: Obtain any point of each of the model parts with the same shape, and extract two adjacent points of the arbitrary point on each of the model parts with the same shape in sequence; A cross product operation is performed based on the arbitrary point and the two adjacent points to generate model part point vectors corresponding to each model part with the same shape; each model part corresponds to multiple model part point vectors. The point vectors of each model part are sequentially converted into matrices corresponding to each model part with the same shape. Perform an inverse transformation on the matrix to obtain the inverse matrix corresponding to each of the model parts with the same shape, and obtain the orientation data corresponding to the point vectors of the model parts during the transformation process.
4. The method according to claim 3, characterized in that, The step of determining the point number of model parts with the same shape and classifying model parts with the same point number into the same part category includes: Based on the inverse matrix, origin regression processing is performed on each model part with the same shape to determine the original position of each model part with the same shape; Obtain the center point of each model part with the same shape, and extract any two points on each model part with the same shape in sequence; Based on the center point and the random vector generated from any two points, numerical calculations are performed to generate random values corresponding to each model part with the same shape. The random value is sent back to the original position of the model part, and the random value is determined as the point number of each model part with the same shape; Based on the point number of each model part with the same shape, the model parts with the same point number are identified and classified into the same part category.
5. The method according to any one of claims 1 to 4, characterized in that, The instantiation rendering based on the original part point cloud data to obtain an instance object corresponding to the target part includes: Obtain multi-level detail information of each target part in the model to be optimized; Based on the multi-level detail information, determine multiple sets of hierarchical parameters corresponding to each of the target parts; The game engine is invoked to instantiate and render the original part point cloud data based on multiple sets of the aforementioned hierarchical parameters, thereby obtaining an instance object corresponding to the target part.
6. The method according to claim 5, characterized in that, The step of performing surface reduction optimization on each instance object in the model to be optimized that meets the surface reduction optimization conditions to obtain the optimized model includes: Based on the multiple sets of hierarchical parameters and the connectivity between the model parts in the model to be optimized, the surface reduction optimization method corresponding to each level of the instance object that meets the surface reduction optimization processing conditions is determined; the surface reduction optimization processing method includes surface reduction optimization processing requirements and surface reduction ratio; Based on the aforementioned face reduction optimization method, face reduction optimization is performed sequentially on each level of the instance object that meets the face reduction optimization conditions to obtain multiple optimized instance objects. The optimized model is obtained from multiple optimized instance objects.
7. The method according to any one of claims 1 to 4, characterized in that, Before performing surface reduction optimization on each instance object in the model to be optimized that meets the surface reduction optimization conditions to obtain the optimized model, the process further includes: Based on each of the target parts, perform model structure detection and generate structure detection results that correspond one-to-one with each of the target parts; If, based on the structural detection results, it is determined that the number of adjacent points of any point on the target part is less than a preset threshold, the surface reduction optimization requirement of the target part is determined to be that no surface reduction optimization is required, and the target part that does not require surface reduction optimization is separated from the model to be optimized. or If, based on the structural detection results, it is determined that the number of adjacent points of any point on the target part is greater than a preset threshold, the surface reduction optimization processing requirement of the target part is determined to be that surface reduction optimization processing is required; the instance object corresponding to the target part that needs surface reduction optimization processing is determined to be an instance object that meets the surface reduction optimization processing conditions.
8. The method according to any one of claims 1 to 4, characterized in that, Before performing surface reduction optimization on each instance object in the model to be optimized that meets the surface reduction optimization conditions to obtain the optimized model, the process further includes: If a boundary preservation operation triggered based on each of the target parts is detected, the model boundary corresponding to the target part is obtained; The model boundary protection requirement is generated based on the model boundary and the boundary preservation operation, and the model boundary protection requirement is added to the polygon reduction optimization processing requirement; the model boundary protection requirement is used to adjust the polygon reduction ratio and protect the model boundary during polygon reduction optimization processing.
9. A model processing device, characterized in that, The device includes: The duplicate part identification and processing module is used to acquire multiple model parts of the model to be optimized, and to perform duplicate part identification processing based on each of the model parts to determine the model parts with the same shape. The model parts classification module is used to determine the point number of model parts with the same shape and classify model parts with the same point number into the same part category; The target part determination module is used to determine the target part corresponding to each of the model parts under each of the part categories; An orientation data determination module is used to determine the inverse matrix and orientation data corresponding to the model parts with the same shape. The origin regression processing module is used to perform origin regression processing on the target parts based on the inverse matrix to determine the original position of each target part; and to determine the original part point cloud data of each target part at the original position according to the orientation data and the point number of the target part. The instantiation rendering module is used to perform instantiation rendering based on the original part point cloud data to obtain an instance object corresponding to the target part; The optimization processing module is used to perform surface reduction optimization processing on each instance object in the model to be optimized that meets the surface reduction optimization processing conditions, so as to obtain the optimized model.
10. The apparatus according to claim 9, characterized in that, The duplicate parts identification and processing module is also used for: Each of the model parts is converted into a wireframe, and the total wireframe length of the wireframe corresponding to each model part is obtained. Based on the total wireframe length, duplicate part identification processing is performed on each of the model parts, and model parts with the same total wireframe length are identified as model parts with the same shape.
11. The apparatus according to claim 9, characterized in that, The orientation data determination module is also used for: Obtain any point of each model part with the same shape, and extract two adjacent points of the arbitrary point on each model part with the same shape in turn; perform a cross product operation based on the arbitrary point and the two adjacent points to generate model part point vectors corresponding to each model part with the same shape; each model part corresponds to multiple model part point vectors; convert each model part point vector into a matrix corresponding to each model part with the same shape in turn. Perform an inverse transformation on the matrix to obtain the inverse matrix corresponding to each of the model parts with the same shape, and obtain the orientation data corresponding to the point vectors of the model parts during the transformation process.
12. The apparatus according to claim 11, characterized in that, The model parts classification module is also used for: Based on the inverse matrix, origin regression is performed on each model part with the same shape to determine the original position of each model part with the same shape; the center point of each model part with the same shape is obtained, and any two points on each model part with the same shape are extracted in sequence; based on the center point and the random vector generated based on the two points, numerical calculation is performed to generate random values that correspond one-to-one with each model part with the same shape; the random values are returned to the original position of the model part, and the random values are determined as the point number of each model part with the same shape; based on the point number of each model part with the same shape, a comparison process is performed to determine the model parts with the same point number, and the model parts with the same point number are classified into the same part category.
13. The apparatus according to any one of claims 9 to 12, characterized in that, The instantiation rendering module is also used for: Obtain multi-level detail information of each target part in the model to be optimized; determine multiple sets of hierarchical parameters corresponding to each target part based on the multi-level detail information; The game engine is invoked to instantiate and render the original part point cloud data based on multiple sets of the aforementioned hierarchical parameters, thereby obtaining an instance object corresponding to the target part.
14. The apparatus according to claim 13, characterized in that, The optimization processing module is also used for: Based on the multiple sets of hierarchical parameters and the connectivity between the model parts in the model to be optimized, a surface reduction optimization method is determined for each level of the instance object that meets the surface reduction optimization conditions. The surface reduction optimization method includes surface reduction optimization requirements and surface reduction ratio. Based on the surface reduction optimization method, surface reduction optimization is performed sequentially on each level of the instance object that meets the surface reduction optimization conditions to obtain multiple optimized instance objects. Based on the multiple optimized instance objects, an optimized model is obtained.
15. The apparatus according to any one of claims 9 to 12, characterized in that, The device further includes: The model structure detection module is used to perform model structure detection based on each of the target parts and generate a structure detection result that corresponds one-to-one with each of the target parts. The model part separation module is used to determine that if, based on the structural detection results, the number of adjacent points of any point on the target part is less than a preset threshold, the surface reduction optimization requirement of the target part is no longer required, and the target part that does not require surface reduction optimization is separated from the model to be optimized. The surface reduction requirement determination module is used to determine that if, based on the structural detection results, the number of adjacent points of any point on the target part is greater than a preset threshold, the surface reduction optimization processing requirement of the target part is that surface reduction optimization processing is required. The instance object filtering module is used to identify the instance objects corresponding to the target parts that need to undergo surface reduction optimization as those that meet the surface reduction optimization conditions.
16. The apparatus according to any one of claims 9 to 12, characterized in that, The device further includes: The model boundary acquisition module is used to acquire the model boundary corresponding to the target part if a boundary preservation operation triggered based on each of the target parts is detected. The model boundary protection requirement addition module is used to generate model boundary protection requirements based on the model boundary and the boundary preservation operation, and add the model boundary protection requirements to the polygon reduction optimization processing requirements; the model boundary protection requirements are used to adjust the polygon reduction ratio and protect the model boundary during polygon reduction optimization processing.
17. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 8.
18. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 8.
19. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Game scene construction method and device, computer storage medium and electronic device
CN110262865A
Scene rendering method and device, computer readable storage medium and computer equipment
CN111105491A