Storage Method, Device, Equipment and Storage Medium for Three-Dimensional Model Visibility Data
By obtaining the visibility data of pixel-level sampled points in the three-dimensional model and determining the vertex data using the error function, the problems of high storage pressure and low rendering efficiency of the three-dimensional model are solved, and efficient storage and accurate rendering are achieved.
Patent Information
- Application Number
- CN202111624049.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2021-11-19
- Filing Date
- 2021-12-28
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2041-12-28
AI Technical Summary
In the prior art, the amount of visibility data of the three-dimensional model is large, resulting in low storage and computing efficiency and affecting rendering efficiency.
By obtaining the visibility data of pixel-level sampling points of the three-dimensional model, and determining the visibility data of each vertex using the first error function, inserting the recovery value of the sampling points, storing the visibility data of the vertex without storing the visibility data of a large number of sampling points.
It reduces the storage space requirement of visibility data, improves rendering efficiency, and ensures that the difference between the rendered three-dimensional model and the original model surface is as small as possible, enhancing the continuity and accuracy of the visual effect.
Smart Images

Figure CN114399421B_ABST
Abstract
Description
[0001] This application claims the priority of a Chinese patent application with the application number 202111374336.0 and the invention title "Storage Method, Device, Equipment and Storage Medium for Visibility Data of 3D Models", which was filed on November 19, 2021, and the entire content is incorporated herein by reference. Technical Field
[0002] Embodiments of this application relate to the fields of computer and Internet technologies, and particularly relate to a storage method, device, equipment and storage medium for visibility data of 3D models. Background Art
[0003] When rendering a 3D model, it is necessary to calculate the visibility data of each point on the 3D model and store the visibility data for use during the model rendering process.
[0004] In related technologies, when calculating the visibility data of an arbitrary point on a 3D model, multiple (such as 720) rays are emitted from this point, and based on whether each ray intersects with environmental objects and the intersection distance, the intersection data of each ray is obtained. The visibility data of this point includes the intersection data of each ray emitted from this point.
[0005] However, since the visibility data of a point on a 3D model includes the intersection data of a large number of rays, this data volume is too large, which is not conducive to storage and calculation, and seriously affects the rendering efficiency of the 3D model. Summary of the Invention
[0006] Embodiments of this application provide a storage method, device, equipment and storage medium for visibility data of 3D models. The technical solutions are as follows:
[0007] According to one aspect of the embodiments of this application, a storage method for visibility data of 3D models is provided. The method includes:
[0008] Obtain the visibility data of multiple sampling points of the 3D model, where the sampling points are sampling points at the pixel level;
[0009] Taking the convergence of the value of the first error function as the goal, determine the visibility data of each vertex of the 3D model; wherein, the visibility data of each vertex is used to interpolate the recovery value of the visibility data of each sampling point; the first error function is used to measure the difference degree between the recovery value and the original value of the visibility data of the sampling point, and the change rate of the recovery value of the visibility data of the sampling point;
[0010] In the vertex data of the 3D model, store the visibility data of each vertex of the 3D model.
[0011] According to one aspect of the embodiments of the present application, a storage device for three-dimensional model visibility data is provided. The device includes:
[0012] A data acquisition module, configured to acquire visibility data of multiple sampling points of a three-dimensional model, where the sampling points are pixel-level sampling points;
[0013] A data determination module, configured to determine visibility data of each vertex of the three-dimensional model with the convergence of the value of a first error function as the target; wherein, the visibility data of each vertex is used to interpolate and obtain a recovery value of the visibility data of each sampling point; the first error function is used to measure the difference degree between the recovery value and the original value of the visibility data of the sampling point, and the change rate of the recovery value of the visibility data of the sampling point;
[0014] A data storage module, configured to store the visibility data of each vertex of the three-dimensional model in the vertex data of the three-dimensional model.
[0015] According to one aspect of the embodiments of the present application, a computer device is provided. The computer device includes a processor and a memory. At least one instruction, at least one program, a code set or an instruction set is stored in the memory. The at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the above-mentioned storage method for three-dimensional model visibility data.
[0016] According to one aspect of the embodiments of the present application, a computer-readable storage medium is provided. At least one instruction, at least one program, a code set or an instruction set is stored in the storage medium. The at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the above-mentioned storage method for three-dimensional model visibility data.
[0017] According to one aspect of the embodiments of the present application, a computer program product or a computer program is provided. The computer program product or the computer program includes computer instructions. The computer instructions are stored in a computer-readable storage medium. The processor reads and executes the computer instructions from the computer-readable storage medium to implement the above-mentioned storage method for three-dimensional model visibility data.
[0018] The technical solution provided by the embodiments of the present application can bring the following beneficial effects:
[0019] By obtaining the original values of the visibility data of each sampling point of the 3D model, and then through the first error function, the difference between the restored value and the original value of the visibility data of the sampling points interpolated from the visibility data of each vertex is minimized. That is, when the first error function converges, the final results of the visibility data of each vertex of the 3D model are obtained and stored in the vertex data of the 3D model. By calculating the visibility data of each vertex of the 3D model through the first error function and storing it in the vertex data, instead of storing a large amount of visibility data of the sampling points, the space required for storing the visibility data is significantly reduced, the storage pressure of the visibility data in the 3D model is alleviated, and the rendering efficiency is improved. At the same time, when designing the first error function, on the one hand, it is used to measure the difference between the restored value and the original value of the visibility data of the sampling points, so that the difference between the restored value and the original value of the visibility data of the sampling points is as small as possible, so that the difference between the surface of the rendered 3D model and the surface of the original 3D model is as small as possible, ensuring the accuracy of the 3D model during rendering; on the other hand, it is used to measure the change rate of the restored value of the visibility data of the sampling points, so that the restored values of the visibility data are continuous, thus enhancing the visual effect of the surface of the model rendered by the 3D model through the visibility data. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0021] Figure 1 It is a schematic diagram of the implementation environment of the solution provided by an embodiment of the present application;
[0022] Figure 2 It is a flowchart of the method for storing the visibility data of the 3D model provided by an embodiment of the present application;
[0023] Figure 3 It is a schematic diagram of the rendered model provided by an embodiment of the present application;
[0024] Figure 4 It is a schematic diagram of the interpolation function provided by an embodiment of the present application;
[0025] Figure 5 It is a schematic diagram of the interpolation function provided by another embodiment of the present application;
[0026] Figure 6 It is a flowchart of the method for storing the visibility data of the 3D model provided by another embodiment of the present application;
[0027] Figure 7 It is a schematic diagram of the sampling point visibility data provided by an embodiment of the present application;
[0028] Figure 8 It is a schematic diagram of the sampling point visibility data provided by another embodiment of the present application;
[0029] Figure 9 It is a schematic diagram of the central axis direction provided by an embodiment of the present application;
[0030] Figure 10 It is a schematic diagram of the target vertebral body provided by an embodiment of the present application;
[0031] Figure 11 It is a schematic diagram of the projected target vertebral body provided by an embodiment of the present application;
[0032] Figure 12 It is a schematic diagram of the coordinate system of the optimal direction provided by an embodiment of the present application;
[0033] Figure 13 It is a schematic diagram of the target vertebral body with different opening angles provided by an embodiment of the present application;
[0034] Figure 14 It is a block diagram of a building model construction device provided by an embodiment of the present application;
[0035] Figure 15 It is a block diagram of a building model construction device provided by another embodiment of the present application;
[0036] Figure 16 It is a schematic structural diagram of a computer device provided by an embodiment of the present application. Detailed implementation manners
[0037] To make the objectives, technical solutions, and advantages of the present application clearer, the following will further describe the embodiments of the present application in detail with reference to the accompanying drawings.
[0038] Please refer to Figure 1 , which shows a schematic diagram of the solution implementation environment provided by an embodiment of the present application. The solution implementation environment may include: a terminal 10 and a server 20.
[0039] The terminal 10 may be an electronic device such as a mobile phone, a tablet computer, a PC (Personal Computer), a wearable device, a vehicle-mounted terminal device, a VR (Virtual Reality) device, an AR (Augmented Reality) device, a smart TV, etc., which is not limited in this application. A client of a target application program may be installed and run in the terminal 10. For example, the target application program may be a game application program or other application programs that need to use the visibility data of the 3D model for model rendering, such as a 3D map program, a social application program, an interactive entertainment application program, etc., which is not limited in this application. The game application program may include a shooting game, a battle flag game, a MOBA (Multiplayer Online Battle Arena) game, etc., which is not limited in this application.
[0040] Based on the visibility data of the 3D model, the client of the target application program renders the 3D model to make the 3D model more realistic. The visibility data is the visibility of the entire model obtained by sampling each pixel point in the 3D model. The brightness and darkness of each part of the model in the scene are characterized by the visibility, so that the 3D model conforms to the optical law in the scene more, enhances the realism of the 3D model in the scene, and enhances the user's visual experience.
[0041] The server 20 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The server 20 may be the background server of the above target application program, and is used to provide background services for the client of the target application program.
[0042] The terminal 10 and the server 20 may communicate with each other through a network. For example, the network may be a wired network or a wireless network.
[0043] In some embodiments, the above target application program may provide a scene, and the scene is a 3D scene, and there is a 3D model in the scene. The 3D model may be dynamic. For example, the 3D model may be a 3D character model, a 3D pet model, a 3D vehicle model, etc., which can move or perform various other operations in the scene. The 3D model may also be static. For example, the 3D model may be a 3D building model, a 3D plant model, etc.
[0044] Taking the game application program as an example, the above scene may be called a virtual scene, and the above 3D model may be a virtual character in the game, or a virtual building, a virtual pet, etc.
[0045] A virtual scene is a scene displayed (or provided) by the client of a target application (such as a game application) when running on a terminal. The virtual scene refers to a scene created for virtual characters to carry out activities (such as game competitions), such as virtual houses, virtual islands, virtual maps, etc. The virtual scene can be a simulation scene of the real world, a semi-simulation and semi-fictional scene, or a purely fictional scene. The virtual scene can be a three-dimensional virtual scene. When the client of the target application runs on the terminal, different virtual scenes can be displayed (or provided) at different time periods.
[0046] The three-dimensional model can be any model in the virtual scene. For example, the three-dimensional model can be a character model, an animal model, a building model, a terrain model, etc. Through the method embodiment of the present application, the visibility data of the three-dimensional model is obtained and stored. When rendering the three-dimensional model, the visibility data of the three-dimensional model can be obtained from the stored data for use.
[0047] Please refer to Figure 2 , which shows a flowchart of a method for storing visibility data of a three-dimensional model provided by an embodiment of the present application. The execution subject of each step of the method can be a computer device. For example, the computer device can be Figure 1 the server 20 in the implementation environment of the solution shown. The method can include at least one of the following steps (210-230):
[0048] Step 210, obtaining the visibility data of multiple sampling points of the three-dimensional model, where the sampling points are pixel-level sampling points.
[0049] The sampling points are points on the surface of the three-dimensional model. By sampling the points on the surface of the three-dimensional model, the visibility data of multiple sampling points is obtained. Among them, the sampling points are pixel-level sampling points, that is, all pixel points on the model can be sampled. Therefore, the sampling points can be any point on the surface of the three-dimensional model. At this time, the visibility data of the sampling points is the original value, which is the true visibility data of the sampling points on the surface of the three-dimensional model.
[0050] The visibility data is used to represent the visibility of the sampling points. The visibility of the sampling points is used to represent whether the sampling points can be observed from each direction. After recording the data in each of the above directions and integrating them, the visibility data of the sampling points is obtained.
[0051] Step 220, aiming at the convergence of the value of the first error function, determining the visibility data of each vertex of the three-dimensional model; wherein, the visibility data of each vertex is used to interpolate the restored value of the visibility data of each sampling point; the first error function is used to measure the difference between the restored value of the visibility data of the sampling points and the original value, and the change rate of the restored value of the visibility data of the sampling points.
[0052] A vertex is a point on the surface mesh of a 3D model. The surface mesh of the 3D model consists of multiple patches. A patch is a data structure used for modeling the above-mentioned 3D model. It is a segmented data structure on the surface mesh of the 3D model. The shape of each patch can be arbitrary, it can be a triangle or other polygons. Among them, a triangular patch is called a triangle patch. A polygon formed by multiple vertices is called a patch.
[0053] The visibility data of the vertices of the 3D model is determined by the original value of the visibility data of the sampling points at the vertex positions. Among them, a sampling point is any point in the 3D model, and a vertex is a vertex of a patch obtained after mesh division in the 3D model. Therefore, there must be a corresponding sampling point at the position of each vertex, and the visibility data of this vertex is determined by the original value of the visibility data of the sampling point corresponding to this vertex position.
[0054] Based on the visibility data of the vertices of the 3D model, the restored values of the visibility data of each sampling point in the patch composed of the corresponding vertices of the 3D model are obtained by interpolation. The difference degree between the restored value and the original value of the visibility data of the sampling point, and the change rate of the restored value of the visibility data of the sampling point are measured by the first error function. Among them, the difference degree represents the magnitude relationship between the restored value and the original value of the visibility data of the sampling point. The change rate represents the continuity of the restored values of the visibility data of adjacent sampling points. The lower the change rate, the higher the continuity of the restored values of the visibility data of adjacent sampling points. With the goal of the convergence of the value of the first error function, the final result of the visibility data of each vertex of the 3D model is determined. This application does not limit the way of taking the value of the first error function. The specific form of the first error function is described in the following embodiments.
[0055] Optionally, step 220 includes the following steps 221 to 222:
[0056] Step 221, construct a first error function based on the restored value and the original value of the visibility data of the sampling point; among them, the value of the first error function is positively correlated with the difference degree between the restored value and the original value of the visibility data of the sampling point, and the value of the first error function is positively correlated with the change rate of the restored value of the visibility data of the sampling point.
[0057] The first error function represents the difference degree between the restored value and the original value of the visibility data of the sampling point, and its specific formula is as follows:
[0058]
[0059] Among them, is the original value of the visibility data, is the restored value of the visibility data, is any sampling point on the surface of the three-dimensional model, is the surface of the three-dimensional model.
[0060] Optionally, step 221 includes the following steps 221a to 221c:
[0061] Step 221a, construct a first sub-function based on the difference between the recovered value and the original value of the visibility data of the sampling point; wherein, the value of the first sub-function is positively correlated with the degree of difference between the recovered value and the original value of the visibility data of the sampling point.
[0062] The first sub-function represents the degree of difference between the recovered value and the original value of the visibility data of each sampling point. Among them, the first sub-function can be the sum of the differences between the recovered value and the original value of the visibility data of the sampling point, or can be expressed as the sum of the squares of the differences between the recovered value and the original value of the visibility data of the sampling point. This application does not limit this. In this embodiment, the first sub-function is the sum of the squares of the differences between the recovered value and the original value of the visibility data of the sampling point, and its specific formula is as follows:
[0063]
[0064] In some embodiments, as Figure 3 shown, Figure 3 in the rendering of the three-dimensional model in, the visibility data stored only after being processed by the first sub-function is used. Obviously, in the areas 32 and 33 of the three-dimensional model 31 in the figure, there are faults at the black and white junctions, making this area look dirty and the visual effect is not good. In this application, this problem can be solved through the following steps.
[0065] Step 221b, construct a second sub-function based on the difference between the change rates corresponding to at least one group of adjacent patches on the three-dimensional model; wherein, the change rate corresponding to the target patch on the three-dimensional model refers to the change rate of the recovered value of the visibility data of each sampling point corresponding to the target patch; the value of the second sub-function is positively correlated with the change rate of the recovered value of the visibility data of the sampling point.
[0066] The second sub-function is used to represent the degree of difference between the change rates corresponding to each group of adjacent patches on the three-dimensional model. Among them, the second sub-function can be the sum of the differences between the change rates corresponding to each group of adjacent patches, or can be the sum of the squares of the absolute values of the differences between the change rates corresponding to each group of adjacent patches. This application does not limit this. In this embodiment, the second sub-function is the sum of the squares of the absolute values of the differences between the change rates corresponding to each group of adjacent patches, and the specific formula is as follows:
[0067]
[0068] Among them, represents any set of adjacent patches. If two patches have a common edge, then these two patches can be used as a set of adjacent patches.
[0069] Step 221c, based on the first sub-function and the second sub-function, construct the first error function.
[0070] Combine the above first sub-function and the second sub-function to obtain the first error function .
[0071]
[0072] Step 222, aiming to minimize the value of the first error function, determine the visibility data of each vertex of the 3D model.
[0073] When the value of the first error function is minimized, the difference between the restored value and the original value of the visibility data of each sampling point is minimized. At this time, a restored value that is as close as possible to the original value of the visibility data can be obtained, ensuring the accuracy of the restored data. At the same time, when the value of the first error function is minimized, the difference between the change rates corresponding to each group of adjacent patches is minimized. At this time, adjacent patches with as small a change rate as possible can be obtained, making the continuity of the visibility data between adjacent patches high, ensuring the high continuity of the overall data, and ensuring the visual effect of the rendered 3D model.
[0074] Aiming at the convergence of the value of the first error function, the minimum value of the first error function can be used as the convergence target. At this time, the first error function is used to measure that the smaller the difference between the restored value and the original value of the visibility data of the sampling point, the smaller the change rate of the restored value of the visibility data of the sampling point, and the more accurate and continuous the obtained vertex visibility data is.
[0075] Among them, when the value of the first error function decreases during measurement, then the value of the first error function is continuously measured until the measured value of the first error function starts to increase and then stops. At this time, the value of the first error function obtained in the previous measurement is the minimum value of the first error function.
[0076] Optionally, set a threshold for the minimum value of the first error function. When the measured value of the first error function is less than the threshold, stop the measurement and set the obtained value of the first error function as the minimum value.
[0077] Similarly, aiming at the convergence of the value of the first error function, the maximum value of the first error function can also be used as the convergence target. At this time, the first error function is used to measure the proximity between the restored value and the original value of the visibility data of the sampling points. The higher the proximity, the smaller the difference between the restored value and the original value of the visibility data of the sampling points.
[0078] Step 230, store the visibility data of each vertex of the 3D model in the vertex data of the 3D model.
[0079] Store the final result of the visibility data of each vertex of the 3D model obtained in the above steps in the vertex data of the 3D model. The vertex data of the 3D model includes the vertex data corresponding to each vertex. In the vertex data corresponding to each vertex, the visibility data of the vertex is included. Optionally, the position data of the vertex, the color data of the vertex, etc. are also included, which is not limited in this application.
[0080] In this embodiment, by obtaining the original values of the visibility data of each sampling point of the 3D model, and then through the first error function, the difference between the restored value and the original value of the visibility data of the sampling points interpolated from the visibility data of each vertex is minimized. That is, when the first error function converges, the final result of the visibility data of each vertex of the 3D model is obtained and stored in the vertex data of the 3D model. The visibility data of each vertex of the 3D model is calculated through the first error function and stored in the vertex data, instead of storing a large amount of visibility data of the sampling points, which fully reduces the space required for storing the visibility data, alleviates the storage pressure of the visibility data in the 3D model, and improves the rendering efficiency. At the same time, when designing the first error function, on the one hand, it is used to measure the difference between the restored value and the original value of the visibility data of the sampling points, so that the difference between the restored value and the original value of the visibility data of the sampling points is as small as possible, so that the difference between the surface of the rendered 3D model and the surface of the original 3D model is as small as possible, ensuring the accuracy of the 3D model during rendering; on the other hand, it is used to measure the change rate of the restored value of the visibility data of the sampling points, so that the restored values of the visibility data are continuous, thereby enhancing the visual effect of the surface of the 3D model rendered through the visibility data.
[0081] Next, the construction process of the first error function will be introduced and explained.
[0082] Without considering the continuity of the visibility data between each patch, the first error function is only composed of the first sub-function. At this time, through the visibility data of the target vertex, the restored values of the visibility data of all sampling points in the patch are obtained through the interpolation function.
[0083] Among them, the interpolation function is defined by a table or file containing discrete points and corresponding function values. The interpolation function is a function that fills in the missing data between two data points through calculation.
[0084] In some embodiments, as Figure 4 shown, Figure 4 it can be seen that the value of point A is 1, and the points , and have a value of 0. Then, through the interpolation function, the values of each point on line segment A , A , A can be obtained. Among them, the values of each point on line segment A , A , A are continuous, and the closer it is to A, the closer its value is to 1 and not greater than 1. Similarly, the closer it is to , and , the closer its value is to 0 and not less than 0. Similarly, the interpolation function can also be used in other graphs, as Figure 5 shown, Figure 5 shows the application of the interpolation function of a hexagon 51. The specific operation method is the same as that in Figure 4 , and will not be elaborated here.
[0085] The restored value of the visibility data of any point in the patch obtained through the interpolation function is:
[0086]
[0087] Among them, is the visibility data of the sampling point corresponding to the vertex of the patch is the expression of the interpolation function.
[0088] As can be seen from the above, the formula of the first sub-function is expressed as follows:
[0089]
[0090] Substituting into gives:
[0091]
[0092]
[0093]
[0094] It can be seen that the first term in the above formula is a quadratic term about , and the second term is about The first term is a linear term and the third term is a constant. Therefore, the formula for the above first sub-function written in matrix form is:
[0095]
[0096] Where:
[0097]
[0098]
[0099]
[0100] Among them, is a matrix, is a vector, and c is the calculated constant value.
[0101] Calculate the minimum value of and the value of when the minimum value is taken.
[0102] According to the calculation formula of the matrix form of the calculation formula when taking the minimum value is:
[0103]
[0104] The corresponding vertex visibility data obtained at this time is the vertex visibility data to be stored in the 3D model.
[0105] Considering the continuity between adjacent patches, and at the same time, since the least squares method is used in the above steps, and the least squares method will cause overfitting during calculation, a regularization term needs to be added. The matrix form of the calculation formula after adding the regularization term is:
[0106]
[0107] The introduction of the regularization term is to neutralize the above overfitting problem, so that the value obtained by the interpolation function is close to the original value, and at the same time, the form of the function should be relatively "smooth", that is, the gradients of the interpolation function of the target vertex and the interpolation function of this point should be as consistent as possible. According to the above conditions, the difference degree between the restored value of the visibility data of the sampling point and the original value is calculated:
[0108]
[0109] Where, is the change rate of the triangular patch , is the change rate of the triangular patch .
[0110] According to the magnitude of the global gradient difference of the interpolation function, the global gradient difference formula of the interpolation function is obtained:
[0111]
[0112] According to the barycentric value of the interpolation function, the expression form of the global gradient of the difference function is obtained;
[0113] Because is relative to of the barycentric value, so:
[0114]
[0115] Where is the area of triangle t, and the only variable in this formula is , so is function of:
[0116]
[0117] Where is direction of, so:
[0118]
[0119] In order to express the integral in matrix form, here is also written in matrix form. From the above formula, it can be seen that is linear function of, so it can be written as:
[0120]
[0121] According to the expression form of the global gradient of the interpolation function, the regularization term is calculated:
[0122]
[0123]
[0124] So the regularization term matrix is:
[0125]
[0126] Substitute the above formula into the matrix form of the calculation formula when taking the minimum value with the regularization term The corresponding vertex visibility data calculated is the vertex visibility data to be stored in the 3D model. Please refer to
[0127] Please refer toFigure 6 , which shows a flowchart of a method for storing three-dimensional model visibility data provided by another embodiment of the present application. The execution subject of each step of this method can be a computer device. For example, the computer device can be Figure 1 the server 20 in the implementation environment shown in the scheme. This method can include at least one of the following steps (610~680):
[0128] Step 610, for a target sampling point of a three-dimensional model, obtain the initial visibility data of the target sampling point.
[0129] The initial visibility data of the target sampling point includes: intersection data pointing in multiple directions with the target sampling point as the vertex. Among them, the intersection data in the target direction is used to indicate whether the ray emitted from the target sampling point along the target direction intersects with an environmental object and the intersection distance. In the case where the ray emitted from the target sampling point along the target direction intersects with an environmental object, further obtain the intersection distance, which refers to the distance between the vertex (i.e., the target sampling point) and the intersection point (i.e., the intersection point of the ray along the target direction and the environmental object).
[0130] In some embodiments, as Figure 7 shown, Figure 7 the selected target sampling point is a point under the armpit of the character model 71, but in actual operation, the selected target sampling point is only located on the surface of the character model 71. Here, it is only for clearly introducing the specific manifestation form of the visibility data of the target sampling point. Figure 7 A large number of rays diverge from a point 72 under the armpit of the character model 71 in all directions in [Figure], which are represented by thin lines and thick lines in the figure. Among them, the thin lines indicate that the rays in this direction do not intersect with any object, and the thick lines indicate that the rays in this direction intersect with other objects. The length of the thick line is the intersection distance. The visibility data consists of the data corresponding to the thin lines and thick lines. Among them, the thin line data includes the direction and the data indicating no intersection, and the thick line data includes the direction, the data indicating intersection, and the intersection distance.
[0131] Obviously, the more rays diverge from the sampling point, the more accurate the visibility data of the sampling point obtained, and at the same time, the more space required to store the visibility data of the sampling point.
[0132] Step 620, determine a target cone for fitting the initial visibility data of the target sampling point.
[0133] In some implementations, as Figure 8 shown, Figure 8Sampling the visibility data of the sampling points 82 on the human model 81. Among them, the sphere 83 in the right figure is obtained after sampling, that is, the sphere 84 in the left figure. Obviously, the area 85 of the sphere 83 is black, indicating invisibility, that is, the overlapping part of the sphere 84 and the human model 81. Therefore, only the visibility information of the non-overlapping area 86 needs to be considered. Obviously, a cone can be formed by the non-overlapping area 86 and the center of the sphere 84, and the visibility data of the sampling point 82 can be represented by the cone.
[0134] The target cone can be represented by only three data, namely the central axis direction, the opening angle, and the scaling value of the target cone. Among them, the central axis direction is used to represent the opening direction of the target cone, that is, the direction of the area not covered by the scene objects in the visibility data of the sampling point. The opening angle is used to represent the size of the target cone, that is, the size of the area not covered by the scene objects in the visibility data of the sampling point. The scaling value is used to represent the brightness of the target cone, that is, the proportion of the visible area in the area not covered by the scene objects in the visibility data of the sampling point.
[0135] Optionally, the central axis direction of the target cone is represented by 2 floating-point numbers, the opening angle of the target cone is represented by 1 floating-point number, and the scaling value of the target cone is represented by 1 floating-point number.
[0136] A floating-point number (float) is a digital representation of a number belonging to a specific subset of rational numbers and is used in a computer to approximately represent any real number. Specifically, this real number is obtained by multiplying an integer or a fixed-point number (i.e., the mantissa) by an integer power of a certain base (usually 2 in a computer). This representation method is similar to scientific notation with a base of 10. A floating-point number represents a number using scientific notation, and its format can be written as: V = (-1)^S * M * R^E. Among them, the meanings of the various variables are as follows:
[0137] S: Sign bit, taking values of 0 or 1, determining the sign of a number, 0 represents positive, and 1 represents negative;
[0138] M: Mantissa, represented as a decimal. For example, for 8.345 * 10^0, 8.345 is the mantissa;
[0139] R: Base. For a decimal number, R is 10, and for a binary number, R is 2;
[0140] E: Exponent, represented as an integer. For example, for 10^-1, -1 is the exponent.
[0141] In the embodiments of the present application, a cone in space is represented by 4 floating-point numbers.
[0142] In some embodiments, as Figure 9 shownFigure 9 The middle ray 91 is the central axis direction of the target vertebral body. The central axis direction of the target vertebral body is obtained through two angles (such as angle θ and angle ) in the figure, where the two angles correspond to the above two floating-point numbers.
[0143] As Figure 10 shown, point 101 is the center of the sphere. The figure 102 intercepted by selecting the corresponding opening angle from the center of the sphere 101 is the target vertebral body. The target vertebral body 102 is a vertebral body with the center of the sphere 101 as the vertex and the bottom surface as a partial spherical surface. The visibility data of the obtained target sampling points is fitted into the target vertebral body. Optionally, according to the visibility data of the target sampling points, the visible part is set to 1, such as the white area 103 in the figure, and the invisible part is set to 0, such as the cross-hatched part in the figure, where the intersection distance is not shown in the figure. Optionally, the intersection distance can be set by the light and dark of the color. For example, the light and dark of the target vertebral body is related to the intersection distance. The closer the intersection distance is, the darker the light and dark of the corresponding position of the target vertebral body is, and the farther the intersection distance is, the brighter the light and dark of the corresponding position of the target vertebral body is.
[0144] In some embodiments, as Figure 11 shown, the interval of the lines is used to represent the light and dark of the target vertebral body. The smaller the interval of the lines is, the darker the light and dark of the target vertebral body is. Among them, the area 111 is completely visible, the areas 112 and 114 are invisible and the intersection distance is large, and the areas 113 and 115 are invisible and the intersection distance is small. Among them, each area represents the average value of the visibility information in that area. Optionally, different light and dark degrees can be set for each sampling point among the sampling points in the target vertebral body. The present application does not limit the setting method of the light and dark of the target vertebral body.
[0145] Optionally, step 620 includes the following steps 621 to 624:
[0146] Step 621, project the initial visibility data of the target sampling points into the spherical harmonic function space to obtain the projected visibility data of the target sampling points.
[0147] Project the initial visibility data of the target sampling points into the spherical harmonic function space to obtain the projected visibility data of the target sampling points in the spherical harmonic function space. The projected visibility data can be represented by 16 floating-point numbers.
[0148] Step 622, based on the projected visibility data of the target sampling points, determine the optimal visible direction corresponding to the target sampling points. The optimal visible direction refers to the central axis direction of the visible area corresponding to the target sampling points determined in the spherical harmonic function space.
[0149] Determine the optimal visibility direction of the target sampling point according to the projection visibility data of the target sampling point projected into the spherical harmonic function space.
[0150] In some embodiments, as Figure 12 shown, Figure 12 shows the projection visibility data of the target sampling point projected into the spherical harmonic function space. Among them, the sphere 120 is the projection visibility data obtained by the above projection. The arrowed coordinate axes 121, 122, and 123 respectively represent the initial coordinate axes in the spherical harmonic function space, and the ray 124 is the central axis direction of the visible region corresponding to the target sampling point in the spherical harmonic function space, that is, the optimal visibility direction corresponding to the target sampling point. The rays 125 and 126 are the other two coordinate axes of the coordinate system determined by the right-hand rule according to the optimal visibility direction corresponding to the target sampling point. Among them, the rays 124, 125, and 126 form a new coordinate system.
[0151] Step 623, determine the central axis direction of the target cone as the optimal visibility direction.
[0152] Project the target cone into the new coordinate system obtained above, where the central axis direction of the target cone is the optimal visibility direction of the above target sampling point.
[0153] Step 624, aiming at the convergence of the value of the second error function, determine the opening angle and scaling value of the target cone; where the second error function is used to measure the difference between the projection representation of the target cone in the spherical harmonic function space and the projection visibility data of the target sampling point.
[0154] Compare the projection representation obtained by projecting the above-obtained target cone with the projection visibility data to obtain the opening angle of the target cone.
[0155] In some embodiments, as Figure 13 shown, Figure 13 shows the projected target cones at 4 different opening angles. Among them, 131, 132, 133, and 134 are the projected target cones with opening angles of 15 degrees, 30 degrees, 45 degrees, and 60 degrees respectively. Among them, the uppermost region in each figure is the visibility data of the target cone. Normally, the other regions should be completely invisible black regions, but due to numerical oscillations that are likely to occur during projection, some white regions appear in the black region of the target cone, but the white regions that appear do not affect the final result, so this situation is not considered. Compare the above 4 projected target cones with the projection visibility data obtained by fitting the initial visibility data of the sampling points into the spherical harmonic function space, and determine the opening angle in the visibility data that is closest as the final opening angle of the target cone.
[0156] By downsampling the visibility data of 16 complex floating-point numbers, visibility data of 4 floating-point numbers is obtained. The visibility data of the 4-floating-point number cone can well represent the visibility data in this application. While reducing the amount of a large amount of visibility data, the accuracy of the visibility data is also ensured.
[0157] Step 630: Determine the visibility data of the target sampling points based on the target cone. The visibility data of the target sampling points includes the central axis direction, opening angle, and scaling value of the target cone. The scaling value is used to characterize the light and darkness degree of the visible area.
[0158] Among them, the light and darkness degree of the visible area is used to represent the occlusion situation of the visible area.
[0159] The visibility data of the target sampling points consists of 4 floating-point numbers, namely the central axis direction, opening angle, and scaling value. Among them, the central axis direction is represented by 2 floating-point numbers, and the opening angle and scaling value are each represented by 1 floating-point number.
[0160] Step 640: With the goal of the value of the first error function converging, determine the visibility data of each vertex of the 3D model; among them, the visibility data of each vertex is used to interpolate the restored value of the visibility data of each sampling point; the first error function is used to measure the difference between the restored value and the original value of the visibility data of the sampling point, as well as the change rate of the restored value of the visibility data of the sampling point.
[0161] Step 650: Store the visibility data of each vertex of the 3D model in the vertex data of the 3D model.
[0162] Steps 640 and 650 have been introduced in the above embodiments and will not be elaborated here.
[0163] Step 660: For the target patch on the 3D model, obtain the visibility data of each vertex of the target patch from the vertex data of the 3D model.
[0164] The target patch is a polygon composed of each vertex in the 3D model. Each target patch is closely attached and evenly covers the surface of the 3D model to form a surface mesh.
[0165] Step 670: Determine the visibility data of the centroid point of the target patch according to the visibility data of each vertex of the target patch.
[0166] Based on the visibility data of each vertex of the target patch and the calculation formula of the centroid point, determine the position of the centroid point of the target patch and the visibility data of the centroid point. For example, according to the distances between each vertex and the centroid point in the target patch, determine the weights corresponding to each vertex respectively, and perform weighted calculation on the visibility data of each vertex according to the weights corresponding to each vertex to obtain the visibility data of the centroid point.
[0167] Step 680, based on the visibility data of each vertex of the target patch and the visibility data of the centroid point of the target patch, interpolate to obtain the restored values of the visibility data of each sampling point corresponding to the target patch.
[0168] Through the interpolation function, based on the visibility data of each vertex and the centroid point of the target patch, obtain the restored values of the visibility data of each sampling point of the target patch.
[0169] By interpolating the visibility data of the target patch through the vertices and the centroid, the visibility data of each sampling point in the obtained patch is ensured, which guarantees the accuracy of the rendered 3D model.
[0170] In this embodiment, the visibility data of the sampling points is first fitted into the spherical harmonic function space, and then through the downsampling of the data, four floating-point numbers are obtained in the target frustum. By downsampling the data, the amount of data of the visibility data is reduced while not losing too much precision. While greatly reducing the visibility data of the sampling points, the precision of the data is also guaranteed.
[0171] At the same time, when using the data, after interpolating the target vertices and the centroid point in the target patch, the visibility data of each sampling point in the obtained patch is ensured, which guarantees the accuracy of the data.
[0172] Next, the calculation process of the opening angle and the scaling value of the target frustum will be introduced and explained.
[0173] Among them, the expression of the visibility data of the four floating-point number target frustum projected into the spherical harmonic function space is:
[0174]
[0175] Among them, are respectively the scaling value, the opening angle and the central axis direction vector of the target frustum, are the values corresponding to each of the 16 floating-point numbers in the spherical harmonic function, is the basis function of the spherical harmonic function.
[0176] Among them, the expression of the visibility data of the four floating-point number target frustum is:
[0177]
[0178] Among them, is the scaling value of the target vertebral body. The shading of the target vertebral body is determined by the scaling value, and all shading values of the target vertebral body are set to the same shading value, that is, the same scaling value.
[0179] Among them, each SH value can be calculated by an integration tool, and the results of each SH value are as follows:
[0180]
[0181]
[0182]
[0183]
[0184]
[0185] Substituting the above 16 floating-point values into the visibility data of the spherical harmonic function of 16 floating-point numbers, the visibility data after the projection of the target vertebral body can be obtained.
[0186] Next, by minimizing and the scaling value of the cone of the target vertex is obtained by minimizing the difference between them.
[0187]
[0188] Derive and S respectively:
[0189]
[0190]
[0191] From the orthonormality of SH, it can be obtained that:
[0192]
[0193]
[0194] It can be deduced that:
[0195]
[0196]
[0197] Setting them all to 0, the extreme point condition equation can be obtained as:
[0198]
[0199]
[0200] The scaling value of the cone is calculated by the dichotomy method. At this time, the visibility data represented by the cone of the target vertex is obtained. The above visibility data is represented by the opening angle, central axis direction, and scaling value of the cone.
[0201] Next, taking the process of building and rendering a 3D model in a game scene as an example, the application of the technical solution of this application in this scene will be introduced and explained. The method may include the following steps (1 to 6):
[0202] 1. Obtain the model structure data and model material data of the 3D model.
[0203] The model structure data includes data such as model size, surface contour, and bone contour. The model material data includes data such as model material and surface color.
[0204] 2. Construct the model structure of the 3D model according to the model structure data of the 3D model.
[0205] Construct the model structure of the 3D model according to the data such as the model size, surface contour, and bone contour of the 3D model.
[0206] 3. Render the material and surface color of the 3D model at one time according to the model material data of the 3D model.
[0207] Render the model structure of the completed 3D model according to the model material data of the 3D model to obtain the material and surface color of the 3D model. Among them, the material of the 3D model includes the density, surface roughness, surface gloss, etc. of the 3D model.
[0208] 4. Set the motion data of the bones of the 3D model according to the set motion mode of the 3D model.
[0209] The set motion mode is the motion mode of the 3D model pre-designed when designing the 3D model. Specifically, according to the set motion mode of the 3D model, set the motion data of the bones of the 3D model. The bones of the 3D model move according to the above motion data, thereby driving the 3D model to move and being able to perform the corresponding designed actions, obtaining the motion mode of the 3D model. Among them, the motion mode of the 3D model is the same as the set motion mode of the 3D model.
[0210] 5. Obtain the visibility data of the 3D model according to the lighting in the game scene where the 3D model is located.
[0211] Place the 3D model that has completed one-time rendering and has had its skeletal motion data set in the game scene, add lighting, and obtain and store the visibility data of the 3D model through the method in the above embodiment. Among them, the 3D model drives the movement of the bones according to the motion data of the bones, so that the 3D model moves in the game scene. At the same time, the obtained visibility data of the 3D model will change with the movement of the 3D model, and store the visibility data obtained at all motion states.
[0212] 6. Render the 3D model that has completed rendering a second time according to the visibility data of the 3D model.
[0213] Render the 3D model that has completed rendering a second time according to the stored visibility data of the 3D model. Among them, the surface of the 3D model obtained by the second rendering shows light and dark levels, and the light and dark levels shown on the surface of the 3D model will change with the movement of the 3D model.
[0214] In this embodiment, by placing the 3D model that has completed one-time rendering and has had its skeletal motion data set in the game scene, and performing a second rendering on the visibility data of the 3D model through the lighting in the game scene, a 3D model with light and dark levels is obtained. When no second rendering is added, when the 3D model is placed in the game scene, due to the lack of consideration of lighting factors, the surface of the 3D model will not show the light and dark differences brought by the lighting, making the 3D model unable to blend well into the game scene and appear out of place. However, after considering the lighting factors and performing a second rendering on the 3D model, the light and dark data of the 3D model are shown, enabling the 3D model to blend well into the game environment. Moreover, when the 3D model moves, the light and dark levels on the surface of the 3D model will also change with the movement, making the 3D model more realistic in the game environment.
[0215] The following is an embodiment of the apparatus of the present application, which can be used to execute the method embodiment of the present application. For details not disclosed in the embodiment of the apparatus of the present application, please refer to the method embodiment of the present application.
[0216] Please refer to Figure 14 , which shows a block diagram of a storage device for visibility data of a 3D model provided by an embodiment of the present application. This device has the functions of implementing the above method example, and this function can be implemented by hardware or by hardware executing corresponding software. This device can be a computer device or can be set in a computer device. The device 1400 may include: a data acquisition module 1410, a data determination module 1420, and a data storage module 1430.
[0217] The data acquisition module 1410 is used to acquire the visibility data of multiple sampling points of the 3D model, and the sampling points are pixel-level sampling points.
[0218] A data determination module 1420 is configured to determine the visibility data of each vertex of the three-dimensional model with the convergence of the value of the first error function as the goal; wherein, the visibility data of each vertex is used to interpolate the restored value of the visibility data of each sampling point; the first error function is used to measure the difference between the restored value of the visibility data of the sampling point and the original value, and the change rate of the restored value of the visibility data of the sampling point.
[0219] A data storage module 1430 is configured to store the visibility data of each vertex of the three-dimensional model in the vertex data of the three-dimensional model.
[0220] In some embodiments, as Figure 15 shown, the data determination module 1420 includes: a function construction unit 1421 and a data determination unit 1422.
[0221] The function construction unit 1421 is configured to construct a first error function based on the restored value and the original value of the visibility data of the sampling point; wherein, the value of the first error function is positively correlated with the difference between the restored value and the original value of the visibility data of the sampling point, and the value of the first error function is positively correlated with the change rate of the restored value of the visibility data of the sampling point.
[0222] The data determination unit 1422 is configured to determine the visibility data of each vertex of the three-dimensional model with the goal of minimizing the value of the first error function.
[0223] In some embodiments, the function construction module 1421 is configured to construct a first sub-function based on the difference between the restored value and the original value of the visibility data of the sampling point; wherein, the value of the first sub-function is positively correlated with the difference between the restored value and the original value of the visibility data of the sampling point; construct a second sub-function based on the difference between the change rates corresponding to at least one set of adjacent patches on the three-dimensional model; wherein, the change rate corresponding to the target patch on the three-dimensional model refers to the change rate of the restored value of the visibility data of each sampling point corresponding to the target patch; the value of the second sub-function is positively correlated with the change rate of the restored value of the visibility data of the sampling point; construct a first error function based on the first sub-function and the second sub-function.
[0224] In some embodiments, as Figure 15 shown, the data acquisition module 1410 includes: a data acquisition unit 1411, a vertebral body fitting unit 1412, and a data determination unit 1413.
[0225] The data acquisition unit 1411 is configured to obtain the initial visibility data of the target sampling point for the target sampling point of the three-dimensional model; wherein, the initial visibility data of the target sampling point includes: the intersection data pointing in multiple directions with the target sampling point as the vertex.
[0226] A vertebral body fitting unit 1412 is configured to determine a target vertebral body for fitting initial visibility data of a target sampling point.
[0227] A data determination unit 1413 is configured to determine visibility data of the target sampling point based on the target vertebral body. The visibility data of the target sampling point includes a central axis direction, an opening angle, and a scaling value of the target vertebral body. The scaling value is used to characterize the brightness and darkness of the visible area.
[0228] In some embodiments, the vertebral body fitting unit 1412 is configured to project the initial visibility data of the target sampling point into a spherical harmonic function space to obtain projected visibility data of the target sampling point; determine an optimal visible direction corresponding to the target sampling point based on the projected visibility data of the target sampling point. The optimal visible direction refers to the central axis direction of the visible area corresponding to the target sampling point determined in the spherical harmonic function space; determine the central axis direction of the optimal visible direction as the central axis direction of the target vertebral body; and determine the opening angle and the scaling value of the target vertebral body with the convergence of the value of a second error function as the target. The second error function is used to measure the difference between the projection representation of the target vertebral body in the spherical harmonic function space and the projected visibility data of the target sampling point.
[0229] In some embodiments, the visibility data of the target sampling point is represented by 4 floating-point numbers. Among them, the central axis direction of the target vertebral body is represented by 2 floating-point numbers, the opening angle of the target vertebral body is represented by 1 floating-point number, and the scaling value of the target vertebral body is represented by 1 floating-point number.
[0230] In some embodiments, the apparatus 1400 further includes a data usage module 1440.
[0231] The data usage module 1440 is configured to, for a target patch on the three-dimensional model, obtain the visibility data of each vertex of the target patch from the vertex data of the three-dimensional model; determine the visibility data of the center of gravity point of the target patch according to the visibility data of each vertex of the target patch; and interpolate to obtain a recovery value of the visibility data of each sampling point corresponding to the target patch according to the visibility data of each vertex of the target patch and the visibility data of the center of gravity point of the target patch.
[0232] It should be noted that, when implementing its functions, the apparatus provided in the above embodiments is only illustrated by dividing the above functional modules. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus provided in the above embodiments and the method embodiments belong to the same concept, and the specific implementation process can be seen in the method embodiments, which will not be elaborated here.
[0233] Please refer to Figure 16, which shows a schematic structural diagram of a computer device provided by an embodiment of the present application. The computer device can be any electronic device with data calculation, processing, and storage functions, such as the terminal or server introduced above, and is used to implement the method for storing three-dimensional model visibility data provided in the above embodiment. Specifically:
[0234] The computer device 1600 includes a central processing unit (such as a CPU (Central Processing Unit, central processor), a GPU (Graphics Processing Unit, graphics processor), and an FPGA (Field Programmable Gate Array, field programmable logic gate array), etc.) 1601, a system memory 1604 including a RAM (Random-Access Memory, random access memory) 1602 and a ROM (Read-Only Memory, read-only memory) 1603, and a system bus 1605 connecting the system memory 1604 and the central processing unit 1601. The computer device 1600 also includes a basic input / output system (Input Output System, I / O system) 1606 for facilitating the transfer of information between various components within the server, and a mass storage device 1607 for storing an operating system 1613, application programs 1614, and other program modules 1615.
[0235] The basic input / output system 1606 includes a display 1608 for displaying information and input devices 1609 such as a mouse and a keyboard for user input of information. Among them, both the display 1608 and the input devices 1609 are connected to the central processing unit 1601 through an input / output controller 1610 connected to the system bus 1605. The basic input / output system 1606 may also include an input / output controller 1610 for receiving and processing inputs from multiple other devices such as a keyboard, a mouse, or an electronic stylus. Similarly, the input / output controller 1610 also provides outputs to a display screen, a printer, or other types of output devices.
[0236] The mass storage device 1607 is connected to the central processing unit 1601 through a mass storage controller (not shown) connected to the system bus 1605. The mass storage device 1607 and its associated computer-readable medium provide non-volatile storage for the computer device 1600. That is to say, the mass storage device 1607 may include a computer-readable medium (not shown) such as a hard disk or a CD-ROM (Compact Disc Read-Only Memory, read-only optical disc) drive.
[0237] Without loss of generality, the computer-readable medium may include a computer storage medium and a communication medium. The computer storage medium includes volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules, or other data. The computer storage medium includes RAM, ROM, EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory or other solid-state storage technologies, CD-ROM, DVD (Digital Video Disc) or other optical storage, magnetic tape cartridges, tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art will know that the computer storage medium is not limited to the above several types. The above system memory 1604 and mass storage device 1607 may be collectively referred to as memory.
[0238] According to an embodiment of the present application, the computer device 1600 may also operate by connecting to a remote computer on a network such as the Internet. That is, the computer device 1600 may be connected to the network 1612 through the network interface unit 1611 connected to the system bus 1605, or in other words, the network interface unit 1616 may also be used to connect to other types of networks or remote computer systems (not shown).
[0239] The memory further includes at least one instruction, at least one program, a code set or an instruction set, which is stored in the memory and is configured to be executed by one or more processors to implement the above method for storing three-dimensional model visibility data.
[0240] In an exemplary embodiment, a computer-readable storage medium is further provided, in which at least one instruction, at least one program, a code set or an instruction set is stored, and when the at least one instruction, at least one program, a code set or an instruction set is executed by a processor of a computer device, the above method for storing three-dimensional model visibility data is implemented.
[0241] Optionally, the computer-readable storage medium may include: ROM (Read-Only Memory), RAM (Random-Access Memory), SSD (Solid State Drives), or optical discs, etc. Among them, the random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).
[0242] In an exemplary embodiment, a computer program product or a computer program is further provided. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the above-mentioned storage method for three-dimensional model visibility data.
[0243] It should be understood that the "plurality" mentioned herein refers to two or more. The "and / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects before and after. In addition, the step numbers described herein only exemplarily show a possible execution sequence between steps. In some other embodiments, the above steps may not be executed in the order of the numbers. For example, two steps with different numbers are executed simultaneously, or two steps with different numbers are executed in the reverse order of the illustration. The embodiments of the present application do not limit this.
[0244] The above are only exemplary embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A storage method for three-dimensional model visibility data, characterized in that, The method includes: Obtaining visibility data of multiple sampling points of a 3D model, where the sampling points are pixel-level sampling points; Taking the convergence of the value of a first error function as the goal, determining the visibility data of each vertex of the 3D model; wherein, the visibility data of each vertex is used to interpolate the recovery value of the visibility data of each sampling point; the first error function is used to measure the difference degree between the recovery value and the original value of the visibility data of the sampling point, and the change rate of the recovery value of the visibility data of the sampling point; In the vertex data of the 3D model, storing the visibility data of each vertex of the 3D model.
2. The method according to claim 1, wherein The step of taking the convergence of the value of a first error function as the goal and determining the visibility data of each vertex of the 3D model includes: Based on the recovery value and the original value of the visibility data of the sampling point, constructing the first error function; wherein, the value of the first error function is positively correlated with the difference degree between the recovery value and the original value of the visibility data of the sampling point, and the value of the first error function is positively correlated with the change rate of the recovery value of the visibility data of the sampling point; Taking minimizing the value of the first error function as the goal, determining the visibility data of each vertex of the 3D model.
3. The method according to claim 2, wherein The step of constructing the first error function based on the recovery value and the original value of the visibility data of the sampling point includes: Based on the difference between the recovery value and the original value of the visibility data of the sampling point, constructing a first sub-function; wherein, the value of the first sub-function is positively correlated with the difference degree between the recovery value and the original value of the visibility data of the sampling point; Based on the difference between the change rates corresponding to at least one set of adjacent patches on the 3D model, constructing a second sub-function; wherein, the change rate corresponding to a target patch on the 3D model refers to the change rate of the recovery value of the visibility data of each sampling point corresponding to the target patch; the value of the second sub-function is positively correlated with the change rate of the recovery value of the visibility data of the sampling point; Based on the first sub-function and the second sub-function, constructing the first error function.
4. The method according to claim 1, wherein The step of obtaining visibility data of multiple sampling points of a 3D model includes: For a target sampling point of the 3D model, obtaining the initial visibility data of the target sampling point; wherein, the initial visibility data of the target sampling point includes: intersection data pointing in multiple directions with the target sampling point as the vertex; Determining a target cone for fitting the initial visibility data of the target sampling point; Based on the target cone, determining the visibility data of the target sampling point, the visibility data of the target sampling point including the central axis direction, opening angle and scaling value of the target cone, and the scaling value being used to characterize the light and darkness of the visible area.
5. The method according to claim 4, wherein The step of determining a target cone for fitting the initial visibility data of the target sampling point includes: Projecting the initial visibility data of the target sampling point into the spherical harmonic function space to obtain the projected visibility data of the target sampling point; Based on the projection visibility data of the target sampling point, determine the optimal visible direction corresponding to the target sampling point, where the optimal visible direction refers to the central axis direction of the visible region corresponding to the target sampling point determined in the spherical harmonic function space; Determine the central axis direction of the target cone as the optimal visible direction; Aim at the convergence of the value of the second error function to determine the opening angle and scaling value of the target cone; wherein, the second error function is used to measure the difference degree between the projection representation of the target cone in the spherical harmonic function space and the projection visibility data of the target sampling point.
6. The method according to claim 4, wherein The visibility data of the target sampling point is represented by 4 floating-point numbers; wherein, the central axis direction of the target cone is represented by 2 floating-point numbers, the opening angle of the target cone is represented by 1 floating-point number, and the scaling value of the target cone is represented by 1 floating-point number.
7. The method according to any one of claims 1 to 6, characterized in that, After storing the visibility data of each vertex of the three-dimensional model in the vertex data of the three-dimensional model, it further includes: For a target patch on the three-dimensional model, obtain the visibility data of each vertex of the target patch from the vertex data of the three-dimensional model; Determine the visibility data of the centroid point of the target patch according to the visibility data of each vertex of the target patch; Interpolate to obtain the recovery value of the visibility data of each sampling point corresponding to the target patch according to the visibility data of each vertex of the target patch and the visibility data of the centroid point of the target patch.
8. A storage device for three-dimensional model visibility data, characterized in that The device includes: A data acquisition module, configured to acquire the visibility data of multiple sampling points of a three-dimensional model, where the sampling points are pixel-level sampling points; A data determination module, configured to aim at the convergence of the value of the first error function to determine the visibility data of each vertex of the three-dimensional model; wherein, the visibility data of each vertex is used to interpolate to obtain the recovery value of the visibility data of each sampling point; the first error function is used to measure the difference degree between the recovery value and the original value of the visibility data of the sampling point, and the change rate of the recovery value of the visibility data of the sampling point; A data storage module, configured to store the visibility data of each vertex of the three-dimensional model in the vertex data of the three-dimensional model.
9. The device according to claim 8, characterized in that, The data determination module includes: A function construction unit, configured to construct the first error function based on the recovery value and the original value of the visibility data of the sampling point; wherein, the value of the first error function is positively correlated with the difference degree between the recovery value and the original value of the visibility data of the sampling point, and the value of the first error function is positively correlated with the change rate of the recovery value of the visibility data of the sampling point; A data determination unit, configured to aim at minimizing the value of the first error function to determine the visibility data of each vertex of the three-dimensional model.
10. The device according to claim 9, characterized in that, The function construction unit is configured to: Construct a first sub-function based on the difference between the restored value and the original value of the visibility data of the sampling point; wherein, the value of the first sub-function is positively correlated with the degree of difference between the restored value and the original value of the visibility data of the sampling point; Construct a second sub-function based on the difference between the change rates corresponding to at least one set of adjacent patches on the three-dimensional model; wherein, the change rate corresponding to the target patch on the three-dimensional model refers to the change rate of the restored values of the visibility data of each sampling point corresponding to the target patch; the value of the second sub-function is positively correlated with the change rate of the restored values of the visibility data of the sampling point; Construct the first error function based on the first sub-function and the second sub-function.
11. The device according to claim 8, characterized in that, The data acquisition module includes: A data acquisition unit for obtaining the initial visibility data of the target sampling point of the three-dimensional model; wherein, the initial visibility data of the target sampling point includes: intersection data pointing in multiple directions with the target sampling point as the vertex; A cone fitting unit for determining a target cone for fitting the initial visibility data of the target sampling point; A data determination unit for determining the visibility data of the target sampling point based on the target cone, the visibility data of the target sampling point including the central axis direction, the opening angle, and the scaling value of the target cone, and the scaling value being used to characterize the brightness and darkness of the visible area.
12. The device according to claim 11, wherein The cone fitting unit is used to: Project the initial visibility data of the target sampling point into the spherical harmonic function space to obtain the projected visibility data of the target sampling point; Determine the optimal visible direction corresponding to the target sampling point based on the projected visibility data of the target sampling point, the optimal visible direction being the central axis direction of the visible area corresponding to the target sampling point determined in the spherical harmonic function space; Determine the central axis direction of the target cone as the optimal visible direction; Taking the convergence of the value of the second error function as the goal, determine the opening angle and the scaling value of the target cone; wherein, the second error function is used to measure the degree of difference between the projection representation of the target cone in the spherical harmonic function space and the projected visibility data of the target sampling point.
13. The device according to claim 11, wherein The visibility data of the target sampling point is represented by 4 floating-point numbers; wherein, the central axis direction of the target cone is represented by 2 floating-point numbers, the opening angle of the target cone is represented by 1 floating-point number, and the scaling value of the target cone is represented by 1 floating-point number.
14. The device according to any one of claims 8 to 13, characterized in that, The device further includes a data usage module for: For the target patch on the three-dimensional model, obtain the visibility data of each vertex of the target patch from the vertex data of the three-dimensional model; Determine the visibility data of the center of gravity point of the target patch according to the visibility data of each vertex of the target patch; Interpolate to obtain the restored values of the visibility data of each sampling point corresponding to the target patch according to the visibility data of each vertex of the target patch and the visibility data of the center of gravity point of the target patch.
15. A computer device, characterized in that, The computer device includes a processor and a memory, and at least one program is stored in the memory, and the at least one program is loaded and executed by the processor to implement the method according to any one of claims 1 to 7.
16. A computer-readable storage medium, characterized in that, At least one program is stored in the storage medium, and the at least one program is loaded and executed by a processor to implement the method according to any one of claims 1 to 7.
17. A computer program product, characterized in that, The computer program product includes computer instructions, the computer instructions are stored in a computer-readable storage medium, and a processor reads and executes the computer instructions to implement the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
A method and system for deblurring three-dimensional motion with spatially heterogeneous fuzzy kernels
CN102270339A
Efficient image rendering method based on modeling
CN103345771A