Model optimization method and device, computer readable program product and electronic equipment
Through the triangular processing of the model, the light range settings, and the average calculation of the pixels, the deletion surface is determined and deleted, the problem of low model optimization accuracy in the existing technology is solved, and the more efficient model optimization and image rendering effect are achieved.
Patent Information
- Application Number
- CN202411614349.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-12
- Publication Date
- 2025-01-28
AI Technical Summary
The accuracy of the model optimization method in the prior art is low, especially in the backside cutting technology, the model surface of the invisible area cannot be completely deleted, resulting in poor optimization results.
By obtaining the model surface in the scene, the triangularization is performed to obtain UV coordinates, and the light range settings are set on the model to obtain light information. Convert the UV coordinates of the vertex to pixel coordinates, and calculate the pixel average of the pixel surface according to the pixel coordinates and light information calculation, and delete the surface and delete the target according to this value.
The accuracy and quality of the model deletion have been improved, the problem of incomplete deletion in the back cutting technology of the back is solved, the unnecessary rendering tasks are reduced, the power consumption of the equipment is reduced, and the smoother user experience is provided.
Smart Images

Figure CN119379886A_ABST
Abstract
Description
Background Art
[0002] Invisible area removal is an effective optimization technology that can reduce unnecessary calculation and rendering tasks, reduce the power consumption of the device, especially for mobile devices, which helps to extend battery life; it can reduce the use of video memory and save memory resources, especially for complex scenes or high-resolution maps.
[0003] In the related art, there is a model asset solution called back clipping, which deletes polygons facing the opposite direction of the camera. It is usually used to optimize polygonal models of game assets. In back clipping, the angle between the camera viewing direction and the model surface normal vector is used for calculation. If the angle between the surface normal vector and the viewing direction in the visible area is less than the limit value, the visible area can be retained. However, in the invisible area, some model faces will be blocked, and their vector angles are within the limit but are not deleted, resulting in insufficient model optimization accuracy.
[0004] Therefore, a new model optimization method needs to be provided.
[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present invention, and therefore may include information that does not constitute prior art known to ordinary technicians in the field. Summary of the invention
[0006] The present disclosure provides a model optimization method, a model optimization device, a computer program product, and an electronic device, thereby overcoming, at least to a certain extent, the problem of low model optimization accuracy caused by the limitations and defects of related technologies.
[0007] According to one aspect of the present disclosure, a model optimization method is provided, comprising:
[0008] Acquire a model surface included in the scene, perform triangulation on the model surface, and obtain UV coordinates of the triangulated model surface;
[0009] Performing optical path setting on the model surface to obtain illumination information of the model surface, converting UV coordinates of vertices of the model surface into pixel coordinates, and obtaining a pixel average value of the model surface according to the pixel coordinates and the illumination information;
[0010] A target deletion surface is obtained according to the pixel average value of the model surface, and the target deletion surface is deleted.
[0011] In an exemplary embodiment of the present disclosure, before triangulating the model surface, the method further includes:
[0012] Acquire geometric data in the scene, and merge the geometric data to obtain a geometric data group;
[0013] Acquire material data corresponding to the geometric data in the geometric data group, and determine first material data with the same material name in the material data;
[0014] A first model surface referencing the first material data in the geometric data group is obtained, the first model surfaces are merged, and material data other than the first material data in the scene is deleted.
[0015] In an exemplary embodiment of the present disclosure, the acquiring of a model surface included in a scene, triangulation of the model surface, and obtaining UV coordinates of the triangulated model surface include:
[0016] Acquire the model surface, and perform triangulation processing on the model surface to obtain a triangulated model surface;
[0017] Resetting the UV coordinates of the triangular model surface, and arranging the reset UV coordinates to obtain arranged UV coordinates;
[0018] The arrangement UV coordinates are determined as UV coordinates of the triangular model surface.
[0019] In an exemplary embodiment of the present disclosure, the step of setting the optical path of the model surface to obtain illumination information of the model surface includes:
[0020] Turning off light bounce in the optical path parameters of the model surface, rendering the illumination information of the model surface through a graphics processor to obtain an illumination image;
[0021] The illumination image is stored to obtain illumination information of the model surface.
[0022] In an exemplary embodiment of the present disclosure, converting the UV coordinates of the vertices of the model surface into pixel coordinates includes:
[0023] The UV coordinates of the vertices included in the model surface are obtained, and based on the information of the illumination image, the UV coordinates of the vertices are converted to obtain the pixel coordinates of the three corner vertices of the model surface.
[0024] In an exemplary embodiment of the present disclosure, obtaining the pixel average value of the model surface according to the pixel coordinates and the illumination information includes:
[0025] Determining pixel points included in the model surface based on pixel coordinates of vertices in the model surface;
[0026] The pixel value of the pixel point is obtained according to the illumination information, and the pixel average value of the model surface is obtained according to the pixel value of the pixel point and the number of pixels included in the model surface.
[0027] In an exemplary embodiment of the present disclosure, obtaining a target deletion surface according to the average pixel value of the model surface and deleting the target deletion surface comprises:
[0028] Traversing the model surface, and comparing an average pixel value of the model surface with the preset value;
[0029] When the pixel average value of the model surface is greater than the preset value, the model surface is stored and the model surface is confirmed as a target deletion surface;
[0030] The stored target deletion surface is deleted.
[0031] According to one aspect of the present disclosure, there is provided a model optimization device, comprising:
[0032] A coordinate acquisition module, used to acquire a model surface included in the scene, perform triangulation on the model surface, and obtain UV coordinates of the triangulated model surface;
[0033] A pixel calculation module, used to set the optical path of the model surface, obtain the illumination information of the model surface, convert the UV coordinates of the vertices of the model surface into pixel coordinates, and obtain the pixel average value of the model surface according to the pixel coordinates and the illumination information;
[0034] The model surface deletion module is used to obtain a target deletion surface according to the pixel average value of the model surface, and delete the target deletion surface.
[0035] According to one aspect of the present disclosure, a computer storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the model optimization method described in any of the above exemplary embodiments is implemented.
[0036] According to one aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the model optimization method described in any of the above exemplary embodiments by executing the executable instructions.
[0037] According to one aspect of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the model optimization method described in any one of the above exemplary embodiments is implemented.
[0038] A model optimization method provided by an embodiment of the present disclosure obtains a model surface included in a scene, triangulates the model surface, and obtains UV coordinates of the triangulated model surface; sets an optical path for the model surface to obtain lighting information of the model surface, converts the UV coordinates of the vertices of the model surface into pixel coordinates, and obtains a pixel average value of the model surface based on the pixel coordinates and the lighting information; obtains a target deletion surface based on the pixel average value of the model surface, and deletes the target deletion surface. On the one hand, the model faces included in the scene are acquired, the model faces are triangulated to obtain the UV coordinates of the model faces, the optical path of the model faces is set to obtain the lighting information of the model faces, the target deletion faces are determined according to the lighting information of the model faces, and the target deletion faces are deleted, thereby improving the accuracy and quality of model face deletion and solving the problem of incomplete model face deletion due to back clipping in related technologies. At the same time, by deleting the unnecessary rendered model faces, the image rendering effect is improved and a smoother user experience is provided. On the other hand, after obtaining the lighting information of the model faces, the vertex UV coordinates of the model faces are converted into pixel coordinates, and the pixel average value of the model faces is obtained according to the pixel coordinates and the lighting information. According to the pixel average value of the model faces, the target deletion faces are obtained, thereby improving the efficiency of determining the target deletion faces. After determining the target deletion faces, deleting the target deletion faces saves memory resources.
[0039] It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The accompanying drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present invention, and together with the specification are used to explain the principles of the present invention. Obviously, the accompanying drawings described below are only some embodiments of the present invention, and for those of ordinary skill in the art, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0041] Figure 1 A flowchart of a model optimization method according to an exemplary embodiment of the present disclosure is schematically shown.
[0042] Figure 2 A flowchart of a model optimization method before triangulating a model surface according to an exemplary embodiment of the present disclosure is schematically shown.
[0043] Figure 3 A flowchart of a method for acquiring a model surface included in a scene, triangulating the model surface, and obtaining UV coordinates of the triangulated model surface according to an exemplary embodiment of the present disclosure is schematically shown.
[0044] Figure 4 A schematic diagram schematically illustrates UV coordinate data of a model surface according to an exemplary embodiment of the present disclosure.
[0045] Figure 5 A flowchart of a method for setting the optical path of the model surface to obtain illumination information of the model surface according to an exemplary embodiment of the present disclosure is schematically shown.
[0046] Figure 6 A flowchart of a method for obtaining a pixel average value of the model surface based on the pixel coordinates and the illumination information according to an exemplary embodiment of the present disclosure is schematically shown.
[0047] Figure 7 A flowchart of a method for obtaining a target deletion surface according to an average pixel value of the model surface and deleting the target deletion surface according to an exemplary embodiment of the present disclosure is schematically shown.
[0048] Figure 8 A schematic diagram schematically illustrates a target deletion surface in a scenario according to an exemplary embodiment of the present disclosure.
[0049] Fig. 9 A block diagram of a model optimization device according to an exemplary embodiment of the present disclosure is schematically shown.
[0050] Fig.10 An electronic device for implementing a model optimization method according to an exemplary embodiment of the present invention is schematically shown. DETAILED DESCRIPTION
[0051] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present invention will be more comprehensive and complete, and the concept of the example embodiments will be fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present invention. However, those skilled in the art will appreciate that the technical solutions of the present invention may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present invention.
[0052] In addition, the accompanying drawings are only schematic illustrations of the present invention and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0053] In this example implementation, a model optimization method is first provided. Figure 1 As shown, the model optimization method may include the following steps:
[0054] Step S110. Acquire a model surface included in the scene, perform triangulation on the model surface, and obtain UV coordinates of the triangulated model surface;
[0055] Step S120. Perform optical path setting on the model surface to obtain illumination information of the model surface, convert UV coordinates of vertices of the model surface into pixel coordinates, and obtain pixel average values of the model surface according to the pixel coordinates and the illumination information;
[0056] Step S130: Obtain a target deletion surface according to the average pixel value of the model surface, and delete the target deletion surface.
[0057] The above-mentioned model optimization method obtains the model surface included in the scene, triangulates the model surface, and obtains the UV coordinates of the triangulated model surface; sets the optical path of the model surface to obtain the lighting information of the model surface, converts the UV coordinates of the vertices of the model surface into pixel coordinates, and obtains the pixel average value of the model surface based on the pixel coordinates and the lighting information; obtains the target deletion surface based on the pixel average value of the model surface, and deletes the target deletion surface. On the one hand, the model faces included in the scene are acquired, the model faces are triangulated to obtain the UV coordinates of the model faces, the optical path of the model faces is set to obtain the lighting information of the model faces, the target deletion faces are determined according to the lighting information of the model faces, and the target deletion faces are deleted, thereby improving the accuracy and quality of model face deletion and solving the problem of incomplete model face deletion due to back clipping in related technologies. At the same time, by deleting the unnecessary rendered model faces, the image rendering effect is improved and a smoother user experience is provided. On the other hand, after obtaining the lighting information of the model faces, the vertex UV coordinates of the model faces are converted into pixel coordinates, and the pixel average value of the model faces is obtained according to the pixel coordinates and the lighting information. According to the pixel average value of the model faces, the target deletion faces are obtained, thereby improving the efficiency of determining the target deletion faces. After determining the target deletion faces, deleting the target deletion faces saves memory resources.
[0058] Hereinafter, each step involved in the model optimization method of the exemplary embodiment of the present disclosure is explained and illustrated in detail.
[0059] In step S110, a model surface included in the scene is obtained, and the model surface is triangulated to obtain UV coordinates of the triangulated model surface.
[0060] In this example embodiment, the model faces in the scene include model faces in the visible area and model faces in the invisible area. The invisible area may be an area outside the player's view or an area blocked by other objects, and the invisible area is not specifically limited in this example embodiment. The model faces in the scene may be triangular faces or quadrilateral faces, and this is not specifically limited in this example embodiment.
[0061] Before triangulating the model surface, refer to Figure 2 As shown, the model optimization method also includes:
[0062] Step S210: Acquire geometric data in the scene, and merge the geometric data to obtain a geometric data group;
[0063] Step S220. Acquire material data corresponding to the geometric data in the geometric data group, and determine first material data with the same material name in the material data;
[0064] Step S230: Obtain the first model surface in the geometric data group that references the first material data, merge the first model surface, and delete the material data other than the first material data in the scene.
[0065] Below, step S210-step S230 will be further explained and illustrated. Specifically, first, the geometric data in the scene is obtained. The geometric data can be all the data of the model in the game scene, and can include points, lines, surfaces, point positions, line lengths, surface areas, etc. in the model. In this example embodiment, the geometric data is not specifically limited. After the geometric data is obtained, bpy.ops.object.join() in BlenderAPI is called to merge the obtained geometric data into a geometric data group to improve the efficiency of the solution. After obtaining the geometric data group, the material ID corresponding to each geometric data in the geometric data group can be obtained, and the corresponding material attribute data can be determined according to the obtained material ID, and the material attribute data is stored as List 1. The material attribute data included in List 1 are compared and processed to determine the first material attribute data with the same material name included in List 1, and the first model face that references the first material attribute data in the geometric data group is obtained, and the first model face is merged and stored in List 2, wherein the format of List 2 may be [[0,[5,22,24,30,46...]],[1,[2,8,15,17,28...]], in which 0 represents the material identifier, and 5, 22, 24, 30, and 46 are model faces that reference material No. 0, respectively. After List 2 is obtained, bpy.ops.object.material_slot_remove_unused() in BlenderAPI may be called to clear the redundant material data in the scene, wherein the redundant material data is the data in the scene except the first material data, and the redundant material data is not referenced by the model face.
[0066] In this example embodiment, by clearing redundant material data, the uniqueness of the material data is ensured, the cleanliness of material usage is ensured, redundant calculations are avoided, and the problem of errors caused by the material not being referenced by the model surface is avoided.
[0067] In this example embodiment, after the clean material information is merged, the model surface can be calculated, referring to Figure 3 As shown, the acquiring of the model surface included in the scene, triangulation of the model surface, and obtaining the UV coordinates of the triangulated model surface include:
[0068] Step S310: Acquire the model surface, and triangulate the model surface to obtain a triangulated model surface;
[0069] Step S320: resetting the UV coordinates of the triangular model surface, and arranging the reset UV coordinates to obtain arranged UV coordinates;
[0070] Step S330: Determine the arranged UV coordinates as the UV coordinates of the triangular model surface.
[0071] Below, step S310-step S330 will be further explained and illustrated. Specifically, enter the edit mode through bpy.ops.object.mode_set() in BlenderAPI, obtain the model surface included in the geometric data through bpy.ops.object.select_all(), and then call bpy.ops.mesh.quads_convert_to_tris() to triangulate the model surface to obtain the triangular model surface. After obtaining the triangular model surface, call bpy.ops.uv.reset and bpy.ops.uv.pack_islands in sequence to reset the UV of the triangular model surface and arrange the UV data to obtain the UV coordinates of the model surface. Figure 4 The UV coordinate data of the model surface is shown.
[0072] In step S120, the optical path of the model surface is set to obtain illumination information of the model surface, the UV coordinates of the vertices of the model surface are converted into pixel coordinates, and the pixel average value of the model surface is obtained based on the pixel coordinates and the illumination information.
[0073] After obtaining the UV coordinates of the model surface, you can set the light path parameters for the triangulated model surface, and use the light path parameters to render the illumination of the model surface to obtain the illumination information of the model surface. Setting the light path parameters means configuring the Light Paths settings. After obtaining the illumination information of the model surface, you can calculate the pixel average of the model surface based on the illumination information.
[0074] In this example embodiment, reference Figure 5 As shown, the step of setting the optical path of the model surface to obtain illumination information of the model surface includes:
[0075] Step S510: Turn off light bounce in the optical path parameters of the model surface, and render the illumination information of the model surface through a graphics processor to obtain an illumination image;
[0076] Step S520: Store the illumination image to obtain illumination information of the model surface.
[0077] Below, step S510 and step S520 will be further explained and illustrated. Specifically, turn off the light bounce in the optical path configuration. When the light bounce is turned on, the shadow area (unilluminated area) will also be illuminated by the bounced light, affecting the accuracy of the calculation. When the light bounce is turned off, the illuminated area and the shadow area will be accurately obtained. The specific parameter values are set to total Toatl=0, diffuse reflection Diffues=1, glossy Glossy=0, transmission Transmissin=0, volume Volume=0, and transparency Transparet=0, that is, only turn on diffuse reflection for 1 bounce, and turn off other channels. In addition, Samples can be configured to 512 to achieve a relative balance between quality and efficiency. When rendering the light on the model surface, the graphics processor can be turned on to improve the rendering efficiency through the computing unit of the graphics processor. After setting the light path parameters, you can start rendering. When starting rendering, you can call and execute bpy.ops.render.render(use_viewport=True) in BlenderAPI to render the lighting information of the model surface and obtain a lighting image. After obtaining the lighting image, you can cache the lighting image in .TIF format and obtain the lighting information of the model surface through the lighting image.
[0078] In this exemplary embodiment, it is also necessary to convert the UV coordinates of the triangulated model surface into pixel coordinates, and the converting of the UV coordinates of the vertices of the model surface into pixel coordinates includes:
[0079] The UV coordinates of the vertices included in the model surface are obtained, and based on the information of the illumination image, the UV coordinates of the vertices are converted to obtain the pixel coordinates of the three corner vertices of the model surface.
[0080] Specifically, the geometric data included in the scene is obtained, and the obtained geometric data is stored in List 3. The model faces included in List 3 are traversed to obtain the coordinate positions of the three vertices corresponding to each model face, and the coordinate positions of the three vertices of the model face are stored using Idx_data.append([idx]+coordinates_list), where idx is the representation of the model face, coordinates_list is the coordinate positions of the three vertices in the model face, and the coordinate position values recorded in coordinates_list are floating point vectors. The three vertex coordinates of the model face are obtained, which are the UV coordinates of the three vertices. After obtaining the UV coordinates of the three vertices of the model face, the UV coordinates are processed according to the size of the illumination image and converted into pixel coordinates. During the conversion, x=int(u*(width-1)), y=int(v*(height-1)), x, y represent pixel coordinates, u, v are the UV coordinates of the vertex, and height is the size of the illumination image.
[0081] After obtaining the illumination image of the model surface and the pixel coordinates of the three vertices of the model surface, the pixel average value of the pixel points included in the model surface can be obtained according to the illumination information of the model surface. Figure 6 As shown, obtaining the pixel average value of the model surface according to the pixel coordinates and the illumination information includes:
[0082] Step S610. Determine the pixel points included in the model surface based on the pixel coordinates of the vertices in the model surface;
[0083] Step S620. Obtain the pixel value of the pixel point according to the illumination information, and obtain the pixel average value of the model surface according to the pixel value of the pixel point and the number of pixels included in the model surface.
[0084] In the following, step S610 and step S620 will be further explained and illustrated. Specifically, based on the pixel coordinates of the three vertices of the model surface, the pixel points included in the model surface are determined, the illumination information of the model surface is obtained, and the pixel value of each pixel point in the model surface is determined according to the illumination information. After the pixel value of each pixel point in the model is obtained, the pixel average value of the model surface is obtained according to the sum of the pixel values of the pixel points included in the model surface and the number of pixel points included in the model surface. Among them, the calculation formula of the pixel average value of the model surface is:
[0085] average_value=sum(pixel_values) / len(pixel_values)
[0086] Among them, pixel_values represents a list of pixel values of the pixels included in the model surface, sum(pixel_values) represents the sum of the pixel values of all pixels in the model surface, and len(pixel_values) represents the number of pixels included in the model surface.
[0087] In this example embodiment, the calculation is performed using the pixel values of all pixels in the model surface, thereby ensuring the accuracy of the calculation and avoiding the problem of reduced accuracy due to noise and insufficient pixel resolution.
[0088] In step S130, a target deletion surface is obtained according to the average pixel value of the model surface, and the target deletion surface is deleted.
[0089] After the average pixel value of the triangulated model surface is obtained, it can be determined whether the model surface is a target deletion surface according to the average pixel value of the triangulated model surface.
[0090] refer to Figure 7 As shown, the target deletion surface is obtained according to the pixel average value of the model surface, and the target deletion surface is deleted, including:
[0091] Step S710: traverse the model surface and compare the average pixel value of the model surface with the preset value;
[0092] Step S720: When the pixel average value of the model surface is greater than the preset value, the model surface is stored and the model surface is confirmed as a target deletion surface;
[0093] Step S730: Delete the stored target deletion surface.
[0094] Below, step S710-step S730 will be further explained and illustrated. Specifically, call bpy.ops.object.mode_set() in BlenderAPI to enter the editing model, and then call bpy.ops.mesh.select_all() and bpy.ops.object.mode_set() to traverse and compare the model faces. Specifically, obtain the pixel average value of each model face, and compare the pixel average value of each model face with the preset value, wherein the preset value can be 1, and the preset value is not specifically limited in this example embodiment. Based on the comparison with the preset value, when the pixel average value of the model face is greater than the preset value, it is recorded as true, and when the pixel value of the model face is less than the preset value, it is recorded as false. When the comparison value is false, no processing is performed on the model face. When the comparison value is true, the model face is stored in the deleted face list. The list of deleted faces is traversed, and bpy.context.view_layer.objects.active.data.polygons[].select is executed to obtain the target deleted face. After obtaining the target deleted face, bpy.ops.mesh.delete() is executed to delete the target deleted face. Figure 8 The target deletion faces in the scene are shown, wherein the triangular faces displayed in white are the target deletion faces.
[0095] The model optimization method provided by the exemplary embodiments of the present disclosure has at least the following advantages: on the one hand, the model faces included in the scene are acquired, the model faces are triangulated to obtain the UV coordinates of the model faces, the optical path is set for the model faces to obtain the illumination information of the model faces, the target deletion faces are determined according to the illumination information of the model faces, and the target deletion faces are deleted, thereby improving the accuracy and quality of model face deletion, solving the problem of incomplete deletion of model faces due to back clipping in the related art, and at the same time, by deleting the model faces that are unnecessary to render, improving the image rendering effect and providing a smoother user experience; on the other hand, after obtaining the illumination information of the model faces, the vertex UV coordinates of the model faces are converted into pixel coordinates, and the pixel average value of the model faces is obtained according to the pixel coordinates and the illumination information, and the target deletion faces are obtained according to the pixel average value of the model faces, thereby improving the efficiency of determining the target deletion faces, and after determining the target deletion faces, deleting the target deletion faces saves memory resources.
[0096] The exemplary embodiment of the present disclosure also provides a model optimization device, referring to Fig. 9 As shown, it may include: a coordinate acquisition module 910, a pixel calculation module 920 and a model surface deletion module 930.
[0097] in:
[0098] A coordinate acquisition module 910 is used to acquire a model surface included in the scene, perform triangulation on the model surface, and obtain UV coordinates of the triangulated model surface;
[0099] The pixel calculation module 920 is used to set the optical path of the model surface, obtain the illumination information of the model surface, convert the UV coordinates of the vertices of the model surface into pixel coordinates, and obtain the pixel average value of the model surface according to the pixel coordinates and the illumination information;
[0100] The model surface deletion module 930 is used to obtain a target deletion surface according to the average pixel value of the model surface, and delete the target deletion surface.
[0101] The specific details of each module in the above-mentioned model optimization device have been described in detail in the corresponding model optimization method, so they will not be repeated here.
[0102] In an exemplary embodiment of the present disclosure, the coordinate acquisition module includes:
[0103] A geometry data group acquisition module is used to acquire geometry data in the scene, and merge the geometry data to obtain a geometry data group;
[0104] A material data determination module, used for acquiring material data corresponding to the geometric data in the geometric data group, and determining first material data with the same material name in the material data;
[0105] The material data clearing module is used to obtain the first model surface that references the first material data in the geometric data group, merge the first model surface, and delete the material data other than the first material data in the scene.
[0106] In an exemplary embodiment of the present disclosure, the coordinate acquisition module includes:
[0107] A triangulation module, used for acquiring the model surface, performing triangulation processing on the model surface, and obtaining a triangulated model surface;
[0108] A coordinate arrangement module is used to perform UV coordinate reset processing on the triangular model surface and arrange the reset UV coordinates to obtain arranged UV coordinates;
[0109] A coordinate acquisition module is used to determine the arrangement UV coordinates as the UV coordinates of the triangular model surface.
[0110] In an exemplary embodiment of the present disclosure, the pixel calculation module includes:
[0111] A rendering module, used to turn off light bounce in the optical path parameters of the model surface, and render the illumination information of the model surface through a graphics processor to obtain an illumination image;
[0112] The illumination information acquisition module is used to store the illumination image and obtain the illumination information of the model surface.
[0113] In an exemplary embodiment of the present disclosure, the pixel calculation module includes:
[0114] The pixel coordinate conversion module is used to obtain the UV coordinates of the vertices included in the model surface, and based on the information of the illumination image, convert the UV coordinates of the vertices to obtain the pixel coordinates of the three corner vertices of the model surface.
[0115] In an exemplary embodiment of the present disclosure, the pixel calculation module includes:
[0116] A pixel point determination module, used to determine the pixel points included in the model surface based on the pixel coordinates of the vertices in the model surface;
[0117] The pixel average value calculation module is used to obtain the pixel value of the pixel point according to the illumination information, and obtain the pixel average value of the model surface according to the pixel value of the pixel point and the number of pixels included in the model surface.
[0118] In an exemplary embodiment of the present disclosure, the model surface deletion module includes:
[0119] A model surface traversal module, used for traversing the model surface and comparing the average pixel value of the model surface with the preset value;
[0120] A target deletion surface determination module, configured to store the model surface and confirm the model surface as a target deletion surface when the pixel average value of the model surface is greater than the preset value;
[0121] The surface deletion module is used to delete the stored target deletion surface.
[0122] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0123] In addition, although the steps of the method of the present invention are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0124] In an exemplary embodiment of the present invention, an electronic device capable of implementing the above method is also provided.
[0125] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".
[0126] Refer to the following Fig.10 The electronic device 1000 according to this embodiment of the present invention will be described. Fig.10 The electronic device 1000 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0127] like Fig.10 As shown, the electronic device 1000 is in the form of a general computing device. The components of the electronic device 1000 may include, but are not limited to: the at least one processing unit 1010, the at least one storage unit 1020, a bus 1030 connecting different system components (including the storage unit 1020 and the processing unit 1010), and a display unit 1040.
[0128] The storage unit stores program codes, which can be executed by the processing unit 1010, so that the processing unit 1010 performs the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification. For example, the processing unit 1010 can perform the following steps: Figure 1 The steps S110 shown in the figure are as follows: obtaining a model surface included in the scene, triangulating the model surface, and obtaining UV coordinates of the triangulated model surface; S120: setting the optical path of the model surface, obtaining lighting information of the model surface, converting the UV coordinates of the vertices of the model surface into pixel coordinates, and obtaining the pixel average value of the model surface based on the pixel coordinates and the lighting information; S130: obtaining a target deletion surface based on the pixel average value of the model surface, and deleting the target deletion surface.
[0129] The storage unit 1020 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 10201 and / or a cache storage unit 10202 , and may further include a read-only storage unit (ROM) 10203 .
[0130] The storage unit 1020 may also include a program / utility 10204 having a set (at least one) of program modules 10205, such program modules 10205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0131] Bus 1030 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0132] The electronic device 1000 may also communicate with one or more external devices 1100 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1000, and / or communicate with any device that enables the electronic device 1000 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1050. In addition, the electronic device 1000 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 1060. As shown, the network adapter 1060 communicates with other modules of the electronic device 1000 via a bus 1030. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1000, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID (Redundant Arrays of Independent Disks, independent redundant disk array) systems, tape drives, and data backup storage systems.
[0133] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present invention.
[0134] In an exemplary embodiment of the present invention, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of this specification is stored. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to perform the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of this specification.
[0135] The program product for implementing the above method according to an embodiment of the present invention may adopt a portable compact disk read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.
[0136] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0137] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0138] The program code contained on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF (Radio Frequency), etc., or any suitable combination of the above.
[0139] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0140] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0141] Other embodiments of the invention will readily occur to those skilled in the art after considering the specification and practicing the invention invented herein. This application is intended to cover any variations, uses or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art that are not invented by the present invention. The specification and examples are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the claims.
Claims
1. A model optimization method, characterized in that: include: Acquire a model surface included in the scene, perform triangulation on the model surface, and obtain UV coordinates of the triangulated model surface; Performing optical path setting on the model surface to obtain illumination information of the model surface, converting UV coordinates of vertices of the model surface into pixel coordinates, and obtaining a pixel average value of the model surface according to the pixel coordinates and the illumination information; A target deletion surface is obtained according to the pixel average value of the model surface, and the target deletion surface is deleted.
2. The method according to claim 1, characterized in that Before triangulating the model surface, the method further includes: Acquire geometric data in the scene, and merge the geometric data to obtain a geometric data group; Acquire material data corresponding to the geometric data in the geometric data group, and determine first material data with the same material name in the material data; A first model surface referencing the first material data in the geometric data group is obtained, the first model surfaces are merged, and material data other than the first material data in the scene is deleted.
3. The method according to claim 1, characterized in that The acquiring of the model surface included in the scene, triangulation of the model surface, and obtaining the UV coordinates of the triangulated model surface include: Acquire the model surface, and perform triangulation processing on the model surface to obtain a triangulated model surface; Resetting the UV coordinates of the triangular model surface, and arranging the reset UV coordinates to obtain arranged UV coordinates; The arrangement UV coordinates are determined as UV coordinates of the triangular model surface.
4. The method according to claim 1, characterized in that: The step of setting the optical path of the model surface to obtain illumination information of the model surface includes: Turning off light bounce in the optical path parameters of the model surface, rendering the illumination information of the model surface through a graphics processor to obtain an illumination image; The illumination image is stored to obtain illumination information of the model surface.
5. The method according to claim 4, characterized in that The step of converting the UV coordinates of the vertices of the model surface into pixel coordinates comprises: The UV coordinates of the vertices included in the model surface are obtained, and based on the information of the illumination image, the UV coordinates of the vertices are converted to obtain the pixel coordinates of the three corner vertices of the model surface.
6. The method according to claim 1, characterized in that The step of obtaining the pixel average value of the model surface according to the pixel coordinates and the illumination information includes: Determining pixel points included in the model surface based on pixel coordinates of vertices in the model surface; The pixel value of the pixel point is obtained according to the illumination information, and the pixel average value of the model surface is obtained according to the pixel value of the pixel point and the number of pixels included in the model surface.
7. The method according to claim 1, characterized in that The step of obtaining a target deletion surface according to the average pixel value of the model surface and deleting the target deletion surface comprises: Traversing the model surface, and comparing an average pixel value of the model surface with the preset value; When the pixel average value of the model surface is greater than the preset value, the model surface is stored and the model surface is confirmed as a target deletion surface; The stored target deletion surface is deleted.
8. A model optimization device, characterized in that: include: A coordinate acquisition module, used to acquire a model surface included in the scene, perform triangulation on the model surface, and obtain UV coordinates of the triangulated model surface; A pixel calculation module, used to set the optical path of the model surface, obtain the illumination information of the model surface, convert the UV coordinates of the vertices of the model surface into pixel coordinates, and obtain the pixel average value of the model surface according to the pixel coordinates and the illumination information; The model surface deletion module is used to obtain a target deletion surface according to the pixel average value of the model surface, and delete the target deletion surface.
9. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
10. An electronic device, characterized in that: include: Processing unit; as well as A storage unit, used to store executable instructions of the processing unit; Wherein, the processing unit is configured to perform the method of any one of claims 1-7 by executing the executable instructions.
