Data processing method and device, computer device, and storage medium
By using a dynamic linked list to maintain fragments during the rendering process, the problem of wasted GPU computing resources is solved, accurate rendering of transparent objects in 3D space and realistic color mixing are achieved, thus improving rendering performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2026-03-13
- Publication Date
- 2026-07-03
AI Technical Summary
In the rendering process based on the UE engine, the existing technology consumes a lot of GPU computing resources and excessive video memory, resulting in resource waste, and it is difficult to accurately render the occlusion relationship and transparency of objects in 3D space.
Using a dynamic linked list to maintain multiple fragments corresponding to each pixel position, and merging them by the depth order of the fragments in the linked list, reduces GPU computing resource consumption and improves rendering performance.
Without relying on hardware mechanisms, it accurately renders multi-layered transparent objects in 3D space, ensuring the realism of color mixing and occlusion relationships, saving video memory, and improving rendering performance.
Smart Images

Figure CN122336090A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a data processing method, apparatus, computer equipment, and storage medium. Background Technology
[0002] Rendering technology is widely used in fields such as video games, film and television production, and virtual reality. Rendering a scene involves rendering objects in three-dimensional space. These objects have occlusion relationships and transparency issues. Therefore, how to accurately render objects in three-dimensional space and ensure the realism of color mixing and occlusion relationships has become a major problem in rendering technology.
[0003] In related technologies, rendering is based on the UE engine. During the rendering stage, the raster ordered view provided by the GPU is used to manage the rendering order of multiple fragments at each pixel position, thereby processing multiple fragments at the same pixel position in order from far to near in depth.
[0004] However, since the above method requires maintaining multiple views, it consumes a lot of GPU computing resources and occupies too much video memory, resulting in resource waste. Summary of the Invention
[0005] This application provides a data processing method, apparatus, computer device, and storage medium that uses a dynamic linked list to maintain multiple fragments corresponding to each pixel position. This enables correct mixing without relying on hardware mechanisms, reduces GPU computing resources, saves video memory, and improves rendering performance. The technical solution is as follows.
[0006] On the one hand, a data processing method is provided, the method comprising: Acquire 3D model data, which is used to render to a screen. The screen includes multiple pixel positions, and each pixel position on the screen corresponds to its own linked list. The three-dimensional model data is rasterized to obtain multiple fragments. The multiple fragments are added to the linked lists of their respective pixel positions. Each fragment includes a pixel position and a depth. For any pixel position on the screen, the multiple fragments in the linked list of the pixel position are merged according to their depth order to obtain the display information of the pixel position; The image is displayed on the screen based on the display information of each pixel position in the screen.
[0007] On the other hand, a data processing apparatus is provided, the apparatus comprising: The acquisition module is used to acquire three-dimensional model data, which is used to render to the screen. The screen includes multiple pixel positions, and each pixel position on the screen corresponds to its own linked list. The first processing module is used to rasterize the three-dimensional model data to obtain multiple fragments, and add the multiple fragments to the linked lists of their respective pixel positions. Each fragment includes a pixel position and a depth. The second processing module is used to, for any pixel position in the screen, merge multiple fragments in the linked list of the pixel position according to the depth order of the multiple fragments in the linked list of the pixel position to obtain the display information of the pixel position; The display module is used to display an image on the screen based on the display information of each pixel position in the screen.
[0008] Optionally, the first processing module is configured to: Allocate a first node for the fragment in the first buffer and store the fragment in the first node; Obtain the head pointer of the linked list at the pixel position of the fragment, where the head pointer of the linked list at the pixel position is used to point to the linked list at the pixel position; Add the first node to the linked list pointed to by the head pointer of the linked list.
[0009] Optionally, the first processing module is configured to: Lock the second buffer, which is used to store the node index corresponding to the free node; Read the first node index from the second buffer, and store the fragment in the first node indicated by the first node index; Update the first node index in the second buffer to the second node index, which indicates an idle second node, and the second node is the next node after the first node; Unlock the second buffer.
[0010] Optionally, the device further includes a distribution module for: A storage unit is allocated in the third buffer for each pixel position in the screen, and the third buffer includes multiple storage units; The head pointer of the linked list at each pixel location is stored in the storage unit at each pixel location; The first processing module is used for: The head pointer of the linked list is retrieved from the storage unit at the pixel position of the fragment.
[0011] Optionally, the head pointer of the linked list is used to point to the first node in the linked list at the pixel position; the first processing module is used to: If the depth of all fragments stored in the linked list is greater than the depth of the fragment of the first node, then the pointer of the first node is set to point to the node pointed to by the head pointer of the linked list, and the head pointer of the linked list is updated to point to the first node. If the depth of the fragment of the third node in the linked list is less than the depth of the fragment of the first node, and the depth of the fragment of the fourth node in the linked list is greater than the depth of the fragment of the first node, then the pointer of the first node is set to point to the fourth node, and the pointer of the third node is updated to point to the first node.
[0012] Optionally, the head pointer of the linked list is used to point to the first node in the linked list at the pixel position; the first processing module is used to: If the depth of all fragments stored in the linked list is greater than the depth of the fragment of the first node, then the pointer of the last node in the linked list is updated to point to the first node, and the pointer of the first node is set to null. If the depth of the fragment of the fifth node in the linked list is less than the depth of the fragment of the first node, and the depth of the fragment of the sixth node in the linked list is greater than the depth of the fragment of the first node, then the pointer of the first node is set to point to the fifth node, and the pointer of the sixth node is updated to point to the first node.
[0013] Optionally, the head pointer of the linked list is used to point to the first node in the linked list at the pixel position; the first processing module is used to: Set the pointer of the first node to point to the node pointed to by the head pointer of the linked list, and update the head pointer of the linked list to point to the first node; or, Update the pointer of the last node in the linked list to point to the first node, and set the pointer of the first node to null.
[0014] Optionally, the fragment further includes transparency, and the first processing module is configured to: If the transparency of the fragment indicates that the fragment is a transparent fragment, then the fragment is added to the linked list of the pixel positions of the fragment; The device further includes: When the transparency of a fragment indicates that the fragment is opaque, if the depth of the fragment is less than the depth of fragments already stored in the depth buffer, then the fragments already stored in the depth buffer are replaced with the fragment; if the depth of the fragment is not less than the depth of fragments already stored in the depth buffer, then the fragment is discarded.
[0015] Optionally, the second processing module is used for: Determine the depth of the first target fragment currently stored in the depth buffer; At least one second target fragment is determined in the linked list at the pixel location, the depth of the second target fragment being less than the depth of the first target fragment; According to the depth order of the first target fragment and the at least one second target fragment, the first target fragment and the at least one second target fragment are fused to obtain the display information of the pixel position.
[0016] Optionally, the fragment further includes color; the second processing module is used for: According to the depth order of multiple fragments in the linked list of the pixel position, the depth of the multiple fragments in the linked list is merged and the color of the multiple fragments in the linked list is merged to obtain the display information of the pixel position. The display information of the pixel position includes the merged depth and the merged color.
[0017] On the other hand, a computer device is provided, the computer device including a processor and a memory, the memory storing at least one computer program, the at least one computer program being loaded and executed by the processor to perform the operations performed by the data processing method as described above.
[0018] On the other hand, a computer-readable storage medium is provided that stores at least one computer program, which is loaded and executed by a processor to perform the operations performed by the data processing method described above.
[0019] On the other hand, a computer program product is provided, including a computer program that is loaded and executed by a processor to perform the operations performed by the data processing method described above.
[0020] The methods, apparatus, computer devices, and storage media provided in this application allocate a linked list to each pixel position on the screen. During the rendering stage, fragments obtained by rasterizing the 3D model data are added to their respective linked lists according to their pixel positions. Subsequently, multiple fragments are blended according to the depth order of the fragments in the linked lists at each pixel position, enabling accurate rendering of multi-layered transparent objects in 3D space and ensuring the realism of color mixing and occlusion relationships. Furthermore, using dynamic linked lists to maintain multiple fragments corresponding to each pixel position can correctly blend them without relying on hardware mechanisms, reducing GPU computing resources, saving video memory, and improving rendering performance. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a schematic diagram of a computer system provided in an embodiment of this application; Figure 2 This is a flowchart of a data processing method provided in an embodiment of this application; Figure 3 This is a flowchart of another data processing method provided in an embodiment of this application; Figure 4 This is a flowchart of another data processing method provided in an embodiment of this application; Figure 5 This is a comparison image of a rendering result provided in an embodiment of this application; Figure 6 This is a flowchart of a hair rendering method provided in an embodiment of this application; Figure 7 This is a schematic diagram of the structure of a data processing device provided in an embodiment of this application; Figure 8 This is a schematic diagram of another data processing device provided in an embodiment of this application; Figure 9 This is a schematic diagram of the structure of a terminal provided in an embodiment of this application; Figure 10 This is a schematic diagram of the structure of a server provided in an embodiment of this application. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0024] It is understood that the terms "first," "second," etc., used in this application may be used to describe various concepts herein, but unless otherwise stated, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of this application, a first node may be referred to as a second node, and similarly, a second node may be referred to as a first node.
[0025] In this context, "at least one" refers to one or more nodes. For example, at least one node can be one node, two nodes, three nodes, or any integer number of nodes greater than or equal to one. "Multiple" refers to two or more nodes. For example, multiple nodes can be two nodes, three nodes, or any integer number of nodes greater than or equal to two. "Each" refers to each of the at least one nodes. For example, each node refers to each of the multiple nodes. If the multiple nodes consist of three nodes, then each node refers to each of the three nodes.
[0026] It should be noted that the information (including but not limited to user equipment information, user personal information, etc.), data (including but not limited to data used for analysis, data stored, data displayed, etc.) and signals (including but not limited to signals transmitted between user terminals and other devices) involved in this application have all been fully authorized by the user or relevant parties, and the collection, use and processing of the relevant data shall comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0027] For example, the 3D model data involved in this application are all fully authorized by the user or relevant parties, and the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0028] For ease of understanding, the concepts involved in the embodiments of this application are explained below.
[0029] OIT (Order Independent Transparency) is a technique used to solve the problem of correctly displaying semi-transparent objects in 3D rendering. Its core goal is to achieve physically correct transparency blending effects without strictly adhering to the fragment depth order during rendering. OIT technology eliminates the dependence of rendering order on the transparency blending result by collecting all transparent fragment information for each pixel during the rendering phase and then sorting or blending them in parallel during the subsequent resolution phase.
[0030] Geometry Pass: This is one of the core stages in the rendering pipeline. It is mainly used to convert model data in the 3D scene into geometric information that is easy to render. This information is stored in a buffer to support calculations such as lighting and transparency blending, providing data support for subsequent lighting calculations.
[0031] Fragment Pass: This is one of the core stages in the rendering pipeline. It is a key step in the rendering pipeline to process the fragments generated by rasterization. Its main task is to calculate the final output color of the pixels based on the geometric information, material properties and lighting conditions corresponding to the fragments, and to perform depth testing, stencil testing and blending operations.
[0032] Lighting Pass: This is one of the core stages in the rendering pipeline. It is a step used to calculate the contribution of scene lighting. Its core function is to calculate the lighting effect of each light source on the pixel in batches based on the geometric attributes of each pixel stored in the geometry buffer, including position, normal vector, material parameters, and generated fragment color information, and then fuse the lighting results with the color information to generate the final pixel color.
[0033] Post-Processing Pass: This is an image optimization and visual enhancement step performed after obtaining the initial pixel color information. Its main function is to perform additional processing on the rendered output to improve image quality or add specific visual effects.
[0034] The data processing method provided in this application can be used in computer devices. Optionally, the computer device is a terminal or a server. Optionally, the server is an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Optionally, the terminal is a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, smart voice interaction device, smart home appliance, vehicle terminal, aircraft, etc., but is not limited to these. This application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, and assisted driving.
[0035] Figure 1 This is a schematic diagram of a computer system provided in an embodiment of this application. See also... Figure 1 The computer system includes a terminal 101 and a server 102. The terminal 101 and the server 102 are connected via a wireless or wired network.
[0036] Terminal 101 has at least one client installed and running. The client can be a game client, social application client, online payment client, online shopping client, medical service client, video client, etc. When terminal 101 runs a client, the client's user interface is displayed on the screen of terminal 101. Terminal 101 is the terminal used by user 121.
[0037] Optionally, terminal 101 may refer to one of a number of terminals, including: smartphones, tablets, laptops, desktop computers, smart voice interaction devices, smart home appliances, in-vehicle terminals, aircraft, VR (Virtual Reality) devices, AR (Augmented Reality) devices, etc., but not limited to these.
[0038] Those skilled in the art will understand that the number of terminals described above can be more or less. For example, there may be only one terminal, or there may be six, eight, or more terminals. This application does not limit the number of terminals or the type of device.
[0039] Figure 1 Only one terminal is shown in the diagram, but in different embodiments, multiple other terminals 103 can access the server 102. Optionally, one or more terminals 103 may also be terminals corresponding to developers, on which a client development and editing platform is installed. Developers can edit and update the client on the terminal 103 and transmit the updated client installation package to the server 102 via wired or wireless network. Terminal 101 can download the client installation package from the server 102 to update the client.
[0040] Terminal 101 and other terminals 103 are connected to server 102 via wired or wireless networks.
[0041] Server 102 includes at least one of a single server, multiple servers, a cloud computing platform, and a virtualization center. Server 102 is used to provide backend services to clients. Optionally, server 102 undertakes the primary computing work, and terminal 101 undertakes the secondary computing work; or, server 102 undertakes the secondary computing work, and terminal 101 undertakes the primary computing work; or, server 102 and terminal 101 collaborate on computing using a distributed computing architecture.
[0042] The method provided in this application embodiment can also be executed by terminal 101 alone, or by server 102 alone, or by terminal 101 and server 102 together. This application embodiment does not limit this.
[0043] Figure 2 This is a flowchart illustrating a data processing method provided in an embodiment of this application. This embodiment is executed by a computer device. See also... Figure 2 The method includes the following steps.
[0044] 201. Computer equipment acquires 3D model data, which is then rendered to the screen. The screen includes multiple pixel positions, and each pixel position on the screen corresponds to its own linked list.
[0045] This 3D model data represents an object in 3D space. Specifically, the 3D model data can be a single object in 3D space, comprising transparent and opaque parts, with the transparent parts including semi-transparent and fully transparent parts, and occlusion relationships existing between different positions of the object. Alternatively, the 3D model data can be multiple objects in 3D space with occlusion relationships, including transparent and opaque objects, with the transparent objects including semi-transparent and fully transparent objects.
[0046] The 3D model data includes vertex positions, facet information, normal vectors, texture coordinates, and material properties. Vertex positions describe the shape and structure of the 3D model in 3D space; facet information defines the connection relationships between vertices; normal vectors provide orientation information for the faces; texture coordinates map 2D textures onto the surface of the 3D model; and material properties include material, color, reflectivity, and transparency.
[0047] The 3D model data is used for rendering to the screen, that is, mapping objects in 3D space onto the screen for display. The screen can be regarded as a 2D grid composed of multiple pixel positions. In this embodiment, in order to process multiple fragments at each pixel position, an independent linked list is allocated for each pixel position on the screen, and the linked list at each pixel position is used to store the multiple fragments at that pixel position.
[0048] 202. The computer device rasterizes the 3D model data to obtain multiple fragments, and adds each fragment to a linked list of its respective pixel position. Each fragment includes a pixel position and a depth.
[0049] During the rendering process, the computer device rasterizes the acquired 3D model data to obtain multiple fragments, determines the pixel position of each fragment, and adds the fragment to the linked list at that pixel position, thereby storing at least one fragment generated at that pixel position in the linked list at that pixel position.
[0050] Rasterization is the process of mapping geometric information in 3D space onto pixel locations on the screen. The 3D model data includes multiple facets, each facet being a triangle. By rasterizing the 3D model data, it's determined which pixel locations each triangle's facet covers when mapped to the 2D screen. A fragment is then generated based on each pixel location covered by a facet. It's important to note that since the same pixel location may be covered by multiple facets in the 3D model, multiple fragments may be generated for that location. Furthermore, a pixel location on the screen may not be covered by any facet in the 3D model, in which case no fragment will be generated for that pixel location.
[0051] Each fragment includes the pixel position and depth. The pixel position is represented by two-dimensional coordinates, and the depth of the fragment is obtained based on the depth of multiple vertices in the fragment, representing the distance between the fragment and the virtual camera.
[0052] 203. For any pixel position on the screen, the computer device merges multiple fragments in the linked list of the pixel position according to their depth order to obtain the display information of the pixel position.
[0053] Each pixel location has a linked list storing the fragments generated at that pixel location. For each pixel location, the computer device merges multiple fragments from that linked list in depth order to generate the display information for that pixel location. Merging in depth order means merging in order from farthest to nearest depth. Since distant objects are occluded by nearby objects, fragments corresponding to distant objects are superimposed first, followed by fragments corresponding to nearby objects. This ensures correct blending based on occlusion relationships and transparency, conforming to the laws of physical occlusion and visual effects.
[0054] 204. Computer devices display images on the screen based on the display information of each pixel position on the screen.
[0055] After determining the display information for each pixel position on the screen, the computer device displays the image according to the display information for each pixel position, thereby rendering the three-dimensional model data onto the screen.
[0056] The method provided in this application allocates a linked list to each pixel position on the screen. During the rendering stage, fragments obtained from rasterizing the 3D model data are added to their respective linked lists according to their pixel positions. Subsequently, multiple fragments are blended according to the depth order of the fragments in the linked lists at each pixel position, enabling accurate rendering of multi-layered transparent objects in 3D space and ensuring the realism of color mixing and occlusion relationships. Furthermore, using dynamic linked lists to maintain multiple fragments corresponding to each pixel position can correctly blend them without relying on hardware mechanisms, reducing GPU computing resources, saving video memory, and improving rendering performance.
[0057] Figure 3 This is a flowchart illustrating a data processing method provided in an embodiment of this application. This embodiment is executed by a computer device. See also... Figure 3 The method includes the following steps.
[0058] 301. Computer equipment acquires 3D model data, which is used to render the 3D model data to the screen, which includes multiple pixel positions.
[0059] The computer device acquires 3D model data to be rendered to the screen. This 3D model data can be related data of the 3D model, which refers to a 3D mesh model composed of facets. The 3D model represents an object in 3D space. In the embodiments of this application, the object can be a semi-transparent object or a transparent object. For example, the 3D model can be a person wearing semi-transparent clothing, a cartoon character with semi-transparent hair, or any other object.
[0060] 302. The computer device allocates a storage unit for each pixel position on the screen in the third buffer. The storage unit at each pixel position stores the head pointer of the linked list of pixel positions. The third buffer includes multiple storage units.
[0061] The computer device creates a third buffer, which may be a head pointer buffer used to store the head pointers of multiple linked lists. This third buffer includes multiple storage units. For each pixel position on the screen, the computer device determines a storage unit in this third buffer and allocates that storage unit to that pixel position. This storage unit is used to store the head pointer of the linked list at that pixel position.
[0062] In this setup, the head pointer of the linked list at each pixel location points to the linked list at that pixel location, and each pixel location on the screen corresponds to its own linked list. For example, the head pointer of the linked list at each pixel location points to the first node in the linked list at that pixel location.
[0063] In this embodiment, a storage unit is allocated in the third buffer for each pixel position, and the corresponding linked list head pointer is stored, enabling fast access to the linked list for each pixel. When a fragment is inserted into the linked list, it can directly obtain the linked list head pointer corresponding to its pixel position without traversing other data structures, thereby speeding up the efficiency of linked list operations.
[0064] In one possible implementation, the size of the third buffer is the same as the screen resolution. Alternatively, the number of storage units in the third buffer is equal to the number of pixel locations on the screen, thus allocating one storage unit for each pixel location on the screen.
[0065] Optionally, the pixel position on the screen can be uniquely represented by a set of integer coordinates, denoted as (x, y), where x represents the horizontal position and y represents the vertical position. The third buffer is a contiguous storage space divided into multiple storage units. The computer device creates an index value for each storage unit in the third buffer, maps the pixel position coordinates to an index value according to a preset rule, and allocates the storage unit indicated by the index value to that pixel position.
[0066] In one possible implementation, for each pixel location, the computer device generates a head pointer of a linked list for that pixel location, sets the head pointer of the linked list for that pixel location to null, stores the null head pointer of the linked list in the storage unit of that pixel location, and then updates the head pointer of the linked list for that pixel location when adding the fragment generated at that pixel location to the linked list of that pixel location.
[0067] 303. The computer equipment rasterizes the 3D model data to obtain multiple fragments, each of which includes pixel position and depth.
[0068] During the rendering process, the computer device rasterizes the acquired 3D model data to obtain at least one pixel location covered by each facet in the 3D model data. A fragment is then generated based on each pixel location covered by a facet. Because there is a spatial hierarchy among the faces in the 3D model data, the same pixel location may be covered by one or more faces, thus potentially generating multiple fragments at that location. Conversely, a pixel location may not be covered by any facet, therefore no fragment may be generated at that location.
[0069] In one possible implementation, each fragment may include not only pixel position and depth, but also color, normal, texture coordinates, material, transparency, etc.
[0070] For example, after projecting each facet from the 3D model data onto a 2D screen, a pixel position P on the screen will be covered by facets A and B. At that pixel position P, a fragment corresponding to facet A and a fragment corresponding to facet B will be generated. The fragment corresponding to facet A includes the pixel position, the depth, color, transparency, normals, etc., of facet A. The fragment corresponding to facet B includes the pixel position, the depth, color, transparency, normals, etc., of facet B.
[0071] 304. For any one of multiple fragments, the computer device allocates a first node for the fragment in the first buffer and stores the fragment in the first node.
[0072] The computer device creates a first buffer, which includes multiple storage units, each of which can be considered a node. The storage units in the first buffer are used to store fragments. Taking a certain fragment as an example, after the computer device obtains the fragment through rasterization, it determines the first node among the free nodes in the first buffer and allocates the first node to the fragment, that is, it stores the fragment in the first node.
[0073] In one possible implementation, the first buffer and the third buffer are independent and different buffers, or the first buffer and the third buffer may be the same buffer.
[0074] In one possible implementation, the first buffer is a texture buffer.
[0075] In one possible implementation, the computer device locks a second buffer, which stores the node index corresponding to an idle node; reads the first node index from the second buffer, stores the fragment in the first node indicated by the first node index; updates the first node index in the second buffer to the second node index, which indicates an idle second node, the second node being the next node after the first node; and unlocks the second buffer.
[0076] The second buffer can be understood as a shared buffer used to manage the node allocation state, storing node indices that indicate "currently available nodes". Locking this second buffer means that during the locking period, other concurrently executing threads cannot simultaneously read or modify the node indices in the second buffer, thus preventing multiple threads from acquiring the same free node at the same time.
[0077] After the second buffer is locked, the computer device reads the first node index from the second buffer. This first node index indicates the location of a currently available free node in the first buffer. Based on this first node index, the corresponding first node in the first buffer is located, and the current fragment is written to that first node, thus completing the binding between the fragment and the node. At this point, the first node transitions from an idle state to an allocated state. Therefore, the computer device needs to update the node index stored in the second buffer; that is, update the first node index in the second buffer to the second node index, which indicates the next node in the idle state.
[0078] The second buffer is a contiguous storage space divided into multiple storage units, each of which can be considered a node. The computer allocates nodes to fragments sequentially according to the order of these storage units. Therefore, the free nodes are inherently ordered; the second node is the next node after the first node. By moving the node index of the second buffer to the next node after the first node, it can be ensured that the first node, which is already occupied, will not be reassigned during the next node allocation operation.
[0079] Finally, the computer device unlocks the second buffer. Unlocking the second buffer means that the current thread has completed reading and updating the node indexes in the second buffer, and other parallel threads can now continue to access the second buffer and execute their respective node allocation processes.
[0080] Optionally, the second buffer and the first and third buffers can be independent of each other, or the second buffer and the first buffer can be the same buffer, or the second buffer and the third buffer can be the same buffer.
[0081] In this implementation, when it is necessary to allocate a node to a fragment, the second buffer is locked first, the index of the first node in the second buffer is read, the first node indicated by the first node index is allocated to the fragment, and the node index of the second buffer is updated. After completing the above steps, the second buffer is unlocked. This can safely and efficiently allocate linked list nodes in a multi-threaded parallel environment, avoid the problem of different threads repeatedly allocating the same node, ensure the uniqueness of linked list nodes, and make full use of the parallel computing power of the GPU. No conflicts or data overwriting will occur when processing a large number of fragments.
[0082] In one possible implementation, the linked list at each pixel location also has a counter that records the number of nodes in the linked list.
[0083] 305. The computer device obtains the head pointer of the linked list at the pixel position in the storage unit of the pixel position of the fragment, and adds the first node to the linked list pointed to by the head pointer. The head pointer of the linked list at the pixel position is used to point to the linked list at the pixel position.
[0084] Each pixel location corresponds to a storage unit in the first buffer, which stores the head pointer of the linked list for that pixel location. Therefore, the computer device retrieves the head pointer of the linked list for the pixel location from the storage unit at that pixel location within the fragment. After retrieving the head pointer, the computer device adds a first node to the linked list pointed to by the head pointer. Adding a node is an update operation on the linked list, that is, making the first node a node in the linked list for that pixel location.
[0085] In this implementation, a node is allocated to each fragment in the first buffer and the fragment is stored in the node. Then, the head pointer of the linked list at the corresponding pixel position is obtained and the node is inserted into the linked list. This achieves one-to-one correspondence management between each fragment and the pixel position, ensuring that each fragment is correctly recorded in the linked list of its corresponding pixel, so that it can be processed in depth order in the subsequent fusion stage.
[0086] In one possible implementation, the fragments also include transparency. The fragments obtained by rasterization are divided into transparent fragments and opaque fragments, and different operations are used to process the transparent fragments and opaque fragments respectively.
[0087] (1) When the fragment transparency indicates that the fragment is a transparent fragment, add the fragment to the list of the pixel positions of the fragment.
[0088] The transparency of a fragment reflects the degree to which it occludes the background. When transparency information indicates that a fragment is transparent, it means that the fragment will not completely occlude fragments behind it, but rather they need to participate in color calculations together according to certain blending rules. Therefore, the fragment is added as valid data to the linked list of its corresponding pixel location. In this way, multiple transparent fragments at the same pixel location can be collected uniformly, regardless of the fragment generation order, thus avoiding transparency errors caused by improper rendering order.
[0089] Optionally, the transparency of a fragment is represented by a transparency value. When the transparency of a fragment is greater than a preset value, the fragment is determined to be a transparent fragment. For example, the transparency is a value between 0 and 1, and the preset value can be 0.
[0090] (2) When the transparency of a fragment indicates that the fragment is an opaque fragment, if the depth of the fragment is less than the depth of the fragments already stored in the depth buffer, the fragments already stored in the depth buffer are replaced with the fragments. If the depth of the fragment is not less than the depth of the fragments already stored in the depth buffer, the fragments are discarded.
[0091] When the transparency information of a fragment indicates that it is an opaque fragment, it means that the fragment will completely occlude the fragments behind it, and there is no need to blend its transparency with the fragments behind it. Therefore, opaque fragments do not need to participate in subsequent sorting and blending, that is, they do not need to be stored in the linked list. The computer device compares the depth of the current opaque fragment with the depth of the fragments already stored in the depth buffer. If the depth of the current fragment is less than the depth of the fragments already stored in the depth buffer, it means that the fragment is in front of the stored fragments and has a higher visibility priority. At this time, the computer device replaces the fragments already stored in the depth buffer with the current fragment, thereby updating the opaque fragment corresponding to the pixel position. Conversely, if the depth of the current fragment is not less than the depth of the fragments already stored in the depth buffer, it means that the fragment is behind or at the same depth position as the stored fragments. This fragment will not have any impact on the final pixel color, so the computer device directly discards the fragment, does not write it into the depth buffer, and does not add it to the linked list of the pixel position.
[0092] Optionally, the transparency of a fragment is represented by a transparency value. When the transparency of a fragment is not greater than a preset value, the fragment is determined to be a transparent fragment. For example, the transparency is a value between 0 and 1, and the preset value can be 0.
[0093] In this implementation, transparent and opaque fragments are distinguished based on their transparency. For transparent fragments, they are added to a linked list at the corresponding pixel position for subsequent sorting and blending, ensuring correct overlay display. For opaque fragments, their depths are compared with those of fragments already stored in the depth buffer, and selective replacements or discards are made to ensure physical correctness of occlusion relationships. This method stores only transparent fragments in the linked list, saving the number of nodes and eliminating the need to sort opaque fragments, thus saving memory and reducing processing pressure.
[0094] In one possible implementation, the head pointer of the linked list is used to point to the first node in the linked list at the pixel location. The computer device adds the first node to the linked list pointed to by the head pointer in four ways: The first method: If the depth of all stored fragments in the linked list is greater than the depth of the fragment of the first node, then set the pointer of the first node to point to the node pointed to by the head pointer of the linked list, and update the head pointer of the linked list to point to the first node; if the depth of the fragment of the third node in the linked list is less than the depth of the fragment of the first node, and the depth of the fragment of the fourth node in the linked list is greater than the depth of the fragment of the first node, then set the pointer of the first node to point to the fourth node, and update the pointer of the third node to point to the first node.
[0095] Optionally, if the current head pointer of the linked list is null, that is, if there is no node in the linked list, the computer device directly updates the head pointer of the linked list to point to the first node and sets the pointer of the first node to null.
[0096] For example, the linked list includes nodes A, B, and C linked in sequence. The head pointer of the linked list points to node A, the pointer of node A points to node B, the pointer of node B points to node C, the pointer of node C is null, the depth of node A is less than the depth of node B, the depth of node B is less than the depth of node C, and the current node is node D.
[0097] If the depth of node D is less than the depths of nodes A, B, and C, then set the pointer of node D to point to node A, and update the head pointer of the linked list to point to node D.
[0098] If the depth of node C in the linked list is less than the depth of node D, and the depth of node B in the linked list is greater than the depth of node D, then set the pointer of node D to point to node C, and update the pointer of node B to point to node D.
[0099] In this implementation, when adding a node to the linked list, the node's position in the linked list is determined based on the depth of the fragments within the node. This ensures that the nodes in the linked list are arranged in order of depth from closest to furthest, thus maintaining the depth order of the fragments in the linked list. This allows subsequent merging operations to be performed directly in depth order without additional sorting, which is beneficial for improving the efficiency of subsequent fragment merging.
[0100] The second approach: If the depth of all stored fragments in the linked list is greater than the depth of the first node's fragment, then update the pointer of the last node in the linked list to point to the first node, and set the pointer of the first node to null; if the depth of the fifth node's fragment is less than the depth of the first node's fragment, and the depth of the sixth node's fragment is greater than the depth of the first node's fragment, then set the pointer of the first node to point to the fifth node, and update the pointer of the sixth node to point to the first node.
[0101] Optionally, if the current head pointer of the linked list is null, that is, if there is no node in the linked list, the computer device directly updates the head pointer of the linked list to point to the first node and sets the pointer of the first node to null.
[0102] For example, the linked list includes nodes A, B, and C linked in sequence. The head pointer of the linked list points to node A, the pointer of node A points to node B, the pointer of node B points to node C, the pointer of node C is null, the depth of node A is greater than the depth of node B, the depth of node B is greater than the depth of node C, and the current node is node D.
[0103] If the depth of node D is greater than the depths of nodes A, B, and C, then set the pointer of node D to point to node A, and update the head pointer of the linked list to point to node D.
[0104] If the depth of node B in the linked list is greater than the depth of node D, and the depth of node C in the linked list is less than the depth of node D, then set the pointer of node D to point to node C, and update the pointer of node B to point to node D.
[0105] In this implementation, when adding a node to the linked list, the node's position in the linked list is determined based on the depth of the fragments within the node. This ensures that the nodes in the linked list are arranged in order of depth from farthest to closest, thus maintaining the depth order of the fragments in the linked list. This allows subsequent merging operations to be performed directly in depth order without additional sorting, which is beneficial for improving the efficiency of subsequent fragment merging.
[0106] The third method: Set the pointer of the first node to point to the node pointed to by the head pointer of the linked list, and update the head pointer of the linked list to point to the first node.
[0107] In other words, when adding a node to a linked list, that node is directly used as the first node of the linked list.
[0108] The fourth method: Update the pointer of the last node in the linked list to point to the first node, and set the pointer of the first node to null.
[0109] In other words, when adding a node to a linked list, that node is directly used as the last node of the linked list.
[0110] Optionally, if the current head pointer of the linked list is null, that is, if there is no node in the linked list, the computer device directly updates the head pointer of the linked list to point to the first node and sets the pointer of the first node to null.
[0111] In this implementation, when adding a node to the linked list, the node is directly inserted at the head or end of the linked list, which enables quick addition of nodes to the linked list and improves the convenience and efficiency of adding nodes to the linked list.
[0112] 306. For any pixel position on the screen, the computer device merges multiple fragments in the linked list of the pixel position according to their depth order to obtain the display information of the pixel position.
[0113] Computer devices process fragments according to the depth order of multiple fragments in a linked list of pixel positions. Fusing according to depth order means fusing in order of depth from far to near.
[0114] In one possible implementation, the multiple fragments in the linked list are arranged in depth order, in which case the computer device can directly merge them according to the order in which the multiple fragments are arranged in the linked list.
[0115] In one possible implementation, if multiple fragments in a linked list are not arranged in depth order, the computer device reads the depth of the multiple fragments in the linked list, constructs a fragment sequence arranged in order of depth from farthest to nearest, and merges them according to the arrangement order of the multiple fragments in the fragment sequence.
[0116] In one possible implementation, opaque fragments are stored in a depth buffer, and transparent fragments are stored in a linked list at pixel locations. A computer device determines the depth of a first target fragment currently stored in the depth buffer; determines at least one second target fragment in the linked list at pixel locations, the second target fragment having a depth less than the first target fragment; and merges the first target fragment and the at least one second target fragment according to their depth order to obtain the display information for the pixel locations.
[0117] The computer device determines the depth of the first target fragment currently stored in the depth buffer. The first target fragment in the depth buffer is the opaque fragment closest to the virtual camera at that pixel location, and this target fragment completely occludes all fragments behind it. By reading the depth value recorded in the depth buffer, the computer device can determine the location of the opaque occlusion at that pixel location. After obtaining the depth of the first target fragment, the computer device determines at least one second target fragment in the linked list corresponding to the pixel location. The second target fragment is a transparent fragment located before the first target fragment, that is, a transparent fragment with a depth less than the depth of the first target fragment.
[0118] After selecting the first target fragment and at least one second target fragment, the computer device fuses them according to the depth order of the first target fragment and at least one second target fragment to obtain the display information of the pixel position.
[0119] In this implementation, only the opaque first target fragment in the depth buffer is merged with the opaque second target fragment in the linked list that is in front of the first target fragment. This ensures that the transparent fragment only affects the visible part, preventing distant transparent fragments from covering nearby opaque fragments. In complex scenes with multiple layers of transparent and opaque objects in 3D space, this approach can accurately reflect the occlusion relationship and transparency superposition effect between multiple layers of objects in 3D space, thus improving the rendering effect.
[0120] In one possible implementation, the computer device merges the depth of multiple fragments in the linked list according to their depth order, and merges the colors of multiple fragments in the linked list to obtain display information of the pixel position, which includes the merged depth and the merged color.
[0121] 307. Computer devices display images on the screen based on the display information of each pixel position on the screen.
[0122] After determining the display information for each pixel position on the screen, the computer device displays the image according to the display information for each pixel position, thereby rendering the three-dimensional model data onto the screen.
[0123] In one possible implementation, the computer device writes the display information for each pixel location into a frame buffer. A frame buffer is a storage area used to temporarily store screen pixel information, with each storage unit corresponding to a pixel location on the screen. After writing to the frame buffer is complete, the computer device triggers the output phase of the display pipeline, sending the display information in the frame buffer to the display hardware according to the screen's scanning order. The display hardware then converts the numerical color information into visible light signals, thereby displaying the image on the screen.
[0124] In one possible implementation, the display information for a pixel location includes the pixel's depth and color. The computer device acquires the lighting information corresponding to the model data, adjusts the color of each pixel location based on the lighting information and the depth of each pixel location to obtain the target color for each pixel location, and displays each pixel location on the screen in the target color of that pixel location.
[0125] The method provided in this application allocates a linked list to each pixel position on the screen. During the rendering stage, fragments obtained from rasterizing the 3D model data are added to their respective linked lists according to their pixel positions. Subsequently, multiple fragments are blended according to the depth order of the fragments in the linked lists at each pixel position, enabling accurate rendering of multi-layered transparent objects in 3D space and ensuring the realism of color mixing and occlusion relationships. Furthermore, using dynamic linked lists to maintain multiple fragments corresponding to each pixel position can correctly blend them without relying on hardware mechanisms, reducing GPU computing resources, saving video memory, and improving rendering performance.
[0126] Figure 4 This is a flowchart of a data processing method provided in an embodiment of this application, such as... Figure 4 As shown, this data processing method includes a geometry processing stage, a fragment processing stage, a lighting processing stage, and a post-processing stage. The geometry processing stage includes a linked list creation process, a linked list maintenance process, and a process for determining the display information of pixel positions.
[0127] Linked list creation: A linked list is allocated for each pixel position. This linked list is used to store the transparent fragments (position, depth, color, and transparency) at that pixel position. For each transparent fragment, it is checked whether there are other transparent fragments at that pixel position. If not, the linked list for that pixel position is initialized, and the transparent fragment is added to the linked list; if it exists, the transparent fragment is added to the linked list already allocated for that pixel position.
[0128] Linked list maintenance: Nodes in the linked list at each pixel position are sorted by depth. Nodes containing transparent fragments with smaller depths are placed before nodes containing transparent fragments with larger depths. Whenever a new transparent fragment is generated, if the depth of the transparent fragment is less than the depth of the first transparent fragment in the current linked list, then the node of that transparent fragment is made the first node of the linked list; otherwise, the node of that transparent fragment is inserted into the appropriate position in the linked list.
[0129] Determine the display information for pixel positions: After storing all transparent fragments, perform a blending operation on the transparent fragments at each pixel. Since the transparent fragments in the linked list are already sorted by depth, the blending operation can be performed in the order of the linked list.
[0130] The rendering method provided in this application, for semi-transparent objects in three-dimensional space, employs a PPLL linked list in the fragment processing stage. A dynamic linked list is maintained for each pixel position on the screen, storing the transparent fragments at that pixel position. In the lighting processing stage, the transparent fragments in the linked list are blended according to depth order. Finally, after a post-processing stage, the target color for each pixel position is output for display. Figure 5 As shown, compared with related technologies, the method provided in this application embodiment can significantly improve rendering speed.
[0131] The data processing method provided in this application embodiment can be applied to scenes that render any object.
[0132] For example, the method provided in the embodiments of this application can be used to render hair. Figure 6 This is a flowchart of a hair rendering method provided in an embodiment of this application, such as... Figure 6 As shown, the method includes the following steps.
[0133] 601. Obtain three-dimensional hair model data.
[0134] This 3D hair model data contains related data for a 3D hair model, which represents hair in 3D space, such as human hair or animal fur. This 3D hair model data is used to render the hair onto the screen. The screen comprises multiple pixel locations, and each pixel location corresponds to its own linked list.
[0135] In this embodiment, to enhance the realism of the hair, the hair material is set to a semi-transparent material, for example, the tips of the hair are made of a semi-transparent material. Since the hair strands intersect each other and have complex occlusion relationships, it is necessary to ensure the correctness of color mixing and occlusion relationships between the hair strands when rendering hair in three-dimensional space.
[0136] 602. Rasterize the 3D hair model data to obtain multiple fragments. Add each fragment to a linked list of its respective pixel position. Each fragment includes a pixel position and a depth.
[0137] The 3D hair model data includes multiple facets on the 3D hair model. By rasterizing the 3D hair model data, it is determined which pixel positions each facet covers after being mapped onto the 2D screen. A fragment is generated based on each pixel position covered by the facet.
[0138] 603. For any pixel position on the screen, according to the depth order of multiple fragments in the linked list of the pixel position, merge multiple fragments in the linked list of the pixel position to obtain the display information of the pixel position.
[0139] When multiple hairs intersect, hairs further away will be obscured by hairs closer to the surface. However, since the hairs in this embodiment are made of a semi-transparent material, the obscured hairs are not completely invisible, and the obscured hairs will affect the final color of the unobscured hairs. Therefore, by first stacking fragments corresponding to the distant hairs and then stacking fragments corresponding to the nearby hairs, it is possible to ensure that the intersecting hairs are correctly blended according to the occlusion relationship and transparency.
[0140] The display information for a pixel location includes the depth and color of that pixel location. The depth is actually the depth of the hair closest to the virtual camera at that pixel location, and the color is actually the color produced by mixing the colors of multiple hairs at that pixel location according to their respective depths and transparency.
[0141] 604. Display rendered hair on the screen based on the display information of each pixel position on the screen.
[0142] The display information is presented according to the position of each pixel, thus displaying the image on the screen, which is the rendered hair.
[0143] In this embodiment, when rendering semi-transparent hair, the fragments obtained by rasterizing the 3D hair model data are added to their respective linked lists according to their pixel positions. Subsequently, multiple fragments are merged according to the depth order of the fragments in the linked lists at the pixel positions, so that multi-layered semi-transparent hair in 3D space can also be accurately rendered. Compared with the related technology that renders each layer of hair in depth order, the method of this embodiment only needs to perform a rendering operation once for each pixel position, which significantly improves the rendering speed of semi-transparent hair, reduces the rendering pressure, and can be adapted to any complex semi-transparent hair rendering scene.
[0144] The above embodiments are only illustrated using the rendering of hair as an example. In addition, the data processing method provided in this application embodiment can also be applied to rendering other semi-transparent objects, such as rendering smoke with semi-transparent materials, or rendering objects with multiple layers of transparency. This application embodiment does not limit this.
[0145] Figure 7 This is a schematic diagram of the structure of a data processing apparatus provided in an embodiment of this application. See also... Figure 7 The device includes: The acquisition module 701 is used to acquire 3D model data. The 3D model data is used to render to the screen. The screen includes multiple pixel positions, and each pixel position on the screen has its own linked list. The first processing module 702 is used to rasterize the 3D model data to obtain multiple fragments, and add the multiple fragments to the linked list of their respective pixel positions. Each fragment includes a pixel position and a depth. The second processing module 703 is used to merge multiple fragments in the linked list of a pixel position according to the depth order of the multiple fragments in the linked list of the pixel position for any pixel position in the screen, so as to obtain the display information of the pixel position. Display module 704 is used to display images on the screen based on display information of each pixel position on the screen.
[0146] The data processing apparatus provided in this application allocates a linked list to each pixel position on the screen. During the rendering stage, fragments obtained by rasterizing the 3D model data are added to their respective linked lists according to their pixel positions. Subsequently, multiple fragments are blended according to the depth order of the fragments in the linked lists at each pixel position, enabling accurate rendering of multi-layered transparent objects in 3D space and ensuring the realism of color mixing and occlusion relationships. Furthermore, using dynamic linked lists to maintain multiple fragments corresponding to each pixel position can correctly blend them without relying on hardware mechanisms, reducing GPU computing resources, saving video memory, and improving rendering performance.
[0147] Optionally, see Figure 8 The first processing module 702 is used for: Allocate a first node for the fragment in the first buffer and store the fragment in the first node; Get the head pointer of the linked list at the pixel position of the fragment. The head pointer of the linked list at the pixel position is used to point to the linked list at the pixel position. Add the first node to the linked list pointed to by the head pointer.
[0148] Optionally, see Figure 8 The first processing module 702 is used for: Lock the second buffer, which is used to store the node index corresponding to the free node; Read the first node index from the second buffer and store the fragment in the first node indicated by the first node index; Update the index of the first node in the second buffer to the index of the second node, which indicates an available second node. The second node is the next node after the first node. Unlock the second buffer.
[0149] Optionally, see Figure 8 The device also includes a distribution module 705 for: A storage unit is allocated for each pixel position on the screen in the third buffer, and the third buffer includes multiple storage units; The head pointer of the linked list for each pixel position is stored in the storage unit at each pixel position; The first processing module 702 is used for: Retrieve the head pointer of the linked list from the storage unit at the pixel position of the fragment.
[0150] Optionally, see Figure 8 The head pointer of the linked list is used to point to the first node in the linked list at the pixel position; the first processing module 702 is used for: If the depth of all the fragments stored in the linked list is greater than the depth of the fragment of the first node, then set the pointer of the first node to point to the node pointed to by the head pointer of the linked list, and update the head pointer of the linked list to point to the first node. If the depth of the fragment of the third node in the linked list is less than the depth of the fragment of the first node, and the depth of the fragment of the fourth node in the linked list is greater than the depth of the fragment of the first node, then set the pointer of the first node to point to the fourth node, and update the pointer of the third node to point to the first node.
[0151] Optionally, see Figure 8 The head pointer of the linked list is used to point to the first node in the linked list at the pixel position; the first processing module 702 is used for: If the depth of all fragments stored in the linked list is greater than the depth of the fragment of the first node, then update the pointer of the last node in the linked list to point to the first node, and set the pointer of the first node to null. If the depth of the fifth node's fragment in the linked list is less than the depth of the first node's fragment, and the depth of the sixth node's fragment in the linked list is greater than the depth of the first node's fragment, then set the pointer of the first node to point to the fifth node, and update the pointer of the sixth node to point to the first node.
[0152] Optionally, see Figure 8 The head pointer of the linked list is used to point to the first node in the linked list at the pixel position; the first processing module 702 is used for: Set the pointer of the first node to point to the node pointed to by the head pointer of the linked list, and update the head pointer of the linked list to point to the first node; or, Update the pointer of the last node in the linked list to point to the first node, and set the pointer of the first node to null.
[0153] Optionally, see Figure 8 The fragment also includes transparency, and the first processing module 702 is used for: If the fragment's transparency indicates that the fragment is a transparent fragment, add the fragment to the linked list at the fragment's pixel position; The device also includes: When the fragment's transparency indicates that the fragment is an opaque fragment, if the fragment's depth is less than the depth of fragments already stored in the depth buffer, then the fragments already stored in the depth buffer are replaced with the new fragment; if the fragment's depth is not less than the depth of fragments already stored in the depth buffer, then the fragment is discarded.
[0154] Optionally, see Figure 8 The second processing module 703 is used for: Determine the depth of the first target fragment currently stored in the depth buffer; At least one second target fragment is determined in the linked list of pixel locations, the depth of the second target fragment being less than the depth of the first target fragment; According to the depth order of the first target fragment and at least one second target fragment, the first target fragment and at least one second target fragment are fused to obtain the display information of the pixel position.
[0155] Optionally, see Figure 8 The fragment also includes color; the second processing module 703 is used for: According to the depth order of multiple fragments in the linked list of pixel positions, the depth of multiple fragments in the linked list is merged and the color of multiple fragments in the linked list is merged to obtain the display information of the pixel position. The display information of the pixel position includes the merged depth and the merged color.
[0156] It should be noted that the data processing apparatus provided in the above embodiments is only an example of the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device can be divided into different functional modules to complete all or part of the functions described above. In addition, the data processing apparatus and data processing method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process can be found in the method embodiments, which will not be repeated here.
[0157] This application also provides a computer device, which includes a processor and a memory. The memory stores at least one computer program, which is loaded and executed by the processor to perform the operations performed in the data processing method of the above embodiments.
[0158] Optionally, the computer device is provided as a terminal. Figure 9 A schematic diagram of the structure of a terminal 900 provided in an exemplary embodiment of this application is shown.
[0159] The terminal 900 includes a processor 901 and a memory 902.
[0160] Processor 901 may include one or more processing cores, such as a quad-core processor, a nine-core processor, etc. Processor 901 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), and PLA (Programmable Logic Array). Processor 901 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 901 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 901 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.
[0161] The memory 902 may include one or more computer-readable storage media, which may be non-transitory. The memory 902 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 902 are used to store at least one computer program, which is used by the processor 901 to implement the data processing method provided in the method embodiments of this application.
[0162] In some embodiments, the terminal 900 may also optionally include a peripheral device interface 903 and at least one peripheral device. The processor 901, memory 902, and peripheral device interface 903 can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface 903 via a bus, signal line, or circuit board. Optionally, the peripheral device includes at least one of a radio frequency circuit 904, a display screen 905, a camera assembly 906, an audio circuit 907, and a power supply 908.
[0163] Peripheral device interface 903 can be used to connect at least one I / O (Input / Output) related peripheral device to processor 901 and memory 902. In some embodiments, processor 901, memory 902 and peripheral device interface 903 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 901, memory 902 and peripheral device interface 903 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.
[0164] The radio frequency (RF) circuit 904 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 904 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 904 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals back into electrical signals. Optionally, the RF circuit 904 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, etc. The RF circuit 904 can communicate with other devices through at least one wireless communication protocol. This wireless communication protocol includes, but is not limited to: metropolitan area networks (MANs), various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks (WLANs), and / or WiFi (Wireless Fidelity) networks. In some embodiments, the RF circuit 904 may also include circuitry related to NFC (Near Field Communication), which is not limited in this application.
[0165] Display screen 905 is used to display a UI (User Interface). This UI may include graphics, text, icons, videos, and any combination thereof. When display screen 905 is a touch display screen, it also has the ability to collect touch signals on or above its surface. These touch signals can be input as control signals to processor 901 for processing. In this case, display screen 905 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there may be one display screen 905, disposed on the front panel of terminal 900; in other embodiments, there may be at least two display screens 905, disposed on different surfaces of terminal 900 or in a folded design; in other embodiments, display screen 905 may be a flexible display screen, disposed on a curved or folded surface of terminal 900. Furthermore, display screen 905 may be configured as a non-rectangular, irregular shape, i.e., a non-rectangular screen. Display screen 905 may be made of materials such as LCD (Liquid Crystal Display) or OLED (Organic Light-Emitting Diode).
[0166] The camera assembly 906 is used to acquire images or videos. Optionally, the camera assembly 906 includes a front-facing camera and a rear-facing camera. The front-facing camera is disposed on the front panel of the terminal 900, and the rear-facing camera is disposed on the back of the terminal 900. In some embodiments, there are at least two rear-facing cameras, which are any one of a main camera, a depth-sensing camera, a wide-angle camera, and a telephoto camera, to achieve background blur function by fusion of the main camera and the depth-sensing camera, panoramic shooting function by fusion of the main camera and the wide-angle camera, VR (Virtual Reality) shooting function, or other fusion shooting function. In some embodiments, the camera assembly 906 may also include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cool light flash, which can be used for light compensation at different color temperatures.
[0167] The audio circuit 907 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, converting the sound waves into electrical signals that are input to the processor 901 for processing, or input to the radio frequency circuit 904 for voice communication. For stereo sound acquisition or noise reduction purposes, multiple microphones may be used, each located at a different part of the terminal 900. The microphone may also be an array microphone or an omnidirectional microphone. The speaker is used to convert the electrical signals from the processor 901 or the radio frequency circuit 904 into sound waves. The speaker may be a conventional diaphragm speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can convert electrical signals not only into audible sound waves but also into inaudible sound waves for purposes such as distance measurement. In some embodiments, the audio circuit 907 may also include a headphone jack.
[0168] Power supply 908 is used to power the various components in terminal 900. Power supply 908 can be AC power, DC power, a disposable battery, or a rechargeable battery. When power supply 908 includes a rechargeable battery, the rechargeable battery can support wired or wireless charging. The rechargeable battery can also be used to support fast charging technology.
[0169] In some embodiments, the terminal 900 further includes one or more sensors 909. The one or more sensors 909 include, but are not limited to, an accelerometer 910, a gyroscope 911, a pressure sensor 912, an optical sensor 913, and a proximity sensor 914.
[0170] Accelerometer 910 can detect the magnitude of acceleration on the three coordinate axes of a coordinate system established by terminal 900. For example, accelerometer 910 can be used to detect the components of gravitational acceleration on the three coordinate axes. Processor 901 can control display screen 905 to display the user interface in either a landscape or portrait view based on the gravitational acceleration signal acquired by accelerometer 910. Accelerometer 910 can also be used for games or for acquiring user motion data.
[0171] The gyroscope sensor 911 can detect the orientation and rotation angle of the terminal 900. The gyroscope sensor 911, in conjunction with the accelerometer sensor 910, can collect 3D motion data from the user on the terminal 900. Based on the data collected by the gyroscope sensor 911, the processor 901 can perform the following functions: motion sensing (e.g., changing the UI based on the user's tilt), image stabilization during shooting, game control, and inertial navigation.
[0172] The pressure sensor 912 can be disposed on the side bezel of the terminal 900 and / or the lower layer of the display screen 905. When the pressure sensor 912 is disposed on the side bezel of the terminal 900, it can detect the user's grip signal on the terminal 900, and the processor 901 can perform left / right hand recognition or quick operation based on the grip signal collected by the pressure sensor 912. When the pressure sensor 912 is disposed on the lower layer of the display screen 905, the processor 901 can control the operable controls on the UI interface based on the user's pressure operation on the display screen 905. The operable controls include at least one of button controls, scroll bar controls, icon controls, and menu controls.
[0173] An optical sensor 913 is used to collect ambient light intensity. In one embodiment, the processor 901 can control the display brightness of the display screen 905 based on the ambient light intensity collected by the optical sensor 913. Optionally, when the ambient light intensity is high, the display brightness of the display screen 905 is increased; when the ambient light intensity is low, the display brightness of the display screen 905 is decreased. In another embodiment, the processor 901 can also dynamically adjust the shooting parameters of the camera assembly 906 based on the ambient light intensity collected by the optical sensor 913.
[0174] The proximity sensor 914, also known as the distance sensor, is installed on the front panel of the terminal 900. The proximity sensor 914 is used to detect the distance between the user and the front of the terminal 900. In one embodiment, when the proximity sensor 914 detects that the distance between the user and the front of the terminal 900 is gradually decreasing, the processor 901 controls the display screen 905 to switch from a screen-on state to a screen-off state; when the proximity sensor 914 detects that the distance between the user and the front of the terminal 900 is gradually increasing, the processor 901 controls the display screen 905 to switch from a screen-off state to a screen-on state.
[0175] Those skilled in the art will understand that Figure 9 The structure shown does not constitute a limitation on terminal 900, and may include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0176] Optionally, the computer device is provided as a server. Figure 10This is a schematic diagram of a server structure provided in an embodiment of this application. The server 1000 can vary significantly due to different configurations or performance. It may include one or more Central Processing Units (CPUs) 1001 and one or more memories 1002. The memories 1002 store at least one computer program, which is loaded and executed by the processor 1001 to implement the methods provided in the above-described method embodiments. Of course, the server may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The server may also include other components for implementing device functions, which will not be elaborated upon here.
[0177] This application also provides a computer-readable storage medium storing at least one computer program, which is loaded and executed by a processor to implement the operations performed by the data processing method of the above embodiments.
[0178] This application also provides a computer program product, including a computer program that is loaded and executed by a processor to perform the operations performed by the data processing method of the above embodiments.
[0179] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0180] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present application should be included within the protection scope of the present application.
Claims
1. A data processing method, characterized in that, The method includes: Acquire 3D model data, which is used to render to a screen. The screen includes multiple pixel positions, and each pixel position on the screen corresponds to its own linked list. The three-dimensional model data is rasterized to obtain multiple fragments. The multiple fragments are added to the linked lists of their respective pixel positions. Each fragment includes a pixel position and a depth. For any pixel position on the screen, the multiple fragments in the linked list of the pixel position are merged according to their depth order to obtain the display information of the pixel position; The image is displayed on the screen based on the display information of each pixel position in the screen.
2. The method according to claim 1, characterized in that, The step of adding the plurality of fragments to the linked lists at their respective pixel positions includes: Allocate a first node for the fragment in the first buffer and store the fragment in the first node; Obtain the head pointer of the linked list at the pixel position of the fragment, where the head pointer of the linked list at the pixel position is used to point to the linked list at the pixel position; Add the first node to the linked list pointed to by the head pointer of the linked list.
3. The method according to claim 2, characterized in that, The step of allocating a first node for the fragment in the first buffer and storing the fragment in the first node includes: Lock the second buffer, which is used to store the node index corresponding to the free node; Read the first node index from the second buffer, and store the fragment in the first node indicated by the first node index; Update the first node index in the second buffer to the second node index, which indicates an idle second node, and the second node is the next node after the first node; Unlock the second buffer.
4. The method according to claim 2, characterized in that, The method further includes: A storage unit is allocated in the third buffer for each pixel position in the screen, and the third buffer includes multiple storage units; The head pointer of the linked list at each pixel location is stored in the storage unit at each pixel location; The step of obtaining the head pointer of the linked list for the pixel position of the fragment includes: The head pointer of the linked list is retrieved from the storage unit at the pixel position of the fragment.
5. The method according to claim 2, characterized in that, The head pointer of the linked list is used to point to the first node in the linked list at the pixel position; adding the first node to the linked list pointed to by the head pointer includes: If the depth of all fragments stored in the linked list is greater than the depth of the fragment of the first node, then the pointer of the first node is set to point to the node pointed to by the head pointer of the linked list, and the head pointer of the linked list is updated to point to the first node. If the depth of the fragment of the third node in the linked list is less than the depth of the fragment of the first node, and the depth of the fragment of the fourth node in the linked list is greater than the depth of the fragment of the first node, then the pointer of the first node is set to point to the fourth node, and the pointer of the third node is updated to point to the first node.
6. The method according to claim 2, characterized in that, The head pointer of the linked list is used to point to the first node in the linked list at the pixel position; adding the first node to the linked list pointed to by the head pointer includes: If the depth of all fragments stored in the linked list is greater than the depth of the fragment of the first node, then the pointer of the last node in the linked list is updated to point to the first node, and the pointer of the first node is set to null. If the depth of the fragment of the fifth node in the linked list is less than the depth of the fragment of the first node, and the depth of the fragment of the sixth node in the linked list is greater than the depth of the fragment of the first node, then the pointer of the first node is set to point to the fifth node, and the pointer of the sixth node is updated to point to the first node.
7. The method according to claim 2, characterized in that, The head pointer of the linked list is used to point to the first node in the linked list at the pixel position; adding the first node to the linked list pointed to by the head pointer includes: Set the pointer of the first node to point to the node pointed to by the head pointer of the linked list, and update the head pointer of the linked list to point to the first node; or, Update the pointer of the last node in the linked list to point to the first node, and set the pointer of the first node to null.
8. The method according to claim 1, characterized in that, The fragment also includes transparency, and adding the plurality of fragments to the linked lists at their respective pixel positions includes: If the transparency of the fragment indicates that the fragment is a transparent fragment, then the fragment is added to the linked list of the pixel positions of the fragment; The method further includes: When the transparency of a fragment indicates that the fragment is opaque, if the depth of the fragment is less than the depth of fragments already stored in the depth buffer, then the fragments already stored in the depth buffer are replaced with the fragment; if the depth of the fragment is not less than the depth of fragments already stored in the depth buffer, then the fragment is discarded.
9. The method according to claim 8, characterized in that, The step of fusing multiple fragments in the linked list at the pixel position according to their depth order to obtain the display information of the pixel position includes: Determine the depth of the first target fragment currently stored in the depth buffer; At least one second target fragment is determined in the linked list at the pixel location, the depth of the second target fragment being less than the depth of the first target fragment; According to the depth order of the first target fragment and the at least one second target fragment, the first target fragment and the at least one second target fragment are fused to obtain the display information of the pixel position.
10. The method according to claim 1, characterized in that, The fragment also includes color; the process of merging multiple fragments in the linked list at the pixel position according to their depth order to obtain the display information of the pixel position includes: According to the depth order of multiple fragments in the linked list of the pixel position, the depth of the multiple fragments in the linked list is merged and the color of the multiple fragments in the linked list is merged to obtain the display information of the pixel position. The display information of the pixel position includes the merged depth and the merged color.
11. A data processing apparatus, characterized in that, The device includes: The acquisition module is used to acquire three-dimensional model data, which is used to render to the screen. The screen includes multiple pixel positions, and each pixel position on the screen corresponds to its own linked list. The first processing module is used to rasterize the three-dimensional model data to obtain multiple fragments, and add the multiple fragments to the linked lists of their respective pixel positions. Each fragment includes a pixel position and a depth. The second processing module is used to, for any pixel position on the screen, merge multiple fragments in the linked list of the pixel position according to the depth order of the multiple fragments in the linked list of the pixel position to obtain the display information of the pixel position; The display module is used to display an image on the screen based on the display information of each pixel position in the screen.
12. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one computer program, which is loaded and executed by the processor to perform the operations of the data processing method as described in any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one computer program, which is loaded and executed by a processor to perform the operations performed by the data processing method as described in any one of claims 1 to 10.
14. A computer program product, comprising a computer program, characterized in that, The computer program is loaded and executed by a processor to perform the operations performed by the data processing method as described in any one of claims 1 to 10.