Virtual object rendering method, device, system and electronic device
By using a multi-threaded mechanism to sort semi-transparent mesh in computer three-dimensional rendering technology, the problem of incorrect rendering order of semi-transparent mesh in the existing technology is solved, efficient rendering effect is achieved and operation cost is reduced.
Patent Information
- Application Number
- CN202210611220.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-31
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2042-05-31
AI Technical Summary
The prior art is difficult to ensure the rendering order of translucent mesh in static and dynamic states, resulting in errors in rendering effects and high manual operation costs.
The main thread collects the translucent mesh queue of the image frame to be rendered, and sends a sort notification to the sorting thread. The translucent mesh is sorted using a multi-threading mechanism to determine the rendering order of the triangle surface.
Ensure the correctness of the rendering order of translucent mesh in static and dynamic states, reduce manual operation costs, and make full use of the advantages of multi-core CPUs to improve sorting efficiency.
Smart Images

Figure CN114911625B_ABST
Abstract
Description
Technical Field
[0001] This document relates to the field of computer three-dimensional rendering technology, and in particular to a virtual object rendering method, device, system and electronic device. Background Art
[0002] As users' requirements for game quality are getting higher and higher, in order to provide users with a better visual experience, some characters' clothes need to have multi-layer translucent effects, such as overlapping layers of gauze or silk clothes. However, when rendering multi-layer translucent clothes, there will be interlacing problems, that is, the rendering order of some triangle faces will be confused.
[0003] The existing technology mainly splits the overlapping parts of a large grid into layers, and then merges the grids layer by layer from back to front to ensure the rendering order between layers. However, this method requires artists to manually split the layers through tools and then re-export new fbx format files, which obviously increases the cost of manual operations. Moreover, the exported fbx format files can only guarantee that the effects are correct in a static state, but the effects in a moving state may still be wrong. For example, if the virtual object corresponding to the grid is rotated in the game, the rendering order of the triangle sequence of the semi-transparent grid corresponding to the virtual object can no longer be guaranteed to be rendered in sequence from back to front, which will result in rendering errors.
[0004] Therefore, further solutions are still needed to ensure the rendering order of semi-transparent meshes in static and dynamic conditions and to reduce the manual operation cost during the rendering process. Summary of the invention
[0005] The purpose of the embodiments of this specification is to provide a virtual object rendering method, device, system and electronic device to ensure the rendering order of semi-transparent grids in static and dynamic conditions and reduce the manual operation cost during the rendering process.
[0006] To solve the above technical problems, the embodiments of this specification are implemented as follows:
[0007] In a first aspect, a virtual object rendering method is proposed, comprising:
[0008] Collecting a semi-transparent grid queue of an image frame to be rendered through a main thread, and sending a sorting notification to a sorting thread, wherein the semi-transparent grid queue includes a plurality of semi-transparent grids, and one semi-transparent grid corresponds to one virtual object;
[0009] The sorting thread obtains the semi-transparent meshes to be sorted in the semi-transparent mesh queue in response to the sorting notification sent by the main thread, and sorts the semi-transparent meshes to be sorted based on the triangle index list of the semi-transparent meshes to be sorted, so as to determine the rendering order of the triangle faces in the semi-transparent meshes to be sorted;
[0010] When the sorting thread completes sorting of the plurality of semi-transparent grids in the semi-transparent grid queue, sending a sorting completion notification to the main thread;
[0011] The main thread receives the sorting completion notification and completes the rendering of the virtual object in the image frame.
[0012] In a second aspect, a virtual object rendering system is proposed, the system comprising a sorting thread and a main thread, wherein:
[0013] The main thread collects a semi-transparent grid queue of an image frame to be rendered, and sends a sorting notification to a sorting thread, wherein the semi-transparent grid queue includes a plurality of semi-transparent grids, and one semi-transparent grid corresponds to one virtual object;
[0014] The sorting thread executes the following single cycle process:
[0015] In response to the sorting notification sent by the main thread, obtaining the semi-transparent meshes to be sorted in the semi-transparent mesh queue, and sorting the semi-transparent meshes to be sorted based on the triangle index list of the semi-transparent meshes to be sorted, so as to determine the rendering order of the triangle faces in the semi-transparent meshes to be sorted;
[0016] After the sorting of the plurality of semi-transparent grids in the semi-transparent grid queue is completed, a sorting completion notification is sent to the main thread, so that the main thread receives the sorting completion notification and completes the rendering of the virtual object in the image frame.
[0017] In a third aspect, a virtual object rendering device is proposed, comprising:
[0018] The acquisition unit acquires the semi-transparent grid queue of the image frame to be rendered through the main thread, and sends a sorting notification to the sorting thread, wherein the semi-transparent grid queue includes a plurality of semi-transparent grids, and one semi-transparent grid corresponds to one virtual object;
[0019] a sorting unit, wherein the sorting thread obtains the semi-transparent meshes to be sorted in the semi-transparent mesh queue in response to the sorting notification sent by the main thread, and sorts the semi-transparent meshes to be sorted based on the triangle index list of the semi-transparent meshes to be sorted, so as to determine the rendering order of the triangle faces in the semi-transparent meshes to be sorted;
[0020] a sending unit, which sends a sorting completion notification to the main thread after the sorting thread completes sorting of the plurality of semi-transparent grids in the semi-transparent grid queue;
[0021] A rendering unit, wherein the main thread receives the sorting completion notification and completes the rendering of the virtual object in the image frame.
[0022] In a fourth aspect, an electronic device is provided, comprising:
[0023] Processor; and
[0024] a memory arranged to store computer executable instructions which, when executed, cause the processor to:
[0025] Collecting a semi-transparent grid queue of an image frame to be rendered through a main thread, and sending a sorting notification to a sorting thread, wherein the semi-transparent grid queue includes a plurality of semi-transparent grids, and one semi-transparent grid corresponds to one virtual object;
[0026] The sorting thread obtains the semi-transparent meshes to be sorted in the semi-transparent mesh queue in response to the sorting notification sent by the main thread, and sorts the semi-transparent meshes to be sorted based on the triangle index list of the semi-transparent meshes to be sorted, so as to determine the rendering order of the triangle faces in the semi-transparent meshes to be sorted;
[0027] When the sorting thread completes sorting of the plurality of semi-transparent grids in the semi-transparent grid queue, sending a sorting completion notification to the main thread;
[0028] The main thread receives the sorting completion notification and completes the rendering of the virtual object in the image frame.
[0029] In a fifth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores one or more programs, and when the one or more programs are executed by an electronic device including a plurality of application programs, the electronic device performs the following operations:
[0030] Collecting a semi-transparent grid queue of an image frame to be rendered through a main thread, and sending a sorting notification to a sorting thread, wherein the semi-transparent grid queue includes a plurality of semi-transparent grids, and one semi-transparent grid corresponds to one virtual object;
[0031] The sorting thread obtains the semi-transparent meshes to be sorted in the semi-transparent mesh queue in response to the sorting notification sent by the main thread, and sorts the semi-transparent meshes to be sorted based on the triangle index list of the semi-transparent meshes to be sorted, so as to determine the rendering order of the triangle faces in the semi-transparent meshes to be sorted;
[0032] When the sorting thread completes sorting of the plurality of semi-transparent grids in the semi-transparent grid queue, sending a sorting completion notification to the main thread;
[0033] The main thread receives the sorting completion notification and completes the rendering of the virtual object in the image frame.
[0034] It can be seen from the technical solutions provided by the above embodiments of this specification that the embodiments of this specification have at least one of the following technical effects:
[0035] One or more embodiments provided in this specification can assign the sorting task of the semi-transparent grids of the image frame to be rendered to the sorting thread alone, and the main thread is responsible for collecting the semi-transparent grid queue of the image frame to be rendered, the semi-transparent grid queue includes multiple semi-transparent grids, and for each image frame, the virtual object containing the semi-transparent grid is rendered in real time through the multi-thread mechanism to ensure the correctness of the rendering effect of the virtual object containing the semi-transparent grid in the image frame in a dynamic state. In addition, the use of the multi-thread mechanism to sort the semi-transparent grids in each image frame also fully utilizes the superior performance of the multi-core CPU, improves the sorting efficiency of the semi-transparent grids, and saves the resources consumed by manually sorting the semi-transparent grids. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0037] Figure 1 It is a schematic diagram of an implementation flow of a virtual object rendering method provided by an embodiment of this specification.
[0038] Figure 2 It is a schematic diagram of the workflow of the main thread in the virtual object rendering method provided according to an embodiment of the present specification.
[0039] Figure 3 It is a schematic diagram of the workflow of sorting threads in a virtual object rendering method provided according to an embodiment of the present specification.
[0040] Figure 4 It is a structural diagram of a virtual object rendering system provided by an embodiment of this specification.
[0041] Figure 5 It is a structural diagram of a virtual object rendering device provided by an embodiment of this specification.
[0042] Figure 6 It is a structural schematic diagram of an electronic device provided by an embodiment of this specification. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of this document more obvious, the example embodiments according to this document will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of this document, rather than all the embodiments of this document, and it should be understood that this document is not limited to the example embodiments described here.
[0044] Embodiments of the present document will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present document are shown in the accompanying drawings, it should be understood that the present document can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein, which are instead provided for a more thorough and complete understanding of the present document. It should be understood that the drawings and embodiments of the present document are for exemplary purposes only and are not intended to limit the scope of protection of the present document.
[0045] It should be understood that the various steps described in the method implementation of this document can be performed in different orders and / or performed in parallel. In addition, the method implementation may include additional steps and / or omit the steps shown. The scope of this document is not limited in this respect.
[0046] The term "including" and its variations used in this document are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0047] It should be noted that the concepts such as "first" and "second" mentioned in this document are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0048] It should be noted that the modifications of "one" and "plurality" mentioned in this document are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0049] The names of the messages or information exchanged between multiple devices in the implementation manner of this document are for illustrative purposes only and are not used to limit the scope of these messages or information.
[0050] In order to ensure the rendering order of semi-transparent grids in static and dynamic conditions and to reduce the manual operation cost during the rendering process, one or more embodiments of the present specification provide a virtual object rendering method.
[0051] As described in the background technology, the rendering order of the triangle sequence of the semi-transparent mesh corresponding to the existing virtual object is still fixed when the virtual object is in a dynamic state. This results in that when the virtual object changes its angle in the changing image frame, such as rotating, it is still rendered according to the rendering order of the triangle sequence of the semi-transparent mesh in the initial state of the virtual image, which will cause rendering errors.
[0052] In order to solve this problem, an embodiment of the present specification provides a virtual object rendering method, which can collect the semi-transparent meshes in the image frame to be rendered and add them to the semi-transparent mesh queue of the image frame through the main thread before each image frame is displayed to the user, and then the sorting thread responds to the sorting notification sent by the main thread, obtains the semi-transparent meshes to be sorted in the semi-transparent mesh queue, and sorts the semi-transparent meshes to be sorted based on the triangle index list of the semi-transparent meshes to be sorted to determine the rendering order of the triangle faces in the semi-transparent meshes to be sorted, and finally the main thread receives the sorting thread to complete the sorting of the semi-transparent meshes in the semi-transparent mesh queue. After the notification is rendered, the virtual object in the image frame. In this way, no matter how the virtual object in the image frame is dynamically transformed, since the semi-transparent meshes corresponding to the virtual object in each image frame are sorted, the image frame displayed to the user can avoid the problem of rendering errors.
[0053] Figure 1 It is a schematic diagram of an implementation flow of a virtual object rendering method provided by an embodiment of this specification. Figure 1 The virtual object rendering method shown may include:
[0054] Step 110, collecting a semi-transparent grid queue of the image frame to be rendered through the main thread, and sending a sorting notification to the sorting thread, the semi-transparent grid queue includes multiple semi-transparent grids, and one semi-transparent grid corresponds to one virtual object.
[0055] Among them, the image frame can be an image frame in a game video, and the image frame often contains multiple virtual objects, and some virtual objects may contain translucent grids. When the virtual object is in a dynamic situation, such as rotating or other actions that change the angle of the virtual object, the translucent grid corresponding to the virtual object may have rendering interlacing problems, that is, rendering errors occur, which in turn gives the user a bad visual experience. In this case, before each image frame is displayed to the user, the embodiment of the present specification collects the translucent grids in the image frame, adds the translucent grids in the image frame to the translucent grid queue of the image frame to be rendered, and then the main thread sends a sorting notification to the sorting thread, so as to use the multi-threading mechanism to complete the sorting task of the translucent grids corresponding to the virtual image in the image frame.
[0056] Among them, multiple semi-transparent grids are obtained by the main thread and added to the semi-transparent grid queue.
[0057] It should be understood that since the main thread is responsible for rendering, in order to improve the sorting efficiency of semi-transparent meshes, a multi-threading mechanism can be used to perform the rendering work of each image frame. Specifically, the main thread can be responsible for collecting multiple semi-transparent meshes in each image frame to be rendered and refreshing the triangle index list of the sorted semi-transparent meshes, while the sorting work of the semi-transparent meshes to be sorted can be performed by the sorting thread alone.
[0058] Since only semi-transparent meshes have the problem of rendering interlacing, in order to improve the efficiency of collecting semi-transparent meshes, a special naming method can be agreed upon for semi-transparent meshes, such as adding "_a" to their suffixes; if the main thread recognizes that there is a newly added semi-transparent mesh with the naming suffix "_a" in the image frame, the main thread will collect it and add it to the semi-transparent mesh queue. If the main thread recognizes that the semi-transparent mesh with the naming suffix "_a" in the image frame is removed from the virtual space, the main thread will delete the semi-transparent mesh from the semi-transparent mesh queue.
[0059] Step 120, the sorting thread responds to the sorting notification sent by the main thread, obtains the semi-transparent meshes to be sorted in the semi-transparent mesh queue, and sorts the semi-transparent meshes to be sorted based on the triangle index list of the semi-transparent meshes to be sorted to determine the rendering order of the triangle faces in the semi-transparent meshes to be sorted.
[0060] Among them, the semi-transparent grids in the semi-transparent grid queue are semi-transparent grids waiting to be sorted. When the sorting thread starts execution, it can pull the semi-transparent grids to be sorted from the semi-transparent grid queue in turn to perform the sorting task, that is, the sorting thread traverses the semi-transparent grids to be sorted in the semi-transparent grid queue to perform the sorting task.
[0061] Optionally, since the semi-transparent meshes are further divided into skinned meshes and non-skinned meshes, when the skinned meshes are sorted, it is also necessary to obtain the vertex list information after skinning in order to improve the accuracy of the sorting of the skinned meshes. Specifically, based on the triangle index list of the semi-transparent meshes to be sorted, the semi-transparent meshes to be sorted are sorted, including:
[0062] Determine whether the semi-transparent mesh to be sorted is a skinned mesh;
[0063] If the semi-transparent mesh to be sorted is a skinned mesh, then based on the relevant data of the skinned mesh, the vertex list information after skinning in the semi-transparent mesh to be sorted is obtained;
[0064] Determine a triangle index list of the semi-transparent mesh to be sorted based on the skinned vertex list information in the semi-transparent mesh to be sorted;
[0065] Sort the semi-transparent meshes to be sorted based on their triangle index lists.
[0066] Among them, skinning is a 3D animation term, also used in 3D games. It is a production technology of 3D animation. Based on the model created in 3D software, bones are added to the model. Since the bones and the model are independent of each other, in order to make the bones drive the model to produce reasonable movement, the technology of binding the model to the bones is called skinning. Since the skin moves with the bones, there may be rendering interlacing problems when the bones move.
[0067] In order to solve this problem, the embodiments of this specification can obtain the skin matrix of each frame of the skinned mesh under the dynamic state, and obtain the skin matrix of the skinned mesh at the current moment (i.e., the image frame moment) based on the skin matrix of each frame of the skinned mesh under the dynamic state, and determine the vertex list information of the semi-transparent mesh after skinning at the current moment based on the skin matrix of the skinned mesh at the current moment. Specifically, based on the relevant data of the skinned mesh, the vertex list information of the semi-transparent mesh to be sorted after skinning is obtained, including:
[0068] Based on the bone matrix of the skinned mesh, the bone weights corresponding to each vertex in the skinned mesh, and the initial vertex list information of the skinned mesh, the skin matrix of each frame of the skinned mesh under dynamic conditions is obtained;
[0069] Based on the skin matrix of each frame under the dynamic state of the skin mesh, the skin matrix of the skin mesh at the image frame time is obtained;
[0070] Based on the skinning matrix of the skinned mesh at the image frame time, the skinned vertex list information of the semi-transparent mesh to be sorted at the current time is determined.
[0071] Optionally, if the semi-transparent mesh to be sorted is not a skinned mesh, the vertex list information of the semi-transparent mesh to be sorted may be directly obtained;
[0072] A triangle index list of the semi-transparent mesh to be sorted is determined based on vertex list information in the semi-transparent mesh to be sorted.
[0073] Optionally, the sorting thread may sort the triangular faces in the semi-transparent mesh to be sorted according to the coordinates of the center points of the triangles in the triangle index list of the semi-transparent mesh to be sorted. Specifically, sorting the semi-transparent mesh to be sorted based on the coordinates of the center points of the triangles in the triangle index list of the semi-transparent mesh to be sorted includes:
[0074] Convert the coordinates of the center point of each triangle in the triangle index list of the semi-transparent mesh to be sorted into the camera space to obtain the coordinates of the center point of each triangle in the camera space;
[0075] Based on the coordinates of the center points of the triangles in the camera space, determine the distance between the center points of the triangles and the camera in the camera space;
[0076] Sort the triangle index list of the semi-transparent mesh to be sorted in descending order of the distance of the center point of each triangle from the camera in the camera space.
[0077] Optionally, to facilitate the sorting of the triangle index list of the semi-transparent mesh, the coordinates of the center point of each triangle in the triangle index list of the semi-transparent mesh to be sorted may be converted to the camera space to determine the distance of the center point of each triangle from the camera. Specifically, the triangle index list of the semi-transparent mesh to be sorted is sorted in descending order of the distance of the center point of each triangle from the camera in the camera space, including:
[0078] The triangle index list of the semi-transparent mesh to be sorted is sorted by insertion sort in descending order of the distance of the center point of each triangle from the camera in the camera space.
[0079] Insertion sort refers to the process of inserting the n-1 (where n>=2) numbers in the elements to be sorted into the previously sorted sequence, assuming that the previous n-1 numbers are already sorted, and then finding a suitable position for itself so that the sequence into which the n-1 number is inserted is also sorted. The process of inserting all elements in this way until the entire sequence is sorted is called insertion sort.
[0080] Step 130: After the sorting thread completes sorting of the plurality of semi-transparent grids in the semi-transparent grid queue, a sorting completion notification is sent to the main thread.
[0081] For example, after the main thread waits for the sorting thread to complete sorting of the semi-transparent meshes, it can refresh the triangle index list of the sorted semi-transparent meshes. After waiting for the main thread to complete all refreshes, the main thread notifies the sorting thread to execute the sorting task of the semi-transparent meshes in the next image frame, that is, to sort the semi-transparent meshes in the semi-transparent mesh queue corresponding to the next image frame of the current image frame.
[0082] The main thread and the sorting thread can synchronize whether the sorting is completed by using a synchronization handle, specifically the AutoResetEvent thread synchronization mechanism of the .NET library. Specifically, the sorting thread can call AutoResetEvent.WaitOne to wait for a signal, and when the sorting thread completes sorting of all the semi-transparent grids in the semi-transparent grid queue corresponding to the image frame, it can call the AutoResetEvent.Set method to send a signal to notify the main thread that the sorting is completed.
[0083] Step 140 , the main thread receives the sorting completion notification and completes the rendering of the virtual objects in the image frame.
[0084] Optionally, in order to ensure the correctness of the rendering order of the triangle index list in the semi-transparent mesh and avoid the problem of interlaced rendering, the main thread receives the sorting completion notification and completes the rendering of the virtual object in the image frame, including:
[0085] The main thread receives the sorting completion notification and refreshes the triangle index lists of multiple semi-transparent meshes;
[0086] The main thread completes the rendering of virtual objects in the image frame based on the refreshed triangle index lists of multiple semi-transparent meshes.
[0087] Among them, the main thread refreshes the triangle index lists of multiple semi-transparent meshes, specifically replacing the triangle index lists of multiple semi-transparent meshes before being sorted by the sorting thread with the triangle index lists of multiple semi-transparent meshes after being sorted by the sorting thread, so that the main thread can complete the rendering of multiple virtual objects in the image frame based on the triangle index lists of multiple semi-transparent meshes after being sorted by the sorting thread.
[0088] Among them, rendering of the semi-transparent mesh can be specifically performed by the rendering engine, that is, the main thread hands over the rendering task to the rendering engine, and the rendering engine renders multiple virtual objects in the image frame based on the front-to-back order of the triangle index list of the refreshed semi-transparent mesh in the image frame.
[0089] Figure 2 This is a schematic diagram of the workflow of the main thread in the virtual object rendering method provided according to an embodiment of the present specification, including:
[0090] Step 21, adding the semi-transparent mesh of the target virtual object to be sorted into the semi-transparent mesh queue.
[0091] Step 22, determining whether a single cycle of the sorting thread is completed.
[0092] If the single loop of the sorting thread ends, step 23 is executed.
[0093] Step 23, refresh the triangle index list of multiple semi-transparent meshes in the semi-transparent mesh queue.
[0094] Step 24, determining whether the triangle index lists of the plurality of semi-transparent meshes in the semi-transparent mesh queue have been refreshed.
[0095] Step 25, notify the sorting thread to start the next cycle.
[0096] At this time, the sorting thread may pull the semi-transparent grids to be sorted from the semi-transparent grid queue of the next image frame for sorting.
[0097] Figure 3 This is a schematic diagram of a workflow of sorting threads in a virtual object rendering method provided according to an embodiment of the present specification, including:
[0098] Step 31, traverse the semi-transparent meshes to be sorted in the new semi-transparent mesh queue to determine whether they are skinned meshes.
[0099] If the semi-transparent mesh to be sorted is a skinned mesh, step 33 is executed; if the semi-transparent mesh to be sorted is not a skinned mesh, step 32 is executed.
[0100] Step 32, obtaining vertex list information.
[0101] If the semi-transparent mesh to be sorted is not a skinned mesh, the vertex list information of the semi-transparent mesh to be sorted may be directly obtained.
[0102] Step 33, obtaining the vertex list information after skinning.
[0103] If the semi-transparent mesh to be sorted is a skinned mesh, it is necessary to obtain the vertex list information after skinning.
[0104] Step 34, determining a triangle index list and performing sorting based on the triangle index list.
[0105] One or more embodiments provided in this specification can assign the sorting task of the semi-transparent grids of the image frame to be rendered to the sorting thread alone, and the main thread is responsible for collecting the semi-transparent grid queue of the image frame to be rendered, the semi-transparent grid queue includes multiple semi-transparent grids, and for each image frame, the virtual object containing the semi-transparent grid is rendered in real time through the multi-thread mechanism to ensure the correctness of the rendering effect of the virtual object containing the semi-transparent grid in the image frame in a dynamic state. In addition, the use of the multi-thread mechanism to sort the semi-transparent grids in each image frame also fully utilizes the superior performance of the multi-core CPU, improves the sorting efficiency of the semi-transparent grids, and saves the resources consumed by manually sorting the semi-transparent grids.
[0106] Figure 4 It is a structural diagram of a virtual object rendering system provided by an embodiment of this specification. Figure 4 The system may include a main thread 401 and a sorting thread 402, wherein:
[0107] The main thread 401 collects a semi-transparent grid queue of an image frame to be rendered, and sends a sorting notification to a sorting thread, wherein the semi-transparent grid queue includes a plurality of semi-transparent grids, and one semi-transparent grid corresponds to one virtual object;
[0108] The sorting thread 402 executes the following single cycle process:
[0109] In response to the sorting notification sent by the main thread, obtaining the semi-transparent meshes to be sorted in the semi-transparent mesh queue, and sorting the semi-transparent meshes to be sorted based on the triangle index list of the semi-transparent meshes to be sorted, so as to determine the rendering order of the triangle faces in the semi-transparent meshes to be sorted;
[0110] After the sorting of the plurality of semi-transparent grids in the semi-transparent grid queue is completed, a sorting completion notification is sent to the main thread, so that the main thread receives the sorting completion notification and completes the rendering of the virtual object in the image frame.
[0111] Optionally, when executing the step of sorting the semi-transparent meshes to be sorted based on the triangle index list of the semi-transparent meshes to be sorted, the sorting thread 402 specifically performs:
[0112] Determine whether the semi-transparent mesh to be sorted is a skinned mesh;
[0113] If the semi-transparent mesh to be sorted is a skinned mesh, then based on the relevant data of the skinned mesh, obtaining the vertex list information after skinning in the semi-transparent mesh to be sorted;
[0114] Determine a triangle index list of the semi-transparent mesh to be sorted based on the skinned vertex list information in the semi-transparent mesh to be sorted;
[0115] The semi-transparent meshes to be sorted are sorted based on the triangle index list of the semi-transparent meshes to be sorted.
[0116] Optionally, when executing the step of obtaining the skinned vertex list information of the semi-transparent mesh to be sorted based on the relevant data of the skinned mesh, the sorting thread 402 specifically performs:
[0117] Based on the bone matrix of the skin mesh, the bone weights corresponding to each vertex in the skin mesh, and the initial vertex list information of the skin mesh, obtaining the skin matrix of each frame of the skin mesh in a dynamic state;
[0118] Based on the skin matrix of each frame of the skin mesh under dynamic conditions, obtaining the skin matrix of the skin mesh at the time of the image frame;
[0119] Based on the skinning matrix of the skinned mesh at the current moment, the skinned vertex list information of the semi-transparent mesh to be sorted at the image frame moment is determined.
[0120] Optionally, when executing the step of sorting the semi-transparent meshes to be sorted based on the triangle index list of the semi-transparent meshes to be sorted, the sorting thread 402 specifically performs:
[0121] Determine the center point of each triangle in the triangle index list of the semi-transparent mesh to be sorted;
[0122] The semi-transparent meshes to be sorted are sorted based on the coordinates of the center points of the triangles in the triangle index list of the semi-transparent meshes to be sorted.
[0123] Optionally, when executing the step of sorting the semi-transparent mesh based on the coordinates of the center points of the triangles in the triangle index list of the semi-transparent mesh, the sorting thread 402 specifically performs:
[0124] The triangle index list of the semi-transparent mesh is sorted by insertion sort in descending order of the distance between the center point of each triangle and the camera in the camera space.
[0125] Optionally, when executing the step of sorting the semi-transparent meshes to be sorted based on the coordinates of the center points of the triangles in the triangle index list of the semi-transparent meshes to be sorted, the sorting thread 402 specifically performs:
[0126] Convert the coordinates of the center point of each triangle in the triangle index list of the semi-transparent mesh to be sorted into the camera space to obtain the coordinates of the center point of each triangle in the camera space;
[0127] Based on the coordinates of the center points of the triangles in the camera space, determining the distance between the center points of the triangles and the camera in the camera space;
[0128] The triangle index list of the semi-transparent mesh to be sorted is sorted in descending order of the distance between the center point of each triangle and the camera in the camera space.
[0129] Optionally, when executing the step of sorting the triangle index list of the semi-transparent mesh to be sorted in descending order of the distances of the center points of the triangles from the camera in the camera space, the sorting thread 402 specifically performs:
[0130] The triangle index list of the semi-transparent mesh to be sorted is sorted in a descending order of the distance between the center point of each triangle and the camera in the camera space by insertion sort.
[0131] Optionally, when executing the steps of receiving the sorting completion notification and completing the rendering of the virtual object in the image frame, the main thread 401 specifically performs:
[0132] The main thread receives the sorting completion notification, and refreshes the triangle index lists of the multiple semi-transparent meshes;
[0133] The main thread renders a plurality of virtual objects corresponding to the plurality of semi-transparent meshes based on the refreshed triangle index lists of the plurality of semi-transparent meshes to complete the rendering of the virtual objects in the image frame.
[0134] Figure 4 The specific implementation of the relevant steps of the embodiment shown can be referred to Figure 1 to Figure 3 The specific implementation of the corresponding steps in the illustrated embodiments will not be repeated in one or more embodiments of this specification.
[0135] The virtual object rendering system provided in this specification can assign the sorting task of the semi-transparent grids of the image frame to be rendered to the sorting thread alone, and the main thread is responsible for collecting the semi-transparent grid queue of the image frame to be rendered, and the semi-transparent grid queue includes multiple semi-transparent grids. For each image frame, the virtual object containing the semi-transparent grid is rendered in real time through a multi-thread mechanism to ensure the correctness of the rendering effect of the virtual object containing the semi-transparent grid in the image frame in a dynamic state. In addition, the use of a multi-thread mechanism to sort the semi-transparent grids in each image frame also fully utilizes the advantages of multi-core CPUs, improves the sorting efficiency of semi-transparent grids, and saves resources consumed by manually sorting semi-transparent grids.
[0136] Figure 5 is a schematic diagram of a virtual object rendering device 500 provided by an embodiment of this specification. Figure 5 In a software implementation, the virtual object rendering device 500 may include:
[0137] The acquisition unit 501 acquires a semi-transparent grid queue of an image frame to be rendered through a main thread, and sends a sorting notification to a sorting thread, wherein the semi-transparent grid queue includes a plurality of semi-transparent grids, and one semi-transparent grid corresponds to one virtual object;
[0138] A sorting unit 502, wherein the sorting thread obtains the semi-transparent meshes to be sorted in the semi-transparent mesh queue in response to the sorting notification sent by the main thread, and sorts the semi-transparent meshes to be sorted based on the triangle index list of the semi-transparent meshes to be sorted, so as to determine the rendering order of the triangle faces in the semi-transparent meshes to be sorted;
[0139] The sending unit 503 sends a sorting completion notification to the main thread after the sorting thread completes sorting of the plurality of semi-transparent grids in the semi-transparent grid queue;
[0140] Rendering unit 504, the main thread receives the sorting completion notification and completes the rendering of the virtual object in the image frame.
[0141] The virtual object rendering device provided in the embodiment of the specification can assign the sorting task of the semi-transparent grids of the image frame to be rendered to the sorting thread alone, and the main thread is responsible for collecting the semi-transparent grid queue of the image frame to be rendered, and the semi-transparent grid queue includes multiple semi-transparent grids. For each image frame, the virtual object containing the semi-transparent grid is rendered in real time through the multi-thread mechanism to ensure the correctness of the rendering effect of the virtual object containing the semi-transparent grid in the image frame in a dynamic state. In addition, the use of the multi-thread mechanism to sort the semi-transparent grids in each image frame also makes full use of the advantageous performance of the multi-core CPU, improves the sorting efficiency of the semi-transparent grids, and saves the resources consumed by manually sorting the semi-transparent grids.
[0142] Optionally, in an implementation manner, when the sorting unit 502 sorts the semi-transparent meshes to be sorted based on the triangle index list of the semi-transparent meshes to be sorted, specifically performs:
[0143] Determine whether the semi-transparent mesh to be sorted is a skinned mesh;
[0144] If the semi-transparent mesh to be sorted is a skinned mesh, then based on the relevant data of the skinned mesh, obtaining the vertex list information after skinning in the semi-transparent mesh to be sorted;
[0145] Determine a triangle index list of the semi-transparent mesh to be sorted based on the skinned vertex list information in the semi-transparent mesh to be sorted;
[0146] The semi-transparent meshes to be sorted are sorted based on the triangle index list of the semi-transparent meshes to be sorted.
[0147] Optionally, in one implementation, the sorting unit 502 obtains the skinned vertex list information in the semi-transparent mesh to be sorted based on the relevant data of the skinned mesh, and specifically performs:
[0148] Based on the bone matrix of the skin mesh, the bone weights corresponding to each vertex in the skin mesh, and the initial vertex list information of the skin mesh, obtaining the skin matrix of each frame of the skin mesh in a dynamic state;
[0149] Based on the skin matrix of each frame of the skin mesh under dynamic conditions, obtaining the skin matrix of the skin mesh at the time of the image frame;
[0150] Based on the skinning matrix of the skinned mesh at the current moment, the skinned vertex list information of the semi-transparent mesh to be sorted at the image frame moment is determined.
[0151] Optionally, in one implementation, the sorting unit 502 sorts the semi-transparent meshes to be sorted based on the triangle index list of the semi-transparent meshes to be sorted by specifically performing:
[0152] Determine the center point of each triangle in the triangle index list of the semi-transparent mesh to be sorted;
[0153] The semi-transparent meshes to be sorted are sorted based on the coordinates of the center points of the triangles in the triangle index list of the semi-transparent meshes to be sorted.
[0154] Optionally, in an implementation manner, the sorting unit 502 sorts the semi-transparent meshes to be sorted based on the coordinates of the center points of the triangles in the triangle index list of the semi-transparent meshes to be sorted by specifically performing:
[0155] Convert the coordinates of the center point of each triangle in the triangle index list of the semi-transparent mesh to be sorted into the camera space to obtain the coordinates of the center point of each triangle in the camera space;
[0156] Based on the coordinates of the center points of the triangles in the camera space, determining the distance between the center points of the triangles and the camera in the camera space;
[0157] The triangle index list of the semi-transparent mesh to be sorted is sorted in descending order of the distance between the center point of each triangle and the camera in the camera space.
[0158] Optionally, in one implementation, the sorting unit 502 sorts the triangle index list of the semi-transparent mesh to be sorted in descending order of the distances of the center points of the triangles from the camera in the camera space, by specifically performing:
[0159] The triangle index list of the semi-transparent mesh to be sorted is sorted in a descending order of the distance between the center point of each triangle and the camera in the camera space by insertion sort.
[0160] Optionally, in one implementation, the rendering unit 504 receives the sorting completion notification and completes the rendering of the virtual object in the image frame when executing the main thread, specifically performing:
[0161] The main thread receives the sorting completion notification, and refreshes the triangle index lists of the multiple semi-transparent meshes;
[0162] The main thread renders a plurality of virtual objects corresponding to the plurality of semi-transparent meshes based on the refreshed triangle index lists of the plurality of semi-transparent meshes to complete the rendering of the virtual objects in the image frame.
[0163] The virtual object rendering device 500 can achieve Figure 1 to Figure 3 For details, please refer to Figure 1 to Figure 3 The virtual object rendering device and method of the illustrated embodiment will not be described in detail.
[0164] Figure 6 This is a schematic diagram of the structure of an electronic device according to an embodiment of this specification. Figure 6 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.
[0165] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0166] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.
[0167] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a virtual object rendering device at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:
[0168] Collecting a semi-transparent grid queue of an image frame to be rendered through a main thread, and sending a sorting notification to a sorting thread, wherein the semi-transparent grid queue includes a plurality of semi-transparent grids, and one semi-transparent grid corresponds to one virtual object;
[0169] The sorting thread obtains the semi-transparent meshes to be sorted in the semi-transparent mesh queue in response to the sorting notification sent by the main thread, and sorts the semi-transparent meshes to be sorted based on the triangle index list of the semi-transparent meshes to be sorted, so as to determine the rendering order of the triangle faces in the semi-transparent meshes to be sorted;
[0170] When the sorting thread completes sorting of the plurality of semi-transparent grids in the semi-transparent grid queue, sending a sorting completion notification to the main thread;
[0171] The main thread receives the sorting completion notification and completes the rendering of the virtual object in the image frame.
[0172] The electronic device provided in the embodiment of the present specification can assign the sorting task of the semi-transparent grids of the image frame to be rendered to the sorting thread alone, and the main thread is responsible for collecting the semi-transparent grid queue of the image frame to be rendered, and the semi-transparent grid queue includes multiple semi-transparent grids. For each image frame, the virtual object containing the semi-transparent grid is rendered in real time through the multi-thread mechanism to ensure the correctness of the rendering effect of the virtual object containing the semi-transparent grid in the image frame in a dynamic state. In addition, the use of the multi-thread mechanism to sort the semi-transparent grids in each image frame also fully utilizes the advantageous performance of the multi-core CPU, improves the sorting efficiency of the semi-transparent grids, and saves the resources consumed by manually sorting the semi-transparent grids.
[0173] The above is as in this manual Figure 1 to Figure 3The method performed by the virtual object rendering device disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of this specification can be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of this specification can be directly embodied as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in a decoding processor. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0174] The electronic device may also perform Figure 1 to Figure 3 The method and the virtual object rendering device are implemented in Figure 4 The functions of the illustrated embodiments will not be described in detail in the embodiments of this specification.
[0175] The embodiment of the present specification also provides a computer-readable storage medium, which stores one or more programs, wherein the one or more programs include instructions, which, when executed by a portable electronic device including a plurality of application programs, enable the portable electronic device to execute Figure 1 to Figure 3 The method of the embodiment shown is specifically used to perform the following operations:
[0176] Collecting a semi-transparent grid queue of an image frame to be rendered through a main thread, and sending a sorting notification to a sorting thread, wherein the semi-transparent grid queue includes a plurality of semi-transparent grids, and one semi-transparent grid corresponds to one virtual object;
[0177] The sorting thread obtains the semi-transparent meshes to be sorted in the semi-transparent mesh queue in response to the sorting notification sent by the main thread, and sorts the semi-transparent meshes to be sorted based on the triangle index list of the semi-transparent meshes to be sorted, so as to determine the rendering order of the triangle faces in the semi-transparent meshes to be sorted;
[0178] When the sorting thread completes sorting of the plurality of semi-transparent grids in the semi-transparent grid queue, sending a sorting completion notification to the main thread;
[0179] The main thread receives the sorting completion notification and completes the rendering of the virtual object in the image frame.
[0180] The computer-readable storage medium provided in the embodiment of the specification can assign the sorting task of the semi-transparent grids of the image frame to be rendered to the sorting thread alone, and the main thread is responsible for collecting the semi-transparent grid queue of the image frame to be rendered, and the semi-transparent grid queue includes multiple semi-transparent grids. For each image frame, the virtual object containing the semi-transparent grid is rendered in real time through the multi-thread mechanism to ensure the correctness of the rendering effect of the virtual object containing the semi-transparent grid in the image frame in a dynamic state. In addition, the use of the multi-thread mechanism to sort the semi-transparent grids in each image frame also fully utilizes the advantageous performance of the multi-core CPU, improves the sorting efficiency of the semi-transparent grids, and saves the resources consumed by manually sorting the semi-transparent grids.
[0181] Of course, in addition to software implementation, the electronic device of this specification does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0182] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0183] In short, the above description is only a preferred embodiment of this specification and is not intended to limit the protection scope of this specification. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this specification shall be included in the protection scope of this specification.
[0184] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0185] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0186] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0187] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
Claims
1. A virtual object rendering method, include: Collecting a semi-transparent grid queue of an image frame to be rendered through a main thread, and sending a sorting notification to a sorting thread, wherein the semi-transparent grid queue includes a plurality of semi-transparent grids, and one semi-transparent grid corresponds to one virtual object; The sorting thread obtains the semi-transparent meshes to be sorted in the semi-transparent mesh queue in response to the sorting notification sent by the main thread, and sorts the semi-transparent meshes to be sorted based on the triangle index list of the semi-transparent meshes to be sorted, so as to determine the rendering order of the triangle faces in the semi-transparent meshes to be sorted; When the sorting thread completes sorting of the plurality of semi-transparent grids in the semi-transparent grid queue, sending a sorting completion notification to the main thread; The main thread receives the sorting completion notification, refreshes the triangle index list of the multiple semi-transparent meshes, and renders multiple virtual objects corresponding to the multiple semi-transparent meshes based on the refreshed triangle index list of the multiple semi-transparent meshes to complete the rendering of the virtual objects in the image frame.
2. The method according to claim 1, sorting the semi-transparent meshes to be sorted based on the triangle index list of the semi-transparent meshes to be sorted, include: Determine whether the semi-transparent mesh to be sorted is a skinned mesh; If the semi-transparent mesh to be sorted is a skinned mesh, then based on the relevant data of the skinned mesh, obtaining the vertex list information after skinning in the semi-transparent mesh to be sorted; Determine a triangle index list of the semi-transparent mesh to be sorted based on the skinned vertex list information in the semi-transparent mesh to be sorted; The semi-transparent meshes to be sorted are sorted based on the triangle index list of the semi-transparent meshes to be sorted.
3. The method according to claim 2, obtaining the skinned vertex list information of the semi-transparent mesh to be sorted based on the relevant data of the skinned mesh, include: Based on the bone matrix of the skin mesh, the bone weights corresponding to each vertex in the skin mesh, and the initial vertex list information of the skin mesh, obtaining the skin matrix of each frame of the skin mesh in a dynamic state; Based on the skin matrix of each frame of the skin mesh under dynamic conditions, obtaining the skin matrix of the skin mesh at the time of the image frame; Based on the skinning matrix of the skinned mesh at the current moment, the skinned vertex list information of the semi-transparent mesh to be sorted at the image frame moment is determined.
4. The method according to claim 1, sorting the semi-transparent meshes to be sorted based on the triangle index list of the semi-transparent meshes to be sorted, include: Determine the center point of each triangle in the triangle index list of the semi-transparent mesh to be sorted; The semi-transparent meshes to be sorted are sorted based on the coordinates of the center points of the triangles in the triangle index list of the semi-transparent meshes to be sorted.
5. The method according to claim 4, sorting the semi-transparent meshes to be sorted based on the coordinates of the center points of the triangles in the triangle index list of the semi-transparent meshes to be sorted, include: Convert the coordinates of the center point of each triangle in the triangle index list of the semi-transparent mesh to be sorted into the camera space to obtain the coordinates of the center point of each triangle in the camera space; Based on the coordinates of the center points of the triangles in the camera space, determining the distance between the center points of the triangles and the camera in the camera space; The triangle index list of the semi-transparent mesh to be sorted is sorted in descending order of the distance between the center point of each triangle and the camera in the camera space.
6. The method according to claim 5, sorting the triangle index list of the semi-transparent mesh to be sorted in descending order of the distance between the center point of each triangle and the camera in the camera space, include: The triangle index list of the semi-transparent mesh to be sorted is sorted in a descending order of the distance between the center point of each triangle and the camera in the camera space by insertion sort.
7. A virtual object rendering system, the system comprising a main thread and a sorting thread, in: The main thread collects a semi-transparent grid queue of an image frame to be rendered, and sends a sorting notification to a sorting thread, wherein the semi-transparent grid queue includes a plurality of semi-transparent grids, and one semi-transparent grid corresponds to one virtual object; The sorting thread executes the following single cycle process: In response to the sorting notification sent by the main thread, obtaining the semi-transparent meshes to be sorted in the semi-transparent mesh queue, and sorting the semi-transparent meshes to be sorted based on the triangle index list of the semi-transparent meshes to be sorted, so as to determine the rendering order of the triangle faces in the semi-transparent meshes to be sorted; After completing the sorting of the multiple semi-transparent meshes in the semi-transparent mesh queue, sending a sorting completion notification to the main thread, so that the main thread receives the sorting completion notification, refreshes the triangle index lists of the multiple semi-transparent meshes, and based on the refreshed triangle index lists of the multiple semi-transparent meshes, renders the multiple virtual objects corresponding to the multiple semi-transparent meshes to complete the rendering of the virtual objects in the image frame.
8. A virtual object rendering device, include: The acquisition unit acquires the semi-transparent grid queue of the image frame to be rendered through the main thread, and sends a sorting notification to the sorting thread, wherein the semi-transparent grid queue includes a plurality of semi-transparent grids, and one semi-transparent grid corresponds to one virtual object; a sorting unit, wherein the sorting thread obtains the semi-transparent meshes to be sorted in the semi-transparent mesh queue in response to the sorting notification sent by the main thread, and sorts the semi-transparent meshes to be sorted based on the triangle index list of the semi-transparent meshes to be sorted, so as to determine the rendering order of the triangle faces in the semi-transparent meshes to be sorted; a sending unit, which sends a sorting completion notification to the main thread after the sorting thread completes sorting of the plurality of semi-transparent grids in the semi-transparent grid queue; A rendering unit, wherein the main thread receives the sorting completion notification, refreshes the triangle index list of the multiple semi-transparent meshes, and renders the multiple virtual objects corresponding to the multiple semi-transparent meshes based on the refreshed triangle index list of the multiple semi-transparent meshes to complete the rendering of the virtual objects in the image frame.
9. An electronic device, include: processor; as well as a memory arranged to store computer executable instructions which, when executed, cause the processor to: Collecting a semi-transparent grid queue of an image frame to be rendered through a main thread, and sending a sorting notification to a sorting thread, wherein the semi-transparent grid queue includes a plurality of semi-transparent grids, and one semi-transparent grid corresponds to one virtual object; The sorting thread obtains the semi-transparent meshes to be sorted in the semi-transparent mesh queue in response to the sorting notification sent by the main thread, and sorts the semi-transparent meshes to be sorted based on the triangle index list of the semi-transparent meshes to be sorted, so as to determine the rendering order of the triangle faces in the semi-transparent meshes to be sorted; When the sorting thread completes sorting of the plurality of semi-transparent grids in the semi-transparent grid queue, sending a sorting completion notification to the main thread; The main thread receives the sorting completion notification, refreshes the triangle index list of the multiple semi-transparent meshes, and renders multiple virtual objects corresponding to the multiple semi-transparent meshes based on the refreshed triangle index list of the multiple semi-transparent meshes to complete the rendering of the virtual objects in the image frame.
10. A computer-readable storage medium storing one or more programs, which, when executed by an electronic device including a plurality of application programs, causes the electronic device to perform the following operations: Collecting a semi-transparent grid queue of an image frame to be rendered through a main thread, and sending a sorting notification to a sorting thread, wherein the semi-transparent grid queue includes a plurality of semi-transparent grids, and one semi-transparent grid corresponds to one virtual object; The sorting thread obtains the semi-transparent meshes to be sorted in the semi-transparent mesh queue in response to the sorting notification sent by the main thread, and sorts the semi-transparent meshes to be sorted based on the triangle index list of the semi-transparent meshes to be sorted, so as to determine the rendering order of the triangle faces in the semi-transparent meshes to be sorted; When the sorting thread completes sorting of the plurality of semi-transparent grids in the semi-transparent grid queue, sending a sorting completion notification to the main thread; The main thread receives the sorting completion notification, refreshes the triangle index list of the multiple semi-transparent meshes, and renders multiple virtual objects corresponding to the multiple semi-transparent meshes based on the refreshed triangle index list of the multiple semi-transparent meshes to complete the rendering of the virtual objects in the image frame.
Citation Information
Patent Citations
Low-resolution particle drawing method for improving resolution based on double buffering
CN104008525A
Virtual character semi-transparent layering ordering method and system
CN106803278A