Gaussian point downsampling method, device, electronic device and readable storage medium
By sorting and sampling Gaussian points in color, the problem of high demand for equipment computing power caused by excessive number of Gaussian points in Gaussian splashing technology is solved, and the effect of efficient rendering and maintaining color balance on ordinary devices is achieved.
Patent Information
- Application Number
- CN202411479450.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2044-10-23
AI Technical Summary
In Gaussian splashing technology, the number of Gaussian points required to render a three-dimensional scene is huge, resulting in high demand for device computing power, making it difficult to render on ordinary devices such as mobile phones or tablets, and it is difficult to ensure that the rendered color is unbalanced after reducing the number of Gaussian points.
By color classification of Gaussian points in the three-dimensional scene to be rendered, multiple color points sets are obtained, and the number of samples in each color point set is determined according to the preset sampling ratio. Randomly sample or cluster to obtain Gaussian points to be rendered to ensure different colors The proportion of Gaussian points is stable, reducing the number of Gaussian points while avoiding color imbalance.
It effectively reduces the number of Gaussian points to be rendered, reduces the computing power consumption of the device, and ensures the color balance and display effect after rendering.
Smart Images

Figure CN119006681B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing, and in particular to a Gaussian point downsampling method, device, electronic device and readable storage medium. Background Art
[0002] Traditional rendering is usually based on a three-dimensional model. The three-dimensional model of the scene is composed of several vertices. The triangle patch composed of three vertices is used as the smallest rendering unit. The position, size, color, transparency and other information of each vertex are used during rendering. Different from the traditional rendering method, the emerging Gaussian splash technology uses the Gaussian ellipsoid as the smallest rendering unit. The rendering scene includes several Gaussian ellipsoids. A single Gaussian ellipsoid carries information such as position (that is, the three-dimensional coordinates in the scene), covariance (reflecting how the ellipsoid is scaled or stretched), color and Alpha (transparency). Therefore, the Gaussian ellipsoid can be abstractly understood as a point of different size, color and transparency at different angles. The Gaussian ellipsoid is hereinafter referred to as a Gaussian point. For example, Figure 1 In the figure, three Gaussian points of different colors and positions are shown, and each Gaussian point is ellipsoidal ( Figure 1 The ellipsoid lines are only for viewing aids and do not actually exist).
[0003] Gaussian splash technology requires that each point cloud in the 3D scene to be rendered be converted into a Gaussian point in advance to obtain a Gaussian splash file of the 3D scene to be rendered, so that rendering can be performed based on the Gaussian splash file. Generally, the number of Gaussian points in a Gaussian splash file depends on the scale of the scene and the rendering accuracy requirements. For example, the number of Gaussian points in a Gaussian splash file for an outdoor scene with a diameter of about one kilometer can reach millions or even tens of millions. Therefore, the rendering of Gaussian splash scenes requires high computing power of the device and is difficult to popularize.
[0004] Therefore, in order to make the Gaussian splash technology adaptable to most devices (such as mobile phones or tablets), you can consider reducing the number of Gaussian points rendered appropriately, but how to ensure that the rendered colors are not unbalanced while reducing them is a problem that needs to be considered. Summary of the invention
[0005] The object of the present invention is to provide a Gaussian point downsampling method, device, electronic device and readable storage medium to improve the problems existing in the prior art.
[0006] The embodiments of the present invention can be implemented as follows:
[0007] In a first aspect, the present invention provides a Gaussian point downsampling method, comprising:
[0008] Obtaining each to-be-rendered mesh in the three-dimensional mesh model corresponding to the to-be-rendered three-dimensional scene, wherein the to-be-rendered mesh includes a plurality of Gaussian points carrying color attributes;
[0009] For each of the to-be-rendered meshes, based on the color attribute, color classification is performed on all Gaussian points in the to-be-rendered meshes to obtain a plurality of color point sets corresponding to the to-be-rendered meshes;
[0010] Based on a preset sampling ratio corresponding to the grid to be rendered, respectively calculating the number of samples in each color point set corresponding to the grid to be rendered;
[0011] Based on the sampling quantity of each of the color point sets, each Gaussian point to be rendered in the grid to be rendered is determined.
[0012] Optionally, the color attribute is a spherical harmonic function of the Gaussian point; and the step of performing color classification on all Gaussian points in the to-be-rendered mesh based on the color attribute to obtain a plurality of color point sets corresponding to the to-be-rendered mesh includes:
[0013] For each Gaussian point in the grid to be rendered, based on the spherical harmonic function of the Gaussian point, determine the RGBA channel value presented by the Gaussian point in the normal direction of the plane formed by the major and minor axes of its own ellipsoid;
[0014] Taking any Gaussian point in the grid to be rendered as the current Gaussian point;
[0015] From all pending Gaussian points in the grid to be rendered that are not set with color labels, find each similar Gaussian point whose RGBA channel value meets the preset same-color condition, and obtain a color point set consisting of the current Gaussian point and each similar Gaussian point;
[0016] Setting a common color label for all Gaussian points in the color point set;
[0017] Determine whether the grid to be rendered still has undetermined Gaussian points for which the color labels are not set;
[0018] If so, any of the pending Gaussian points is used as a new current Gaussian point, and the process returns to the step of searching for each similar Gaussian point whose RGBA channel value satisfies a preset same-color condition from all the pending Gaussian points in the grid to be rendered without a color label, and obtaining a color point set consisting of the current Gaussian point and each of its similar Gaussian points, until there is no pending Gaussian point in the grid to be rendered without a color label;
[0019] If not, color classification of all Gaussian points in the grid to be rendered is completed to obtain the plurality of color point sets.
[0020] Optionally, the meshes of the three-dimensional mesh model correspond one-to-one to the leaf nodes in the octree corresponding to the three-dimensional scene to be rendered;
[0021] The step of respectively calculating the number of samples in each color point set corresponding to the grid to be rendered based on the preset sampling ratio corresponding to the grid to be rendered comprises:
[0022] Obtain the target LOD level of the leaf node corresponding to the mesh to be rendered;
[0023] The number of samples of each of the color point sets is determined based on a preset sampling ratio of the target LOD level and the number of Gaussian points of each of the color point sets.
[0024] Optionally, the step of determining each Gaussian point to be rendered in the grid to be rendered based on the number of samples of each color point set includes:
[0025] Based on the number of sampling points of each color point set, each color point set is randomly sampled respectively, and each Gaussian point randomly sampled from each color point set is used as a Gaussian point to be rendered in the grid to be rendered.
[0026] Optionally, the step of determining each Gaussian point to be rendered in the grid to be rendered based on the number of samples of each color point set includes:
[0027] For any of the color point sets, multiple clustering iterations are performed on all Gaussian points in the color point set based on a region growing algorithm, until the number of cluster sets obtained plus the number of Gaussian points remaining in the color point set is not greater than the number of samples corresponding to the color point set, and clustering is stopped to obtain multiple cluster sets and outlier sets; the outlier set includes multiple outlier Gaussian points;
[0028] Fitting all Gaussian points of each cluster set to obtain cluster Gaussian points corresponding to each cluster set;
[0029] Taking each of the clustered Gaussian points and each outlier Gaussian point in the outlier set as the Gaussian point to be rendered;
[0030] Each of the color point sets is traversed to obtain each Gaussian point to be rendered in the grid to be rendered.
[0031] Optionally, the Gaussian points carry a covariance matrix; the step of performing multiple clustering iterations on all Gaussian points of the color point set based on the region growing algorithm until the number of cluster sets obtained plus the number of Gaussian points remaining in the color point set is not higher than the number of samples corresponding to the color point set, and stopping clustering, to obtain multiple cluster sets and outlier sets, includes:
[0032] Calculating the normal vector and curvature of each Gaussian point in the color point set;
[0033] Determine three semi-axes of each Gaussian point in the color point set based on the covariance matrix of each Gaussian point in the color point set respectively;
[0034] Arrange all Gaussian points in the color point set in ascending order based on the curvature, and use the Gaussian point with the smallest curvature as an initial seed point;
[0035] Determine each neighborhood point within a neighborhood range of a preset clustering radius around the seed point from the color point set;
[0036] Based on the normal vector of the seed point and the normal vector of each of the neighborhood points, calculate the normal angle between each of the neighborhood points and the seed point and the average normal angle within the neighborhood range;
[0037] Based on the curvature of each of the neighborhood points, calculate the average curvature within the neighborhood range;
[0038] For each of the neighborhood points, if the difference between the normal angle between the neighborhood point and the seed point and the average normal angle is lower than a preset angle threshold and the sum of the three semi-axis differences between the neighborhood point and the seed point is lower than a preset value, the neighborhood point is used as a target neighborhood point of the seed point;
[0039] Add the seed point and each of the target neighborhood points to a point set; the point set is initially empty;
[0040] If the difference between the curvature of any target neighborhood point and the average curvature is lower than a preset curvature threshold, the target neighborhood point is added to the sequence of undetermined seed points; the sequence of undetermined seed points is initially empty;
[0041] If the seed point sequence is not empty, a new seed point is taken from the seed point sequence, and the step of determining each neighborhood point within a preset clustering radius around the seed point from the color point set is returned to be executed until the seed point sequence is empty;
[0042] If the seed point sequence is empty, the current point set is used as a cluster set, and each Gaussian point in the cluster set is removed from the color point set;
[0043] If the sum of the number of the obtained cluster sets and the number of Gaussian points in the color point set is higher than the number of samples corresponding to the color point set, returning to the step of arranging all Gaussian points in the color point set in ascending order based on the curvature and taking the Gaussian point with the smallest curvature as the initial seed point, until the sum of the number of the obtained cluster sets and the number of Gaussian points in the color point set is not higher than the number of samples corresponding to the color point set;
[0044] If the sum of the number of the obtained cluster sets and the number of Gaussian points in the color point set is not higher than the sampling number corresponding to the color point set, clustering is stopped to obtain multiple cluster sets, and each Gaussian point currently remaining in the color point set is used as the outlier Gaussian point to obtain an outlier set.
[0045] Optionally, the Gaussian points carry positions and covariance matrices; and the step of fitting each cluster set as a clustered Gaussian point comprises:
[0046] For each of the cluster sets, based on the covariance matrix of each Gaussian point in the cluster set, determine six ellipsoid boundary points corresponding to each Gaussian point in the cluster set;
[0047] Calculate the three semi-axes and the center point of the ellipsoid corresponding to the minimum volume ellipsoid that encloses all the ellipsoid boundary points;
[0048] Taking the minimum volume ellipsoid as the cluster Gaussian point corresponding to the cluster set;
[0049] Taking the color attribute of the Gaussian point closest to the center point of the minimum volume ellipsoid in the cluster set as the color attribute of the cluster Gaussian point;
[0050] The covariance matrix and the position of the clustered Gaussian points are determined based on the three semi-axes of the minimum volume ellipsoid and the center point of the ellipsoid.
[0051] In a second aspect, the present invention provides a Gaussian point downsampling device, comprising:
[0052] An acquisition module, used to obtain each to-be-rendered mesh in the three-dimensional mesh model corresponding to the to-be-rendered three-dimensional scene, wherein the to-be-rendered mesh includes a plurality of Gaussian points carrying color attributes;
[0053] A color classification module, for performing color classification on all Gaussian points in each of the grids to be rendered based on the color attribute, to obtain a plurality of color point sets corresponding to the grids to be rendered;
[0054] A quantity calculation module, used to calculate the number of samples in each color point set corresponding to the grid to be rendered based on a preset sampling ratio corresponding to the grid to be rendered;
[0055] The sampling module is used to determine each Gaussian point to be rendered in the grid to be rendered based on the sampling quantity of each color point set.
[0056] In a third aspect, the present invention provides an electronic device, comprising: a memory and a processor, wherein the memory stores a software program, and when the electronic device is running, the processor executes the software program to implement the Gaussian point downsampling method as described in the first aspect above.
[0057] In a fourth aspect, the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the Gaussian point downsampling method described in the first aspect is implemented.
[0058] Compared with the prior art, the embodiment of the present invention provides a Gaussian point downsampling method, device, electronic device and readable storage medium. First, each to-be-rendered mesh in the three-dimensional mesh model corresponding to the to-be-rendered three-dimensional scene is obtained, and the to-be-rendered mesh includes a plurality of Gaussian points carrying color attributes; for each to-be-rendered mesh, all Gaussian points in the to-be-rendered mesh are color-classified based on the color attributes to obtain a plurality of color point sets corresponding to the to-be-rendered mesh; based on the preset sampling ratio corresponding to the to-be-rendered mesh, the number of samples in each color point set corresponding to the to-be-rendered mesh is calculated respectively; based on the number of samples of each color point set, each to-be-rendered Gaussian point in the to-be-rendered mesh is determined. In this way, the present invention obtains a plurality of color point sets by color-classifying all Gaussian points in the to-be-rendered mesh, and then determines each to-be-rendered Gaussian point in each color point set according to the preset sampling ratio corresponding to the to-be-rendered mesh. After color classification, sampling is performed according to the preset sampling ratio, so that the ratio of Gaussian points of different colors in the to-be-rendered mesh is stable compared to before sampling, which not only reduces the number of Gaussian points to be rendered but also ensures that there will be no color imbalance after rendering. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0060] Figure 1 A schematic diagram of a Gaussian ellipsoid.
[0061] Figure 2 One of the flow charts of a Gaussian point downsampling method provided in an embodiment of the present invention.
[0062] Figure 3 The second flowchart of a Gaussian point downsampling method provided by an embodiment of the present invention.
[0063] Figure 4 A schematic diagram of ellipsoid analysis corresponding to a Gaussian point provided in an embodiment of the present invention.
[0064] Figure 5 The third flowchart of a Gaussian point downsampling method provided by an embodiment of the present invention.
[0065] Figure 6 A fourth flowchart of a Gaussian point downsampling method provided in an embodiment of the present invention.
[0066] Figure 7 A schematic diagram of the structure of a Gaussian point downsampling device provided in an embodiment of the present invention.
[0067] Figure 8 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0068] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0069] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0070] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0071] In addition, the terms “first”, “second”, etc., if used, are merely used to distinguish between the descriptions and should not be understood as indicating or implying relative importance.
[0072] It should be noted that, in the absence of conflict, the features in the embodiments of the present invention may be combined with each other.
[0073] As mentioned in the background technology section, the number of Gaussian points in a Gaussian splash file usually depends on the scene scale and rendering accuracy requirements. For example, the number of Gaussian points in a Gaussian splash file for an outdoor scene with a diameter of about one kilometer can reach millions or even tens of millions. Therefore, the rendering of Gaussian splash scenes requires high computing power of the device and is difficult to popularize. In particular, Gaussian splash scenes are difficult to render on mobile phones and can only be limited to rendering on PCs with independent graphics cards.
[0074] Therefore, in order to make the Gaussian splash technology adaptable to most devices (such as mobile phones or tablets), the inventor considered reducing the computing power consumption of the device by appropriately reducing the number of Gaussian points rendered. However, how to ensure that the rendered colors are not unbalanced and the rendering effect of the scene at the same time is a problem that needs to be considered.
[0075] Based on the discovery of the above technical problems, the inventors have proposed the following technical solutions to solve or improve the above problems through creative work. It should be noted that the defects in the solutions in the above prior art are the results obtained by the inventors after practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed in the embodiments of the present application for the above problems below should all be the contributions made by the inventors to the present application in the process of invention and creation, and should not be understood as technical contents known to those skilled in the art.
[0076] The Gaussian point downsampling method provided in the embodiment of the present invention can be applied to electronic devices, which may be, but are not limited to, smart tablets, smart phones, personal computers, servers, and the like.
[0077] Please refer to Figure 2 , Figure 2 A schematic flow chart of a Gaussian point downsampling method provided by an embodiment of the present invention, the method comprising the following steps S101-S104:
[0078] S101, obtaining each to-be-rendered mesh in a three-dimensional mesh model corresponding to a to-be-rendered three-dimensional scene.
[0079] In this embodiment, the 3D scene to be rendered may be a local city 3D scene, a suburban 3D scene, or a 3D scene of a certain geographical location, or may be a virtual 3D game scene produced by animation.
[0080] The 3D scene to be rendered has a corresponding Gaussian splash file, which includes a number of Gaussian points, each of which is converted from a point cloud in the 3D scene to be rendered. The 3D mesh model is obtained by meshing the 3D space of the 3D scene to be rendered, and includes a number of meshes.
[0081] Optionally, the mesh to be rendered may be a mesh having Gaussian points to be rendered in the three-dimensional mesh model. Several Gaussian points in each mesh to be rendered can be found from the Gaussian splash file, and the Gaussian points carry color attributes, that is, spherical harmonic functions of the Gaussian points.
[0082] S102 , for each grid to be rendered, based on color attributes, color classification is performed on all Gaussian points in the grid to be rendered to obtain a plurality of color point sets corresponding to the grid to be rendered.
[0083] In this embodiment, for each mesh to be rendered, all Gaussian points in the mesh to be rendered are color classified based on color attributes, so that all Gaussian points in the mesh to be rendered can be divided into multiple color point sets, and all Gaussian points in each color point set belong to the same color structure.
[0084] S103 , based on a preset sampling ratio corresponding to the grid to be rendered, respectively calculate the number of samples in each color point set corresponding to the grid to be rendered.
[0085] In this embodiment, a game character (such as a player character) will be rendered during rendering, and the corresponding preset sampling ratios are different for different grids to be rendered. That is, the size of the preset sampling ratio corresponding to a grid to be rendered may depend on the distance between the grid to be rendered and the grid where the character is located. The closer the distance, the larger the preset sampling ratio; the farther the distance, the smaller the preset sampling ratio. In this way, it can be ensured that the closer to the grid where the character is located, the more Gaussian points are rendered, and the number of Gaussian points rendered is reduced as much as possible in the place far from the grid where the character is located, so as to reduce the computing power required for rendering while also ensuring the rendering effect.
[0086] S104 . Determine each Gaussian point to be rendered in the grid to be rendered based on the number of samples of each color point set.
[0087] In this embodiment, assuming that the number of samples of a color point set of a grid to be rendered is s, then s Gaussian points to be rendered can be found from the color point set.
[0088] For each grid to be rendered, the above steps S102 to S104 can be executed to determine all Gaussian points to be rendered in the grid to be rendered.
[0089] The Gaussian point downsampling method provided by an embodiment of the present invention first obtains each to-be-rendered mesh in a three-dimensional mesh model corresponding to a to-be-rendered three-dimensional scene, wherein the to-be-rendered mesh includes a plurality of Gaussian points carrying color attributes; for each to-be-rendered mesh, the present invention obtains a plurality of color point sets by color classification of all Gaussian points of the to-be-rendered mesh, and then determines each to-be-rendered Gaussian point of each color point set according to a preset sampling ratio corresponding to the to-be-rendered mesh, so that after color classification, sampling is performed respectively according to the preset sampling ratio, so that the ratio of Gaussian points of different colors to be rendered in the to-be-rendered mesh is stable compared to before sampling, which not only reduces the number of Gaussian points to be rendered but also ensures that color imbalance will not occur after rendering.
[0090] In an optional implementation, the color of the Gaussian point is expressed by sampling spherical harmonic functions, so that the Gaussian point will present different colors when viewed from different directions. In order to facilitate color classification, the present invention samples the colors presented by the Gaussian points in the normal direction of the plane formed by their major and minor axes to compare and determine whether two Gaussian points belong to the same color structure. Figure 2 Based on Figure 3 In the above step S102, the sub-step of "based on the color attribute, color classification of all Gaussian points in the grid to be rendered to obtain multiple color point sets corresponding to the grid to be rendered" may include S1021~S1027.
[0091] S1021. For each Gaussian point in the grid to be rendered, based on the spherical harmonic function of the Gaussian point, determine the RGBA channel value presented by the Gaussian point in the normal direction of the plane formed by the major and minor axes of its own ellipsoid.
[0092] In this embodiment, the RGBA channel value includes an R channel value, a G channel value, a B channel value and a transparency channel value, namely, red, green, blue and transparency, and each channel is expressed by 0 to 255. Among them, determining the color presented by a Gaussian point at a certain position on the surface of the ellipsoid based on the spherical harmonic function of the Gaussian point is a prior art and will not be described in detail here.
[0093] It can be understood that the shape of the Gaussian point is an ellipsoid, and the three axes include the major axis, the middle axis and the minor axis of the ellipsoid. Figure 4 Take the ellipsoid corresponding to the Gaussian point shown as an example. Assume that the center point of the ellipsoid is point O, the major axis is CD, the median axis is AB, and the minor axis is EF. Then the plane formed by the major and minor axes is the plane surrounded by CEDF, and the normal direction of the plane is or The RGBA channel values of the Gaussian point in the normal direction of the plane formed by the major and minor axes of its own ellipsoid are the RGBA channel values of point A or point B. This example is only an example and is not limited here.
[0094] S1022. Taking any Gaussian point in the grid to be rendered as the current Gaussian point.
[0095] S1023. From all pending Gaussian points in the grid to be rendered that are not set with color labels, find each similar Gaussian point whose RGBA channel value meets the preset same-color condition, and obtain a color point set consisting of the current Gaussian point and each of its similar Gaussian points.
[0096] In this embodiment, based on the RGBA channel value of the current Gaussian point, each similar Gaussian point whose RGBA channel value satisfies the preset same-color condition can be found from all pending Gaussian points in the grid to be rendered without setting a color label, and a color point set consisting of the current Gaussian point and each similar Gaussian point can be obtained. The preset same-color condition can be that the sum of the R channel difference, G channel difference, and B channel difference between two Gaussian points is lower than a first set threshold and the transparency difference between the two Gaussian points is lower than a second set threshold. Among them, the first set threshold k1 and the second set threshold k2 can be flexibly set, for example, they are set to 10, 20 or 15, 20 respectively.
[0097] That is, for two Gaussian points M and N, the preset same-color condition can be expressed as: and ,in, Represents the R channel value, Represents the G channel value, Represents the B channel value, Represents the A channel value.
[0098] Therefore, the method to find out the similar Gaussian point corresponding to the current Gaussian point is: for each pending Gaussian point in the grid to be rendered that does not have a color label set, calculate the difference between the R channel value, G channel value, B channel value and transparency channel value of the pending Gaussian point and the R channel value, G channel value, B channel value and transparency channel value of the current Gaussian point, respectively, to obtain the R channel difference, G channel difference, B channel difference and transparency channel difference; if the sum of the R channel difference, G channel difference and B channel difference is lower than the first set threshold and the transparency channel difference is lower than the second set threshold, it is determined that the pending Gaussian point belongs to the same Gaussian point as the current Gaussian point.
[0099] S1024. Set a common color label for all Gaussian points in the color point set.
[0100] In this embodiment, after finding all Gaussian points of the same type as the current Gaussian point, a color point set is obtained, and a common color label can be set for all Gaussian points in the color point set. For example, the color labels of different color point sets can be 0, 1, 2, 3..., or a, b, c..., etc., so as to distinguish color point sets with different color structures.
[0101] S1025 , determining whether the grid to be rendered still has any undetermined Gaussian points for which no color labels are set.
[0102] In this embodiment, if there are still undetermined Gaussian points without color labels in the grid to be rendered, the following step S1026 is executed and then the process returns to the above step S1023 until there are no undetermined Gaussian points without color labels in the grid to be rendered. If there are no undetermined Gaussian points without color labels in the grid to be rendered, the following step S1027 is executed to complete the color classification of all Gaussian points in the grid to be rendered, and obtain multiple color point sets.
[0103] S1026. Take any undetermined Gaussian point as a new current Gaussian point.
[0104] S1027, completing color classification of all Gaussian points in the grid to be rendered, and obtaining multiple color point sets.
[0105] For all Gaussian points of a grid to be rendered, the above steps S1021 to S1027 are executed to complete the color classification of all Gaussian points of the grid to be rendered, and obtain multiple color point sets belonging to different color structures.
[0106] In an optional implementation, in order to facilitate the management of the three-dimensional gateway model, an octree can be used. The octree is formed based on the three-dimensional mesh model. Each node in the octree includes up to eight child nodes. The root node of the octree represents the entire three-dimensional space of the three-dimensional scene to be rendered. The octree includes a number of leaf nodes, each of which corresponds to a mesh in the three-dimensional mesh model. In the present invention, the preset sampling ratio may depend on the target LOD (Level of Detail) level of the leaf node corresponding to the mesh to be rendered. Correspondingly, the sub-steps of the above step S103 may include S1031~S1032:
[0107] S1031, obtaining the target LOD level of the leaf node corresponding to the mesh to be rendered.
[0108] Optionally, the LOD level data of the octree can be calculated in advance based on the mesh where the character is located, the maximum number of renderable Gaussian points, and the preset rendering scale group. The LOD level data includes the LOD level of each leaf node in the octree. Thus, for the meshes to be rendered, the target LOD level of the leaf node corresponding to the mesh to be rendered can be determined.
[0109] Optionally, the maximum number of renderable Gaussian points may be a predetermined maximum number of Gaussian points that the current device supports for stable rendering to an ideal frame rate. The LOD level may be divided into multiple levels from low to high, and the rendering ratio group may include a preset sampling ratio corresponding to each level, and the preset sampling ratio corresponding to each level gradually decreases from a low level to a high level.
[0110] Assume that the LOD levels include the core level, the first level, the second level, and the third level, and the preset sampling ratios corresponding to the four levels can be 100%, 60%, 20%, and 0% respectively, so that the closer to the mesh where the character is located, the more Gaussian points are rendered, thereby ensuring the rendering quality. This example is only an example and is not limited here.
[0111] S1032 , respectively calculating the product of the number of Gaussian points of each color point set and the preset sampling ratio of the target LOD level to obtain the number of samples of each color point set.
[0112] In this embodiment, for each color point set of a mesh to be rendered, the product of the preset sampling ratio of the target LOD level of the leaf node corresponding to the mesh to be rendered and the number of Gaussian points of the color point set is the sampling number of the color point set.
[0113] In an optional implementation, in the above step S104, each color point set may be randomly sampled based on the number of sampling points in each color point set, and each Gaussian point randomly sampled from each color point set is used as the Gaussian point to be rendered in the grid to be rendered.
[0114] In another optional implementation, in order to ensure the display effect of different color structures after rendering, the region growing algorithm can be used to cluster each set of color points in the grid to be rendered, so as to merge all Gaussian points in the grid to be rendered that are almost located in the same plane to achieve the purpose of reducing the number of Gaussian points without affecting the display effect after rendering. Figure 2 Based on Figure 5 The sub-steps of the above step S104 may include S1041~S1044.
[0115] S1041. For any color point set, perform multiple clustering iterations on all Gaussian points in the color point set based on the region growing algorithm until the number of cluster sets obtained plus the number of Gaussian points remaining in the color point set is no higher than the number of samples corresponding to the color point set, and stop clustering to obtain multiple cluster sets and outlier sets.
[0116] In this embodiment, for a color point set, multiple clustering iterations are performed on all Gaussian points in the color point set based on the region growing algorithm, and each obtained cluster set is separated from the color point set. The clustered color point set can be regarded as an outlier set.
[0117] It can be understood that the Gaussian points carry a covariance matrix (a 3x3 semi-positive definite matrix), which can reflect how the ellipsoid is scaled or stretched, that is, it can reflect the shape and size of the ellipsoid of the Gaussian points. Optionally, when clustering, it is necessary to consider whether the two Gaussian points are in the same plane, which can be determined by the normal vector and curvature of the Gaussian points. It is also necessary to consider whether the size and shape of the two Gaussian points are similar, which can be compared by calculating the three semi-axes of the two Gaussian points.
[0118] Correspondingly, in Figure 5 Based on Figure 6 , the sub-steps of step S1041 may include S10411~S1041e.
[0119] S10411. Calculate the normal vector and curvature of each Gaussian point in the color point set.
[0120] The Gaussian point carries a position, that is, the coordinates of the center point of the ellipsoid. Optionally, for each Gaussian point, based on the position of the Gaussian point and the positions of several surrounding Gaussian points, the surface where the Gaussian point is located can be fitted, and then the normal vector and curvature of the Gaussian point can be calculated.
[0121] S10412. Determine three semi-axes of each Gaussian point in the color point set based on the covariance matrix of each Gaussian point in the color point set.
[0122] In this embodiment, the three semi-axes of the Gaussian point include the major semi-axis, the middle semi-axis and the minor semi-axis of the ellipsoid. For a Gaussian point, based on the covariance matrix of the Gaussian point, the six ellipsoid boundary points of the Gaussian point can be determined, and based on the six ellipsoid boundary points, the three semi-axes of the Gaussian point can be calculated. Figure 4 , Figure 4 In the figure, the six boundary points of the ellipsoid are A, B, C, D, E and F, and the major semi-axis, middle semi-axis and minor semi-axis of the ellipsoid are OD, OB and OE respectively.
[0123] S10413. Arrange all Gaussian points in the color point set in ascending order based on the curvature, and use the Gaussian point with the smallest curvature as the initial seed point.
[0124] Due to the characteristics of the region growing algorithm, the Gaussian point with the smallest curvature and some of the nearby Gaussian points are approximately in a plane. By selecting them as the initial seed points, these Gaussian points in the same plane as the seed points can be found.
[0125] S10414. Determine each neighborhood point within a neighborhood range of a preset clustering radius around the seed point from the color point set.
[0126] In this embodiment, the location of the seed point is taken as the center of the circle, and a preset clustering radius (for example, 0.2 or 0.5) is diffused outward as the neighborhood range of the seed point, and each Gaussian point in the neighborhood range is a neighborhood point of the seed point.
[0127] S10415. Based on the normal vector of the seed point and the normal vector of each neighborhood point, calculate the normal angle between each neighborhood point and the seed point and the average normal angle within the neighborhood range.
[0128] In this embodiment, based on the normal vector of the seed point and the normal vector of each neighborhood point, the normal angle between each neighborhood point and the seed point can be calculated, and then the normal angles between all neighborhood points and the seed point are averaged to obtain the average normal angle within the neighborhood range.
[0129] S10416. Based on the curvature of each neighborhood point, calculate the average curvature within the neighborhood range.
[0130] In this embodiment, the average value of the curvatures of all neighborhood points within the neighborhood is the average curvature within the neighborhood.
[0131] S10417. For each neighborhood point, if the difference between the normal angle between the neighborhood point and the seed point and the average normal angle is lower than a preset angle threshold and the sum of the three semi-axis differences between the neighborhood point and the seed point is lower than a preset value, the neighborhood point is used as the target neighborhood point of the seed point.
[0132] In this embodiment, if a neighboring point of a seed point satisfies both of the following conditions, it is considered as a target neighboring point:
[0133] Condition 1: The difference between the normal angle between the neighborhood point and the seed point and the average normal angle is lower than the preset angle threshold (for example, 5 or 7);
[0134] Condition 2: The sum of the major semi-axis difference, minor semi-axis difference, and median semi-axis difference between the neighborhood point and the seed point is lower than a preset value (for example, 0.3 or 0.5).
[0135] S10418. Add the seed point and each target neighborhood point to the point set.
[0136] In this embodiment, the point set is initially empty. Starting from the initial seed point, the seed point and its target neighborhood points are gradually added to the point set, and the class plane area where all Gaussian points in the point set are located is gradually generated and expanded.
[0137] S10419: If the difference between the curvature of any target neighborhood point and the average curvature is lower than a preset curvature threshold, the target neighborhood point is added to the sequence of pending seed points.
[0138] In this embodiment, the initial seed point is used as the growth center of the plane-like region at the beginning. The sequence of undetermined seed points is initially empty. If the difference between the curvature of a target neighborhood point and the average curvature is lower than the preset curvature threshold, the target neighborhood point can be added to the sequence of undetermined seed points to serve as the subsequent growth center.
[0139] S1041a. Determine whether the seed point sequence is empty.
[0140] In this embodiment, if the seed point sequence is not empty, the following step S1041b is executed and then the above step S10414 is returned to execute until the seed point sequence is empty, and the following step S1041c is executed to obtain a cluster set. If the seed point sequence is empty, the following steps S1041c and S1041d are directly executed.
[0141] S1041b, taking out a new seed point from the seed point sequence.
[0142] S1041c. Take the current point set as a cluster set, and remove each Gaussian point in the cluster set from the color point set.
[0143] S1041d. Determine whether the sum of the number of obtained cluster sets and the number of Gaussian points in the color point set is higher than the number of samples corresponding to the color point set.
[0144] In this embodiment, if the sum of the number of cluster sets obtained and the number of Gaussian points in the color point set is higher than the number of samples corresponding to the color point set, the above step S10413 is returned to be executed until the sum of the number of cluster sets obtained and the number of Gaussian points in the color point set is not higher than the number of samples corresponding to the color point set. If the sum of the number of cluster sets obtained and the number of Gaussian points in the color point set is not higher than the number of samples corresponding to the color point set, the following step S1041e is directly executed.
[0145] S1041e, stop clustering, obtain multiple cluster sets, and take each Gaussian point currently remaining in the color point set as an outlier Gaussian point to obtain an outlier set.
[0146] Through the above steps S10411 to S1041e, the region growing algorithm can be used for clustering, and all Gaussian points belonging to the same color structure in the color point set that are almost located in the same plane and have the same size can be classified into one category to obtain a cluster set.
[0147] S1042. Fit all Gaussian points of each cluster set to obtain cluster Gaussian points corresponding to each cluster set.
[0148] In this embodiment, all Gaussian points of each cluster set are fitted, that is, ellipsoid fitting is performed, so as to obtain cluster Gaussian points corresponding to each cluster set.
[0149] Optionally, sub-steps of S1042 may include S10421~S10425.
[0150] S10421. For each cluster set, based on the covariance matrix of each Gaussian point in the cluster set, determine six ellipsoid boundary points corresponding to each Gaussian point in the cluster set.
[0151] In this embodiment, the process of determining six ellipsoid boundary points of the Gaussian points based on the covariance matrix of the Gaussian points is a prior art and will not be described in detail herein.
[0152] S10422. Calculate the three semi-axes and the center point of the ellipsoid corresponding to the minimum volume ellipsoid surrounding all ellipsoid boundary points.
[0153] In this embodiment, for the ellipsoid boundary points of all Gaussian points in a cluster set, an ellipsoid method can be used to determine the minimum volume ellipsoid surrounding all the ellipsoid boundary points. The specific calculation method is the existing technology and will not be described in detail here.
[0154] S10423. Use the minimum volume ellipsoid as the cluster Gaussian point corresponding to the cluster set.
[0155] S10424. The color attribute of the Gaussian point closest to the center point of the minimum volume ellipsoid in the cluster set is used as the color attribute of the cluster Gaussian point.
[0156] In this embodiment, since all Gaussian points in the cluster set belong to the same color structure, the spherical harmonic function of the Gaussian point closest to the center point of the minimum volume ellipsoid can be directly used as the spherical harmonic function of the clustered Gaussian points.
[0157] S10425. Determine the covariance matrix and position of the clustered Gaussian points based on the three semi-axes of the minimum volume ellipsoid and the center point of the ellipsoid.
[0158] In this embodiment, the covariance matrix and the position of the clustered Gaussian points can be determined respectively based on the three semi-axes of the minimum volume ellipsoid and the center point of the ellipsoid.
[0159] It can be understood that each Gaussian point in the cluster set is a small ellipsoid. After ellipsoid fitting, a large ellipsoid can be obtained.
[0160] Through the above steps S10421~S10425, all Gaussian points in the cluster set that are almost located in the same plane and have the same size can be replaced with a larger cluster Gaussian point. In this way, ellipsoid fitting is performed to achieve Gaussian point downsampling. Compared with the method of directly selecting only a part of the Gaussian points as the Gaussian points to be rendered, better rendering display effects will be achieved.
[0161] S1043: Use each clustered Gaussian point and each outlier Gaussian point in the outlier set as a Gaussian point to be rendered.
[0162] S1044. Traverse each color point set to obtain each Gaussian point to be rendered in the grid to be rendered.
[0163] In this embodiment, for each color point set of a grid to be rendered, the above steps S1041 to S1043 and their sub-steps are executed to determine each Gaussian point to be rendered in the grid to be rendered, and complete the Gaussian point downsampling of the grid to be rendered.
[0164] It should be noted that the execution order of each step in the above method embodiment is not limited to that shown in the drawings, and the execution order of each step shall be based on the actual application situation.
[0165] Compared with the prior art, the embodiments of the present invention have the following beneficial effects.
[0166] First, the present invention first classifies all Gaussian points of the grid to be rendered in the three-dimensional scene based on color attributes, thereby obtaining multiple color point sets belonging to different color structures. After color classification, sampling is performed according to a preset sampling ratio, so that the ratio of Gaussian points of different colors in the grid to be rendered is stable compared to before sampling, which not only reduces the number of Gaussian points to be rendered but also ensures that there will be no color imbalance after rendering.
[0167] Secondly, after determining the number of samples for each color point set based on the preset sampling ratio of the grid to be rendered, the region growing algorithm is used for clustering based on the high number of samples. From all Gaussian points in the same color structure in the color point set, all Gaussian points that are almost in the same plane and of the same size are grouped together to obtain a cluster set. Then, all Gaussian points in the cluster set that are almost in the same plane and of the same size are replaced with a larger cluster Gaussian point by ellipsoid fitting, thereby achieving Gaussian point downsampling and ensuring the subsequent rendering display effect.
[0168] In order to execute the corresponding steps in the above method embodiment and various possible implementation modes, an implementation method of a Gaussian point downsampling device is provided below.
[0169] See also Figure 7 , Figure 7The Gaussian point downsampling device 200 provided by the embodiment of the present invention is shown in the structural diagram. The Gaussian point downsampling device 200 comprises: an acquisition module 210 , a color classification module 220 , a quantity calculation module 230 and a sampling module 240 .
[0170] An acquisition module 210 is used to obtain each to-be-rendered mesh in the three-dimensional mesh model corresponding to the to-be-rendered three-dimensional scene, where the to-be-rendered mesh includes a plurality of Gaussian points carrying color attributes;
[0171] A color classification module 220 is used to classify the colors of all Gaussian points in each grid to be rendered based on the color attribute, and obtain a plurality of color point sets corresponding to the grid to be rendered;
[0172] The number calculation module 230 is used to calculate the number of samples in each color point set corresponding to the grid to be rendered based on the preset sampling ratio corresponding to the grid to be rendered;
[0173] The sampling module 240 is used to determine each Gaussian point to be rendered in the grid to be rendered based on the sampling quantity of each color point set.
[0174] Optionally, the color attribute is the spherical harmonic function of the Gaussian point. The color classification module 220 can be specifically used to: for each Gaussian point in the grid to be rendered, based on the spherical harmonic function of the Gaussian point, determine the RGBA channel value presented by the Gaussian point in the normal direction of the plane formed by the major and minor axes of its own ellipsoid; use any Gaussian point in the grid to be rendered as the current Gaussian point; from all the pending Gaussian points in the grid to be rendered that are not set with color labels, find each similar Gaussian point whose RGBA channel value meets the preset same color condition, and obtain the color point set consisting of the current Gaussian point and each of its similar Gaussian points; set a common color for all Gaussian points in the color point set. color label; determine whether there are any pending Gaussian points without color labels in the grid to be rendered; if so, take any pending Gaussian point as the new current Gaussian point, return to execute the step of finding each similar Gaussian point whose RGBA channel value meets the preset same-color condition from all pending Gaussian points in the grid to be rendered without color labels, and obtain the color point set consisting of the current Gaussian point and each of its similar Gaussian points, until there are no pending Gaussian points without color labels in the grid to be rendered; if not, complete the color classification of all Gaussian points in the grid to be rendered to obtain multiple color point sets.
[0175] Optionally, the meshes of the three-dimensional mesh model correspond one-to-one to the leaf nodes in the octree corresponding to the three-dimensional scene to be rendered. The quantity calculation module 230 can be specifically used to: obtain the target LOD level of the leaf node corresponding to the mesh to be rendered; and determine the sampling quantity of each color point set based on the preset sampling ratio of the target LOD level and the number of Gaussian points of each color point set.
[0176] Optionally, the sampling module 240 may be specifically configured to: based on the number of sampling points in each color point set, randomly sample each color point set respectively, and use each Gaussian point randomly sampled from each color point set as a Gaussian point to be rendered in the grid to be rendered.
[0177] Alternatively, the sampling module 240 can be specifically used for: for any color point set, performing multiple clustering iterations on all Gaussian points in the color point set based on the region growing algorithm, and stopping clustering when the number of cluster sets obtained plus the number of Gaussian points remaining in the color point set is not higher than the sampling number corresponding to the color point set, thereby obtaining multiple cluster sets and outlier sets; the outlier set includes multiple outlier Gaussian points; fitting all Gaussian points in each cluster set to obtain cluster Gaussian points corresponding to each cluster set; using each cluster Gaussian point and each outlier Gaussian point in the outlier set as the Gaussian point to be rendered; traversing each color point set to obtain each Gaussian point to be rendered in the grid to be rendered.
[0178] Optionally, the Gaussian point carries a covariance matrix. The sampling module 240 can be specifically used to: calculate the normal vector and curvature of each Gaussian point in the color point set; determine the three semi-axes of each Gaussian point in the color point set based on the covariance matrix of each Gaussian point in the color point set; sort all Gaussian points in the color point set in ascending order based on the curvature, and use the Gaussian point with the smallest curvature as the initial seed point; determine each neighbor point in the neighborhood range of a preset clustering radius around the seed point from the color point set; calculate the normal vector of each neighbor point and the seed point based on the normal vector of the seed point and the normal vector of each neighbor point The normal angle between the points and the average normal angle in the neighborhood; based on the curvature of each neighborhood point, calculate the average curvature in the neighborhood; for each neighborhood point, if the difference between the normal angle between the neighborhood point and the seed point and the average normal angle is lower than the preset angle threshold and the sum of the three semi-axis differences between the neighborhood point and the seed point is lower than the preset value, then the neighborhood point is used as the target neighborhood point of the seed point; the seed point and each target neighborhood point are added to the point set; the point set is initially empty; if there is any target neighborhood point whose curvature is lower than the average curvature than the preset curvature Threshold, the target neighborhood point is added to the pending seed point sequence; the pending seed point sequence is initially empty; if the seed point sequence is not empty, a new seed point is taken from the seed point sequence, and the step of determining each neighborhood point within the preset clustering radius around the seed point from the color point set is returned to execute until the seed point sequence is empty; if the seed point sequence is empty, the current point set is taken as a cluster set, and each Gaussian point in the cluster set is removed from the color point set; if the sum of the number of cluster sets obtained and the number of Gaussian points in the color point set is higher than the color point set, The corresponding number of samples, then return to the step of arranging all Gaussian points in the color point set in ascending order based on the curvature, and taking the Gaussian point with the smallest curvature as the initial seed point, until the sum of the number of cluster sets obtained and the number of Gaussian points in the color point set is not higher than the number of samples corresponding to the color point set; if the sum of the number of cluster sets obtained and the number of Gaussian points in the color point set is not higher than the number of samples corresponding to the color point set, then stop clustering to obtain multiple cluster sets, and take each remaining Gaussian point in the color point set as an outlier Gaussian point to obtain an outlier set.
[0179] Optionally, the sampling module 240 can be specifically used to: for each cluster set, determine the six ellipsoid boundary points corresponding to each Gaussian point in the cluster set based on the covariance matrix of each Gaussian point in the cluster set; calculate the three semi-axes and the ellipsoid center point corresponding to the minimum volume ellipsoid surrounding all the ellipsoid boundary points; use the minimum volume ellipsoid as the cluster Gaussian point corresponding to the cluster set; use the color attribute of the Gaussian point closest to the center point of the minimum volume ellipsoid in the cluster set as the color attribute of the cluster Gaussian point; and determine the covariance matrix and position of the cluster Gaussian point based on the three semi-axes of the minimum volume ellipsoid and the ellipsoid center point.
[0180] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the Gaussian point downsampling device 200 described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0181] See also Figure 8 , Figure 8 The electronic device 300 includes a processor 310 , a memory 320 , and a bus 330 , wherein the processor 310 is connected to the memory 320 via the bus 330 .
[0182] The memory 320 may be used to store software programs, for example, software programs corresponding to the Gaussian point downsampling device 200 provided in the embodiment of the present invention. The processor 310 executes various functional applications and data processing to implement the Gaussian point downsampling method provided in the embodiment of the present invention by running the software programs stored in the memory 320.
[0183] Among them, the memory 320 can be but is not limited to: RAM (Random Access Memory), ROM (Read Only Memory), FLASH (Flash Memory), PROM (Programmable Read-Only Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electric Erasable Programmable Read-Only Memory), etc.
[0184] The processor 310 may be an integrated circuit chip with signal processing capability. The processor 310 may be a general-purpose processor, including: CPU (Central Processing Unit), NP (Network Processor), etc.; it may also be: DSP (Digital Signal Processing), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0185] Understandably, Figure 8The structure shown is for illustration only. The electronic device 300 may also include Figure 8 More or fewer components as shown, or with Figure 8 Different configurations shown. Figure 8 Each component shown in the figure can be implemented by hardware, software or a combination thereof.
[0186] The embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the Gaussian point downsampling method disclosed in the above embodiment is implemented. The computer-readable storage medium can be, but is not limited to, various media that can store program codes, such as a USB flash drive, a mobile hard disk, a ROM, a RAM, a PROM, an EPROM, an EEPROM, a FLASH disk, or an optical disk.
[0187] In summary, the embodiments of the present invention provide a Gaussian point downsampling method, device, electronic device and readable storage medium. First, each to-be-rendered mesh in a three-dimensional mesh model corresponding to a to-be-rendered three-dimensional scene is obtained, and the to-be-rendered mesh includes a plurality of Gaussian points carrying color attributes; for each to-be-rendered mesh, all Gaussian points in the to-be-rendered mesh are color-classified based on the color attributes to obtain a plurality of color point sets corresponding to the to-be-rendered mesh; based on a preset sampling ratio corresponding to the to-be-rendered mesh, the number of samples in each color point set corresponding to the to-be-rendered mesh is calculated respectively; based on the number of samples of each color point set, each to-be-rendered Gaussian point in the to-be-rendered mesh is determined. In this way, the present invention obtains a plurality of color point sets by color-classifying all Gaussian points in the to-be-rendered mesh, and then determines each to-be-rendered Gaussian point in each color point set according to the preset sampling ratio corresponding to the to-be-rendered mesh. After color classification, sampling is performed according to the preset sampling ratio, so that the ratio of Gaussian points of different colors in the to-be-rendered mesh is stable compared to before sampling, which not only reduces the number of Gaussian points to be rendered but also ensures that there will be no color imbalance after rendering.
[0188] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A Gaussian point downsampling method, characterized in that: include: Obtaining each to-be-rendered mesh in the three-dimensional mesh model corresponding to the to-be-rendered three-dimensional scene, wherein the to-be-rendered mesh includes a plurality of Gaussian points carrying color attributes; For each of the to-be-rendered meshes, based on the color attribute, color classification is performed on all Gaussian points in the to-be-rendered meshes to obtain a plurality of color point sets corresponding to the to-be-rendered meshes; Based on a preset sampling ratio corresponding to the grid to be rendered, respectively calculating the number of samples in each color point set corresponding to the grid to be rendered; Determine each Gaussian point to be rendered in the grid to be rendered based on the number of samples of each color point set; The color attribute is a spherical harmonic function of the Gaussian point; and the step of performing color classification on all Gaussian points in the to-be-rendered mesh based on the color attribute to obtain a plurality of color point sets corresponding to the to-be-rendered mesh includes: For each Gaussian point in the grid to be rendered, based on the spherical harmonic function of the Gaussian point, determine the RGBA channel value presented by the Gaussian point in the normal direction of the plane formed by the major and minor axes of its own ellipsoid; Taking any Gaussian point in the grid to be rendered as the current Gaussian point; From all pending Gaussian points in the grid to be rendered that are not set with color labels, find each similar Gaussian point whose RGBA channel value meets the preset same-color condition, and obtain a color point set consisting of the current Gaussian point and each similar Gaussian point; Setting a common color label for all Gaussian points in the color point set; Determine whether the grid to be rendered still has undetermined Gaussian points for which the color labels are not set; If so, any of the pending Gaussian points is used as a new current Gaussian point, and the process returns to the step of searching for each similar Gaussian point whose RGBA channel value satisfies a preset same-color condition from all the pending Gaussian points in the grid to be rendered without a color label, and obtaining a color point set consisting of the current Gaussian point and each of its similar Gaussian points, until there is no pending Gaussian point in the grid to be rendered without a color label; If not, color classification of all Gaussian points in the grid to be rendered is completed to obtain the plurality of color point sets.
2. The method according to claim 1, characterized in that The meshes of the three-dimensional mesh model correspond one-to-one to the leaf nodes in the octree corresponding to the three-dimensional scene to be rendered; The step of respectively calculating the number of samples in each color point set corresponding to the grid to be rendered based on the preset sampling ratio corresponding to the grid to be rendered comprises: Obtain the target LOD level of the leaf node corresponding to the mesh to be rendered; The product of the number of Gaussian points of each color point set and the preset sampling ratio of the target LOD level is calculated respectively to obtain the number of samples of each color point set.
3. The method according to claim 1, characterized in that The step of determining each Gaussian point to be rendered in the grid to be rendered based on the number of samples of each color point set includes: Based on the number of sampling points of each color point set, each color point set is randomly sampled respectively, and each Gaussian point randomly sampled from each color point set is used as a Gaussian point to be rendered in the grid to be rendered.
4. The method according to claim 1, characterized in that: The step of determining each Gaussian point to be rendered in the grid to be rendered based on the number of samples of each color point set includes: For any of the color point sets, multiple clustering iterations are performed on all Gaussian points in the color point set based on a region growing algorithm, until the number of cluster sets obtained plus the number of Gaussian points remaining in the color point set is not greater than the number of samples corresponding to the color point set, and clustering is stopped to obtain multiple cluster sets and outlier sets; the outlier set includes multiple outlier Gaussian points; Fitting all Gaussian points of each cluster set to obtain cluster Gaussian points corresponding to each cluster set; Taking each of the clustered Gaussian points and each outlier Gaussian point in the outlier set as the Gaussian point to be rendered; Each of the color point sets is traversed to obtain each Gaussian point to be rendered in the grid to be rendered.
5. The method according to claim 4, characterized in that The Gaussian points carry a covariance matrix; the step of performing multiple clustering iterations on all Gaussian points of the color point set based on the region growing algorithm until the number of cluster sets obtained plus the number of Gaussian points remaining in the color point set is not higher than the number of samples corresponding to the color point set, and then stopping clustering to obtain multiple cluster sets and outlier sets includes: Calculating the normal vector and curvature of each Gaussian point in the color point set; Determine three semi-axes of each Gaussian point in the color point set based on the covariance matrix of each Gaussian point in the color point set respectively; Arrange all Gaussian points in the color point set in ascending order based on the curvature, and use the Gaussian point with the smallest curvature as an initial seed point; Determine each neighborhood point within a neighborhood range of a preset clustering radius around the seed point from the color point set; Based on the normal vector of the seed point and the normal vector of each of the neighborhood points, calculate the normal angle between each of the neighborhood points and the seed point and the average normal angle within the neighborhood range; Based on the curvature of each of the neighborhood points, calculate the average curvature within the neighborhood range; For each of the neighborhood points, if the difference between the normal angle between the neighborhood point and the seed point and the average normal angle is lower than a preset angle threshold and the sum of the three semi-axis differences between the neighborhood point and the seed point is lower than a preset value, the neighborhood point is used as a target neighborhood point of the seed point; Add the seed point and each of the target neighborhood points to a point set; the point set is initially empty; If the difference between the curvature of any target neighborhood point and the average curvature is lower than a preset curvature threshold, the target neighborhood point is added to the sequence of undetermined seed points; the sequence of undetermined seed points is initially empty; If the seed point sequence is not empty, a new seed point is taken from the seed point sequence, and the step of determining each neighborhood point within a preset clustering radius around the seed point from the color point set is returned to be executed until the seed point sequence is empty; If the seed point sequence is empty, the current point set is used as a cluster set, and each Gaussian point in the cluster set is removed from the color point set; If the sum of the number of the obtained cluster sets and the number of Gaussian points in the color point set is higher than the number of samples corresponding to the color point set, returning to the step of arranging all Gaussian points in the color point set in ascending order based on the curvature and taking the Gaussian point with the smallest curvature as the initial seed point, until the sum of the number of the obtained cluster sets and the number of Gaussian points in the color point set is not higher than the number of samples corresponding to the color point set; If the sum of the number of the obtained cluster sets and the number of Gaussian points in the color point set is not higher than the sampling number corresponding to the color point set, clustering is stopped to obtain multiple cluster sets, and each Gaussian point currently remaining in the color point set is used as the outlier Gaussian point to obtain an outlier set.
6. The method according to claim 4, characterized in that The Gaussian points carry positions and covariance matrices; the step of fitting each cluster set into clustered Gaussian points comprises: For each of the cluster sets, based on the covariance matrix of each Gaussian point in the cluster set, determine six ellipsoid boundary points corresponding to each Gaussian point in the cluster set; Calculate the three semi-axes and the center point of the ellipsoid corresponding to the minimum volume ellipsoid that encloses all the ellipsoid boundary points; Taking the minimum volume ellipsoid as the cluster Gaussian point corresponding to the cluster set; Taking the color attribute of the Gaussian point closest to the center point of the minimum volume ellipsoid in the cluster set as the color attribute of the cluster Gaussian point; The covariance matrix and the position of the clustered Gaussian points are determined based on the three semi-axes of the minimum volume ellipsoid and the center point of the ellipsoid.
7. A Gaussian point downsampling device, characterized in that: include: An acquisition module, used for acquiring each to-be-rendered mesh in the three-dimensional mesh model corresponding to the to-be-rendered three-dimensional scene, wherein the to-be-rendered mesh includes a plurality of Gaussian points carrying color attributes; A color classification module, for performing color classification on all Gaussian points in each of the grids to be rendered based on the color attribute, to obtain a plurality of color point sets corresponding to the grids to be rendered; A quantity calculation module, used to calculate the number of samples in each color point set corresponding to the grid to be rendered based on a preset sampling ratio corresponding to the grid to be rendered; A sampling module, used for determining each Gaussian point to be rendered in the grid to be rendered based on the sampling quantity of each color point set; Wherein, the color attribute is the spherical harmonic function of the Gaussian point; and the color classification module is specifically used for: For each Gaussian point in the grid to be rendered, based on the spherical harmonic function of the Gaussian point, determine the RGBA channel value presented by the Gaussian point in the normal direction of the plane formed by the major and minor axes of its own ellipsoid; Taking any Gaussian point in the grid to be rendered as the current Gaussian point; From all pending Gaussian points in the grid to be rendered that are not set with color labels, find each similar Gaussian point whose RGBA channel value meets the preset same-color condition, and obtain a color point set consisting of the current Gaussian point and each similar Gaussian point; Setting a common color label for all Gaussian points in the color point set; Determine whether the grid to be rendered still has undetermined Gaussian points for which the color labels are not set; If so, any of the pending Gaussian points is used as a new current Gaussian point, and the process returns to the step of searching for each similar Gaussian point whose RGBA channel value satisfies a preset same-color condition from all the pending Gaussian points in the grid to be rendered without a color label, and obtaining a color point set consisting of the current Gaussian point and each of its similar Gaussian points, until there is no pending Gaussian point in the grid to be rendered without a color label; If not, color classification of all Gaussian points in the grid to be rendered is completed to obtain the plurality of color point sets.
8. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores a software program, and when the electronic device is running, the processor executes the software program to implement the Gaussian point downsampling method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the Gaussian point downsampling method according to any one of claims 1 to 6 is implemented.
