Data processing method and device
By determining the model material and mesh data indexes in the data cache and constructing batch rendering tasks, the problem of material and mesh limitations in traditional rendering methods is solved, achieving efficient synchronous rendering of materials and meshes and improving rendering performance.
Patent Information
- Application Number
- CN202511374141.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-25
- Publication Date
- 2025-10-31
AI Technical Summary
Traditional rendering methods are limited by material and mesh constraints when dealing with a large number of different materials and mesh models, resulting in low scene rendering efficiency and the inability to achieve batch rendering.
By receiving rendering instructions, determining the model's material and mesh data, determining the corresponding data in the data cache based on the material and mesh indexes, constructing a batch rendering task, and using the GPU to execute the batch rendering task, the synchronous rendering of materials and meshes is achieved.
It enables batch rendering of materials and meshes, improving rendering performance and efficiency, reducing resource consumption, and increasing frame rate.
Smart Images

Figure CN120876700A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to data processing methods. This application also relates to a data processing apparatus, a computing device, a computer-readable storage medium, and a computer program product. Background Technology
[0002] With the development of computer technology, the gaming industry has made unprecedented progress. Thanks to advancements in 3D rendering technology, games with exquisite graphics and realistic scenes are emerging in large numbers.
[0003] In 3D rendering, efficiently rendering complex scenes is a key challenge. Traditional batch rendering pipelines require identical materials and meshes to be merged into a single batch. When processing a large number of models with different materials and meshes, traditional rendering methods suffer from low scene rendering efficiency due to material and mesh limitations, making batch rendering impossible for scenes with diverse materials and meshes. Therefore, a new data processing method is urgently needed to address these issues. Summary of the Invention
[0004] In view of this, embodiments of this application provide a data processing method to address the technical deficiencies existing in the prior art. Embodiments of this application also provide a data processing apparatus, a computing device, a computer-readable storage medium, and a computer program product.
[0005] According to a first aspect of the embodiments of this application, a data processing method is provided, including: Receive rendering instructions submitted for an initial virtual scene, and determine the model material and model mesh corresponding to the initial virtual scene in response to the rendering instructions; In the data cache area, material data corresponding to the model material is determined according to the material data index, and mesh data corresponding to the model mesh is determined according to the mesh data index; Based on the material data and the mesh data, a batch rendering task is constructed, and the target virtual scene corresponding to the initial virtual scene is rendered by executing the batch rendering task.
[0006] According to a second aspect of the embodiments of this application, a data processing apparatus is provided, comprising: The receiving module is configured to receive rendering instructions submitted for an initial virtual scene, and in response to the rendering instructions determine the model material and model mesh corresponding to the initial virtual scene; The determination module is configured to determine the material data corresponding to the model material in the data cache based on the material data index, and to determine the mesh data corresponding to the model mesh based on the mesh data index; The rendering module is configured to construct a batch rendering task based on the material data and the mesh data, and to render the target virtual scene corresponding to the initial virtual scene by executing the batch rendering task.
[0007] According to a third aspect of the embodiments of this application, a data processing method is provided, comprising: Determine the model materials and model meshes corresponding to the initial virtual scene; Obtain the mesh storage data corresponding to the model mesh and the material storage data corresponding to the model material, and store the mesh storage data and the material storage data into the data cache area respectively; Based on the storage results, construct the mesh data index corresponding to the mesh storage data, and construct the material data index corresponding to the material storage data.
[0008] According to a fourth aspect of the embodiments of this application, a computing device is provided, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor executes the computer-executable instructions to implement the steps of the data processing method.
[0009] According to a fifth aspect of the present application, a computer-readable storage medium is provided that stores computer-executable instructions that, when executed by a processor, implement the steps of the data processing method.
[0010] According to a sixth aspect of the present application, a chip is provided that stores a computer program, which, when executed by the chip, implements the steps of the data processing method.
[0011] According to a seventh aspect of the embodiments of this specification, a computer program product is provided, including a computer program or instructions that, when executed by a processor, implement the steps of the data processing method described above.
[0012] The data processing method provided in this application receives rendering instructions submitted for an initial virtual scene and determines the model materials and model meshes corresponding to the initial virtual scene in response to the rendering instructions. In the data cache, material data associated with the model material is determined based on the material data index, and mesh data corresponding to the model mesh is determined based on the mesh data index, thus realizing material data reading and mesh data reading respectively. A batch rendering task is constructed based on the material data and mesh data, and the target virtual scene corresponding to the initial virtual scene is rendered by executing the batch rendering task. This achieves synchronous rendering of the initial virtual scene in both the mesh and material dimensions, realizing batch rendering of materials and meshes and improving rendering performance. Attached Figure Description
[0013] Figure 1 This is a flowchart of a data processing method provided in an embodiment of this application; Figure 2 This is a flowchart illustrating a data processing method for game scene rendering provided in one embodiment of this application; Figure 3 This is a schematic diagram of data reading and writing of a data processing method provided in an embodiment of this application; Figure 4 This is a flowchart of another embodiment of a data processing method provided in this application; Figure 5 This is a schematic diagram of the structure of a data processing device provided in an embodiment of this application; Figure 6 This is a structural block diagram of a computing device provided in one embodiment of this application. Detailed Implementation
[0014] Many specific details are set forth in the following description to provide a full understanding of this application. However, this application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this application; therefore, this application is not limited to the specific embodiments disclosed below.
[0015] The terminology used in one or more embodiments of this application is for the purpose of describing particular embodiments only and is not intended to limit the scope of one or more embodiments of this application. The singular forms “a,” “the,” and “the” used in one or more embodiments of this application and in the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” used in one or more embodiments of this application refers to and includes any or all possible combinations of one or more associated listed items.
[0016] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this application, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this application, and similarly, second may also be referred to as first.
[0017] First, the terminology used in one or more embodiments of the present invention will be explained.
[0018] DrawCall is a basic operation in the graphics rendering pipeline, which refers to the CPU sending an instruction to the GPU to draw one or a group of graphic objects (such as triangles, meshes, etc.).
[0019] Shader: A program that runs on the GPU (graphics card) to control the rendering process of 3D graphics and determine the final color and appearance of each pixel or vertex.
[0020] UV coordinates: These typically refer to the sampling positions of mesh vertices on the texture map (the range is usually 0~1).
[0021] Cluster: A logical or spatial unit partitioned for rendering optimization, used for batching, streaming, compression, etc. It is a runtime management unit serving performance optimization goals. For meshes, the mesh can be divided into multiple clusters based on spatial location.
[0022] In modern 3D rendering, efficiently rendering complex scenes is a key challenge, especially when dealing with a large number of different materials and mesh models. Traditional rendering methods suffer from batching difficulties due to material and mesh limitations. Batch rendering in traditional rendering pipelines requires identical materials and meshes to be merged into a single batch, which severely restricts batching for scenes with diverse materials and meshes. Since each individual material and mesh requires a separate GPU rendering instruction call, this incurs significant overhead and places additional pressure on hardware resources, impacting frame rate and performance.
[0023] Based on this, a data processing method is provided in this application. This application also relates to a data processing apparatus, a computing device, a computer-readable storage medium, and a computer program product. These will be described in detail in the following embodiments.
[0024] Figure 1 A flowchart of a data processing method according to an embodiment of this application is shown, which specifically includes the following steps: Step 102: Receive the rendering command submitted for the initial virtual scene, and determine the model material and model mesh corresponding to the initial virtual scene in response to the rendering command.
[0025] The initial virtual scene can be a game scene or animation scene to be rendered. It can be a scene rendered using 3D rendering. Rendering the initial virtual scene essentially involves rendering the scene model and textures within it. A texture is one (or more) two-dimensional images used to describe the visual details of a model's surface, such as color, roughness, reflection, and bumps. Textures can correspond to different materials, i.e., model materials, which define the visual properties and rendering behavior of an object's surface. A scene model refers to the geometric description of a 3D object, defining its shape, outline, and structure in 3D space. The core components of a model include vertices, faces or triangles, normals, UV coordinates, and bones and weights. Rendering commands are computer commands initiated by the user from the user's terminal to the server regarding the initial virtual scene, used to display the rendered target virtual scene corresponding to the initial virtual scene on the user's terminal. The model mesh can be the mesh corresponding to the scene model in the initial virtual scene.
[0026] The data processing method provided in this application can be applied to a terminal running an initial virtual scene. For example, if the user is using a terminal to render the scene, this method is applied to the terminal; or if the user is using a cloud service, and the virtual scene is generated in the cloud service and transmitted to the user's terminal for display, this method is applied to a cloud server that has deployed the cloud service. In the method provided in this application, the executing entity of this method is not limited, and the actual application shall prevail.
[0027] Step 104: Determine the material data corresponding to the model material in the data cache based on the material data index, and determine the mesh data corresponding to the model mesh based on the mesh data index.
[0028] The data cache stores material data indexes and mesh data indexes, as well as data related to model materials and meshes. The data cache can be a GPU cache, storing the model mesh and texture data of the virtual models included in the initial virtual scene. The material data index is used to query material data associated with the model materials in the data cache. Material data refers to material parameters needed for rendering, such as metallicity, smoothness, natural light, and the mapping coordinates of virtual textures in the physical graph. This information is stored in the data cache (GPU buffer), while the index value corresponding to the material data index is stored in the virtual geometry data structure corresponding to the model mesh. During the rendering phase, material parameters are read from the data cache using the index value to restore the material's state and achieve material rendering.
[0029] Mesh data refers to the vertex data of the model mesh stored in the data cache. The mesh data index is constructed when the mesh data is stored in the data cache and is used to quickly determine the data corresponding to the model mesh in the data cache based on the model mesh representation.
[0030] In the method provided in this application embodiment, after determining the model material and model mesh corresponding to the initial virtual scene in the above steps, the mesh data corresponding to the model mesh and the material data corresponding to the model material can be read from the data cache. For example, if the initial virtual scene contains a mecha model, it is necessary to obtain the mesh data corresponding to the mecha model and the material data corresponding to the mecha model material from the data cache, so that the material features of the mecha model can be rendered simultaneously with the rendering of the mecha model structure.
[0031] In practical applications, before receiving rendering instructions submitted for the initial virtual scene, the process also includes: Determine the model material and the model mesh corresponding to the initial virtual scene; Obtain the mesh storage data corresponding to the model mesh and the material storage data corresponding to the model material, and store the mesh storage data and the material storage data into the data cache area respectively; Based on the storage results, construct the mesh data index corresponding to the mesh storage data, and construct the material data index corresponding to the material storage data.
[0032] Mesh storage data can be understood as the mesh data required by the mesh model corresponding to the initial virtual scene during the rendering phase. Mesh storage data includes, but is not limited to, mesh vertex data. Since a mesh is a geometry composed of vertices and faces, mesh vertex data is a set of attributes describing each mesh vertex. Mesh vertex data determines the vertex's position, appearance, and behavior in space. Mesh vertex data is stored in a data buffer (GPU Buffer), and the index value of the mesh vertex data in this buffer is stored in the virtual geometry data structure of the corresponding model mesh.
[0033] Material storage data can be understood as the material data corresponding to the virtual textures in the initial virtual scene. This material data corresponds to material parameters, which include, but are not limited to, texture maps, normal maps, base colors, metallicity, smoothness, and self-illumination. Materials can be materials with different properties, such as stone, wood, or iron. Different materials correspond to different material parameters, which are recorded in each material. The material parameters are stored in the GPU's buffer in a specific order, and the index values of these parameters in the buffer are stored in the virtual geometry data structure of the corresponding model mesh.
[0034] In the method provided in this application embodiment, before rendering the initial virtual scene, to avoid DrawCalls for each mesh and each texture, the material storage data corresponding to the model material and the mesh storage data corresponding to the model mesh can be structurally stored. The GPU Buffer is used as a data cache, and the mesh vertex data corresponding to each model mesh is stored in the data cache according to the data page format, along with the material data corresponding to each material. Finally, the complete material storage data and mesh storage data are stored separately in the data cache. Subsequently, when rendering the initial virtual scene, the material data and mesh data can be read separately from the data cache for batch processing. With a single DrawCall, the rendering of the virtual scene can be completed using the GPU, improving the rendering efficiency of the virtual scene.
[0035] The method provided in this application embodiment, obtaining the grid storage data corresponding to the model grid, includes: Identify at least one grid vertex corresponding to the model grid, and collect grid vertex data corresponding to each grid vertex; The grid storage data is generated based on the model data corresponding to the model grid and the data of each grid vertex.
[0036] In practical applications, a model mesh is a geometric shape composed of vertices and faces (usually triangles) used to represent the shape of an object. Examples include a cube, a character model, and a wall. The process involves determining all the vertices corresponding to the model mesh, collecting vertex data for each vertex, and then compiling this into mesh vertex data. Vertex data is a set of attributes describing each vertex, determining its position, appearance, and behavior in space. Model data refers to the data required for rendering the mesh model itself, including but not limited to animation-related data (bone weights, skinning information) and material data references.
[0037] In the method provided in this application embodiment, the initial virtual scene includes at least one model, each model corresponds to a model mesh and a model material, and each model mesh contains at least one cluster, that is, the model mesh is divided into at least one cluster according to the number of mesh vertices corresponding to the model mesh. When storing the mesh data corresponding to the initial virtual scene, data extraction and storage can be performed for each model mesh. For example, the model mesh and model material are determined in model A. For the model mesh in model A, the clusters contained in the model mesh are determined, data is extracted for each cluster to obtain the model data required for rendering the model itself, and the mesh vertex data corresponding to the vertices contained in the cluster, and mesh storage data is generated based on the model data and the mesh vertex data.
[0038] In one specific embodiment provided in this application, for a game scene, before rendering the game scene, the models contained in the game scene can be determined first, including the model meshes and model materials. For the model meshes, to avoid performing a DrawCall for each mesh during game scene rendering, all model mesh data can be batch-stored. That is, for each model mesh, data is collected from each cluster contained within the model mesh and sequentially batch-stored into a data cache. This allows for batch extraction of model mesh data during subsequent virtual scene rendering, achieving batch processing of model mesh data and reducing resource overhead.
[0039] The method provided in this application embodiment, obtaining the material storage data corresponding to the model material, includes: Identify at least one model sub-texture associated with the model material, and merge the at least one model sub-texture to obtain the material storage data corresponding to the model material.
[0040] In the method provided in this application embodiment, the initial virtual scene includes at least one model material, each with a different texture. For the model materials, virtual texture technology can be used to map the textures of different materials to a single large texture space. That is, at least one model sub-texture associated with a model material is stitched together horizontally to obtain a large texture map, and the offset information of each model sub-texture in the large texture map is recorded. The offset information is the UV mapping coordinate, used to index the texture data corresponding to the model sub-texture. The offset information and material parameters corresponding to at least one model sub-texture constitute material storage data. The material storage data is stored in a data cache area, and a material data index is generated, thus realizing structured storage of the material storage data.
[0041] In practical applications, during the shading stage, the material storage data in the data buffer (GPU Buffer) can be accessed through the material data index. The material storage data contains the mapping data of the model's sub-textures. The actual physical texture data can be read through the mapping data, and texture rendering can be completed.
[0042] The method provided in this application embodiment includes determining material data corresponding to the model material in a data cache based on a material data index, and determining mesh data corresponding to the model mesh based on a mesh data index, including: Within the data cache area, a material data cache area and a mesh data cache area are determined; The material data associated with the model material is determined in the material data cache based on the material data index; The grid data corresponding to the model grid is determined in the grid data cache area according to the grid data index.
[0043] The material data cache and mesh data cache can be understood as sub-caches within the data cache, used to store model material-related data and model mesh-related data, respectively. Model mesh-related data is stored in the mesh data cache using virtual geometry technology, while model material-related data is stored in the material data cache using virtual texture technology.
[0044] In one specific embodiment provided in this application, taking a game scene as an example, the data cache area includes a material data cache area and a mesh data cache area. The material data cache area stores data related to the model materials contained in the initial virtual scene, and the mesh data cache area stores data related to the model meshes contained in the initial virtual scene. Upon receiving a rendering command for the initial virtual scene, rendering of the initial virtual scene can begin in response to the rendering command. Rendering the initial virtual scene essentially involves rendering the model meshes and model materials within the initial virtual scene.
[0045] The method provided in this application embodiment determines the material data associated with the model material in the material data cache based on the material data index, and determines the mesh data corresponding to the model mesh in the mesh data cache based on the mesh data index, thereby improving the acquisition efficiency of the two types of data.
[0046] Step 106: Construct a batch rendering task based on the material data and the mesh data, and render the target virtual scene corresponding to the initial virtual scene by executing the batch rendering task.
[0047] Specifically, batch rendering can be used to render a target virtual scene based on material and mesh data. A batch rendering task can be generated by calling a single GPU rendering command; that is, a draw call command (DrawCall) is submitted to the GPU based on material and mesh data to generate a batch rendering task. Executing this batch rendering task completes the rendering of the target virtual scene. The target virtual scene is the visualized scene obtained after rendering, corresponding to the initial virtual scene.
[0048] In the method provided in this application embodiment, after obtaining material data and mesh data in the above steps, a batch rendering task can be generated based on the material data and mesh data. By executing the batch rendering task, the rendering of the target virtual scene can be completed. When executing the batch rendering task, a DrawCall is implemented by submitting a single draw call instruction to the GPU based on the material data and mesh data. When the GPU completes the rendering of the target virtual scene, it indicates that the batch rendering task has been completed.
[0049] In practical applications, when rendering mecha scenes for games, rendering the mecha involves rendering both model materials and model meshes. Material data for the model materials and mesh data for the model meshes can be read separately from the GPU buffer. These material and mesh data can then be batch-processed to generate a batch rendering task. During the batch rendering task, a DrawCall is executed based on the material and mesh data, sending a drawing command to the GPU, which can then complete the rendering of the target virtual scene.
[0050] The method provided in this application embodiment constructs a batch rendering task based on the material data and the mesh data, including: Determine at least one material sub-data item contained in the material data, and at least one mesh sub-data item contained in the mesh data; Based on the matching relationship between the at least one material sub-data and the at least one mesh sub-data, at least one set of data pairs is constructed; Construct rendering subtasks for each set of data pairs, and generate the batch rendering task based on each rendering subtask.
[0051] In this embodiment, mesh data is stored page-by-page in the data cache, with each mesh data corresponding to at least one mesh page. The mesh sub-data corresponding to each mesh page is stored sequentially in the data cache. For each model in the initial virtual scene, each model corresponds to a model mesh and a model material, and there is a matching relationship between the two at the model dimension. The material data includes material sub-data such as color and texture.
[0052] Material data corresponds to at least one mesh sub-data, forming a data pair. The associated material and mesh sub-data of this data pair are read from the data buffer and batched. A rendering sub-task can then be generated based on the batched data. The rendering sub-tasks corresponding to each model in the initial virtual scene constitute the batched rendering task. During the execution of the batched rendering task, at least one rendering sub-task in the batched rendering task can be executed in parallel to complete the rendering of the target virtual scene, thereby achieving batch rendering of meshes and materials and improving the rendering efficiency of the target virtual scene.
[0053] The method provided in this application embodiment can construct a batch rendering task based on multiple rendering subtasks. Subsequently, by executing the batch rendering task, the batch rendering of meshes and materials can be achieved, thereby improving the rendering efficiency of virtual scenes.
[0054] In the method provided in this application embodiment, before rendering the target virtual scene corresponding to the initial virtual scene by executing the batch rendering task, the method further includes: Receive the task execution instruction associated with the batch rendering task; The step of rendering the target virtual scene corresponding to the initial virtual scene by executing the batch rendering task includes: In response to the task execution instruction, the batch rendering task is executed to render the target virtual scene corresponding to the initial virtual scene.
[0055] The task execution instruction can be understood as the DrawCall command submitted by the server to the GPU, which is used to render the target virtual scene using the CPU.
[0056] In the method provided in this application embodiment, generating a batch rendering task indicates that the batch processing of the model mesh and model materials corresponding to the initial virtual scene has been completed, merging the model materials and model mesh corresponding to the initial virtual scene into a single rendering batch. Sending a DrawCall to the GPU based on the data corresponding to the batch rendering task is equivalent to initiating a task execution instruction to the GPU. Once the GPU completes the rendering of the target virtual scene, it indicates that the batch rendering task has been successfully executed.
[0057] In practical applications, the initial game scene corresponds to models such as mechs and buildings, each model has different materials, and different materials have different textures. When rendering the initial game scene, a batch rendering task can be determined. By making a single DrawCall to the GPU, the batch rendering task can be executed, ultimately rendering the target game scene containing visualized models such as mechs and buildings. This improves the rendering efficiency of the game scene while ensuring scene detail.
[0058] The method provided in this application embodiment renders the target virtual scene corresponding to the initial virtual scene by executing the batch rendering task, including: Invoke the shader to execute the batch rendering task and determine the rendering data associated with the batch rendering task; The target virtual scene corresponding to the initial virtual scene is rendered based on the rendering data.
[0059] The rendering data includes mesh data and material data to be rendered. When rendering the target virtual scene, multiple meshes can be drawn uniformly based on the vertex indices of the virtual geometry. The UV offset parameters of the virtual texture ensure that different materials are correctly rendered in the same batch of rendering; that is, UV mapping is dynamically adjusted in the shader to support the correct display of different materials.
[0060] In the method provided in this application embodiment, the position of the virtual texture in the physical graph varies depending on the model's location in the initial virtual scene. The position of the virtual texture in the physical graph is not fixed; it varies depending on the loading time, specifically which cells in the physical graph are idle at the moment the virtual texture needs to be loaded. Idle cells are allocated to store the texture data of the virtual texture. For example, the model material records the texture's position, starting coordinates, and dimensions in the virtual texture. When a part of the texture in the virtual texture is to be used, that part of the texture is filled into the GPU physical graph, and its position in the physical graph is recorded in the virtual texture. Based on the recorded position, the shader determines the actual coordinate position in the GPU physical graph, and then samples the texture in the physical graph according to the actual coordinate position to complete texture rendering.
[0061] The data processing method provided in this application receives rendering instructions submitted for an initial virtual scene and determines the model materials and model meshes corresponding to the initial virtual scene in response to the rendering instructions. In the data cache, material data associated with the model material is determined based on the material data index, and mesh data corresponding to the model mesh is determined based on the mesh data index, thus realizing material data reading and mesh data reading respectively. A batch rendering task is constructed based on the material data and mesh data, and the target virtual scene corresponding to the initial virtual scene is rendered by executing the batch rendering task. This achieves synchronous rendering of the initial virtual scene in both the mesh and material dimensions, realizing batch rendering of materials and meshes and improving rendering performance.
[0062] The following is in conjunction with the appendix Figure 2 Taking the data processing method provided in this application for game scene rendering as an example, the data processing method will be further explained. Among other things, Figure 2 This application provides a flowchart illustrating a data processing method for game scene rendering according to an embodiment of the present application, which specifically includes the following steps: Step 202: Determine the model materials and model mesh corresponding to the initial virtual scene.
[0063] The initial virtual scene can be a game scene, an animation scene, or any other virtual scene that needs to be displayed through rendering. In 3D rendering, model materials and model meshes are two core components of a 3D model. They work together to determine the final visual appearance of an object on the screen. Model materials define the visual properties of an object's surface, i.e., "what the object looks like." They control the surface properties of the model, such as color, reflectivity, roughness, transparency, and whether it emits light. Materials typically rely on shaders to implement rendering logic and can reference one or more texture images to add detail.
[0064] Step 204: Determine at least one mesh vertex associated with the model mesh and collect the mesh vertex data corresponding to each mesh vertex.
[0065] Step 206: Generate mesh storage data based on the model data and vertex data corresponding to the model mesh.
[0066] In practical applications, a model mesh represents the geometric structure of a 3D model, defining the shape and outline of an object. A mesh consists of a series of vertices, each containing position coordinates (x, y, z), and may also contain information such as normals, texture coordinates, color, and tangents. These vertices are connected by triangular patches to form a polygonal model. For the 3D model contained in the initial virtual scene, it is necessary to collect the mesh vertex data of each mesh vertex, as well as the model data corresponding to the model itself. Based on the mesh vertex data and model data, the corresponding mesh storage data that needs to be stored is formed. By using virtual geometry technology, the vertex data of different meshes in the initial virtual scene are stored and managed in a unified manner, realizing the merging of multiple meshes into a single virtual geometry, and using a unified data structure to store all vertex, normal, and other information.
[0067] Step 208: Determine at least one model texture associated with the model material, merge at least one model texture, and generate material storage data corresponding to the model material based on the model texture data.
[0068] For each model material, there is at least one corresponding texture, and each material has parameters such as metallicity, smoothness, and self-illumination. Virtual texture technology can be used to map the textures of different materials to a single large texture space. That is, the textures of multiple materials are preprocessed into a single virtual texture, enabling horizontal stitching of the textures while recording the UV mapping offset coordinates of each material. The UV mapping offset coordinates can be used as one type of data for indexing the texture. The material storage data that needs to be stored consists of the parameters required for model material rendering (such as metallicity, smoothness, self-illumination, and the mapping coordinates of the virtual texture in the physical graph). This data needs to be stored in a data cache in a specific order.
[0069] In practice, the process for determining the mesh storage data and material storage data can be found in [reference needed]. Figure 3 .like Figure 3 As shown, the initial virtual scene can contain N 3D models, from Model A to Model N. Each model corresponds to two parts: a mesh and materials. Each of the N models (Model A to Model N) contains pages 0 to N, and each page contains multiple clusters. Each cluster can be considered as a set of vertices consisting of at least one vertex. Each of the N models (Model A to Model N) also corresponds to materials A to Material N, with each material having parameters such as color, texture, normals, metallicity, and smoothness.
[0070] Step 210: Store the mesh storage data and material storage data in the data cache area respectively, and construct the mesh data index corresponding to the mesh storage data and the material data index corresponding to the material storage data.
[0071] In practical applications, the storage of mesh storage data and material storage data can be found in [reference needed]. Figure 3 The data buffer can be a GPU buffer, such as... Figure 3 As shown, mesh storage data and material storage data can be stored in the page buffer and material buffer of the GPU Buffer, respectively. Mesh storage data is collected from the data pages corresponding to each mesh and stored page by page in the page buffer. Material storage data is collected from the materials corresponding to each model and stored model by model in the material buffer.
[0072] In practice, separate indexes need to be built for mesh storage data and material storage data to facilitate subsequent data retrieval. The index value of the material in the buffer will be stored in the corresponding virtual geometry data structure, and the material state can be restored by reading the data from the buffer using this index value during the drawing phase.
[0073] Step 212: Receive the rendering command submitted for the initial virtual scene, and in response to the rendering command, determine the material of the model to be rendered and the mesh of the model to be rendered corresponding to the initial virtual scene.
[0074] Step 214: Determine the material data cache and mesh data cache in the data cache area, and determine the material data associated with the material of the model to be rendered in the material data cache area according to the material data index, and determine the mesh data corresponding to the mesh of the model to be rendered in the mesh data cache area according to the mesh data index.
[0075] After storing the mesh and material data, when scene rendering is required, batch processing of meshes and materials can be achieved based on the page buffer and material buffer. The materials and meshes of the models to be rendered need to be determined when rendering the initial virtual scene. The page data corresponding to the mesh and the material parameters corresponding to the material are read from the page buffer and material buffer respectively. Based on the correspondence between meshes and materials, a batch rendering task consisting of multiple model rendering tasks is constructed.
[0076] Step 216: Construct a batch rendering task based on material data and mesh data, and call the shader to execute the batch rendering task to render the target virtual scene corresponding to the initial virtual scene.
[0077] In practical applications, a graphical shader editing tool can be written to automatically generate the corresponding shader code and dynamically adjust the UV mapping in the shader to support the correct display of different materials.
[0078] For batch rendering tasks, only one DrawCall is needed during the task execution, eliminating the need for DrawCalls for each individual material and mesh. This significantly reduces the number of DrawCalls and improves rendering performance. Scene and modeling artists no longer need to consider how to reduce DrawCalls during the production process; they can focus on creating more aesthetically pleasing scenes and models, allowing them to concentrate more on art production.
[0079] Figure 4 A flowchart of a data processing method provided in another embodiment of this application is shown, such as... Figure 4 As shown, the method includes the following steps: Step 402: Determine the model materials and model mesh corresponding to the initial virtual scene; Step 404: Obtain the mesh storage data corresponding to the model mesh and the material storage data corresponding to the model material, and store the mesh storage data and the material storage data into the data cache area respectively; Step 406: Construct the mesh data index corresponding to the mesh storage data and the material data index corresponding to the material storage data based on the storage results.
[0080] In this implementation, to avoid DrawCalls for each mesh and texture before rendering the initial virtual scene, the material storage data corresponding to the model materials and the mesh storage data corresponding to the model meshes are first stored in a structured manner. The GPU Buffer is used as a data cache. The vertex data of each model mesh is stored in the data cache according to the data page format, and the material data corresponding to each material is stored individually. Finally, the complete material storage data and mesh storage data are stored separately in the data cache. Subsequently, when rendering the initial virtual scene, the material data and mesh data can be read separately from the data cache for batch processing. With a single DrawCall, the rendering of the virtual scene can be completed using the GPU.
[0081] The method provided in this application overcomes the limitations of materials and meshes, achieving batch storage of cross-material and cross-mesh data through unified geometry and material processing. This improves the storage efficiency and access speed of mesh and material data, thereby significantly enhancing the overall performance of virtual scene rendering.
[0082] Corresponding to the above method embodiments, this application also provides data processing apparatus embodiments. Figure 5 A schematic diagram of the structure of a data processing apparatus according to an embodiment of this application is shown. Figure 5 As shown, the device includes: The receiving module 502 is configured to receive rendering instructions submitted for an initial virtual scene, and determine the model material and model mesh corresponding to the initial virtual scene in response to the rendering instructions. The determination module 504 is configured to determine the material data corresponding to the model material in the data cache based on the material data index, and to determine the mesh data corresponding to the model mesh based on the mesh data index; The rendering module 506 is configured to construct a batch rendering task based on the material data and the mesh data, and to render the target virtual scene corresponding to the initial virtual scene by executing the batch rendering task.
[0083] Optionally, the determining module 504 is further configured to: Within the data cache area, a material data cache area and a mesh data cache area are determined; The material data associated with the model material is determined in the material data cache based on the material data index; The grid data corresponding to the model grid is determined in the grid data cache area according to the grid data index.
[0084] Optionally, the rendering module 506 is further configured to: Determine at least one material sub-data item contained in the material data, and at least one mesh sub-data item contained in the mesh data; Based on the matching relationship between the at least one material sub-data and the at least one mesh sub-data, at least one set of data pairs is constructed; Construct rendering subtasks for each set of data pairs, and generate the batch rendering task based on each rendering subtask.
[0085] Optionally, the rendering module 506 is further configured to: Receive the task execution instruction associated with the batch rendering task; The step of rendering the target virtual scene corresponding to the initial virtual scene by executing the batch rendering task includes: In response to the task execution instruction, the batch rendering task is executed to render the target virtual scene corresponding to the initial virtual scene.
[0086] Optionally, the determining module 504 is further configured to: Determine the model material and the model mesh corresponding to the initial virtual scene; Obtain the mesh storage data corresponding to the model mesh and the material storage data corresponding to the model material, and store the mesh storage data and the material storage data into the data cache area respectively; Based on the storage results, construct the mesh data index corresponding to the mesh storage data, and construct the material data index corresponding to the material storage data.
[0087] Optionally, the determining module 504 is further configured to: Identify at least one grid vertex corresponding to the model grid, and collect grid vertex data corresponding to each grid vertex; The grid storage data is generated based on the model data corresponding to the model grid and the data of each grid vertex.
[0088] Optionally, the determining module 504 is further configured to: Identify at least one model sub-texture associated with the model material, and merge the at least one model sub-texture to obtain the material storage data corresponding to the model material.
[0089] Optionally, the rendering module 506 is further configured to: Invoke the shader to execute the batch rendering task and determine the rendering data associated with the batch rendering task; The target virtual scene corresponding to the initial virtual scene is rendered based on the rendering data.
[0090] The data processing apparatus provided in this application receives rendering instructions submitted for an initial virtual scene and determines the model materials and model meshes corresponding to the initial virtual scene in response to the rendering instructions. In the data cache, it determines the material data associated with the model material based on the material data index, and the mesh data corresponding to the model mesh based on the mesh data index, thereby realizing material data reading and mesh data reading respectively. Based on the material data and mesh data, a batch rendering task is constructed, and the target virtual scene corresponding to the initial virtual scene is rendered by executing the batch rendering task. This achieves synchronous rendering of the initial virtual scene in both the mesh and material dimensions, realizing batch rendering of materials and meshes and improving rendering performance.
[0091] The above is an illustrative scheme of a data processing apparatus according to this embodiment. It should be noted that the technical solution of this data processing apparatus and the technical solution of the aforementioned data processing method belong to the same concept. Details not described in detail in the technical solution of the data processing apparatus can be found in the description of the technical solution of the aforementioned data processing method. Furthermore, the components in the apparatus embodiment should be understood as functional modules necessary to implement each step of the program flow or each step of the method; these functional modules are not actual functional divisions or separations. An apparatus claim defined by such a set of functional modules should be understood as a functional module architecture that primarily implements the solution through the computer program described in the specification, and not as a physical device that primarily implements the solution through hardware.
[0092] Figure 6 A structural block diagram of a computing device 600 according to an embodiment of this application is shown. The components of the computing device 600 include, but are not limited to, a memory 610 and a processor 620. The processor 620 is connected to the memory 610 via a bus 630, and a database 650 is used to store data.
[0093] The computing device 600 also includes an access device 640, which enables the computing device 600 to communicate via one or more networks 660. Examples of these networks include a Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the Internet. The access device 640 may include one or more of any type of wired or wireless network interface (e.g., a Network Interface Card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) interface, a Wi-MAX interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.
[0094] In one embodiment of this application, the aforementioned components of the computing device 600 and Figure 6 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 6 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this application. Those skilled in the art can add or replace other components as needed.
[0095] The computing device 600 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or PCs. The computing device 600 can also be a mobile or stationary server.
[0096] The processor 620 is used to execute computer-executable instructions for the data processing method.
[0097] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the data processing method described above belong to the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the data processing method described above.
[0098] One embodiment of this application also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, are used for a data processing method.
[0099] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the data processing method described above belong to the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the data processing method described above.
[0100] One embodiment of this application also provides a chip that stores a computer program, which, when executed by the chip, implements the steps of the data processing method.
[0101] An embodiment of this specification also provides a computer program product, including a computer program or instructions that, when executed by a processor, implement the steps of the above-described data processing method.
[0102] The above is an illustrative scheme of a computer program product according to this embodiment. It should be noted that the technical solution of this computer program product and the technical solution of the data processing method described above belong to the same concept. For details not described in detail in the technical solution of the computer program product, please refer to the description of the technical solution of the data processing method described above.
[0103] The foregoing has described specific embodiments of this application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0104] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or certain intermediate forms. The computer-readable medium may include any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added to or subtracted according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.
[0105] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0106] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0107] The preferred embodiments disclosed above are merely illustrative of this application. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this application. These embodiments are selected and specifically described in this application to better explain the principles and practical applications of this application, thereby enabling those skilled in the art to better understand and utilize this application. This application is limited only by the claims and their full scope and equivalents.
Claims
1. A data processing method, characterized in that, include: Receive rendering instructions submitted for an initial virtual scene, and determine the model material and model mesh corresponding to the initial virtual scene in response to the rendering instructions; In the data cache area, material data corresponding to the model material is determined according to the material data index, and mesh data corresponding to the model mesh is determined according to the mesh data index; Based on the material data and the mesh data, a batch rendering task is constructed, and the target virtual scene corresponding to the initial virtual scene is rendered by executing the batch rendering task.
2. The method as described in claim 1, characterized in that, The step of determining the material data corresponding to the model material in the data cache based on the material data index, and determining the mesh data corresponding to the model mesh based on the mesh data index, includes: Within the data cache area, a material data cache area and a mesh data cache area are determined; The material data associated with the model material is determined in the material data cache based on the material data index; The grid data corresponding to the model grid is determined in the grid data cache area according to the grid data index.
3. The method as described in claim 1, characterized in that, The process of constructing a batch rendering task based on the material data and the mesh data includes: Determine at least one material sub-data item contained in the material data, and at least one mesh sub-data item contained in the mesh data; Based on the matching relationship between the at least one material sub-data and the at least one mesh sub-data, at least one set of data pairs is constructed; Construct rendering subtasks for each set of data pairs, and generate the batch rendering task based on each rendering subtask.
4. The method as described in claim 1, characterized in that, Before rendering the target virtual scene corresponding to the initial virtual scene by executing the batch rendering task, the method further includes: Receive the task execution instruction associated with the batch rendering task; The step of rendering the target virtual scene corresponding to the initial virtual scene by executing the batch rendering task includes: In response to the task execution instruction, the batch rendering task is executed to render the target virtual scene corresponding to the initial virtual scene.
5. The method as described in claim 1, characterized in that, Before receiving the rendering instructions submitted for the initial virtual scene, the process also includes: Determine the model material and the model mesh corresponding to the initial virtual scene; Obtain the mesh storage data corresponding to the model mesh and the material storage data corresponding to the model material, and store the mesh storage data and the material storage data into the data cache area respectively; Based on the storage results, construct the mesh data index corresponding to the mesh storage data, and construct the material data index corresponding to the material storage data.
6. The method as described in claim 5, characterized in that, The step of obtaining the grid storage data corresponding to the model grid includes: Identify at least one grid vertex corresponding to the model grid, and collect grid vertex data corresponding to each grid vertex; The grid storage data is generated based on the model data corresponding to the model grid and the data of each grid vertex.
7. The method as described in claim 5, characterized in that, The step of obtaining the material storage data corresponding to the model material includes: Identify at least one model sub-texture associated with the model material, and merge the at least one model sub-texture to obtain the material storage data corresponding to the model material.
8. The method as described in claim 1, characterized in that, The step of rendering the target virtual scene corresponding to the initial virtual scene by executing the batch rendering task includes: Invoke the shader to execute the batch rendering task and determine the rendering data associated with the batch rendering task; The target virtual scene corresponding to the initial virtual scene is rendered based on the rendering data.
9. A data processing method, characterized in that, include: Determine the model materials and model meshes corresponding to the initial virtual scene; Obtain the mesh storage data corresponding to the model mesh and the material storage data corresponding to the model material, and store the mesh storage data and the material storage data into the data cache area respectively; Based on the storage results, construct the mesh data index corresponding to the mesh storage data, and construct the material data index corresponding to the material storage data.
10. A data processing apparatus, characterized in that, include: The receiving module is configured to receive rendering instructions submitted for an initial virtual scene, and in response to the rendering instructions determine the model material and model mesh corresponding to the initial virtual scene; The determination module is configured to determine the material data corresponding to the model material in the data cache based on the material data index, and to determine the mesh data corresponding to the model mesh based on the mesh data index; The rendering module is configured to construct a batch rendering task based on the material data and the mesh data, and to render the target virtual scene corresponding to the initial virtual scene by executing the batch rendering task.
11. A computing device, characterized in that, include: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the steps of the method according to any one of claims 1 to 9.
12. A computer-readable storage medium storing computer instructions, characterized in that, When executed by the processor, this instruction implements the steps of the method according to any one of claims 1 to 9.
13. A computer program product, characterized in that, It includes a computer program or instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Batch rendering method, device and equipment and storage medium
CN116977537A
Model data processing method and model data processing device
CN119271640A
