Texture rendering method and device, electronic equipment, storage medium and program product
By obtaining vertex identifier information and querying the texture map using the index record table, the problems of UV unwrapping accuracy and video memory waste are solved, achieving higher precision and efficiency in texture rendering.
Patent Information
- Application Number
- CN202411344820.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2025-01-10
AI Technical Summary
In the skinning and decal techniques for complex models, the accuracy decreases after UV unwrapping, which limits the precision of the decal position. Furthermore, traditional methods lead to wasted video memory, affecting system performance and resource utilization.
By obtaining the vertex identifier information of the object to be rendered, querying the vertex parameter information using the first index record table, and querying the texture map using the second index record table, the texture map is applied only at the actual required locations, avoiding the precision limitations of full UV unwrapping and reducing video memory waste.
It improves the accuracy of texture mapping and rendering efficiency, reduces video memory waste, and enhances the accuracy and efficiency of rendering effects.
Smart Images

Figure CN119295634A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of image rendering technology, and in particular to a texture rendering method, device, electronic device, storage medium and program product. Background Art
[0002] In computer graphics, in order to improve the details and realism of characters, rendering decal effects on the character surface has become an important technical requirement. These effects include scratches, scars, etc., which are designed to make the characters more vivid and realistic. As a means of dynamically rendering the surface details of characters, skinning decal technology has attracted the attention of more and more developers.
[0003] In related technologies, skinning and decaling technology realizes full UV expansion (unfolding the 3D model to the coordinates of the 2D plane) for the object and bakes the decal results. However, when there are many parts in the model, due to hardware conditions, the accuracy of UV expansion decreases, the accuracy of decal position is limited, and not all positions after UV expansion need decals, which wastes video memory. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides a texture rendering method. One or more embodiments of the present invention also relate to a texture rendering device, a computing device, a computer-readable storage medium and a computer program product to solve the technical defects existing in the prior art.
[0005] According to a first aspect of an embodiment of the present invention, there is provided a texture rendering method, comprising: Obtain vertex identification information of multiple vertices of a target component in an object to be rendered; Based on the first index record table, query the vertex parameter information corresponding to each vertex identification information, wherein the first index record table includes a first correspondence between the vertex identification information and the vertex parameter information, and each vertex parameter information is used to determine the texture position; Based on the second index record table, query the texture map corresponding to each vertex identification information, wherein the second index record table includes a second correspondence between the vertex identification information and the texture map; Render the target component based on the vertex parameter information and texture map corresponding to each vertex identification information.
[0006] According to a second aspect of an embodiment of the present invention, there is provided a texture rendering device, comprising: An acquisition module is configured to acquire vertex identification information of multiple vertices of a target component in an object to be rendered; A first query module is configured to query vertex parameter information corresponding to each vertex identification information based on a first index record table, wherein the first index record table includes a first correspondence between the vertex identification information and the vertex parameter information, and each vertex parameter information is used to determine a texture position; A second query module is configured to query the texture map corresponding to each vertex identification information based on a second index record table, wherein the second index record table includes a second correspondence between the vertex identification information and the texture map; The rendering module is configured to render the target component based on the vertex parameter information and the texture map corresponding to each vertex identification information.
[0007] According to a third aspect of an embodiment of the present invention, there is provided a computing device, including: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the above-mentioned texture rendering method are implemented.
[0008] According to a fourth aspect of an embodiment of the present invention, a computer-readable storage medium is provided, which stores a computer program / instruction, and the computer program / instruction implements the steps of the above-mentioned texture rendering method when executed by a processor.
[0009] According to a fifth aspect of an embodiment of the present invention, there is provided a computer program product, comprising a computer program / instruction, which implements the steps of the above-mentioned texture rendering method when executed by a processor.
[0010] An embodiment of the present invention realizes obtaining vertex identification information of multiple vertices of a target component in a to-be-rendered object; based on a first index record table, querying vertex parameter information corresponding to each vertex identification information, wherein the first index record table includes a first correspondence between the vertex identification information and the vertex parameter information, and each vertex parameter information is used to determine a texture position; based on a second index record table, querying a texture map corresponding to each vertex identification information, wherein the second index record table includes a second correspondence between the vertex identification information and the texture map; based on the vertex parameter information corresponding to each vertex identification information and the texture map, rendering the target component. Based on the vertex identification information, querying the corresponding vertex parameter information in the first index record table to accurately describe the texture position, and then, based on this information, searching for a specific texture map in the second index record table, avoiding the precision limitation problem of full UV expansion, because the texture map is only applied to the texture position actually required, rather than all expanded positions, thereby reducing the waste of video memory and improving the precision of the texture map position and rendering efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1is a structural interaction diagram of a texture rendering system provided by an embodiment of the present invention; Figure 2 is a flow chart of a texture rendering method provided by an embodiment of the present invention; Figure 3 is a process flow chart of a texture rendering method provided by an embodiment of the present invention; Figure 4 It is a schematic diagram of a block record of UV information provided by an embodiment of the present invention; Figure 5 is a schematic diagram of rearranging a bounding box provided by an embodiment of the present invention; Figure 6 is a structural schematic diagram of a texture rendering device provided by an embodiment of the present invention; Figure 7 It is a structural block diagram of a computing device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0012] Many specific details are set forth in the following description to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present invention, so the present invention is not limited to the specific implementation disclosed below.
[0013] The terms used in one or more embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present invention. The singular forms of "a", "said" and "the" used in one or more embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of the present invention refers to and includes any or all possible combinations of one or more associated listed items.
[0014] It should be understood that, although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present invention, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present invention, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0015] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0016] First, the terms involved in one or more embodiments of the present invention are explained.
[0017] Decal Texture: Create a dedicated decal texture for the skinned object, draw the damage effect on the texture, and dynamically overlay them on the model surface when the game is running. This method is suitable for minor damage effects, has low performance requirements, has severe low-resolution aliasing, and has a large overhead for large-scale use of video memory.
[0018] GPU: Graphics processing unit, also known as display core, visual processor, display chip, is a microprocessor that specializes in image and graphics related computing on personal computers, workstations, game consoles and some mobile devices (such as tablets, smart phones, etc.).
[0019] Triangle: The basic geometric unit used in 3D graphics to represent the surface of a 3D model. A triangle is a planar polygon consisting of three vertices, which define a triangle. In 3D modeling and computer graphics, complex 3D models are usually composed of many triangles, which together constitute the surface of the model.
[0020] Bounding box: For each triangular face, we calculate a cube that encloses the triangle. This is done to simplify collision detection, because detecting collisions between cubes is much simpler than detecting collisions between triangles. For example: think of the path of a bullet as a cylinder. The path of a bullet can be defined as a straight line segment from the launch point to the expected end point, and the radius of the cylinder depends on the size of the bullet or the required collision accuracy. Then, check whether this cylinder intersects with the bounding box in the scene to determine whether the bullet hits the triangular face.
[0021] In computer graphics, in order to enhance the details and realism of characters, rendering decal effects on the character surface has become an important technical requirement. These decal effects include scratches, scars, dirt, etc., with the purpose of making the character look more vivid and realistic. Skinning decal technology is a means of dynamically rendering the surface details of characters, and has attracted more and more attention from developers in recent years.
[0022] The core of skinning decal technology is to use full UV technology. This process involves unfolding a 3D model onto a 2D plane so that decal textures can be applied to this plane. Simply put, full UV is a process that "unfolds" the surface of a 3D model into a plane, allowing developers to accurately paint and apply textures on this plane. Decal effects such as scratches and scars are drawn on the unfolded 2D plane, and then these textures are "baked" onto the model. This method allows for detailed texturing of character surfaces in games or virtual environments, thereby enhancing visual effects and realism.
[0023] However, when the model has many parts, skinning decal technology will face some challenges. Due to hardware limitations, the unfolded UV map may cause a decrease in accuracy, which limits the accuracy of the decal position. For example, if a character's model has many small parts, and these parts are compressed or stretched during UV unfolding, the decal texture may become blurry or inaccurate. This is especially true when dealing with complex characters or highly detailed models, because the unfolded UV map may not provide enough detail resolution.
[0024] In addition, not all areas after UV unfolding need to have decals applied. Since decals are usually only applied to specific areas of the model, such as scars on a character or damaged areas on equipment, these areas may only occupy a small part of the UV map after unfolding. However, traditional baking methods calculate the entire UV area, which leads to a waste of video memory. Because even if most of the unfolded areas do not require decals, they still take up video memory space, thus affecting system performance and resource utilization.
[0025] Therefore, although skinning and decal technology can significantly improve the details and realism of the character, its UV unfolding accuracy and video memory utilization issues are still important challenges that developers need to solve when dealing with complex models.
[0026] In view of the above problems, a texture rendering method is provided in the present invention. The present invention also relates to a texture rendering system, a texture rendering device, a computing device, a computer-readable storage medium, and a computer program product, which are described in detail one by one in the following embodiments.
[0027] See also Figure 1 , Figure 1It is a structural interaction diagram of a texture rendering system provided by an embodiment of the present invention, the texture rendering system includes a server, a material database and a rendering end, the server is used to obtain vertex identification information of multiple vertices of a target component in an object to be rendered, based on a first index record table, query the material database for vertex parameter information corresponding to each vertex identification information, wherein the first index record table includes a first correspondence between vertex identification information and vertex parameter information, each vertex parameter information is used to determine a texture position, based on a second index record table, query the material database for a texture map corresponding to each vertex identification information, wherein the second index record table includes a second correspondence between vertex identification information and texture map, and send the vertex parameter information and texture map to the rendering end; the rendering end is used to render the target component based on the vertex parameter information corresponding to each vertex identification information and the texture map.
[0028] Applied to the texture rendering system, the vertex identification information of multiple vertices of the target component in the object to be rendered is first obtained through the server. Then, based on the first index record table, the server queries the vertex parameter information corresponding to these vertex identification information, and these vertex parameter information are used to accurately describe the position of the texture. Next, the system uses the second index record table to query the corresponding texture map according to these vertex identification information. Since the texture map is only applied to the texture position actually required, rather than all the expanded UV positions, the accuracy limitation problem that may be caused by full UV expansion is avoided. In this way, the system can accurately apply the texture map to the actual texture position of the model, reduce the waste of video memory, and improve the accuracy of the texture map position and rendering efficiency.
[0029] See also Figure 2 , Figure 2 It is a flowchart of a texture rendering method provided by an embodiment of the present invention, which specifically includes the following steps.
[0030] Step 202: Obtain vertex identification information of multiple vertices of a target component in the object to be rendered.
[0031] The vertex identification information is an ID or index that uniquely identifies each vertex in the target component and is used to distinguish and process different vertices during the rendering process.
[0032] In practical applications, the target component is first identified from the object to be rendered. An object can contain multiple components, and each component may contain one or more models. For each model, vertex identification information is a set of IDs or indices used to uniquely identify vertices. Since the vertex identification information of a model is the same internally, it is first necessary to extract the vertex identification information from all models of the target component. Specifically, a list of vertex identification information in each model is extracted, and then this information is integrated into a unified data structure, such as a list or array. During the integration process, if the vertex identification information in different models is exactly the same, this information will remain unchanged in the data structure. Ensure that the integrated vertex identification information accurately reflects all vertices in the target component and avoid redundancy and duplication. Finally, the sorted vertex identification information is used for subsequent rendering steps.
[0033] In a specific embodiment of the present invention, it is assumed that the object to be rendered includes two components, each of which has multiple models. Component A includes model 1 and model 2, wherein the vertex identification information of model 1 and model 2 is [1, 2, 3] respectively. Component B includes model 3 and model 4, wherein the vertex identification information of model 3 and model 4 is [1, 2, 4]. After extracting the vertex identification information of each model, the information is integrated into a unified list [1, 2, 3, 4]. In this way, the integration of vertex identification information ensures that all unique vertices in the target component are recorded and provides an accurate data basis for subsequent rendering steps.
[0034] Furthermore, before obtaining vertex identification information of multiple vertices of a target component in an object to be rendered, the method also includes: determining a target component related to a texture map among multiple candidate components of the object to be rendered; identifying multiple vertices of the target component according to a preset identification rule, and recording vertex identification information of the multiple vertices.
[0035] Preset identification rules refer to the standards or methods used to uniquely identify vertices in the target component. These rules are defined according to the type and characteristics of the texture map to ensure that each vertex can be correctly identified and processed. Identification rules can include specific character identifiers or color values to distinguish different texture areas or components. For example, all vertices of the same texture map can use the same character identifier (such as "Tex1"), or use the same RGB color value, such as (255,0,0). This rule setting helps to accurately map textures and apply image data during rendering, thereby ensuring that the visual effect of the model surface is consistent with the design intention. Figure 1 To.
[0036] In practical applications, it is first necessary to identify the target components associated with the texture map from multiple candidate components of the object to be rendered. To achieve this, the system analyzes the texture map properties of each candidate component to determine which components use a specific texture map. This process involves classifying and screening the candidate components to select those components associated with the rendering target. Next, the system identifies multiple vertices in the determined target components according to preset identification rules. The preset identification rules can be set according to the texture map type. For example, for vertices using the same texture map, they can be identified as the same character or color value, such as "Tex1" or RGB value (255,0,0). In the process of applying the identification rules, the system traverses the vertex data of each target component and assigns it a corresponding identifier. Finally, the vertex identification information of multiple vertices is recorded, including the vertex identifier and the related vertex data, and the information is organized into a list or data structure for use in subsequent rendering steps.
[0037] In a specific embodiment of the present invention, a group of candidate components is provided, including a wall component and a floor component. The texture map used by the wall component is "brick texture", while the texture map used by the floor component is "wood texture". The system first selects the wall component using "brick texture" and assigns the same identifier "Tex1" to all its vertices. Then, the identification information of these vertices is recorded, such as [(vertex ID1, "Tex1"), (vertex ID2, "Tex1"), ...], for subsequent operations.
[0038] Based on this, the system can effectively identify and mark the vertex information in the target component, ensuring that texture maps can be accurately applied in the subsequent rendering process, improving the accuracy and consistency of the rendering effect.
[0039] Furthermore, multiple vertices of the target component are identified according to preset identification rules, and vertex identification information of the multiple vertices is recorded, including: according to the identification of the target component, obtaining texture position information corresponding to the target component, wherein the texture position information is used to describe the area where a texture map exists on the surface of the target component; obtaining multiple triangular faces of the target component, and filtering a target triangular face from the multiple triangular faces according to the texture position information; identifying multiple vertices of the target triangular face according to preset identification rules, and recording vertex identification information of the multiple vertices.
[0040] In practical applications, first, the texture position information corresponding to the target component is obtained according to the identification information of the target component. The texture position information describes the specific area of the texture map on the surface of the target component, that is, the part covered by the texture. This information usually includes the coordinate range of the texture, the area size, etc., which is used to determine the mapping position of the texture on the model surface. Next, the system will obtain multiple triangular faces of the target component, which are the basic geometric units that make up the surface of the target component. By analyzing the texture position information, the system will filter out the target triangular faces corresponding to the texture map area from these triangular faces. The basis for filtering is whether the triangular face is located in the area described by the texture position information. Next, according to the preset identification rules, the multiple vertices of the filtered target triangular faces are identified. For example, if the preset identification rules require that the vertices of the same texture area use the same character identifier or color value, then all qualified vertices will be assigned the same identifier. Finally, the identification information of these vertices, including the vertex identifier and the related triangular face data, is recorded and organized into a structured data list for use in the rendering process.
[0041] In a specific embodiment of the present invention, it is assumed that the target component is a wall with a masonry texture. The system first obtains the specific location information of the masonry texture on the wall, such as the area covered by the texture. Then, all the triangles of the wall are identified, and those triangles located in the masonry texture area are screened out. Preset identification rules are applied to the vertices of these triangles, such as identifying the vertices of the texture area as "BrickTex", and recording the relevant vertex identification information, such as [(vertex ID1, "BrickTex"), (vertex ID2, "BrickTex"), ...].
[0042] Based on this, the system can accurately match vertex identifiers with texture areas, so that textures can be accurately applied during the rendering process, ensuring that the final visual effect meets the design requirements and improving rendering efficiency and accuracy.
[0043] Step 204: Based on the first index record table, query the vertex parameter information corresponding to each vertex identification information, wherein the first index record table includes a first correspondence between the vertex identification information and the vertex parameter information, and each vertex parameter information is used to determine the texture position.
[0044] Among them, vertex parameter information is used to describe the position of vertices in texture mapping and how they are used to render texture maps, including the relationship between vertices and textures.
[0045] In practical applications, first prepare the first index record table, which contains the mapping relationship between vertex identification information and its corresponding vertex parameter information. Vertex identification information is a unique identifier for each vertex, while vertex parameter information includes the coordinates of the vertex on the texture map, the texture mapping method, etc. This information is usually used to determine how the texture is applied to the model surface to ensure the correct correspondence between the texture and the vertex. According to the vertex identification information to be queried, the vertex parameter information corresponding to each vertex identification information is retrieved from the first index record table. The specific steps include: finding the corresponding entry of each vertex identification information in the first index record table, and extracting the relevant vertex parameter information. These parameter information may include texture coordinates (such as UV coordinates) for determining the position of each vertex on the texture map. By retrieving and sorting these vertex parameter information, the specific position of each vertex on the texture map can be determined, thereby providing the necessary texture data support for subsequent rendering operations.
[0046] In a specific embodiment of the present invention, it is assumed that the first index record table contains a mapping relationship between vertex identification information and vertex parameter information. For example, the vertex parameter information corresponding to vertex identification information 1 includes texture coordinates (0.1, 0.2), and the vertex parameter information corresponding to vertex identification information 2 includes texture coordinates (0.4, 0.6). By looking up the table and extracting this information, it is possible to determine how to apply the texture map to the corresponding vertex, thereby achieving accurate texture mapping and rendering.
[0047] Furthermore, before querying the vertex parameter information corresponding to each vertex identification information based on the first index record table, it also includes: obtaining the texture position information corresponding to the target component according to the identification of the target component; determining the first correspondence between the vertex identification information and the vertex parameter information of multiple vertices of the target component based on the texture position information; and storing the first correspondence in the first index record table.
[0048] In practical applications, first, according to the identification of the target component, the texture position information corresponding to it is obtained. This information describes the coverage area of the texture on the surface of the target component, and includes details such as texture coordinates and area size. Next, based on the texture position information, the first correspondence between the vertex identification information and the vertex parameter information of multiple vertices of the target component is determined. Specifically, the system will analyze which vertex identifications are associated with specific vertex parameters based on the texture position information. For example, if a vertex belongs to part of the texture area, a correspondence is established between the identification information of the vertex and its corresponding vertex parameter information. Then, these correspondences are organized into records and stored in the first index record table. The first index record table is usually a data structure or a database table that records the mapping relationship between vertex identification information and vertex parameter information for subsequent query and use.
[0049] In a specific embodiment of the present invention, it is assumed that the target component is a floor with a wood grain texture. The system first obtains the position information of the wood grain texture on the floor, such as the area covered by the texture and the texture coordinates. Based on this information, the corresponding relationship between the identification information of multiple vertices on the floor (such as "WoodTex") and their vertex parameter information (such as position, normal) is determined. Then, these relationships are recorded in the first index record table, such as [(vertex identification "WoodTex", vertex parameter information ID1), (vertex identification "WoodTex", vertex parameter information ID2), ...].
[0050] Based on this, the system can efficiently manage the mapping relationship between vertex identification information and vertex parameter information, providing reliable data support for subsequent rendering and processing, thereby improving rendering accuracy and efficiency.
[0051] Furthermore, based on the texture position information, a first correspondence between vertex identification information and vertex parameter information of multiple vertices of a target component is determined, including: performing two-dimensional expansion processing on the target component to obtain a component expansion diagram, and determining coordinate information of multiple vertices of the target component in the component expansion diagram based on the texture position information; determining multiple rendering areas based on the coordinate information; for any rendering area, determining multiple vertices inside the rendering area; and constructing a first correspondence between vertex parameter information describing any rendering area information and vertex identification information of multiple vertices.
[0052] In practical applications, the target component is first subjected to two-dimensional expansion processing to obtain an expanded view of the component. The expanded view is the expanded form of the target component surface on a two-dimensional plane, which is used to simplify texture mapping. Next, the specific coordinates of multiple vertices in the target component in the expanded view are determined based on the texture position information. These coordinate information describes the position of each vertex in the expanded view, which is convenient for subsequent area division. Based on these coordinate information, the expanded view is divided into multiple rendering areas, each of which represents a different part or area of the texture map. In each rendering area, all vertices inside the area are identified and determined. Finally, a first correspondence between the vertex parameter information and the vertex identification information describing the area is constructed for each rendering area. This correspondence includes the identification of each vertex in the rendering area and its related vertex parameter information, such as position and normal.
[0053] In a specific embodiment of the present invention, it is assumed that the target component is a wall with a complex pattern. First, the three-dimensional model of the wall is unfolded into a two-dimensional image. According to the texture position information, the coordinates of each vertex on the wall in the unfolded image are determined. For example, an area of a decorative pattern on the wall may correspond to a specific rectangular area in the unfolded image. The unfolded image is divided into multiple rendering areas, each area corresponding to a different part of the texture. The vertices inside each rendering area are determined, and a corresponding relationship between the vertex parameter information and the vertex identification information is established for each area. For example, the texture coordinates and normal direction of each vertex are recorded.
[0054] Based on this, vertex identifiers can be efficiently associated with vertex parameter information, so that textures can be accurately applied and consistent visual effects can be maintained during the rendering process.
[0055] Furthermore, based on the coordinate information, multiple rendering areas are determined, including: based on the coordinate information, calculating the continuity of multiple triangular faces; based on the continuity, dividing multiple vertices corresponding to the multiple triangular faces into multiple vertex groups, wherein the vertices in the vertex groups are continuous; constructing multiple bounding boxes corresponding to the multiple vertex groups, and using the multiple bounding boxes as multiple rendering areas.
[0056] Among them, the coordinate information is used to describe the position of the vertex on the unfolded graph, vertex continuity refers to whether the positional relationship between vertices forms a coherent structure, the vertex group is a set of continuous vertices, and the bounding box is a minimum rectangle used to enclose all vertices in the vertex group.
[0057] In practical applications, the continuity between multiple vertices is first calculated based on the coordinate information. The continuity calculation is to determine whether the vertices are arranged in a certain order to form continuous edges or faces. By analyzing the coordinate data of the vertices, the system can determine which vertices are adjacent to each other and form a coherent structure. Based on this continuity information, the system divides the vertices into multiple vertex groups, where the vertices in each vertex group are continuous. Continuity ensures that the vertex groups can form a valid geometric area, thereby providing a reasonable structure for rendering.
[0058] Next, a bounding box is constructed for each vertex group. The bounding box is a bounding box constructed for the texture coordinates of the vertex group. Since the texture coordinates are two-dimensional, the bounding box shape is a rectangle. The construction of the bounding box is based on the coordinate information in the vertex group. Usually a minimum rectangle or cube is calculated. This geometry can completely cover the vertex group. Finally, these bounding boxes are used as rendering areas, which will be used for subsequent graphics rendering and processing.
[0059] In a specific embodiment of the present invention, it is assumed that the target component is a complex building facade. First, the continuity of multiple vertices on the facade is calculated based on the coordinate information on the unfolded diagram, for example, by analyzing whether these vertices are continuously arranged along the outline of the building. These vertices are grouped, and each group of vertices forms a coherent part. A bounding box is created for each vertex group. For example, a decorative area of the facade may be enclosed in a rectangular bounding box. Finally, all these bounding boxes are used as rendering areas for subsequent rendering processing.
[0060] Based on this, vertices can be effectively grouped and rendering areas can be defined, making the area division in the rendering process more reasonable and efficient, thereby improving rendering accuracy and efficiency.
[0061] Furthermore, the first index record table is in the form of an index map, and storing the first corresponding relationship in the first index record table includes: converting the first corresponding relationship into first index coordinates according to a preset index conversion rule; and storing the first index coordinates in the first index record table in the form of an index map.
[0062] The first index record table is in the form of an index map, which is used to store data in a graphical manner. The first corresponding relationship refers to the mapping relationship between vertex identification information and vertex parameter information, and the first index coordinates convert these corresponding relationships into coordinate positions in the index map.
[0063] In practical applications, the first correspondence is first converted into the first index coordinate according to a preset index conversion rule. The index conversion rule is usually to map the vertex identification information and the vertex parameter information to a specific position in the index map. The purpose of this step is to convert the complex correspondence into coordinate points in the map for easy storage and quick retrieval. According to the conversion rule, the system will map each vertex identification information and its corresponding vertex parameter information into a coordinate system of a two-dimensional map. For example, the system can convert the corresponding vertex parameter information into the coordinates of a point in the map based on the position of the vertex in the three-dimensional model.
[0064] Next, the obtained first index coordinates are stored in a first index record table in the form of an index graph. The first index record table stores these coordinates and related information in a graphical form, making subsequent queries and retrievals more efficient. The record table in the form of an index graph can help the system quickly find specific vertex identification information and its parameter information, and directly locate the corresponding data through the coordinate position in the graph.
[0065] In a specific embodiment of the present invention, it is assumed that the first correspondence describes the texture coordinates and normal direction of a vertex in a three-dimensional model. The system converts these correspondences into coordinates in an index map. For example, the identification information of a vertex and its corresponding texture coordinates are mapped to a point in the index map, and the coordinates of the point may be (0.5, 0.75). In the index map, the color value of this point may be set to a specific RGB value, such as (255, 0, 0), to represent the specific attributes of the vertex. These coordinates and color values are stored in a record table in the form of an index map for subsequent rendering and query.
[0066] Based on this, the system can effectively organize complex vertex data into a graphical index record table, improve the efficiency of data storage and access, and support efficient rendering and data processing.
[0067] Step 206: Based on the second index record table, query the texture map corresponding to each vertex identification information, wherein the second index record table includes a second correspondence between the vertex identification information and the texture map.
[0068] The second index record table is a data table used to record the corresponding relationship between vertex identification information and texture maps. Texture maps are images or textures used to decorate the surface of the model.
[0069] In practical applications, first prepare a second index record table, which contains the mapping relationship between vertex identification information and its corresponding texture map. Vertex identification information is a unique identifier for each vertex, while texture map refers to the image file or texture data actually applied to the model. According to the vertex identification information to be queried, the texture map corresponding to each vertex identification information is retrieved from the second index record table. The specific steps include: finding the entry of each vertex identification information in the second index record table, and extracting the associated texture map information. This step ensures that the texture map applied to these vertices can be accurately determined based on the vertex identification information, thereby ensuring the correct rendering of the model surface.
[0070] In a specific embodiment of the present invention, it is assumed that the second index record table includes the mapping relationship between vertex identification information and texture maps. For example, the texture map corresponding to vertex identification information 1 is "diffuse_texture.png", and the texture map corresponding to vertex identification information 2 is "normal_map.png". By querying the table and extracting the corresponding texture map of each vertex identification information, these texture maps can be accurately applied to the surface of the model to ensure the correct display and effect of the texture.
[0071] Furthermore, before querying the texture map corresponding to each vertex identification information based on the second index record table, it also includes: obtaining the texture map corresponding to the target component according to the identification of the target component; determining the second correspondence between the vertex identification information of multiple vertices of the target component and the texture map; and storing the second correspondence in the second index record table.
[0072] In practical applications, first obtain the corresponding texture map according to the identification information of the target component. Texture maps are images used to add details to the surface of the target component, usually containing information such as color, lighting, and roughness. The system searches for and loads the texture map associated with the target component through the identification (such as ID or name) of the target component.
[0073] Next, a second correspondence between vertex identification information of a plurality of vertices of the target component and the texture map is determined. This step involves matching the vertex identification information with specific texture coordinates or attributes in the texture map. For example, the identification of each vertex is matched with a specific pixel or texture coordinate on the texture map. This mapping relationship describes the position of each vertex in the texture map or the corresponding texture information.
[0074] Then, these second correspondences are stored in a second index record table. The second index record table stores these mapping data in a graphical or tabular form for efficient query and retrieval. The data in the record table includes vertex identification information and its corresponding position or attribute on the texture map, which is usually stored in the form of coordinates, color values or texture coordinates.
[0075] In a specific embodiment of the present invention, it is assumed that the target component is a 3D model with a complex pattern. The system first loads the corresponding texture map according to the identifier of the target component, such as a texture map with detailed patterns at various positions in the component. Next, considering that each vertex in the target component has an original texture coordinate in the texture map, for example, the vertex identifier "Vertex123" may have an original texture coordinate (0.3, 0.45) in the texture map.
[0076] In order to make the utilization of texture maps more efficient, the index record table of the present invention does not directly record the specific position coordinates of the vertices, but first records the original coordinates of the bounding box of the vertex group containing these vertices in the texture map (the minimum coordinates of the lower left corner (x, y) and the size (width, height)), that is, the first index record table. For example, assuming that the lower left corner coordinates of the vertex group bounding box are (0.3, 0.45), the width is 0.1, and the height is 0.15, then it is recorded as (0.3, 0.45, 0.1, 0.15). Next, each bounding box is arranged in a non-overlapping manner to obtain a new texture map, and the position and size of the bounding box in the new texture map are recorded, that is, the second index record table. For example, in the new texture map, the lower left corner coordinates of the bounding box may be (0.1, 0.1), the width is 0.1, and the height is 0.15, which is recorded as (0.1, 0.1, 0.1, 0.15). In this way, when a texture of a target component needs to be rendered, the vertex identification information of the target component can be used to query the texture coordinates of the texture in the new texture map in the second index record table, thereby ensuring correct texture mapping.
[0077] Based on this, a detailed mapping relationship between vertices and texture maps can be established, and efficient data query and rendering can be achieved through index record tables to ensure that texture maps are accurately applied to the target component surface.
[0078] Furthermore, determining a second correspondence between vertex identification information of multiple vertices of a target component and a texture map includes: performing two-dimensional expansion processing on the target component to obtain a component expansion diagram, and determining coordinate information of multiple vertices in the component expansion diagram; determining multiple rendering areas based on the coordinate information; for any rendering area, determining multiple vertices inside the rendering area; and constructing a second correspondence between the texture map and the vertex identification information of multiple vertices.
[0079] In practical applications, the target component is first subjected to two-dimensional unfolding processing to obtain a component unfolding diagram. The unfolding diagram is a representation of the target component surface on a two-dimensional plane, which can unfold the three-dimensional model and place it on the plane to facilitate texture mapping. Through unfolding processing, the system converts the three-dimensional surface of the component into one or more two-dimensional regions, which are represented as a component unfolding diagram.
[0080] Next, multiple rendering regions are determined based on the coordinate information on the expanded image. The coordinate information describes the position of each vertex in the expanded image, and these vertices are used to determine the position of the texture in the expanded image. The system divides the expanded image into multiple rendering regions, each region representing a different part or area of the texture map. The rendering regions are divided based on the vertex coordinate information in the expanded image.
[0081] For each rendering region, determine the multiple vertices inside the region. This step involves identifying and recording the vertices in each rendering region, including their position and identification information in the unfolded graph. These vertices will be used for subsequent texture mapping and processing.
[0082] Finally, a second correspondence between the texture map and the vertex identification information of the plurality of vertices is constructed. This correspondence describes the specific position or attribute of each vertex identification information in the texture map. By matching each vertex and its coordinates in the unfolded graph, the vertex identification information is mapped to a specific position or texture coordinate on the texture map.
[0083] In a specific embodiment of the present invention, it is assumed that the target component is a complex sculpture model. The system first unfolds the sculpture model in two dimensions to obtain a component unfolded view containing multiple parts. According to the coordinate information in the unfolded view, the sculpture model is divided into multiple rendering areas, for example, each area corresponds to a part of the model surface. Then, the vertices in each rendering area are identified. For example, a certain area may contain multiple vertices, and each vertex has a specific position in the unfolded view. Finally, a second correspondence between the texture map and the vertex identification information is established for each vertex. For example, the position coordinates of the vertex "VertexA" on the sculpture model in the texture map are recorded as (0.5, 0.75).
[0084] Based on this, vertex identification information can be accurately mapped to the texture map, ensuring that the texture map can be correctly applied to the surface of the target component during the rendering process.
[0085] Furthermore, the second index record table is in the form of an index map, and storing the second correspondence in the second index record table includes: converting the second correspondence into second index coordinates according to a preset index conversion rule; and storing the second index coordinates in the second index record table in the form of an index map.
[0086] In practical applications, the second index record table is first set to an index map form, that is, a graphical data structure is used to store information. The index map is a two-dimensional graphic structure, and each point represents a specific attribute of the data. Next, according to the preset index conversion rule, the information in the second correspondence is converted into the second index coordinate. The index conversion rule includes how to map the correspondence between the vertex identification information and the texture map to the coordinate position in the index map. These rules may involve coordinate mapping, data normalization, etc., so as to accurately place the data points in the index map.
[0087] After the conversion is completed, the obtained second index coordinates are stored in the second index record table. The table stores the correspondence between the vertex identification information and the texture map in the form of an index map, supporting fast data retrieval and query.
[0088] In a specific embodiment of the present invention, it is assumed that the position of the identification information "VertexXYZ" of a vertex on the texture map of the target component in the texture map is (0.15, 0.2). According to the preset index conversion rule, the position is converted into the coordinate point (0.6, 0.8) in the index map. The RGB color value of the coordinate point in the index map is (255, 0, 0), indicating the texture attribute of the point. The coordinate point (0.6, 0.8) and its RGB color value (255, 0, 0) are recorded in the second index record table.
[0089] Based on this, the correspondence between vertex identification information and texture maps is efficiently stored and retrieved in the form of an index graph, which improves the efficiency of data management and rendering and makes data visualization and query more intuitive.
[0090] Step 208: Render the target component based on the vertex parameter information and the texture map corresponding to each vertex identification information.
[0091] In practical applications, first collect the vertex parameter information and texture map corresponding to all vertex identification information. Vertex parameter information usually includes the coordinates of the vertex on the texture map (such as UV coordinates), and the texture map is a specific image file or texture data. The steps for rendering using this information are as follows: First, apply the vertex parameter information to each vertex of the target component. Specifically, according to the vertex identification information, retrieve the corresponding vertex parameter information from the record table and apply it to the vertex data of the model. Next, according to these vertex parameter information, map the texture map to the model surface. This means that the image data on the texture map is accurately mapped to the surface of the target component according to the UV coordinates of the vertex.
[0092] In order to render, the system needs to use a rendering engine to synthesize the processed vertex data and texture maps. The rendering engine generates the final image based on the vertex data and texture maps, and applies the texture to each vertex of the model to form a realistic visual effect. During the rendering process, the system will perform operations such as lighting calculations and texture sampling to ensure the realism and accuracy of the final rendering effect. After the rendering is completed, the surface of the target component will show the correctly applied texture map, showing the expected visual effect.
[0093] In a specific embodiment of the present invention, it is assumed that the vertex parameter information of the vertex identification information 1 of the target component is (0.1, 0.2), and the corresponding texture map is "diffuse_texture.png". During rendering, the system will map the image data in "diffuse_texture.png" to the vertices of the target component according to the UV coordinates of (0.1, 0.2). In this way, the surface of the target component finally rendered will show an accurate texture effect.
[0094] For example, the first index record table in the form of an index map records the minimum coordinates and width and height (x, y, width, height) of the lower left corner of the original bounding box. Assuming that the information obtained in the first index record table in the form of an index map is (0, 0, 0.5, 0.5), mapping back to [0, 1] yields: [(0.1,0.2)-(0,0)] / max(0.5,0.5)=(0.2,0.4).
[0095] Similarly, according to the information (0.2, 0.3, 0.4, 0.5) recorded in the second index record table in the form of an index map, the actual texture coordinates on diffuse_texture are calculated: (0.2, 0.4)*max(0.4,0.5)+(0.2,0.3)=(0.3,0.5).
[0096] An embodiment of the present invention realizes obtaining vertex identification information of multiple vertices of a target component in a to-be-rendered object; based on a first index record table, querying vertex parameter information corresponding to each vertex identification information, wherein the first index record table includes a first correspondence between the vertex identification information and the vertex parameter information, and each vertex parameter information is used to determine a texture position; based on a second index record table, querying a texture map corresponding to each vertex identification information, wherein the second index record table includes a second correspondence between the vertex identification information and the texture map; based on the vertex parameter information corresponding to each vertex identification information and the texture map, rendering the target component. Based on the vertex identification information, querying the corresponding vertex parameter information in the first index record table to accurately describe the texture position, and then, based on this information, searching for a specific texture map in the second index record table, avoiding the precision limitation problem of full UV expansion, because the texture map is only applied to the texture position actually required, rather than all expanded positions, thereby reducing the waste of video memory and improving the precision of the texture map position and rendering efficiency.
[0097] The following combination Figure 3 , taking the application of the texture rendering method provided by the present invention in a game as an example, the texture rendering method is further described. Figure 3 This is a process flow chart of a texture rendering method provided by an embodiment of the present invention. Taking an object with 12 components as an example, a vertex color channel (0-255) is preset, and two additional 255x240 auxiliary images are used to record UV mapping information, which specifically includes the following steps.
[0098] Step 302: Identify the vertices of the same component with IDs.
[0099] Specifically, the purpose of step 302 is to uniquely identify all vertices in the same component. By assigning a unique ID to each vertex, these vertices can be easily tracked and managed in subsequent steps. This ID identification can help the system maintain the consistency of vertices during processing and calculation, and simplify the subsequent calculation process.
[0100] Step 304: Based on ComputeShader, the triangle faces of the component and the decal box are precisely intersected, and the triangle faces with intersection are retained.
[0101] Specifically, the intersection between the component's triangles and the decal box (the decal area) is calculated using ComputeShader technology. ComputeShader is an efficient parallel computing tool that can quickly handle complex computing tasks. Through this step, the system can accurately find the triangles that intersect with the decal area, ensuring that only the actually needed parts are processed, avoiding unnecessary calculations and rendering.
[0102] Step 306: Based on ComputeShader, vertices with the same ID are divided into 16x16 blocks according to the UV positions, the block continuity is calculated, the bounding box of each isolated cluster in the block is obtained, and then the overlapping bounding box is solved within the same component, and small clusters are combined into large clusters.
[0103] Specifically, ComputeShader is used to assign vertices with the same ID to 16x16 blocks according to their UV coordinate positions. The continuity of the blocks and the bounding boxes of isolated clusters (i.e., the smallest rectangular area) are calculated, and then the overlapping bounding boxes are merged within the same component, and small clusters are combined into larger clusters. This helps to optimize the data structure, reduce redundancy, and improve rendering efficiency. Figure 4 As shown, Figure 4 It is a schematic diagram of a block record of UV information provided by an embodiment of the present invention, and the black area is a bounding box.
[0104] Step 308: Record the bounding box information of the vertex in the first 255x240 auxiliary image, and map the vertex parameters in each bounding box to [0, 1] according to the bounding box.
[0105] Specifically, the bounding box information of each vertex is recorded in an auxiliary image of size 255x240. The bounding box information is used to define the position and size of each vertex in the texture space. At the same time, the vertex parameters in each bounding box are normalized to the range of [0,1] to adapt to the coordinate system of the texture map. This step prepares for subsequent texture mapping and ensures that all vertex parameters are within a unified standard range.
[0106] Step 310: Based on ComputeShader, each bounding box is arranged compactly without overlapping, and the position of each vertex in the decal map is calculated.
[0107] Specifically, each bounding box is optimally placed so that they do not overlap and are compactly arranged in the decal map. This means adjusting all bounding boxes to the best position in the decal map to ensure that there is no area overlap and to make the best use of the decal map space. Ultimately, this step calculates the exact position of each vertex in the decal map in preparation for actual texture rendering. See Figure 5 As shown, Figure 5 It is a schematic diagram of rearranging bounding boxes provided by an embodiment of the present invention, where the bounding boxes AM are arranged compactly and without overlapping.
[0108] Step 312: Record the rearranged bounding box information on a second 255x240 auxiliary image.
[0109] Specifically, the rearranged bounding box information calculated in step 310 is recorded on another auxiliary image of size 255x240. This image contains the final position of each bounding box in the decal image, which is convenient for subsequent fast search and rendering. The purpose of this step is to save the optimized layout information so that it can be efficiently read and used at runtime.
[0110] Step 314: At runtime, the object only needs to look up the mapping information in the two graphs according to the vertex ID of the vertex to sample the correct result.
[0111] Specifically, in the actual rendering process, the system only needs to find the corresponding mapping information from the two auxiliary maps according to the vertex ID. In this way, by querying and sampling the recorded bounding box and texture position data, the texture information of each vertex can be quickly and accurately obtained. This method avoids the complexity of real-time calculation, simplifies the rendering process, improves efficiency, and ensures the accuracy of texture mapping. It does not require the object to have a fully expanded UV as a whole (the component is fully expanded, but the entire object is not required), saving video memory. At the same time, after re-expanding the UV, the utilization rate of pixels is improved.
[0112] Corresponding to the above method embodiment, the present invention also provides a texture rendering device embodiment, Figure 6 FIG. 1 is a schematic diagram of a texture rendering device provided by an embodiment of the present invention. Figure 6 As shown, the device comprises: An acquisition module 602 is configured to acquire vertex identification information of multiple vertices of a target component in an object to be rendered; A first query module 604 is configured to query vertex parameter information corresponding to each vertex identification information based on a first index record table, wherein the first index record table includes a first correspondence between the vertex identification information and the vertex parameter information, and each vertex parameter information is used to determine a texture position; A second query module 606 is configured to query the texture map corresponding to each vertex identification information based on the second index record table, wherein the second index record table includes a second correspondence between the vertex identification information and the texture map; The rendering module 608 is configured to render the target component based on the vertex parameter information and the texture map corresponding to each vertex identification information.
[0113] Optionally, the texture rendering device also includes an identification module, which is configured to determine a target component related to the texture map among multiple candidate components of the object to be rendered; identify multiple vertices of the target component according to preset identification rules, and record vertex identification information of the multiple vertices.
[0114] Optionally, the identification module is further configured to obtain texture position information corresponding to the target component based on the identification of the target component, wherein the texture position information is used to describe the area on the surface of the target component where the texture map exists; obtain multiple triangular faces of the target component, and filter the target triangular face from the multiple triangular faces based on the texture position information; identify multiple vertices of the target triangular face according to preset identification rules, and record vertex identification information of the multiple vertices.
[0115] Optionally, the texture rendering device also includes a first storage module, which is configured to obtain texture position information corresponding to the target component according to the identification of the target component; determine a first correspondence between vertex identification information and vertex parameter information of multiple vertices of the target component based on the texture position information; and store the first correspondence in a first index record table.
[0116] Optionally, the first storage module is further configured to perform two-dimensional expansion processing on the target component to obtain a component expansion diagram, determine multiple vertices of the target component and coordinate information in the component expansion diagram based on the texture position information; determine multiple rendering areas based on the coordinate information; for any rendering area, determine multiple vertices inside the rendering area; and construct a first correspondence between vertex parameter information describing any rendering area information and vertex identification information of multiple vertices.
[0117] Optionally, the first storage module is further configured to calculate the continuity of multiple triangular faces based on the coordinate information; divide the multiple vertices corresponding to the multiple triangular faces into multiple vertex groups based on the continuity, wherein the vertices in the vertex groups are continuous; construct multiple bounding boxes corresponding to the multiple vertex groups, and use the multiple bounding boxes as multiple rendering areas.
[0118] Optionally, the first storage module is further configured to convert the first corresponding relationship into first index coordinates according to a preset index conversion rule; and store the first index coordinates in a first index record table in the form of an index map.
[0119] Optionally, the texture rendering device also includes a second storage module, which is configured to obtain the texture map corresponding to the target component according to the identification of the target component; determine the second correspondence between the vertex identification information of multiple vertices of the target component and the texture map; and store the second correspondence in a second index record table.
[0120] Optionally, the second storage module is further configured to perform two-dimensional expansion processing on the target component to obtain a component expansion diagram, determine the coordinate information of multiple vertices in the component expansion diagram; based on the coordinate information, determine multiple rendering areas; for any rendering area, determine the multiple vertices inside the rendering area; and construct a second correspondence between the texture map and the vertex identification information of multiple vertices.
[0121] Optionally, the second storage module is further configured to convert the second corresponding relationship into second index coordinates according to a preset index conversion rule; and store the second index coordinates in a second index record table in the form of an index map.
[0122] Applied to the texture rendering device, the acquisition module 602 is first responsible for extracting multiple vertex identification information of the target component in the object to be rendered, and providing basic data for subsequent processing. Then, the first query module 604 uses the first index record table to find the corresponding vertex parameter information according to these vertex identification information, and these parameter information are used to accurately describe the position of the texture. Next, the second query module 606 queries the texture map corresponding to the vertex identification information based on the second index record table, so as to ensure that the texture data of each vertex is correctly matched. Finally, the rendering module 608 combines these vertex parameter information with the texture map to render the target component. In this way, the texture map is only applied to the texture position actually required, avoiding the precision limitation problem of full UV expansion, reducing the waste of video memory, and improving the accuracy of the texture map position and rendering efficiency.
[0123] The above is a schematic scheme of a texture rendering device of this embodiment. It should be noted that the technical scheme of the texture rendering device and the technical scheme of the above-mentioned texture rendering method belong to the same concept, and the details not described in detail in the technical scheme of the texture rendering device can be referred to the description of the technical scheme of the above-mentioned texture rendering method.
[0124] Figure 7The block diagram of a computing device 700 according to an embodiment of the present invention is shown. The components of the computing device 700 include but are not limited to a memory 710 and a processor 720. The processor 720 is connected to the memory 710 via a bus 730, and the database 750 is used to store data.
[0125] The computing device 700 also includes an access device 740 that enables the computing device 700 to communicate via one or more networks 760. 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 740 may include one or more of any type of network interface (e.g., a network interface card (NIC)) of wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world-wide interoperability for microwave access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, and a near field communication (NFC).
[0126] In one embodiment of the present invention, the above components of the computing device 700 and Figure 7 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 7 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of the present invention. Those skilled in the art may add or replace other components as needed.
[0127] The computing device 700 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 700 may also be a mobile or stationary server.
[0128] The processor 720 is used to execute the following computer program / instruction, which implements the steps of the above-mentioned texture rendering method when executed by the processor.
[0129] The various embodiments of the present invention are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the computing device embodiment, since it is basically similar to the texture rendering method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the texture rendering method embodiment.
[0130] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program / instruction, which implements the steps of the above-mentioned texture rendering method when executed by a processor.
[0131] The various embodiments of the present invention are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the computer-readable storage medium embodiment, since it is basically similar to the texture rendering method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the texture rendering method embodiment.
[0132] An embodiment of the present invention further provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned texture rendering method when executed by a processor.
[0133] The above is a schematic solution of a computer program product of this embodiment. It should be noted that the technical solution of the computer program product and the technical solution of the above-mentioned texture rendering method belong to the same concept, and the details not described in detail in the technical solution of the computer program product can be referred to the description of the technical solution of the above-mentioned texture rendering method.
[0134] The above describes specific embodiments of the present invention. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0135] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0136] It should be noted that, for the convenience of description, the aforementioned method embodiments are all described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the described action sequence, because according to the embodiments of the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of the present invention.
[0137] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0138] The preferred embodiments of the present invention disclosed above are only used to help explain the present invention. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of the present invention. The present invention selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of the present invention, so that those skilled in the art can understand and use the present invention well. The present invention is limited only by the claims and their full scope and equivalents.
Claims
1. A texture rendering method, characterized in that: include: Obtain vertex identification information of multiple vertices of a target component in an object to be rendered; Based on the first index record table, query the vertex parameter information corresponding to each vertex identification information, wherein the first index record table includes a first correspondence between the vertex identification information and the vertex parameter information, and the each vertex parameter information is used to determine the texture position; Based on the second index record table, query the texture map corresponding to each vertex identification information, wherein the second index record table includes a second correspondence between the vertex identification information and the texture map; The target component is rendered based on the vertex parameter information corresponding to each vertex identification information and the texture map.
2. The method according to claim 1, characterized in that Before acquiring vertex identification information of multiple vertices of the target component in the object to be rendered, the method further includes: Determine a target component related to the texture map among multiple candidate components of the object to be rendered; The multiple vertices of the target component are identified according to a preset identification rule, and vertex identification information of the multiple vertices is recorded.
3. The method according to claim 2, characterized in that The step of identifying the multiple vertices of the target component according to a preset identification rule and recording vertex identification information of the multiple vertices includes: According to the identifier of the target component, acquiring texture position information corresponding to the target component, wherein the texture position information is used to describe an area where a texture map exists on the surface of the target component; Acquire multiple triangular faces of the target component, and select a target triangular face from the multiple triangular faces according to the texture position information; The multiple vertices of the target triangular surface are identified according to a preset identification rule, and vertex identification information of the multiple vertices is recorded.
4. The method according to claim 1, characterized in that Before querying the vertex parameter information corresponding to each vertex identification information based on the first index record table, the method further includes: According to the identifier of the target component, obtaining texture position information corresponding to the target component; Based on the texture position information, determining a first correspondence between vertex identification information and vertex parameter information of a plurality of vertices of the target component; The first corresponding relationship is stored in the first index record table.
5. The method according to claim 4, characterized in that The determining, based on the texture position information, a first correspondence between vertex identification information and vertex parameter information of a plurality of vertices of the target component comprises: Performing two-dimensional expansion processing on the target component to obtain a component expansion diagram, and determining coordinate information of multiple vertices of the target component in the component expansion diagram based on the texture position information; Based on the coordinate information, determining a plurality of rendering areas; For any of the rendering areas, determining a plurality of vertices inside the rendering area; A first correspondence between vertex parameter information describing any rendering area information and vertex identification information of the plurality of vertices is constructed.
6. The method according to claim 5, characterized in that The plurality of vertices correspond to a plurality of triangular faces; and the determining a plurality of rendering areas based on the coordinate information includes: Based on the coordinate information, calculating the continuity of the plurality of triangular faces; Dividing the plurality of vertices corresponding to the plurality of triangular faces into a plurality of vertex groups based on the continuity, wherein the vertices in the vertex groups are continuous; Constructing a plurality of bounding boxes corresponding to the plurality of vertex groups, and using the plurality of bounding boxes as a plurality of rendering areas.
7. The method according to claim 4, characterized in that The first index record table is in the form of an index graph, and storing the first corresponding relationship in the first index record table includes: According to a preset index conversion rule, converting the first corresponding relationship into a first index coordinate; The first index coordinates are stored in a first index record table in the form of the index map.
8. The method according to claim 1, characterized in that Before searching the texture map corresponding to each vertex identification information based on the second index record table, the method further includes: According to the identifier of the target component, obtaining a texture map corresponding to the target component; Determine a second correspondence between vertex identification information of a plurality of vertices of the target component and the texture map; The second corresponding relationship is stored in the second index record table.
9. The method according to claim 8, characterized in that The determining of a second correspondence between vertex identification information of a plurality of vertices of the target component and the texture map includes: Performing two-dimensional expansion processing on the target component to obtain a component expansion diagram, and determining coordinate information of the multiple vertices in the component expansion diagram; Based on the coordinate information, determining a plurality of rendering areas; For any of the rendering areas, determining a plurality of vertices inside the rendering area; A second correspondence between the texture map and the vertex identification information of the plurality of vertices is constructed.
10. The method according to claim 8, characterized in that The second index record table is in the form of an index graph, and storing the second corresponding relationship in the second index record table includes: According to a preset index conversion rule, converting the second corresponding relationship into a second index coordinate; The second index coordinates are stored in a second index record table in the form of the index map.
11. A texture rendering device, characterized in that: include: An acquisition module is configured to acquire vertex identification information of multiple vertices of a target component in an object to be rendered; A first query module is configured to query vertex parameter information corresponding to each vertex identification information based on a first index record table, wherein the first index record table includes a first correspondence between the vertex identification information and the vertex parameter information, and each vertex parameter information is used to determine a texture position; A second query module is configured to query the texture map corresponding to each vertex identification information based on a second index record table, wherein the second index record table includes a second correspondence between the vertex identification information and the texture map; The rendering module is configured to render the target component based on the vertex parameter information corresponding to each vertex identification information and the texture map.
12. A computing device, characterized in that: include: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the texture rendering method according to any one of claims 1 to 10 are implemented.
13. A computer-readable storage medium, characterized in that: It stores a computer program / instruction, which, when executed by a processor, implements the steps of the texture rendering method described in any one of claims 1 to 10.
14. A computer program product, characterized in that The invention comprises a computer program / instruction, which, when executed by a processor, implements the steps of the texture rendering method according to any one of claims 1 to 10.
Citation Information
Cited By
Texture sampling method and device
CN121544677A