Model patch detection method, apparatus, computer equipment and readable storage medium
By utilizing display screen parameters and spatial transformation matrix to transform the projection unit in model patch detection, the problem of tiny patches affecting rendering effects is solved, achieving efficient and accurate patch detection and performance optimization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-06
- Publication Date
- 2026-04-07
AI Technical Summary
In existing technologies, the faces used to represent details in the model occupy a small pixel space during rendering but still require CPU or GPU processing, affecting the overall rendering effect. Furthermore, manual inspection is tedious and ineffective.
By determining the display screen parameters, the projection unit is transformed into the model space using a spatial transformation matrix. The target model surface is detected based on the size and shape type of the target detection unit, thereby improving the detection accuracy and efficiency.
It effectively identifies and reduces tiny patches that result in poor image quality, improving GPU or CPU rendering performance and simplifying the detection process.
Smart Images

Figure CN117197069B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, specifically to a method, apparatus, computer device, and readable storage medium for detecting model facets. Background Technology
[0002] On mobile platforms, polygonal faces and vertices consume significant computing power. To achieve better detail, artists often add more vertices and faces to models. However, in some practical applications, the faces used to represent details often occupy only a small amount of pixel space when rendered to the screen, contributing little to the overall visual presentation. Yet, this face information still requires processing by the CPU (Central Processing Unit) or GPU (graphics processing unit), thus consuming some of their performance and affecting the overall rendering quality of the model.
[0003] To prevent artists from adding too many polygons to highlight details and negatively impacting the overall rendering of the model, it is essential to inspect these polygons. However, current technology requires importing the model into graphics software for display, followed by manual identification and processing of poorly performing polygons. This process is cumbersome, and the model displayed in the graphics software overlaps with the display grid of the graphics editing tools, affecting the subsequent polygon inspection results. Summary of the Invention
[0004] Therefore, it is necessary to provide a model patch detection method, apparatus, computer equipment, and readable storage medium to address the above-mentioned technical problems, so as to solve the problem of poor detection effect in existing methods for detecting patches that do not contribute enough to the image performance of the model during the display process.
[0005] Firstly, this application provides a method for detecting model surface patches, including:
[0006] A method for detecting model patches, characterized in that it includes:
[0007] Determine the display screen of the target device and the corresponding display parameters of the display screen;
[0008] Based on the display parameters, a projection unit comprising a specified number of pixels is determined;
[0009] According to the specified spatial transformation matrix, the projection unit in the screen space is transformed to obtain the target detection unit corresponding to the projection unit in the model space of the target scene model;
[0010] The target scene model is detected based on the target detection unit to determine the target model patch from multiple model patches included in the target scene model;
[0011] The target model patch is determined based on the size of the target detection unit in the model space.
[0012] Secondly, this application provides a model surface patch detection device, comprising:
[0013] A parameter determination module is used to determine the display screen of the target device and the display parameters corresponding to the display screen.
[0014] The unit determination module is used to determine a projection unit including a specified number of pixels based on the display parameters;
[0015] The transformation module is used to transform the projection unit in the screen space according to the specified spatial transformation matrix to obtain the target detection unit corresponding to the projection unit in the model space of the target scene model.
[0016] The detection module is used to detect the target scene model based on the target detection unit, so as to determine the target model patch from the multiple model patches included in the target scene model;
[0017] The target model patch is determined based on the size of the target detection unit in the model space.
[0018] Thirdly, this application also provides a computer device, characterized in that the computer device comprises:
[0019] One or more processors;
[0020] Memory; and
[0021] One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the model patch detection method provided above.
[0022] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, the computer program being loaded by a processor to execute the model patch detection method provided above.
[0023] Fifthly, embodiments of this application provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the model patch detection method provided above.
[0024] The solution provided in this application uses a specified spatial transformation matrix to process a projection unit containing a specific number of pixels in screen space into a target detection unit in model space. This allows for the convenient determination of target model patches in the target scene model that do not perform well in screen space using the size of the target detection unit, thereby effectively improving the accuracy and efficiency of detecting fine patches. Attached Figure Description
[0025] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0026] Figure 1 This is a schematic flowchart illustrating the steps of a model patch detection method provided in an embodiment of this application.
[0027] Figure 2 This is a schematic flowchart illustrating the steps for transforming a projection unit according to an embodiment of this application.
[0028] Figure 3 This is a flowchart illustrating the steps for detecting minute facets based on their spatial dimensions, as provided in this application embodiment.
[0029] Figure 4 This application provides a schematic flowchart illustrating the steps for filtering model patches based on patch shape type in an embodiment of the present application.
[0030] Figure 5 This application provides a schematic flowchart of a process for filtering model patches based on area and patch shape type.
[0031] Figure 6 This application provides a flowchart illustrating the steps for determining a target scene model.
[0032] Figure 7 This is a schematic diagram showing the effect of detecting model surfaces using the model surface detection method provided in this application embodiment;
[0033] Figure 8 This is a schematic diagram of the structure of a model patch detection device provided in an embodiment of this application;
[0034] Figure 9 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0035] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0036] In the description of this application, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the stated features. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0037] In the description of this application, the word "for example" is used to mean "used as an example, illustration, or description." Any embodiment described as "for example" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use the invention. Details are set forth in the following description for purposes of explanation. It should be understood that those skilled in the art will recognize that the invention can be made without using these specific details. In other instances, well-known structures and processes will not be described in detail to avoid obscuring the description of the invention with unnecessary detail. Therefore, the invention is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed in this application.
[0038] To facilitate understanding of the model patch detection method provided in this application embodiment, the application scenario of the model patch detection method will be explained first. In this application embodiment, "model" refers to an art resource created by artists in modeling software, such as common character models, architectural models, etc. Specifically, a model is usually composed of vertices, lines, and patches. After being rendered by a CPU or GPU, these vertices, lines, and patches can be displayed on a display device, such as a screen, to show the corresponding model effect.
[0039] Typically, to enhance the detail of a model, artists often add more vertices, lines, and faces during the modeling process to represent these details. However, in certain scenarios, such as when the model is placed at a distance from the viewpoint, these detailed vertices, lines, and faces occupy only a small pixel space on the screen after rendering by the CPU or GPU, contributing little to the overall visual presentation. Nevertheless, they still consume some CPU or GPU resources, especially the faces. For ease of description, we will refer to these small pixel spaces—for example, faces that occupy between 1 and 10 pixels after rendering—as micro-facets. For instance, a certain GPU's performance specifications state that the proportion of micro-facets in the image should ideally be less than 10%. Therefore, real-time detection of these micro-facets during modeling is essential to avoid introducing too many into the model, effectively improving GPU or CPU performance.
[0040] Currently, artists typically import completed models into graphics display software, such as 3ds Max or Maya, for display, and then identify and annotate the tiny faces that occupy a small pixel space. However, this method is cumbersome, especially since typical scenes often involve hundreds or thousands of models. Importing them sequentially into graphics display software for identification is extremely troublesome. Furthermore, when the model is displayed in graphics display software, it often overlaps with the display grid of the graphics editing tools, affecting the detection effect of tiny faces. To solve these problems and improve the detection effect of tiny faces, this application provides a model face detection method, apparatus, computer device, and readable storage medium. The model face detection method is installed in the form of a computer program in the model face detection apparatus, which is set in the form of a processor in the computer device. The model face detection apparatus in the computer device executes the model face detection method provided in this application by running the computer program corresponding to the model face detection method.
[0041] Specifically, such as Figure 1 As shown, Figure 1 This application provides a schematic flowchart of a model patch detection method, specifically including steps S110 to S140:
[0042] S110, determine the display screen of the target device and the display parameters corresponding to the display screen.
[0043] The target device typically refers to a terminal device that has the function of rendering the model and displaying it to the user through the device's display screen. It can also be understood as the terminal device used to perform the model patch detection method in this application. Specifically, common target devices include mobile phones, laptops, desktop computers, etc., while the display screen of the target device is usually a mobile phone screen, computer screen, etc.
[0044] Furthermore, considering that different display parameters on different display screens result in different display effects on the model and different visual effects for users, in order to detect model faces with poor display effects, it is usually necessary to further determine the display parameters corresponding to the display screen. Specifically, the display parameters corresponding to the display screen usually include at least the screen resolution, and may also include the screen size, etc.
[0045] S120, based on the display parameters, determine a projection unit including a specified number of pixels.
[0046] In this embodiment, based on the aforementioned determination of the display parameters corresponding to the display screen of the target device, a projection unit comprising a specified number of pixels can be further determined on the screen to satisfy the user's visual effect. For example, as a feasible embodiment of this application, the number of pixels in the projection unit is usually related to the screen resolution in the display parameters. The higher the screen resolution, the more pixels are contained in a unit area on the screen, and the larger the specified number of pixels. For example, taking a conventional 1920*1080 resolution screen as an example, typically at least 10 pixels are needed on a screen of this resolution to meet the user's basic visual needs. That is, when the number of pixels in the area rendered on the screen by a certain model patch is less than 10, it can be considered that the screen area occupied by the model patch is too small and does not contribute much to the user's visual effect; the model patch can be considered a tiny patch. Of course, the above is only a feasible embodiment. In fact, the user's basic visual needs can also be related to the screen size of the display screen.
[0047] Furthermore, based on the above, after determining the projection unit including a specified number of pixels, the projection unit can be recorded in the screen space in the form of two-dimensional coordinates for subsequent model patch detection.
[0048] Furthermore, this application does not restrict the shape type of the projection unit. Common shapes include triangles, squares, circles, etc. These projection units with different shapes can better detect different shapes of patches in the model.
[0049] S130, according to the specified spatial transformation matrix, the projection unit in the screen space is transformed to obtain the target detection unit corresponding to the projection unit in the model space of the target scene model.
[0050] In this embodiment, after determining the projection unit containing a specified number of pixels that can satisfy the user's most basic visual effect, it can be transformed into the model space of the target scene model to be detected using a specified spatial transformation matrix, thereby obtaining the target detection unit corresponding to the projection unit in the model space. It is understood that the area occupied by the target detection unit in the model space when displayed on the screen after rendering by the device is the same as the area of the projection unit on the screen. Therefore, based on the size relationship between the target detection unit and the projection unit, the size of the area occupied by each model patch included in the target scene model to be detected in the model space after rendering and display on the screen can be estimated.
[0051] Specifically, for ease of understanding, the rendering process—that is, rendering the surfaces of the model onto the device's screen for display—generally includes the following three steps:
[0052] 1) Transformation operation of the world transformation matrix: that is, transforming the face in the model from the model space coordinate system to the world space coordinate system of the rendering pipeline. In the model space coordinate system, the face in the model usually exists in the form of the vertex coordinates of several vertices of the face. Therefore, after the transformation operation of the world transformation matrix, the face will exist in the form of the coordinates of several points in the world space coordinate system of the rendering pipeline.
[0053] 2) Transformation operation of camera transformation matrix: The camera can be understood as the viewpoint, which describes where and from what perspective the user observes the model (panel) in the scene, thus determining part of the rendering effect of the model (panel). The transformation operation of camera transformation matrix can transform the panel in the world space coordinate system of the rendering pipeline to the camera space coordinate system. Similarly, the panel also exists in the camera space coordinate system as the coordinates of several points.
[0054] 3) Transformation operation of projection transformation matrix: that is, projecting the face in the camera space coordinate system into the two-dimensional screen space coordinate system, thereby determining the area occupied by the face in the screen space, and generating the final rendering effect of the face in the corresponding area. Specifically, the face in the screen space coordinate system usually exists in the form of the coordinates of several points.
[0055] Therefore, transforming the projection unit in screen space into the target detection unit corresponding to the projection unit in the model space of the target scene model usually requires performing the inverse operation of the above steps. Specific implementation schemes can be found in the following sections. Figure 2 And its explanations and descriptions.
[0056] Of course, considering that artists often add more vertices and faces to models in pursuit of better detail, models with small faces typically have a large number of vertices or faces. Therefore, to improve the efficiency of small face detection for multiple models in a scene, when performing face detection on models in the scene, a simple filtering process is first performed based on the number of faces and / or vertices of each model to determine the target scene models that need face detection. Specific implementation details can be found in subsequent sections. Figure 6 And its explanations and descriptions.
[0057] S140, the target scene model is detected based on the target detection unit to determine the target model patch from the multiple model patches included in the target scene model.
[0058] In this embodiment, the target model patch is typically determined based on the size of the target detection unit in model space. For example, as a common feasible implementation, the target model patch can be based on the size of the target detection unit in model space. That is, the unit area of the target detection unit in model space can be determined based on the size information of the target detection unit in model space. By comparing the patch area of each model patch in the target scene model with the unit area, the target model patch with poor image performance, such as the one that occupies less than 10 screen pixels after final rendering, can be identified from the multiple model patches included in the target scene model. Specific implementation schemes can be found in the following sections. Figure 3 And its explanations and descriptions.
[0059] Of course, in addition to the aforementioned method of detecting multiple model patches in the target scene model based on size, i.e., the unit area of the target detection unit, considering that the model patches in the target scene model may include different shapes, when determining a specified number of projection units from the screen space, projection units corresponding to different patch shape types can be determined separately, and then transformed to obtain target detection units corresponding to different patch shape types in the model space. This achieves the selection of appropriate target detection units based on different patch shape types for detecting model patches of specific shapes in the target scene model. Specific implementation schemes can be found in subsequent sections. Figure 4 And its explanations and descriptions.
[0060] Furthermore, to facilitate artists in quickly identifying minute faces from the model, the model face detection device can further highlight target model faces in the target scene model from a visual perspective. For example, it can display the color of the target face by writing vertex colors, making it easier for artists to modify and update. Specifically, such as... Figure 7 As shown, Figure 7 This illustration shows the effect of detecting and displaying target model faces in an embodiment of this application. It can be seen that in the target scene model, all potentially minute facets are identified and displayed. Users can then modify these facets based on their actual needs. In other words, in response to user commands, target model faces and / or target vertices of these facets can be removed or merged to obtain a simplified scene model. Since the simplified scene model reduces the number of minute facets compared to the target scene model, it can better utilize the processing power of the GPU or CPU during rendering, thus providing better rendering results. Of course, to facilitate users in determining the priority of processing these target model faces and / or target vertices, as a feasible embodiment of this application, these target model faces can also be distinguished in the target scene model based on the size difference between the target model facets and the target detection units. For example, the larger the size of the target model patch and the target detection unit, the less ideal the final rendering effect of the target model patch is. In this case, the target model patch needs to be processed first. Therefore, a darker color can be used to mark and display the target model patch. Conversely, a lighter color can be used to mark and display the target model patch.
[0061] The solution provided in this application uses a specified spatial transformation matrix to process a projection unit containing a specific number of pixels in screen space into a target detection unit in model space. This allows for the convenient determination of target model patches in the target scene model that do not perform well in screen space using the size of the target detection unit, thereby effectively improving the accuracy and efficiency of detecting fine patches.
[0062] like Figure 2 As shown, Figure 2 This application provides a flowchart illustrating the steps for transforming a projection unit, specifically including steps S210 to S230:
[0063] S210, according to the projection transformation matrix in the specified spatial transformation matrix, the projection unit in the screen space is transformed to obtain the first detection unit corresponding to the projection unit in the camera space.
[0064] In this embodiment, the projection transformation matrix is typically used to transform point coordinates in camera space to point coordinates in screen space, thereby forming a corresponding region. The specific calculation formula is as follows:
[0065]
[0066] In the calculation formula, the first term on the left-hand side of the equation is the projection transformation matrix, where r is the projection plane, i.e., the aspect ratio of the screen space; α can be understood as the viewing angle of the facet in the model relative to the viewpoint (i.e., the camera position); A and B are calculated based on the far-plane distance f of the facet in the model relative to the viewpoint (i.e., the camera position) and the near-plane distance n of the screen relative to the viewpoint (i.e., the camera position), where:
[0067]
[0068]
[0069] The second term on the left side of the equation represents the point coordinates in camera space. The first three terms of (x, y, z, 1) represent the three-dimensional coordinates of the point in camera space, where z is the viewing distance. The 1 in the last term can be understood as homogeneous coordinates, used in computer graphics to distinguish between vectors and points for linear geometric transformations of graphics. This usually has no impact on the implementation of the scheme in this application, so it will not be elaborated upon here. The matrix on the right side of the equation represents the point coordinates in screen space. Since screen space is two-dimensional, the first two terms are usually taken, i.e.,... and As two-dimensional point coordinates in screen space.
[0070] Based on the above description, since the solution provided in this application transforms the point coordinates in screen space to the point coordinates in camera space, that is, in the above processing, it is necessary to use the inverse matrix of the projection transformation matrix to perform inverse transformation processing on the point coordinates in screen space. In order to transform the two-dimensional point coordinates in screen space to the three-dimensional point coordinates in camera space, it is also necessary to add the viewing distance z in the detection parameters to the two-dimensional point coordinates in screen space to form the three-dimensional point coordinates. The specific description of the inverse operation of the matrix will not be repeated here in the embodiments of this application.
[0071] S220, transform the first detection unit in the camera space according to the camera transformation matrix in the specified spatial transformation matrix to obtain the second detection unit corresponding to the projection unit in the world space.
[0072] In this embodiment, the camera transformation matrix is mainly used to transform the point coordinates in the world space of the rendering pipeline to the point coordinates in the camera space. It usually requires the position offset and rotation of the camera relative to the origin in the world space, that is, the camera pose in the detection parameters. In other words, the camera transformation matrix corresponds to the camera pose in the detection parameters.
[0073] Based on the above description, since the solution provided in this application transforms the first detection unit in camera space, i.e., point coordinates, to the second detection unit in world space, i.e., point coordinates, in the above processing, it is necessary to use the inverse matrix of the camera transformation matrix corresponding to the camera pose to perform inverse transformation processing on the point coordinates of the detection area in camera space. The specific description of the inverse operation of the matrix will not be repeated here in the embodiments of this application.
[0074] S230, transform the second detection unit in the world space according to the world transformation matrix in the specified spatial transformation matrix to obtain the target detection unit corresponding to the projection unit in the model space of the target scene model.
[0075] In this embodiment, the world transformation matrix is mainly used to transform the point coordinates in the model space to the point coordinates in the world space. It usually involves the translation, rotation and scaling of the points. Typically, the space transformation matrix is determined based on the detection parameters corresponding to the target scene model, where the detection parameters include at least the viewpoint parameters and viewing distance parameters of the target scene model in the model space.
[0076] Based on the above description, since the solution provided in this application transforms the point coordinates in world space to the point coordinates in model space, that is, in the above processing, it is necessary to use the inverse matrix of the world transformation matrix to perform inverse transformation processing on the point coordinates of the detection area in world space. The specific description of the inverse operation of the matrix will not be repeated here in the embodiments of this application.
[0077] In this embodiment, through the inverse operation of a series of matrices during the rendering process, the projection unit in the screen space can be transformed into the target detection unit in the model space of the target scene model. Since the above process is the inverse process of rendering, after subsequent rendering processing, the target detection unit will generate the rendering effect of the corresponding projection unit in the screen space. Thus, by comparing the size of the model patch of the target scene model with the size of the target detection unit, the rendering effect of each model patch can be roughly determined, thereby realizing the detection of tiny patches.
[0078] like Figure 3 As shown, Figure 3This is a flowchart illustrating the steps for detecting minute facets in space, based on the spatial dimensions of a facet, as provided in this application embodiment. Specifically, it includes steps S310 to S320:
[0079] S310, Based on the size of the target detection unit in the model space, determine the unit area of the target detection unit in the model space.
[0080] As can be seen from the foregoing descriptions, target detection units typically exist in the form of coordinates in model space. These coordinates can reflect the size information of the target detection unit in model space. Therefore, based on the size of the target detection unit in model space, i.e., the aforementioned coordinate values, the unit area of the target detection unit in model space can be determined.
[0081] S320, the model surface in the target scene model whose surface area is smaller than the unit area is determined as the target surface.
[0082] In this embodiment, as described above, when the area of a model patch in the target scene model is smaller than the area of the target detection unit in the model space, it indicates that the space occupied by the model patch on the screen after rendering is too small. In this case, the model patch is a tiny patch that cannot provide sufficient contribution to the image performance. Therefore, model patches in the target scene model whose area is smaller than the unit area can be identified as target patches. Similar to calculating the area of the target detection unit in the model space, the area of a patch in the target scene model can be calculated based on the coordinate values of the vertices of each model patch in the target scene model, which will not be elaborated further in this embodiment.
[0083] like Figure 4 As shown, Figure 4 This application provides a flowchart illustrating a process for selecting model patches based on patch shape type, specifically including steps S410 to S420:
[0084] S410, based on the shape type of the multiple model facets included in the target scene model, determine the type detection unit corresponding to each of the model facets from the target detection unit.
[0085] In this embodiment, to improve the detection results of small facets in the target scene model, type detection units corresponding to each model facet can be determined from the target detection units based on the facet shape types of the multiple model facets included in the target scene model. Specifically, the target detection units can be processed by cutting or transforming to generate type detection units of various shapes. For example, for a triangular model facet in the target scene model, the corresponding triangular target detection unit can be used as the type detection unit for that model facet; or for a quadrilateral model facet in the target scene model, the corresponding quadrilateral target detection unit can be used as the type detection unit for that model facet. Of course, considering that the facet shape type of the model facet may not be a regular shape, simple shape matching can be performed based on the actual facet shape type of the model facet. For example, as long as the actual facet shape type of the model facet is close to that of a triangle, the triangular target detection unit can be used as the type detection unit for that model facet.
[0086] S420, Based on the type detection unit corresponding to each of the model patches, determine the target model patch from the plurality of model patches.
[0087] In this embodiment, after determining the corresponding type detection units for model patches of different shapes, the target model patch can be better identified from the model patches. For example, as a feasible implementation of this application, by covering the type detection units on the corresponding model patches, when it is determined that the type detection units cover at least a certain proportion of the area of the model patch, it can be considered that the rendering effect of the model patch is not ideal, and it can be identified as the target model patch. In this way, the amount of calculation of the patch area based on coordinate points is reduced, the patch detection efficiency is improved, and different methods for determining the target model patch can be configured for model patches of different shape types. It can also realize the detection of specific patch shape types, such as slender patches with large differences in side length, thereby improving the flexibility of patch detection.
[0088] Of course, during the implementation of the above scheme, it is also possible to combine it with the aforementioned Figure 3 The provided implementation scheme for determining target model patches based on area involves first identifying model patches whose areas are smaller than a preset area threshold based on the relationship between the patch areas of multiple model patches included in the target scene model and the threshold. Then, based on the shape type of the candidate model patches, type detection units corresponding to each candidate model patch are determined from the target detection units. Specific implementation schemes can be found below. Figure 5 And its explanations and descriptions.
[0089] like Figure 5 As shown, Figure 5 This application provides a flowchart illustrating the steps for filtering model patches based on area and patch shape type, specifically including steps S510 to S520:
[0090] S510, based on the relationship between the area of multiple model patches included in the target scene model and a preset area threshold, model patches with an area smaller than the area threshold are determined as candidate model patches.
[0091] In this embodiment, by comparing the area of the model patches included in the target scene model with a preset area threshold, model patches with an area smaller than the area threshold can be identified as candidate model patches. These candidate model patches can be considered as model patches that may not display ideally on the screen after rendering. Specifically, the area threshold here can be related to the unit area of the aforementioned target detection unit in the model space. For example, a value can be added to the unit area of the target detection unit in the model space to increase a certain degree of fault tolerance. This embodiment does not limit the area threshold.
[0092] S520, based on the shape type of the candidate model facet, determine the type detection unit corresponding to each candidate model facet from the target detection unit.
[0093] In this embodiment, by identifying model faces with an area smaller than the area threshold as candidate model faces that may not display well on the screen after rendering, the computational load of subsequent detection of model faces of different face shapes by the corresponding type detection unit can be reduced to a certain extent. This improves the efficiency of model face detection while ensuring the detection effect.
[0094] like Figure 6 As shown, Figure 6 This application provides a flowchart illustrating the steps for determining a target scene model, specifically including steps S610 to S620:
[0095] S610, obtain the number of model faces and / or the number of model vertices for each initial model in the initial scene.
[0096] In this embodiment of the application, as can be seen from the description of the aforementioned step S110, the scene usually contains hundreds or thousands of initial models. In order to improve the efficiency of surface detection for these initial models, considering that models with small surfaces usually contain richer vertex information or surface information, the number of surface surfaces and / or the number of vertices of each initial model in the initial scene can be counted first.
[0097] S620, an initial model whose number of model faces and / or the number of model vertices is greater than a preset threshold is determined as the target scene model to be detected.
[0098] In this embodiment of the application, based on the foregoing, it can be considered that an initial model with a number of model faces and / or a number of model vertices greater than a preset threshold is more likely to have tiny faces. Therefore, the number of model faces and / or a number of model vertices of each initial model can be compared with a preset threshold, and then the initial model with a number of model faces and / or a number of model vertices greater than the threshold can be identified as the target model to be detected for face detection.
[0099] Furthermore, the quantity threshold used in the aforementioned process can be a pre-set threshold, or it can be a statistical value obtained by counting the number of model faces and / or the number of model vertices of each initial model in the initial scene, or a combination of multiple statistical values. For example, as a common and feasible implementation, the quantity threshold can be selected as the average value of the number of model faces and / or the number of model vertices of the initial model.
[0100] To facilitate understanding of the beneficial effects of the above scheme, such as Figure 7 As shown, a schematic diagram illustrates the effect obtained by detecting model surfaces using the model surface detection method provided in this application embodiment. Specifically, as shown... Figure 7 As shown, where Figure 7 The areas shown are the small patches that have been filtered out and have a low contribution to the image after rendering.
[0101] To better implement the model patch detection method provided in the embodiments of this application, based on the model patch detection method provided in the embodiments of this application, this application also provides a model patch detection device, such as... Figure 8 As shown, the model patch detection device 800 includes:
[0102] The parameter determination module 810 is used to determine the display screen of the target device and the display parameters corresponding to the display screen.
[0103] The unit determination module 820 is used to determine a projection unit including a specified number of pixels based on the display parameters.
[0104] The transformation module 830 is used to transform the projection unit in the screen space according to the specified spatial transformation matrix to obtain the target detection unit corresponding to the projection unit in the model space of the target scene model.
[0105] The detection module 840 is used to detect the target scene model based on the target detection unit, so as to determine the target model patch from the multiple model patches included in the target scene model;
[0106] The target model patch is determined based on the size of the target detection unit in the model space.
[0107] In some embodiments of this application, the transformation module 830 is configured to transform the projection unit in screen space according to the projection transformation matrix in the specified spatial transformation matrix to obtain a first detection unit corresponding to the projection unit in camera space; transform the first detection unit in camera space according to the camera transformation matrix in the specified spatial transformation matrix to obtain a second detection unit corresponding to the projection unit in world space; and transform the second detection unit in world space according to the world transformation matrix in the specified spatial transformation matrix to obtain a target detection unit corresponding to the projection unit in the model space of the target scene model.
[0108] In some embodiments of this application, the detection module 840 is used to determine the unit area of the target detection unit in the model space based on the size of the target detection unit in the model space; and to determine the model surface in the target scene model whose surface area is smaller than the unit area as the target surface.
[0109] In some embodiments of this application, the detection module 840 is used to determine, from the target detection units, a type detection unit corresponding to each of the multiple model patches included in the target scene model, based on the patch shape type of each model patch; and to determine the target model patch from the multiple model patches based on the type detection unit corresponding to each model patch.
[0110] In some embodiments of this application, the detection module 840 is used to determine model patches whose area is less than the area threshold as candidate model patches based on the relationship between the patch area of the multiple model patches included in the target scene model and the preset area threshold; and to determine the type detection unit corresponding to each candidate model patch from the target detection unit based on the patch shape type of the candidate model patches.
[0111] In some embodiments of this application, the transformation module 830 is used to obtain the number of model faces and / or the number of model vertices of each initial model in the initial scene; and to determine the initial model whose number of model faces and / or the number of model vertices is greater than a preset threshold as the target scene model to be detected.
[0112] In some embodiments of this application, the detection module 840 is used to distinguish and identify the target model patch in the target scene model based on the size difference between the target model patch and the target detection unit.
[0113] In some embodiments of this application, the detection module 840 is used to process the target model patches and / or the target vertices corresponding to the target model patches in the target scene model to obtain a simplified scene model.
[0114] Specific limitations regarding the model patch detection device can be found in the limitations of the model patch detection method described above, and will not be repeated here. Each module in the aforementioned model patch detection 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 in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the corresponding operations of each module.
[0115] In some embodiments of this application, the model patch detection device 800 can be implemented as a computer program, which can be implemented in, for example... Figure 9 The computer device shown is running the program. The computer device's memory can store the various program modules that make up the model patch detection device 800, for example, Figure 8 The parameter determination module 810, element determination module 820, transformation module 830, and detection module 840 are shown. The computer program comprised of these modules causes the processor to execute the steps in the model patch detection methods of the various embodiments of this application described in this specification.
[0116] For example, Figure 9 The computer equipment shown can be used as follows Figure 8 The parameter determination module 810 in the model patch detection device 800 shown executes step S110. The computer device can execute step S120 via the unit determination module 820. The computer device can execute step S130 via the transformation module 830. The computer device can execute step S140 via the detection module 840. The computer device includes a processor, memory, and a network interface connected via a system bus. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communication with external computer devices via a network connection. When the computer program is executed by the processor, it implements a model patch detection method.
[0117] Those skilled in the art will understand that Figure 9 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.
[0118] In some embodiments of this application, a computer device is provided, including one or more processors; memory; and one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to perform the following steps:
[0119] Determine the display screen of the target device and the corresponding display parameters of the display screen;
[0120] Based on the display parameters, a projection unit comprising a specified number of pixels is determined;
[0121] According to the specified spatial transformation matrix, the projection unit in the screen space is transformed to obtain the target detection unit corresponding to the projection unit in the model space of the target scene model;
[0122] The target scene model is detected based on the target detection unit to determine the target model patch from multiple model patches included in the target scene model;
[0123] The target model patch is determined based on the size of the target detection unit in the model space.
[0124] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: transforming the projection unit in screen space according to the projection transformation matrix in the specified spatial transformation matrix to obtain a first detection unit corresponding to the projection unit in camera space; transforming the first detection unit in camera space according to the camera transformation matrix in the specified spatial transformation matrix to obtain a second detection unit corresponding to the projection unit in world space; and transforming the second detection unit in world space according to the world transformation matrix in the specified spatial transformation matrix to obtain a target detection unit corresponding to the projection unit in the model space of the target scene model.
[0125] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: determining the unit area of the target detection unit in the model space based on the size of the target detection unit in the model space; and determining the model surface in the target scene model whose surface area is smaller than the unit area as the target surface.
[0126] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: based on the relationship between the area of the multiple model patches included in the target scene model and a preset area threshold, model patches with an area smaller than the area threshold are determined as candidate model patches; based on the patch shape type of the candidate model patches, type detection units corresponding to each candidate model patch are determined from the target detection units.
[0127] In some embodiments of this application, when the processor executes the computer program, it also performs the following steps: obtaining the number of model faces and / or the number of model vertices of each initial model in the initial scene; and determining the initial model whose number of model faces and / or the number of model vertices is greater than a preset threshold as the target scene model to be detected.
[0128] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: distinguishing the target model patch in the target scene model based on the size difference between the target model patch and the target detection unit.
[0129] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: processing the target model patches and / or the target vertices corresponding to the target model patches in the target scene model to obtain a simplified scene model.
[0130] In some embodiments of this application, a computer-readable storage medium is provided, storing a computer program that is loaded by a processor, causing the processor to perform the following steps:
[0131] Determine the display screen of the target device and the corresponding display parameters of the display screen;
[0132] Based on the display parameters, a projection unit comprising a specified number of pixels is determined;
[0133] According to the specified spatial transformation matrix, the projection unit in the screen space is transformed to obtain the target detection unit corresponding to the projection unit in the model space of the target scene model;
[0134] The target scene model is detected based on the target detection unit to determine the target model patch from multiple model patches included in the target scene model;
[0135] The target model patch is determined based on the size of the target detection unit in the model space.
[0136] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: transforming the projection unit in screen space according to the projection transformation matrix in the specified spatial transformation matrix to obtain a first detection unit corresponding to the projection unit in camera space; transforming the first detection unit in camera space according to the camera transformation matrix in the specified spatial transformation matrix to obtain a second detection unit corresponding to the projection unit in world space; and transforming the second detection unit in world space according to the world transformation matrix in the specified spatial transformation matrix to obtain a target detection unit corresponding to the projection unit in the model space of the target scene model.
[0137] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: determining the unit area of the target detection unit in the model space based on the size of the target detection unit in the model space; and determining the model surface in the target scene model whose surface area is smaller than the unit area as the target surface.
[0138] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: based on the relationship between the area of the multiple model patches included in the target scene model and a preset area threshold, model patches with an area smaller than the area threshold are determined as candidate model patches; based on the patch shape type of the candidate model patches, type detection units corresponding to each candidate model patch are determined from the target detection units.
[0139] In some embodiments of this application, when the processor executes the computer program, it also performs the following steps: obtaining the number of model faces and / or the number of model vertices of each initial model in the initial scene; and determining the initial model whose number of model faces and / or the number of model vertices is greater than a preset threshold as the target scene model to be detected.
[0140] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: distinguishing the target model patch in the target scene model based on the size difference between the target model patch and the target detection unit.
[0141] In some embodiments of this application, when the processor executes the computer program, it further implements the following steps: processing the target model patches and / or the target vertices corresponding to the target model patches in the target scene model to obtain a simplified scene model.
[0142] 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 methods described above. Any references to memory, storage, 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, or optical storage, etc. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0143] 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.
[0144] The foregoing has provided a detailed description of a model patch detection method, apparatus, computer device, and storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for detecting model surface patches, characterized in that, include: Determine the display screen of the target device and the corresponding display parameters of the display screen; Based on the display parameters, a projection unit comprising a specified number of pixels is determined; According to the specified spatial transformation matrix, the projection unit in the screen space is transformed to obtain the target detection unit corresponding to the projection unit in the model space of the target scene model; The target scene model is detected based on the target detection unit to determine the target model patch from multiple model patches included in the target scene model; The target model patch is determined based on the size of the target detection unit in the model space; The step of transforming the projection unit in screen space according to a specified spatial transformation matrix to obtain the target detection unit corresponding to the projection unit in the model space of the target scene model includes: The projection unit in the screen space is transformed according to the projection transformation matrix in the specified spatial transformation matrix to obtain the first detection unit corresponding to the projection unit in the camera space. Based on the camera transformation matrix in the specified spatial transformation matrix, the first detection unit in the camera space is transformed to obtain the second detection unit in the world space corresponding to the projection unit. The second detection unit in the world space is transformed according to the world transformation matrix in the specified spatial transformation matrix to obtain the target detection unit corresponding to the projection unit in the model space of the target scene model.
2. The model patch detection method according to claim 1, characterized in that, The spatial transformation matrix is determined based on the detection parameters corresponding to the target scene model; the detection parameters include at least the viewpoint parameters and viewing distance parameters of the target scene model in the model space.
3. The model patch detection method according to claim 1, characterized in that, The step of detecting the target scene model based on the target detection unit to determine the target model patch from multiple model patches included in the target scene model includes: Based on the size information of the target detection unit in the model space, the unit area of the target detection unit in the model space is determined; Model patches in the target scene model whose area is smaller than the unit area are identified as target patches.
4. The model patch detection method according to claim 1, characterized in that, The step of detecting the target scene model based on the target detection unit to determine the target model patch from multiple model patches included in the target scene model includes: Based on the shape type of the multiple model patches included in the target scene model, a type detection unit corresponding to each model patch is determined from the target detection unit; Based on the type detection unit corresponding to each of the model patches, the target model patch is determined from the plurality of model patches.
5. The model patch detection method according to claim 4, characterized in that, The step of determining the type detection unit corresponding to each of the multiple model facets included in the target scene model, based on the facet shape type, includes: Based on the relationship between the area of multiple model patches included in the target scene model and a preset area threshold, model patches with an area smaller than the area threshold are identified as candidate model patches. Based on the shape type of the candidate model facets, type detection units corresponding to each candidate model facet are determined from the target detection units.
6. The model patch detection method according to claim 1, characterized in that, Before the step of transforming the projection unit in screen space according to the specified spatial transformation matrix to obtain the target detection unit corresponding to the projection unit in the model space of the target scene model, the method further includes: Obtain the number of model faces and / or the number of model vertices for each initial model in the initial scene; An initial model whose number of model faces and / or the number of model vertices is greater than a preset threshold is identified as the target scene model to be detected.
7. The model patch detection method according to claim 1, characterized in that, After the step of detecting the target scene model based on the target detection unit to determine the target model patch from multiple model patches included in the target scene model, the method further includes: Based on the size difference between the target model patch and the target detection unit, the target model patch is distinguished and identified in the target scene model.
8. The model patch detection method according to any one of claims 1 to 7, characterized in that, After the step of detecting the target scene model based on the target detection unit to determine the target model patch from multiple model patches included in the target scene model, the method further includes: The target model patches and / or the target vertices corresponding to the target model patches in the target scene model are processed to obtain a simplified scene model.
9. A model surface patch detection device, characterized in that, include: A parameter determination module is used to determine the display screen of the target device and the display parameters corresponding to the display screen. The unit determination module is used to determine a projection unit including a specified number of pixels based on the display parameters; The transformation module is used to transform the projection unit in the screen space according to the specified spatial transformation matrix to obtain the target detection unit corresponding to the projection unit in the model space of the target scene model. The detection module is used to detect the target scene model based on the target detection unit, so as to determine the target model patch from multiple model patches included in the target scene model; The target model patch is determined based on the size of the target detection unit in the model space; The step of transforming the projection unit in screen space according to a specified spatial transformation matrix to obtain the target detection unit corresponding to the projection unit in the model space of the target scene model includes: The projection unit in the screen space is transformed according to the projection transformation matrix in the specified spatial transformation matrix to obtain the first detection unit corresponding to the projection unit in the camera space. Based on the camera transformation matrix in the specified spatial transformation matrix, the first detection unit in the camera space is transformed to obtain the second detection unit in the world space corresponding to the projection unit. The second detection unit in the world space is transformed according to the world transformation matrix in the specified spatial transformation matrix to obtain the target detection unit corresponding to the projection unit in the model space of the target scene model.
10. A computer device, characterized in that, The computer device includes: One or more processors; Memory; and One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the model patch detection method of any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that, It stores a computer program, which is loaded by a processor to execute the model patch detection method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Image rendering method and device
CN104268922A
Data processing method and device and readable storage medium
WO2023087911A1