A method, device and storage medium for rendering a semi-transparent object
By acquiring the occlusion rate data of semi-transparent object graphics, the semi-transparent objects are automatically determined and sorted for rendering, solving the problems of poor rendering effect of semi-transparent objects and time-consuming manual sorting, and achieving efficient rendering effect.
Patent Information
- Application Number
- CN202111391134.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-19
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2041-11-19
AI Technical Summary
In existing technologies, semi-transparent objects have poor rendering effects and manual sorting is time-consuming and laborious, resulting in poor rendering results.
By acquiring the occlusion rate data of semi-transparent object graphics, the distribution subset of single-layer semi-transparent objects and the sorting data between subsets are determined, and sorting and rendering are performed automatically, avoiding manual intervention.
It improves the efficiency and effect of rendering semi-transparent objects, ensures better rendering results, and solves the problems of poor rendering effect and time-consuming manual sorting in existing technologies.
Smart Images

Figure CN114119828B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of image processing, and particularly relate to a semi-transparent object rendering sorting method and device, equipment and storage medium. BACKGROUND
[0002] In order to better show the character display effect, in the field of image processing, it is usually necessary to perform semi-transparent processing on the character, so as to make the character lifelike, thereby improving the user experience.
[0003] In the prior art, the sorting processing of semi-transparent rendering is generally avoided, or the semi-transparent part is rendered in a manual sorting manner, resulting in poor rendering result of the unprocessed semi-transparent part in the prior art, and the manual sorting of the semi-transparent part is time-consuming and laborious. SUMMARY
[0004] Embodiments of the present application provide a semi-transparent object rendering sorting method, device, equipment and storage medium, which can improve the rendering sorting efficiency of semi-transparent objects while ensuring the rendering effect of semi-transparent objects.
[0005] In a first aspect, the embodiments of the present application provide a semi-transparent object rendering sorting method, comprising:
[0006] obtaining occlusion rate data of semi-transparent object graphics in a semi-transparent object graphic set;
[0007] determining a single-layer semi-transparent object distribution subset of the semi-transparent objects and inter-subset sorting data of the single-layer semi-transparent object distribution subset according to the occlusion rate data of the semi-transparent object graphics;
[0008] sorting and rendering the semi-transparent object graphics in the semi-transparent object graphic set according to the inter-subset sorting data of the single-layer semi-transparent object distribution subset.
[0009] In a second aspect, the embodiments of the present application further provide a semi-transparent object rendering sorting device, comprising:
[0010] An occlusion rate data acquisition module is configured to obtain occlusion rate data of semi-transparent object graphics in a semi-transparent object graphic set;
[0011] A data processing module is configured to determine a single-layer semi-transparent object distribution subset of the semi-transparent objects and inter-subset sorting data of the single-layer semi-transparent object distribution subset according to the occlusion rate data of the semi-transparent object graphics;
[0012] A sorting and rendering module is configured to sort and render the semi-transparent object graphics in the semi-transparent object graphic set according to the inter-subset sorting data of the single-layer semi-transparent object distribution subset.
[0013] Thirdly, embodiments of the present invention also provide an electronic device, the electronic device comprising:
[0014] One or more processors;
[0015] Storage device for storing one or more programs;
[0016] When the one or more programs are executed by the one or more processors, the one or more processors implement the semi-transparent object rendering and sorting method provided in any embodiment of the present invention.
[0017] Fourthly, embodiments of the present invention also provide a computer storage medium storing a computer program that, when executed by a processor, implements the semi-transparent object rendering and sorting method provided in any embodiment of the present invention.
[0018] The technical solution of this embodiment obtains the occlusion rate data of semi-transparent object graphics in a set of semi-transparent object graphics, and then determines the single-layer semi-transparent object distribution subset and the inter-subset sorting data of the single-layer semi-transparent object distribution subset based on the occlusion rate data. The semi-transparent object graphics in the set of semi-transparent object graphics are then sorted and rendered according to the inter-subset sorting data of the single-layer semi-transparent object distribution subset. Determining the single-layer semi-transparent object distribution subset through the occlusion rate data enables hierarchical partitioning of the set of semi-transparent object graphics. Sorting and rendering the semi-transparent object graphics in the set according to the inter-subset sorting data requires no manual intervention and can automatically sort and render the hierarchically partitioned set of semi-transparent object graphics according to the inter-subset sorting data. This also ensures better rendering effects and solves the problems of poor rendering results due to unprocessed semi-transparent parts in existing technologies, and the time-consuming and laborious nature of manually sorting semi-transparent parts. It improves the rendering sorting efficiency of semi-transparent objects while ensuring the rendering effect of semi-transparent objects. Attached Figure Description
[0019] Figure 1 This is a flowchart of a semi-transparent object rendering and sorting method provided in Embodiment 1 of the present invention;
[0020] Figure 2 This is a flowchart of a semi-transparent object rendering and sorting method provided in Embodiment 2 of the present invention;
[0021] Figure 3 This is a schematic diagram of a hair strand after color marking provided in Embodiment 2 of the present invention;
[0022] Figure 4 This is a schematic diagram of an unsorted rendering effect provided in Embodiment 2 of the present invention;
[0023] Figure 5This is a schematic diagram of the sorted rendering effect provided in Embodiment 2 of the present invention;
[0024] Figure 6 This is a schematic diagram of dividing the mesh of a hair model into hair strands according to Embodiment 2 of the present invention;
[0025] Figure 7 This is a schematic diagram of another method for dividing the mesh of a hair model into hair strands, provided in Embodiment 2 of the present invention;
[0026] Figure 8 This is a schematic diagram of a hair model without intra-layer sorting provided in Embodiment 2 of the present invention;
[0027] Figure 9 This is a comparison diagram of a hair model without intra-layer sorting and a hair model with intra-layer sorting provided in Embodiment 2 of the present invention;
[0028] Figure 10 This is a comparison diagram of another hair model without intra-layer sorting and a hair model with intra-layer sorting provided in Embodiment 2 of the present invention;
[0029] Figure 11 This is a schematic diagram of a semi-transparent object rendering and sorting device provided in Embodiment 3 of the present invention;
[0030] Figure 12 This is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. Detailed Implementation
[0031] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it.
[0032] It should also be noted that, for ease of description, the accompanying drawings show only the parts relevant to the invention and not all of them. Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the operations (or steps) as sequential processes, many of the operations can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the operations can be rearranged. The process can be terminated when its operation is completed, but it may also have additional steps not included in the drawings. The process may correspond to a method, function, procedure, subroutine, subprogram, etc.
[0033] Example 1
[0034] Figure 1This is a flowchart of a semi-transparent object rendering and sorting method provided in Embodiment 1 of the present invention. This embodiment is applicable to the efficient sorting and rendering of semi-transparent objects. This method can be executed by a semi-transparent object rendering and sorting device, which can be implemented by software and / or hardware, and is generally integrated into an electronic device. Accordingly, such as Figure 1 As shown, the method includes the following operations:
[0035] S110. Obtain the occlusion rate data of the semi-transparent object graphics in the semi-transparent object graphics collection.
[0036] The semi-transparent object graphic set can be a collection of graphics of semi-transparent objects that need to be rendered and sorted. A semi-transparent object graphic can be a graphic of a semi-transparent object within the semi-transparent object graphic set. The semi-transparent object graphic set can include at least one semi-transparent object graphic. For example, semi-transparent object graphics can include, but are not limited to, semi-transparent hair graphics, semi-transparent clothing graphics, semi-transparent facial features graphics, semi-transparent hair accessory graphics, and semi-transparent character graphics. When the semi-transparent object graphic is a semi-transparent hair graphic, the semi-transparent object graphic set can be a graphic set including multiple semi-transparent hair graphics. Occlusion rate data can be used to characterize the degree of occlusion of an object.
[0037] In this embodiment of the invention, a set of semi-transparent object graphics can be obtained first, and then the semi-transparent object graphics included in the set of semi-transparent object graphics can be determined, thereby calculating the occlusion rate data of each semi-transparent object graphic.
[0038] S120. Determine the single-layer semi-transparent object distribution subset and the sorting data between subsets of the single-layer semi-transparent object distribution subset based on the occlusion rate data of the semi-transparent object graphics.
[0039] The semi-transparent object can be a semi-transparent object that needs to be rendered in a specific order. A subset of a single-layer semi-transparent object distribution can be a collection of semi-transparent object graphics belonging to a certain layer within a set of semi-transparent object graphics. For example, when the semi-transparent object is a hair model, the semi-transparent object graphics can be hair strands, and the subset of a single-layer semi-transparent object distribution can be hair strands at a certain layer within the hair model. The sorting data between subsets can be data representing the rendering order of the subsets of the single-layer semi-transparent object distribution.
[0040] In this embodiment of the invention, the semi-transparent object graphics in the set of semi-transparent object graphics can be divided according to the occlusion rate data of the semi-transparent object graphics to obtain a single-layer semi-transparent object distribution subset, so that the semi-transparent object graphics located in the single-layer semi-transparent object distribution subset belong to the same level, and then the sorting data between the subsets of the single-layer semi-transparent object distribution subset is determined according to the order of dividing the single-layer semi-transparent object distribution subset.
[0041] S130. Sort and render the semi-transparent object graphics in the semi-transparent object graphics set according to the sorting data between subsets of the single-layer semi-transparent object distribution subset.
[0042] In this embodiment of the invention, the rendering order of the single-layer semi-transparent object distribution subset can be determined based on the inter-subset sorting data of the single-layer semi-transparent object distribution subset, and then the semi-transparent object graphics in the semi-transparent object graphic set can be sorted and rendered according to the rendering order of the single-layer semi-transparent object distribution subset.
[0043] The technical solution of this embodiment obtains the occlusion rate data of semi-transparent object graphics in a set of semi-transparent object graphics, and then determines the single-layer semi-transparent object distribution subset and the inter-subset sorting data of the single-layer semi-transparent object distribution subset based on the occlusion rate data. The semi-transparent object graphics in the set of semi-transparent object graphics are then sorted and rendered according to the inter-subset sorting data of the single-layer semi-transparent object distribution subset. Determining the single-layer semi-transparent object distribution subset through the occlusion rate data enables hierarchical partitioning of the set of semi-transparent object graphics. Sorting and rendering the semi-transparent object graphics in the set according to the inter-subset sorting data requires no manual intervention and can automatically sort and render the hierarchically partitioned set of semi-transparent object graphics according to the inter-subset sorting data. This also ensures better rendering effects and solves the problems of poor rendering results due to unprocessed semi-transparent parts in existing technologies, and the time-consuming and laborious nature of manually sorting semi-transparent parts. It improves the rendering sorting efficiency of semi-transparent objects while ensuring the rendering effect of semi-transparent objects.
[0044] Example 2
[0045] Figure 2 This is a flowchart of a semi-transparent object rendering and sorting method provided in Embodiment 2 of the present invention. This embodiment is based on the above embodiment and is further specified. In this embodiment, specific optional implementation methods are given for obtaining the occlusion rate data of semi-transparent object graphics in a semi-transparent object graphics set, and for internal sorting of a single-layer semi-transparent object distribution subset. Correspondingly, as Figure 2 As shown, the method includes the following operations:
[0046] S210. Determine the current semi-transparent object to be processed based on the set of semi-transparent object graphics.
[0047] The semi-transparent object to be processed can be a semi-transparent graphic that currently needs to have its occlusion rate data calculated.
[0048] In this embodiment of the invention, the current semi-transparent object to be processed that requires occlusion rate data to be calculated can be determined from the semi-transparent object graphic set.
[0049] In an optional embodiment of the present invention, before obtaining the occlusion rate data of the semi-transparent object graphics in the semi-transparent object graphics set, the method may further include: obtaining vertex association data of the semi-transparent object units in the semi-transparent object; and determining the semi-transparent object graphics set based on the vertex association data of the semi-transparent object units.
[0050] A semi-transparent object unit can be the smallest constituent unit of a semi-transparent object, meaning it cannot be further divided. For example, when the semi-transparent object is a 3D model, the semi-transparent object unit is the triangle that makes up the 3D model. Vertex association data can be data associated with the vertices of the semi-transparent object unit. Vertex association data can include vertex identifiers used to identify vertex numbers and the semi-transparent object unit to which the vertex belongs, etc.
[0051] In this embodiment of the invention, the semi-transparent objects that need to be rendered and sorted can be obtained first, and then the semi-transparent object units that constitute the semi-transparent objects can be determined. The vertex association data of each semi-transparent object unit can be further determined so as to determine the semi-transparent object units with shared vertices based on the vertex association data, and then the semi-transparent object graphic set can be determined based on the semi-transparent object units with shared vertices.
[0052] For example, when the semi-transparent object is a hair model, vertex association data can be input into the hairStrands.Create() function to determine the semi-transparent object graphic set. The hairStrands.Create() function is a function for dividing hair strands. This embodiment of the invention does not limit the function used to determine the semi-transparent object graphic set.
[0053] For example, we can first traverse the semi-transparent object units within a semi-transparent object. If none of the vertices of a semi-transparent object unit have been assigned a semi-transparent object graphic identifier, then we assign a new semi-transparent object graphic identifier to the vertices of that semi-transparent object unit. If some vertices of a semi-transparent object unit have been assigned semi-transparent object graphic identifiers, then we configure the semi-transparent object graphic identifiers to the vertices of that semi-transparent object unit that have not been assigned semi-transparent object graphic identifiers. If different vertices of a semi-transparent object unit have different semi-transparent object graphic identifiers, then we select one semi-transparent object graphic identifier from the different semi-transparent object graphic identifiers of the different vertices of that semi-transparent object unit and uniformly configure it to all vertices of that semi-transparent object unit. Furthermore, the vertices of the semi-transparent object unit that had the same semi-transparent object graphic identifier as the semi-transparent object unit before the uniform configuration are configured with the same semi-transparent object graphic identifier as the vertices of the semi-transparent object unit after the uniform configuration. Here, the semi-transparent object graphic identifier can be a symbol representing a semi-transparent object graphic, to facilitate the counting of semi-transparent object units belonging to the same semi-transparent object graphic. For example, the semi-transparent object graphic identifier of semi-transparent object graphic A can be ID1, and the semi-transparent object graphic identifier of semi-transparent object graphic B can be ID2.
[0054] For example, suppose the semi-transparent object is a hair model, and the semi-transparent object units are triangles 1, 2, 3, 4, and 5 that make up the hair model. Specifically, the vertices of triangle 1 are vertices 1, 2, and 3; the vertices of triangle 2 are vertices 2, 3, and 4; the vertices of triangle 3 are vertices 5, 6, and 7; the vertices of triangle 4 are vertices 4, 5, and 6; and the vertices of triangle 5 are vertices 8, 9, and 10. Assuming the hair bundle identifier (semi-transparent hair graphic identifier) assigned to the vertices of triangle 1 is ID1, since triangles 1 and 2 share vertices 2 and 3, triangles 1 and 2 can be classified as a single hair bundle, i.e., a single semi-transparent hair graphic, and the hair bundle identifier ID1 is assigned to the vertices of triangles 1 and 2. Triangle 3 does not share vertices with triangles 2 and 1, therefore triangle 3 is classified as a single hair bundle, and the hair bundle identifier ID2 is assigned to the vertices of triangle 3. Since triangle 4 shares vertex 4 with triangle 2 and vertices 5 and 6 with triangle 3, triangle 4 can be assigned to either the hair bundle identifier ID1 or the hair bundle identifier ID2. In this case, triangle 4 will have different hair bundle identifiers at its vertices. Therefore, hair bundle identifier ID1 can be uniformly assigned to the vertices of triangle 4, and hair bundle identifier ID1 can also be assigned to the vertices of triangle 3. Thus, triangles 1, 2, 3, and 4 can be grouped into a single hair bundle, with all triangle vertices within this bundle having a unified hair bundle ID1. Since the vertices of triangle 5 have not been assigned hair bundle identifiers and do not share vertices with triangles 1, 2, 3, or 4, hair bundle identifier ID2 can be assigned to the vertices of triangle 5.
[0055] S220. Calculate the current normal direction data of the semi-transparent object to be processed.
[0056] Among them, the current normal direction data can be used to characterize the normal direction of the semi-transparent object graphic whose normal direction needs to be determined.
[0057] Specifically, if the semi-transparent object to be processed is a planar graphic, the current normal direction data of the semi-transparent object can be calculated according to the calculation method of planar normals. If the semi-transparent object to be processed is a curved surface graphic, the current normal direction data of the semi-transparent object can be calculated according to the calculation method of surface normals.
[0058] For example, if the semi-transparent object to be processed is a curved surface, the semi-transparent object units that make up the semi-transparent object to be processed can be determined first. Then, the product of the normal vector of the semi-transparent object unit and the area of the semi-transparent object unit is used as the normal direction data of the semi-transparent object unit. Furthermore, the average value of the normal direction data of all the semi-transparent object units of the semi-transparent object to be processed is used as the current normal direction data of the semi-transparent object to be processed. Alternatively, the vertex normal vectors of the semi-transparent object units can be weighted and the weighted result can be used as the normal direction data of the semi-transparent object unit. Finally, the average value of the normal direction data of all the semi-transparent object units of the semi-transparent object to be processed is used as the current normal direction data of the semi-transparent object to be processed.
[0059] S230. Determine the associated semi-transparent object of the current semi-transparent object to be processed based on the current normal direction data.
[0060] The associated semi-transparent object can be a semi-transparent graphic that obscures the currently processed semi-transparent object. The associated semi-transparent object can include one or more semi-transparent graphic objects.
[0061] In this embodiment of the invention, the associated semi-transparent objects that will occlude the current semi-transparent object when drawing the current semi-transparent object can be determined based on the normal direction data.
[0062] In an optional embodiment of the present invention, determining the associated semi-transparent object of the current semi-transparent object to be processed based on the current normal direction data may include: determining the current orthographic camera parameters matched by the current semi-transparent object to be processed based on the current normal direction data; and determining the associated semi-transparent object of the current semi-transparent object to be processed based on the current orthographic camera parameters matched by the current semi-transparent object to be processed and the graphic depth data of the non-current semi-transparent object graphic.
[0063] Here, the current orthographic camera parameters can be the data that the orthographic camera needs to configure to capture the current semi-transparent object to be processed. The non-current semi-transparent object image can be any semi-transparent object image captured by the orthographic camera other than the currently processed semi-transparent object. The image depth data can be data representing the pixel depth of the image. Pixel depth can refer to the number of bits used to store each pixel, and is also used to measure the image resolution.
[0064] In this embodiment of the invention, a direction opposite to the vector direction of the current normal direction data can be determined first. Then, an orthogonal camera is placed according to this direction. Next, the parameters of the current orthogonal camera matching the current semi-transparent object are determined based on the maximum diagonal of the bounding box of the semi-transparent object to be processed. After obtaining the parameters of the current orthogonal camera matching the current semi-transparent object, the orthogonal camera can be configured so that the range captured by the orthogonal camera at least includes the entire semi-transparent object to be processed, and the depth of the captured image at least includes the entire set of semi-transparent object graphics. Then, non-current semi-transparent object graphics are determined from the graphics captured by the orthogonal camera. The graphic depth data of these non-current semi-transparent object graphics is then parsed. Based on the graphic depth data of these non-current semi-transparent object graphics, non-current semi-transparent object graphics that are closer to the orthogonal camera than the current semi-transparent object to be processed are determined. These non-current semi-transparent object graphics that are closer to the orthogonal camera than the current semi-transparent object to be processed are then identified as associated semi-transparent objects of the current semi-transparent object to be processed.
[0065] S240. Determine the area of occlusion of the currently unprocessed semi-transparent object by the associated semi-transparent object.
[0066] Among them, the occlusion area can represent the range of occlusion and can be used to represent the occluded area in the semi-transparent object to be processed.
[0067] In this embodiment of the invention, the image region of the associated semi-transparent object and the image region of the current semi-transparent object to be processed can be determined first, and then the occlusion area of the associated semi-transparent object on the current semi-transparent object can be determined based on the image region of the associated semi-transparent object and the image region of the current semi-transparent object to be processed.
[0068] In an optional embodiment of the present invention, determining the occlusion area of the associated semi-transparent object on the current semi-transparent object to be processed may include: obtaining the object depth value of the current semi-transparent object to be processed and the object depth value of the associated semi-transparent object according to the current orthogonal camera parameters; determining the global graphic area of the current semi-transparent object to be processed according to the object depth value of the current semi-transparent object to be processed; determining the occlusion graphic area of the current semi-transparent object to be processed according to the object depth value of the associated semi-transparent object; and determining the occlusion area of the associated semi-transparent object on the current semi-transparent object to be processed according to the occlusion graphic area and the global graphic area.
[0069] The object depth value can be the average pixel depth of the graphic. The global graphic area can be the graphic area of the currently processed semi-transparent object. The occluding graphic area can be the area of the associated semi-transparent objects that occludes the currently processed semi-transparent object.
[0070] In this embodiment of the invention, the captured image of the current orthogonal camera can be determined according to the current orthogonal camera parameters. Then, the object depth value of the current semi-transparent object to be processed and the object depth value of the associated semi-transparent object can be calculated based on the captured image of the current orthogonal camera. Then, based on the object depth value of the current semi-transparent object to be processed, the global graphic area of the current semi-transparent object to be processed corresponding to the object depth value of the current semi-transparent object to be processed can be determined. And based on the object depth value of the associated semi-transparent object, the occlusion graphic area of the current semi-transparent object to be processed corresponding to the object depth value of the associated semi-transparent object can be determined. Then, the area of the overlapping region between the occlusion graphic area and the global graphic area is used as the occlusion area of the associated semi-transparent object on the current semi-transparent object to be processed.
[0071] S250. Calculate the occlusion rate data of the semi-transparent object graphic based on the occlusion area of the current semi-transparent object to be processed.
[0072] In this embodiment of the invention, the occlusion rate data of the semi-transparent object graphic can be calculated based on the occlusion area of the semi-transparent object to be processed and the graphic area of the semi-transparent object to be processed.
[0073] Optionally, the occlusion rate of the semi-transparent object to be processed can be calculated based on its occlusion area and graphic area. This allows the semi-transparent object to be removed from the semi-transparent object graphic set, updating the set. The process then returns to step S210 until the semi-transparent object set is empty. The algorithm for calculating the occlusion rate can be implemented on a CPU (Central Processing Unit) or a GPU (Graphics Processing Unit).
[0074] For example, the sum of the occlusion area A of the semi-transparent object to be processed and the graphic area B of the semi-transparent object to be processed, C, can be calculated first. Then, the ratio of the occlusion area A of the semi-transparent object to the sum C can be used as the occlusion rate data of the semi-transparent object graphic.
[0075] For example, the pixel depth value of the current hair strand can be written to the depth buffer, and the graphic area of the current hair strand can be rendered as color 'a'. Then, depth writing can be disabled (at this point, drawing other hair strands will not modify the data in the depth buffer; the depth buffer only contains the pixel depth value of the current hair strand). Next, depth testing can be enabled (only hair strands closer to the orthographic camera will be output; those farther away will be discarded, and discarded hair strands will not occlude the current hair strand). Then, the occlusion area of the hair strands occluding the current hair strand can be rendered as color 'b'. After the current hair strand has been rendered, the rendering effect can be seen in [reference needed]. Figure 3After obtaining the rendering areas of color a and color b, we can further calculate the number of pixels of color a based on its rendering area, and the number of pixels of color b based on its rendering area. This allows us to calculate the sum of the pixel counts of color a and color b. The ratio of the pixel count of color b to this sum is used as the occlusion rate data for the semi-transparent object. A ratio of 0 indicates that the current hair strand has no occlusion, while a ratio of 1 indicates that the current hair strand is completely occluded.
[0076] For example, the GPU can encode all the operation instructions for the hair strand into the command buffer (a programming concept for command buffers) in batches, and then render the global graphics area and occlusion area of the current hair strand based on the rendering pipeline. Furthermore, it calculates the occlusion rate data based on the renderer. Compared to the CPU, the GPU's data processing speed is much faster. When rendering the current hair strand, it can be set as a rendering target with a side length of 256 pixels, and the depth buffer of the entire image can be flushed to the closest representable value (such as 0).
[0077] S260. Determine the single-layer semi-transparent object distribution subset and the sorting data between subsets of the single-layer semi-transparent object distribution subset based on the occlusion rate data of the semi-transparent object graphics.
[0078] In an optional embodiment of the present invention, after determining the single-layer semi-transparent object distribution subset of the semi-transparent object based on the occlusion rate data of the semi-transparent object graphic, the method may further include: determining the current single-layer semi-transparent object to be sorted; obtaining the current normal direction data of the current single-layer semi-transparent object to be sorted; determining target normal direction data based on the current normal direction data of the current single-layer semi-transparent object to be sorted and the normal direction data of non-current single-layer semi-transparent objects within the single-layer semi-transparent object distribution subset; updating the current normal direction data based on the target normal direction data; and sorting the current single-layer semi-transparent object within the subset based on the current normal direction data.
[0079] The currently unsorted single-layer semi-transparent objects can be semi-transparent object graphics with a determined intra-layer arrangement order within a subset of layered semi-transparent object distributions. The first determined currently unsorted single-layer semi-transparent object includes a single semi-transparent object graphic, while subsequent determined currently unsorted single-layer semi-transparent objects are combinations of multiple semi-transparent object graphics. Non-currently unsorted single-layer semi-transparent objects can be any unprocessed semi-transparent objects within the single-layer semi-transparent object distribution subset, excluding the currently unsorted single-layer semi-transparent object. These non-currently unsorted single-layer semi-transparent objects belong to the same single-layer semi-transparent object distribution subset as the currently unsorted single-layer semi-transparent object. The target normal direction data can be calculated from the current normal direction data of the currently unsorted single-layer semi-transparent object and the normal direction data of the non-currently unsorted single-layer semi-transparent objects within the single-layer semi-transparent object distribution subset, and is used to update the current normal direction data.
[0080] In this embodiment of the invention, the currently unsorted single-layer semi-transparent objects can be determined from the single-layer semi-transparent object distribution subset, and the current normal direction data of the currently unsorted single-layer semi-transparent objects can be further calculated. This allows for the determination of non-currently unsorted single-layer semi-transparent objects within the single-layer semi-transparent object distribution subset whose normal direction is closest to the opposite direction of the current normal direction data of the currently unsorted single-layer semi-transparent objects, and the determination of the normal direction data of the non-currently unsorted single-layer semi-transparent objects. After obtaining the current normal direction data of the single-layer semi-transparent object to be sorted, and the normal direction data of the non-current single-layer semi-transparent objects within the subset of single-layer semi-transparent objects whose opposite direction to the current normal direction data is closest, the target normal direction data can be calculated based on the current normal direction data of the single-layer semi-transparent object to be sorted and the normal direction data of the non-current single-layer semi-transparent objects within the subset of single-layer semi-transparent objects. The target normal direction data is then used as the new current normal direction data. The non-current single-layer semi-transparent objects for which the target normal direction data is calculated are added to the current single-layer semi-transparent object to be sorted. The process of determining the current single-layer semi-transparent object to be sorted is then repeated until the current single-layer semi-transparent object to be sorted includes all semi-transparent object graphics in the subset of single-layer semi-transparent objects. The order of the semi-transparent objects added to the current single-layer semi-transparent object to be sorted during the calculation of the current normal direction data is used as the internal sorting of the subset of the current single-layer semi-transparent object to be sorted. Finally, the single-layer semi-transparent object to be sorted is rendered according to the internal sorting of the subset of the current single-layer semi-transparent object to be sorted.
[0081] In an optional embodiment of the present invention, updating the current normal direction data according to the target normal direction data may include: obtaining the sum of the target normal direction data and the current normal direction data; and updating the current normal direction data according to the sum of the target normal direction data and the current normal direction data.
[0082] In this embodiment of the invention, the sum of the target normal direction data and the current normal direction data can be calculated, and then the sum of the target normal direction data and the current normal direction data can be used as the new current normal direction data. Then, the non-current unsorted single-layer semi-transparent objects corresponding to the target normal direction data can be added to the current unsorted single-layer semi-transparent objects, and the operation of determining the current unsorted single-layer semi-transparent objects can be returned to execute until the current unsorted single-layer semi-transparent objects include all the previously unprocessed semi-transparent objects in the single-layer semi-transparent object distribution subset, and the update of the current normal direction data ends.
[0083] For example, suppose that the subset of a single-layer semi-transparent object distribution includes semi-transparent object graphic A, semi-transparent object graphic B, and semi-transparent object graphic C. If the current unsorted single-layer semi-transparent objects are empty, a semi-transparent object image can be randomly selected from the subset of single-layer semi-transparent object distributions, for example, semi-transparent object image A. The selected semi-transparent object image A is then added to the current unsorted single-layer semi-transparent objects. At this time, the current normal direction data of the current unsorted single-layer semi-transparent objects is the current normal direction data of semi-transparent object image A. Then, semi-transparent object images B and C are taken as non-current unsorted single-layer semi-transparent objects. Further, from the non-current unsorted single-layer semi-transparent objects, the semi-transparent object image B that is closest to the opposite direction of the vector corresponding to the current normal direction data of semi-transparent object image A is determined. Then, the current normal direction data is updated to the target normal direction data based on the sum of the normal direction data of semi-transparent object image B and the current normal direction data of semi-transparent object image A. Finally, semi-transparent object image B is added to the current unsorted single-layer semi-transparent objects.
[0084] After adding semi-transparent object graphic B to the current unsorted single-layer semi-transparent objects, the current unsorted single-layer semi-transparent objects include semi-transparent object graphic A and semi-transparent object graphic B. The non-unsorted single-layer semi-transparent objects are semi-transparent object graphic C. The current normal direction data of the current unsorted single-layer semi-transparent objects is the sum of the normal direction data of semi-transparent object graphic B and semi-transparent object graphic A. Based on the current normal direction data of the current unsorted single-layer semi-transparent objects, determine the semi-transparent object graphic C whose vector is closest in the opposite direction to the current normal direction data of the current unsorted single-layer semi-transparent objects. Then, the semi-transparent object graphic... The sum of the normal direction data of shape C, the normal direction data of semi-transparent object shape B, and the normal direction data of semi-transparent object shape A is used as the target normal direction data. Semi-transparent object shape C is added to the current unsorted single-layer semi-transparent object. Since the current unsorted single-layer semi-transparent object includes all semi-transparent object shapes in the single-layer semi-transparent object distribution subset, the operation of determining the current unsorted single-layer semi-transparent object ends. According to the update process of the current normal direction data, the order of the semi-transparent objects added to the current unsorted single-layer semi-transparent object (semi-transparent object shape A, semi-transparent object shape B, and semi-transparent object shape C) is used as the internal sort of the subset.
[0085] In an optional embodiment of the present invention, determining the single-layer semi-transparent object distribution subset and the inter-subset sorting data of the single-layer semi-transparent object distribution subset based on the occlusion rate data of the semi-transparent object graphics may include: determining a current occlusion rate threshold; dividing the semi-transparent object graphics with occlusion rate data less than or equal to the current occlusion rate threshold into single-layer semi-transparent object distribution subsets; and determining the inter-subset sorting data of the single-layer semi-transparent object distribution subset according to the determination order of each single-layer semi-transparent object distribution subset.
[0086] The current occlusion rate threshold can be a preset threshold for occlusion rate based on the rendering effect. For example, the current occlusion rate threshold can be set to 0.2, and the occlusion rate thresholds for determining each subset of single-layer semi-transparent object distributions can be the same or different.
[0087] In this embodiment of the invention, the current occlusion rate threshold can be determined according to the required rendering effect, and an empty set can be initialized as a single-layer semi-transparent object distribution subset. Then, semi-transparent object graphics with occlusion rate data less than or equal to the current occlusion rate threshold can be divided into single-layer semi-transparent object distribution subsets. Then, the sorting data between the subsets of the single-layer semi-transparent object distribution subsets can be determined according to the determination order of each single-layer semi-transparent object distribution subset.
[0088] For example, suppose that a single-layer semi-transparent object distribution subset 1 is first determined, then a single-layer semi-transparent object distribution subset 2 is determined, and finally a single-layer semi-transparent object distribution subset 3 is determined. Then the sorted data among the subsets is single-layer semi-transparent object distribution subset 1, single-layer semi-transparent object distribution subset 2, and single-layer semi-transparent object distribution subset 3.
[0089] S270. Sort and render the semi-transparent object graphics in the semi-transparent object graphic set according to the sorting data between subsets of the single-layer semi-transparent object distribution subset.
[0090] In an optional embodiment of the present invention, sorting and rendering the semi-transparent object graphics in the semi-transparent object graphics set according to the inter-subset sorting data of the single-layer semi-transparent object distribution subset may include: reversing the inter-subset sorting data of the single-layer semi-transparent object distribution subset to obtain inter-subset reverse sorting data; and sorting and rendering the semi-transparent object graphics in the semi-transparent object graphics set according to the inter-subset reverse sorting data.
[0091] Reversing order processing can be used to rearrange the data in an array in reverse order. For example, if the original array is 123, reversing the original array will result in an array of 321. Reversing order sorting between subsets can be the result of reversing the sorted data between subsets of a single-layer semi-transparent object distribution.
[0092] In this embodiment of the invention, the inter-subset sorting data of a single-layer semi-transparent object distribution subset can be reversed to obtain the reversed sorting result of the inter-subset sorting data, i.e., the inter-subset reversed sorting data. Then, the inter-subset reversed sorting data and the inter-subset sorting data of the single-layer semi-transparent object distribution subset are used to sort and render the semi-transparent object graphics in the semi-transparent object graphics set.
[0093] For example, suppose the sorted data between subsets are single-layer semi-transparent object distribution subset 1, single-layer semi-transparent object distribution subset 2, and single-layer semi-transparent object distribution subset 3, and the sorted data between subsets in reverse order are single-layer semi-transparent object distribution subset 3, single-layer semi-transparent object distribution subset 2, and single-layer semi-transparent object distribution subset 1. Then, the single-layer semi-transparent object distribution subset 3 in the semi-transparent object graphic set is rendered first, then the single-layer semi-transparent object distribution subset 2 in the semi-transparent object graphic set is rendered, and finally the single-layer semi-transparent object distribution subset 1 in the semi-transparent object graphic set is rendered.
[0094] In a specific example, when rendering the hair model of a virtual character, semi-transparency is introduced to improve the display effect of the hair and make the edges of the hair look more natural. Semi-transparency rendering can utilize painter algorithms to draw graphics from far to near; in the hair model, the triangles at the back of the head are drawn first, followed by the sideburns, resulting in a near-to-far rendering process. However, a single renderer cannot handle the order of its own triangles, causing significant errors in the unordered mesh after introducing semi-transparency. Some triangles that need to be occluded are drawn later, resulting in triangles that should have been occluded not being occluded, such as... Figure 4 As shown, the circled area represents the case where the triangles that should have been occluded were not. This solution achieves the sorting of triangle rendering order by performing intra-layer sorting (subset-based sorting) on the hair bundle layer (equivalent to sorting data in reverse order of the subset) and sorting the hair bundle layers according to their stripped reverse order (equivalent to sorting data in reverse order of the subset). This reduces the problem of poor rendering results caused by a single renderer's inability to sort its own triangles. The final sorted rendering effect after sorting the hair bundle layers according to this solution can be seen in [link to example]. Figure 5 .
[0095] The hair strand sorting of the hair model can be done using the following steps: Step 1: Divide the hair model into triangles to form hair strands; Step 2: Calculate the occlusion rate of the hair strands to be sorted (hair strands that have not been sorted into layers are equivalent to multiple semi-transparent objects to be processed); Step 3: In the hair strands to be sorted, hair strands with occlusion rates less than or equal to the current occlusion rate threshold are divided into hair strand layers Li, where Li represents the i-th layer of hair strands; Step 4: Sort the hair strands within a hair strand layer; Step 5: Remove hair strands Li from the hair strands to be sorted, let i = i + 1, and return to execute steps 2-5 until the hair strands to be sorted are empty and all hair strands are assigned to a certain layer; Step 6: Render the hair strands according to the hair strand layers L1, L2, ... Ln obtained by the stripping order, in the reverse stripping order Ln...L1, L2. Here, L1 represents the first layer of hair strands, L2 represents the second layer of hair strands, and so on, with Ln representing the n-th layer of hair strands. A larger n indicates that the hair strand layer is further inward. Hair strands further inward are drawn first to ensure correct blending from the inside out. The final result is an offline (occurring during the editing stage, not during game execution) sorted grid, which can be used directly in the game to achieve a good display effect.
[0096] Specifically, step 2 may include: Step 2.1, calculating the current normal direction data of the current hair strand; Step 2.2, setting up an orthogonal camera in the opposite direction to the normal direction corresponding to the current normal direction data; Step 2.3, drawing the current hair strand based on the image captured by the orthogonal camera, writing the pixel depth value to the depth buffer, and marking the current hair strand as color a; Step 2.4, turning off depth writing, enabling depth testing, and rendering the occlusion area of the hair strand that occludes the current hair strand as color b; Step 2.5, using the number of pixels of color b / (the number of pixels of color b + the number of pixels of color a) as the occlusion rate data of the current hair strand.
[0097] Step 4 may include: Step 4.1.1, determining the unsorted hair bundles within the layer, initially set to all hair bundles within the layer; Step 4.1.2, calculating the normal direction data of the unsorted hair bundles within the layer; Step 4.1.3, determining the current hair bundle from the unsorted hair bundles within the layer (equivalent to determining the current unsorted single-layer semi-transparent object to be sorted, and at this time, the current unsorted single-layer semi-transparent object to be sorted only includes one semi-transparent object graphic), and using the normal direction data N of the current hair bundle as the current normal direction data; Step 4.2, determining the hair bundle within the current layer that is closest to the current hair bundle in the opposite direction, as the next hair bundle to be processed, and marking the next hair bundle to be processed as S. n Step 4.3, use S n The sum of the current normal direction data N and the existing normal direction data N is used as the target normal direction data Nn, where Nn = S. n +N, and update the current normal direction data using the formula N = Nn; Step 4.4, delete S from the unsorted hair bundles within the layer. n , will S n Add to the sorted list; Step 4.5, return to execute steps 4.2 to 4.4 until the unsorted hair bundles in the layer are cleared, and the order in which hair bundles are added to the sorted list is the sorting order of the hair bundles in the layer.
[0098] Figure 6 This is a schematic diagram of dividing the mesh of a hair model into hair strands, as provided in Embodiment 2 of the present invention. Figure 6 As shown, in a three-dimensional coordinate system, triangles, serving as a mesh, are divided into multiple hair strands. To illustrate the hair strands more clearly, a schematic diagram of another hair model's hair strands is provided in a three-dimensional coordinate system; see [link to diagram]. Figure 7 .exist Figure 7 and Figure 6 Each strand of hair is considered a hair bundle.
[0099] Figure 8 This is a schematic diagram of a hair model without intra-layer sorting provided in Embodiment 2 of the present invention, as shown below. Figure 8As shown, without layer sorting, the hair model will appear mostly correct on one side and mostly incorrect on the other. When viewed from right to left on the right, the hair model is rendered mostly correctly, but when viewed from left to right on the left, the hair model is mostly incorrect; that is, most of the hairstyle on the right side can still be seen, while only a small portion of the hairstyle on the left side can be seen.
[0100] Figure 9 This is a comparison diagram of a hair model without intra-layer sorting and a hair model with intra-layer sorting provided in Embodiment 2 of the present invention. Figure 10 This is a comparison diagram of another hair model without intra-layer sorting and a hair model with intra-layer sorting provided in Embodiment 2 of the present invention, as shown below. Figure 9 As shown, when viewing the hair model from the right, if the hair strand layer has completed its internal sorting, the rendered image will appear partially correct and partially incorrect when viewed from the right (the correct parts of the hair model will be lighter in color than the incorrect parts). If the hair strand layer has not undergone internal sorting, the rendered image will appear mostly correct when viewed from the right. Figure 10 As shown, when viewing the hair model from the left, if the hair strand layer is properly sorted within its layer, the rendered image will appear partially correct and partially incorrect when viewed from the left. If the hair strand layer is not sorted within its layer, the rendered image will appear mostly incorrect when viewed from the left. When the transparency of the semi-transparent hair strands is medium or low, if the correct and incorrect parts of the hair model are interspersed, the incorrect parts are not easily detected. Therefore, this solution improves the visual effect by sorting the hair strand layer within its layer.
[0101] After sorting the hair bundles, debugging tools can be used to view intermediate results during the calculation process, thereby identifying errors that may arise, such as calculation problems and / or art resource issues. Debugging tools allow for quick location of errors, enabling accurate determination of the areas requiring correction. For example, test cases can be written within the debugging tool as test units, ensuring that code modifications do not compromise the correctness of the hair bundle sorting and rendering. The testing tool can also visually display the intra-layer sorting order and the overall sorting order of hair bundle layers, facilitating the verification of sorting results and the correctness of hair bundle segmentation. Furthermore, when calculating the occlusion rate data for the current hair bundle, it can output images of the current hair bundle and other hair bundles occluding it, facilitating the verification of the orthographic camera and occlusion rate data.
[0102] The technical solution of this embodiment determines the current semi-transparent object to be processed based on the set of semi-transparent object graphics, calculates the current normal direction data of the current semi-transparent object to be processed, determines the associated semi-transparent objects of the current semi-transparent object to be processed based on the current normal direction data, further determines the occlusion area of the associated semi-transparent objects on the current semi-transparent object to be processed, calculates the occlusion rate data of the semi-transparent object graphics based on the occlusion area of the current semi-transparent object to be processed, determines the single-layer semi-transparent object distribution subset and the sorting data between subsets of the single-layer semi-transparent object distribution subset based on the occlusion rate data of the semi-transparent object graphics, and then sorts and renders the semi-transparent object graphics in the set of semi-transparent object graphics based on the sorting data between subsets of the single-layer semi-transparent object distribution subset. By determining the distribution subset of a single-layer semi-transparent object using occlusion rate data, a hierarchical division of the semi-transparent object graphic set can be achieved. Then, the semi-transparent object graphics in the semi-transparent object graphic set are sorted and rendered according to the sorting data between subsets. This can automatically sort and render the hierarchically divided semi-transparent object graphic set according to the sorting data between subsets without manual intervention, and can also ensure better rendering effects. This solves the problems of poor rendering results caused by the failure to process semi-transparent parts in the existing technology, and the time-consuming and laborious problem of manually sorting semi-transparent parts. It can improve the rendering sorting efficiency of semi-transparent objects while ensuring the rendering effect of semi-transparent objects.
[0103] It should be noted that any arrangement or combination of the technical features in the above embodiments also falls within the protection scope of this invention.
[0104] Example 3
[0105] Figure 11 This is a schematic diagram of a semi-transparent object rendering and sorting device provided in Embodiment 3 of the present invention, as shown below. Figure 11 As shown, the device includes: an occlusion rate data acquisition module 310, a data processing module 320, and a sorting and rendering module 330, wherein:
[0106] Occlusion rate data acquisition module 310 is used to acquire occlusion rate data of semi-transparent object graphics in the semi-transparent object graphic collection;
[0107] Data processing module 320 is used to determine the single-layer semi-transparent object distribution subset of the semi-transparent object and the sorting data between subsets of the single-layer semi-transparent object distribution subset based on the occlusion rate data of the semi-transparent object graphic.
[0108] The sorting and rendering module 330 is used to sort and render the semi-transparent object graphics in the semi-transparent object graphics set according to the inter-subset sorting data of the single-layer semi-transparent object distribution subset.
[0109] The technical solution of this embodiment obtains the occlusion rate data of semi-transparent object graphics in a set of semi-transparent object graphics, and then determines the single-layer semi-transparent object distribution subset and the inter-subset sorting data of the single-layer semi-transparent object distribution subset based on the occlusion rate data. The semi-transparent object graphics in the set of semi-transparent object graphics are then sorted and rendered according to the inter-subset sorting data of the single-layer semi-transparent object distribution subset. Determining the single-layer semi-transparent object distribution subset through the occlusion rate data enables hierarchical partitioning of the set of semi-transparent object graphics. Sorting and rendering the semi-transparent object graphics in the set according to the inter-subset sorting data requires no manual intervention and can automatically sort and render the hierarchically partitioned set of semi-transparent object graphics according to the inter-subset sorting data. This also ensures better rendering effects and solves the problems of poor rendering results due to unprocessed semi-transparent parts in existing technologies, and the time-consuming and laborious nature of manually sorting semi-transparent parts. It improves the rendering sorting efficiency of semi-transparent objects while ensuring the rendering effect of semi-transparent objects.
[0110] Optionally, the occlusion rate data acquisition module 310 is specifically used for: determining the current semi-transparent object to be processed based on the semi-transparent object graphic set; calculating the current normal direction data of the current semi-transparent object to be processed; determining the associated semi-transparent objects of the current semi-transparent object to be processed based on the current normal direction data; determining the occlusion area of the associated semi-transparent objects on the current semi-transparent object to be processed; and calculating the occlusion rate data of the semi-transparent object graphic based on the occlusion area of the current semi-transparent object to be processed.
[0111] Optionally, the occlusion rate data acquisition module 310 is specifically used to: determine the current orthogonal camera parameters matched by the current normal direction data; and determine the associated semi-transparent object of the current semi-transparent object based on the current orthogonal camera parameters matched by the current semi-transparent object and the graphic depth data of the non-current semi-transparent object graphic.
[0112] Optionally, the occlusion rate data acquisition module 310 is specifically used for: acquiring the object depth value of the currently processed semi-transparent object and the object depth value of the associated semi-transparent object based on the current orthogonal camera parameters; determining the global graphic area of the currently processed semi-transparent object based on the object depth value of the currently processed semi-transparent object; determining the occlusion graphic area of the currently processed semi-transparent object based on the object depth value of the associated semi-transparent object; and determining the occlusion area of the associated semi-transparent object on the currently processed semi-transparent object based on the occlusion graphic area and the global graphic area.
[0113] Optionally, the data processing module 320 is specifically used for: determining the current occlusion rate threshold; dividing semi-transparent object graphics with occlusion rate data less than or equal to the current occlusion rate threshold into the single-layer semi-transparent object distribution subset; and determining the inter-subset sorting data of the single-layer semi-transparent object distribution subset according to the determination order of each of the single-layer semi-transparent object distribution subsets.
[0114] Optionally, the semi-transparent object rendering and sorting device further includes a subset-internal sorting module, used to determine the current single-layer semi-transparent object to be sorted; obtain the current normal direction data of the current single-layer semi-transparent object to be sorted; determine target normal direction data based on the current normal direction data of the current single-layer semi-transparent object to be sorted and the normal direction data of non-current single-layer semi-transparent objects within the subset of the single-layer semi-transparent object distribution; update the current normal direction data based on the target normal direction data; and perform subset-internal sorting on the current single-layer semi-transparent object to be sorted based on the current normal direction data.
[0115] Optionally, the subset internal sorting module is specifically used to: obtain the sum of the target normal direction data and the current normal direction data; and update the current normal direction data according to the sum of the target normal direction data and the current normal direction data.
[0116] Optionally, the sorting and rendering module 330 is specifically used to: reverse the sorting data between subsets of the single-layer semi-transparent object distribution subset to obtain reverse sorting data between subsets; and sort and render the semi-transparent object graphics in the semi-transparent object graphic set according to the reverse sorting data between subsets.
[0117] Optionally, the semi-transparent object rendering and sorting device further includes a semi-transparent object graphic set determination module, used to obtain vertex association data of semi-transparent object units in the semi-transparent object; and determine the semi-transparent object graphic set based on the vertex association data of the semi-transparent object units.
[0118] The aforementioned semi-transparent object rendering and sorting apparatus can execute the semi-transparent object rendering and sorting apparatus method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the method. Technical details not described in detail in this embodiment can be found in the semi-transparent object rendering and sorting apparatus method provided in any embodiment of the present invention.
[0119] Since the semi-transparent object rendering sorting device described above is an apparatus capable of executing the semi-transparent object rendering sorting method in the embodiments of the present invention, those skilled in the art can understand the specific implementation methods and various variations of the semi-transparent object rendering sorting device in this embodiment based on the semi-transparent object rendering sorting method described in the embodiments of the present invention. Therefore, how the semi-transparent object rendering sorting device implements the semi-transparent object rendering sorting method in the embodiments of the present invention will not be described in detail here. Any apparatus used by those skilled in the art to implement the semi-transparent object rendering sorting method in the embodiments of the present invention falls within the scope of protection of this application.
[0120] Example 4
[0121] Figure 12 This is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. Figure 12 A block diagram is shown of an electronic device 412 suitable for implementing embodiments of the present invention. Figure 12 The electronic device 412 shown is merely an example and should not be construed as limiting the functionality or scope of the embodiments of the present invention. The electronic device 412 may be, for example, a computer device or a server device.
[0122] like Figure 12 As shown, electronic device 412 is represented in the form of a general-purpose computing device. The components of electronic device 412 may include, but are not limited to: one or more processors 416, storage device 428, and bus 418 connecting different system components (including storage device 428 and processor 416).
[0123] Bus 418 represents one or more of several bus architectures, including memory buses or memory controllers, peripheral buses, graphics acceleration ports, processors, or local buses using any of the various bus architectures. Examples of these architectures include, but are not limited to, Industry Standard Architecture (ISA) buses, MicroChannel Architecture (MCA) buses, Enhanced ISA buses, Video Electronics Standards Association (VESA) local buses, and Peripheral Component Interconnect (PCI) buses.
[0124] Electronic device 412 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by electronic device 412, including volatile and non-volatile media, removable and non-removable media.
[0125] Storage device 428 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 430 and / or cache memory 432. Electronic device 412 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 434 may be used to read and write non-removable, non-volatile magnetic media (… Figure 12 Not shown; usually referred to as a "hard drive"). Although Figure 12 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disc drive for reading and writing to a removable non-volatile optical disc (e.g., a compact disc-read-only memory (CD-ROM), a digital video disc-read-only memory (DVD-ROM), or other optical media) may be provided. In these cases, each drive may be connected to bus 418 via one or more data media interfaces. Storage device 428 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.
[0126] A program 436 having at least one set of program modules 426 may be stored in, for example, a storage device 428. Such program modules 426 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 426 typically perform the functions and / or methods described in the embodiments of the present invention.
[0127] Electronic device 412 can also communicate with one or more external devices 414 (e.g., keyboard, pointing device, camera, display 424, etc.), and with one or more devices that enable a user to interact with the electronic device 412, and / or with any device that enables the electronic device 412 to communicate with one or more other computing devices (e.g., network card, modem, etc.). This communication can be performed via input / output (I / O) interface 422. Furthermore, electronic device 412 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN)) and / or public networks, such as the Internet) via network adapter 420. As shown, network adapter 420 communicates with other modules of electronic device 412 via bus 418. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with electronic device 412, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, Redundant Arrays of Independent Disks (RAID) systems, tape drives, and data backup storage systems.
[0128] The processor 416 executes various functional applications and data processing by running programs stored in the storage device 428, such as implementing the semi-transparent object rendering and sorting method provided in the above embodiments of the present invention: obtaining occlusion rate data of semi-transparent object graphics in a semi-transparent object graphic set; determining a single-layer semi-transparent object distribution subset and inter-subset sorting data of the single-layer semi-transparent object distribution subset based on the occlusion rate data of the semi-transparent object graphics; and sorting and rendering the semi-transparent object graphics in the semi-transparent object graphic set based on the inter-subset sorting data of the single-layer semi-transparent object distribution subset.
[0129] The technical solution of this embodiment obtains the occlusion rate data of semi-transparent object graphics in a set of semi-transparent object graphics, and then determines the single-layer semi-transparent object distribution subset and the inter-subset sorting data of the single-layer semi-transparent object distribution subset based on the occlusion rate data. The semi-transparent object graphics in the set of semi-transparent object graphics are then sorted and rendered according to the inter-subset sorting data of the single-layer semi-transparent object distribution subset. Determining the single-layer semi-transparent object distribution subset through the occlusion rate data enables hierarchical partitioning of the set of semi-transparent object graphics. Sorting and rendering the semi-transparent object graphics in the set according to the inter-subset sorting data requires no manual intervention and can automatically sort and render the hierarchically partitioned set of semi-transparent object graphics according to the inter-subset sorting data. This also ensures better rendering effects and solves the problems of poor rendering results due to unprocessed semi-transparent parts in existing technologies, and the time-consuming and laborious nature of manually sorting semi-transparent parts. It improves the rendering sorting efficiency of semi-transparent objects while ensuring the rendering effect of semi-transparent objects.
[0130] Example 5
[0131] Embodiment 5 of the present invention also provides a computer storage medium for storing a computer program. When executed by a computer processor, the computer program is used to perform any of the semi-transparent object rendering and sorting methods of the above embodiments of the present invention: obtaining occlusion rate data of semi-transparent object graphics in a semi-transparent object graphics set; determining a single-layer semi-transparent object distribution subset and inter-subset sorting data of the single-layer semi-transparent object distribution subset based on the occlusion rate data of the semi-transparent object graphics; and sorting and rendering the semi-transparent object graphics in the semi-transparent object graphics set according to the inter-subset sorting data of the single-layer semi-transparent object distribution subset.
[0132] The computer storage medium of this invention can be any combination of one or more computer-readable media. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM) or flash memory, optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0133] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0134] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wire, optical fiber, radio frequency (RF), or any suitable combination thereof.
[0135] Computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof. Programming languages include object-oriented programming languages—such as Java, Smalltalk, and C++—as well as conventional procedural programming languages, such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0136] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.
Claims
1. A method for rendering and sorting semi-transparent objects, characterized in that, include: Retrieve vertex association data of semi-transparent object units within a semi-transparent object; The set of semi-transparent object graphics is determined based on the vertex association data of the semi-transparent object unit; Get the occlusion rate data of semi-transparent object graphics in the semi-transparent object graphic collection; Based on the occlusion rate data of the semi-transparent object graphics, determine the single-layer semi-transparent object distribution subset and the sorting data between subsets of the single-layer semi-transparent object distribution subset; wherein, the single-layer semi-transparent object distribution subset is a set of semi-transparent object graphics belonging to a first level in the set of semi-transparent object graphics. The semi-transparent object graphics in the semi-transparent object graphics set are sorted and rendered according to the inter-subset sorting data of the single-layer semi-transparent object distribution subset; The step of obtaining the occlusion rate data of the semi-transparent object graphics in the semi-transparent object graphics set includes: The current semi-transparent object to be processed is determined based on the set of semi-transparent object graphics; the current normal direction data of the current semi-transparent object to be processed is calculated; the associated semi-transparent objects of the current semi-transparent object to be processed are determined based on the current normal direction data; the occlusion area of the associated semi-transparent objects on the current semi-transparent object to be processed is determined; and the occlusion rate data of the semi-transparent object graphics is calculated based on the occlusion area of the current semi-transparent object to be processed. The step of determining the single-layer semi-transparent object distribution subset and the inter-subset ranking data of the single-layer semi-transparent object distribution subset based on the occlusion rate data of the semi-transparent object graphic includes: Determine the current occlusion rate threshold; divide the semi-transparent object graphics whose occlusion rate data is less than or equal to the current occlusion rate threshold into the single-layer semi-transparent object distribution subsets; determine the inter-subset sorting data of the single-layer semi-transparent object distribution subsets according to the determination order of each single-layer semi-transparent object distribution subset.
2. The method according to claim 1, characterized in that, The step of determining the associated semi-transparent object of the currently to-be-processed semi-transparent object based on the current normal direction data includes: The current orthogonal camera parameters matching the current semi-transparent object to be processed are determined based on the current normal direction data. The associated semi-transparent object of the current semi-transparent object is determined based on the current orthogonal camera parameters matched with the current semi-transparent object and the graphic depth data of the non-current semi-transparent object graphic.
3. The method according to claim 2, characterized in that, Determining the occlusion area of the associated semi-transparent object on the currently processed semi-transparent object includes: Based on the current orthographic camera parameters, obtain the object depth value of the currently unprocessed semi-transparent object and the object depth value of the associated semi-transparent object; The global graphic area of the current semi-transparent object to be processed is determined based on the object depth value of the current semi-transparent object to be processed. The area of the occluded graphic of the currently processed semi-transparent object is determined based on the object depth value of the associated semi-transparent object. The occlusion area of the associated semi-transparent object on the current semi-transparent object to be processed is determined based on the occlusion area of the graphic and the global graphic area.
4. The method according to claim 1, characterized in that, After determining the single-layer semi-transparent object distribution subset of the semi-transparent object based on the occlusion rate data of the semi-transparent object graphic, the method further includes: Identify the currently unsorted single-layer semi-transparent objects; Obtain the current normal direction data of the currently unsorted single-layer semi-transparent object; The target normal direction data is determined based on the current normal direction data of the currently unsorted single-layer semi-transparent object and the normal direction data of the non-currently unsorted single-layer semi-transparent objects in the distribution subset of the single-layer semi-transparent object. Update the current normal direction data according to the target normal direction data; The subset of the currently unsorted single-layer semi-transparent objects is sorted based on the current normal direction data.
5. The method according to claim 4, characterized in that, The step of updating the current normal direction data based on the target normal direction data includes: Obtain the sum of the target normal direction data and the current normal direction data; The current normal direction data is updated based on the sum of the target normal direction data and the current normal direction data.
6. The method according to claim 1, characterized in that, The step of sorting and rendering the semi-transparent object graphics in the semi-transparent object graphics set according to the inter-subset sorting data of the single-layer semi-transparent object distribution subset includes: The inter-subset sorting data of the single-layer semi-transparent object distribution subset is reversed to obtain the inter-subset reverse sorting data; The semi-transparent object graphics in the semi-transparent object graphics set are sorted and rendered according to the reverse sorting data between the subsets.
7. A semi-transparent object rendering and sorting device, characterized in that, include: The semi-transparent object graphics set determination module is used to obtain the vertex association data of the semi-transparent object units in the semi-transparent object; The set of semi-transparent object graphics is determined based on the vertex association data of the semi-transparent object unit; The occlusion rate data acquisition module is used to acquire the occlusion rate data of semi-transparent object graphics in the semi-transparent object graphic collection; The data processing module is used to determine the single-layer semi-transparent object distribution subset and the subset sorting data of the single-layer semi-transparent object distribution subset based on the occlusion rate data of the semi-transparent object graphics; wherein, the single-layer semi-transparent object distribution subset is a set of semi-transparent object graphics belonging to a first level in the set of semi-transparent object graphics. The sorting and rendering module is used to sort and render the semi-transparent object graphics in the semi-transparent object graphics set according to the inter-subset sorting data of the single-layer semi-transparent object distribution subset. The occlusion rate data acquisition module is specifically used to determine the current semi-transparent object to be processed based on the set of semi-transparent object graphics; calculate the current normal direction data of the current semi-transparent object to be processed; determine the associated semi-transparent objects of the current semi-transparent object to be processed based on the current normal direction data; determine the occlusion area of the associated semi-transparent objects on the current semi-transparent object to be processed; and calculate the occlusion rate data of the semi-transparent object graphics based on the occlusion area of the current semi-transparent object to be processed. The data processing module is specifically used to determine the current occlusion rate threshold; divide the semi-transparent object graphics whose occlusion rate data is less than or equal to the current occlusion rate threshold into the single-layer semi-transparent object distribution subset; and determine the inter-subset sorting data of the single-layer semi-transparent object distribution subset according to the determination order of each of the single-layer semi-transparent object distribution subsets.
8. An electronic device, characterized in that, The electronic device includes: One or more processors; Storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the semi-transparent object rendering sorting method as described in any one of claims 1-6.
9. A computer storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the semi-transparent object rendering sorting method as described in any one of claims 1-6.
Citation Information
Patent Citations
Object rendering processing method and device, computer device and storage medium
CN113052951A