Texture mapping method and device, storage medium and electronic equipment

By using world space coordinates and normals in texture mapping, texture coordinates are dynamically calculated and weight values ​​are determined by combining the angles between multiple world coordinate axes. This solves the problem of traditional methods being highly dependent on the model's topology, achieving a more realistic, natural, accurate, and flexible texture fitting effect, which is suitable for complex models.

CN121147375APending Publication Date: 2025-12-16NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202511383526.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-25
Publication Date
2025-12-16

AI Technical Summary

Technical Problem

Traditional texture mapping methods are highly dependent on the model topology and UV unwrapping of 3D models, making them difficult to apply to complex models such as irregular geometric models and dynamically deformable models. This leads to problems such as texture deformation and messiness, affecting the texture mapping effect.

Method used

A texture mapping method based on world space coordinates and normals is adopted. By obtaining the world space coordinates and normals of the model vertices, texture coordinates are dynamically calculated, and texture weight values ​​are determined by combining the angles between multiple world coordinate axes. Mixed sampling is then performed to achieve texture projection.

Benefits of technology

It eliminates the dependence on model topology and UV unwrapping, achieving a more realistic, natural, accurate and flexible texture bonding effect. It is suitable for irregular geometric models and dynamically deformable models, avoiding texture misalignment and stretching, and improving bonding quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121147375A_ABST
    Figure CN121147375A_ABST
Patent Text Reader

Abstract

The invention provides a texture mapping method, a texture mapping device, a computer storage medium and electronic equipment, and relates to the technical field of computer graphic processing. The method comprises the following steps: acquiring a world space coordinate and a world space normal of a vertex of a target model; performing texture projection on the world space coordinates on a plurality of world coordinate axes to obtain target texture coordinates of the vertexes of the target model on the world coordinate axes; determining a texture weight value based on the included angles between the world space normal and the plurality of world coordinate axes; and carrying out texture sampling according to the target texture coordinate to obtain an initial map sampling result, and carrying out mixed sampling on the initial map sampling result and the texture weight value on the corresponding world coordinate axis to carry out texture mapping on the to-be-processed model based on the target map sampling result. The method can get rid of dependence on a model topological structure and UV expansion of a three-dimensional model, and realizes a more real, natural, accurate and flexible texture fitting effect without deformation stretching.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer graphics processing technology, and in particular to a texture mapping method, texture mapping apparatus, computer storage medium, and electronic device. Background Technology

[0002] In the field of computer graphics, texture mapping is commonly used to select appropriate regions of a two-dimensional texture image (such as color, normal, roughness, etc.) for each face on a 3D mesh model as textures to enhance the visual realism.

[0003] Currently, traditional texture mapping methods typically require obtaining the vertex texture coordinates (UV coordinates) of a 3D model and then mapping the texture onto each facet of the 3D model according to the UV coordinates. However, the above texture mapping methods are highly dependent on the model's topology and UV unwrapping, which can easily lead to problems such as deformation and texture chaos when mapping complex models such as irregular geometric models and dynamically deformable models, thus affecting the texture mapping effect of the 3D model. Summary of the Invention

[0004] This disclosure provides a texture mapping method, texture mapping device, computer storage medium, and electronic device, which can eliminate the dependence on the model topology and UV unwrapping of the 3D model during the texture mapping process, and achieve a more realistic, natural, accurate, flexible, and deformation-free texture bonding effect. It is also applicable to texture mapping of complex models such as irregular geometric models and dynamically deformable models, thereby improving the applicability and bonding effect of texture mapping.

[0005] In a first aspect, one embodiment of this disclosure provides a texture mapping method, which includes: for each target model vertex of the model to be processed, obtaining the world space coordinates and world space normal of the target model vertex in the world space coordinate system; projecting the world space coordinates of the target model vertex onto multiple world coordinate axes of the world space coordinate system to obtain the target texture coordinates of the target model vertex on each world coordinate axis; determining the texture weight value on each world coordinate axis based on the angle between the world space normal and the multiple world coordinate axes; performing texture sampling according to the target texture coordinates to obtain the initial texture sampling result on each world coordinate axis, and mixing the initial texture sampling result with the texture weight value on the corresponding world coordinate axis to obtain the target texture sampling result, so as to perform texture mapping on the model to be processed based on the target texture sampling result.

[0006] Secondly, one embodiment of this disclosure provides a texture mapping apparatus, which includes: an acquisition module, used to acquire the world space coordinates and world space normal of each target model vertex in the world space coordinate system for each target model vertex of the model to be processed; a texture projection module, used to project the world space coordinates of the target model vertex onto multiple world coordinate axes of the world space coordinate system to obtain target texture coordinates of the target model vertex on each world coordinate axis; a weight determination module, used to determine the texture weight value on each world coordinate axis based on the angle between the world space normal and the multiple world coordinate axes; and a texture sampling module, used to perform texture sampling according to the target texture coordinates to obtain the initial texture sampling result on each world coordinate axis, and to perform mixed sampling with the texture weight value on the corresponding world coordinate axis to obtain the target texture sampling result, so as to perform texture mapping on the model to be processed based on the target texture sampling result.

[0007] Thirdly, one embodiment of this disclosure provides a computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements the texture mapping method described above.

[0008] Fourthly, one embodiment of this disclosure provides an electronic device, including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the texture mapping method described above by executing the executable instructions.

[0009] Fifthly, one embodiment of this disclosure provides a computer program product, including a computer program that is executed by a processor to implement the texture mapping method described above.

[0010] The technical solution disclosed herein has the following beneficial effects: The texture mapping method described above obtains the world space coordinates and world space normals of each target model vertex in the world space coordinate system for the model to be processed; projects the world space coordinates of the target model vertex onto multiple world coordinate axes of the world space coordinate system to obtain the target texture coordinates of the target model vertex on each world coordinate axis; determines the texture weight value on each world coordinate axis based on the angle between the world space normal and multiple world coordinate axes; performs texture sampling based on the target texture coordinates to obtain the initial texture sampling results on each world coordinate axis; and mixes the initial texture sampling results with the texture weight values ​​on the corresponding world coordinate axes to obtain the target texture sampling results, and performs texture mapping on the model to be processed based on the target texture sampling results.

[0011] On the one hand, this method directly uses the world space coordinates of each vertex in the model to be processed to dynamically calculate the texture coordinates, thus completely skipping the UV editing and unwrapping process, saving a significant amount of time spent on model texture adaptation. It is particularly suitable for procedurally generated models, as it does not require consideration of the model's topology and can batch adapt all procedurally generated content, ensuring consistent texture proportions and orientations. Therefore, this method can eliminate the dependence on the model's topology and UV unwrapping during texture mapping, achieving a more realistic, natural, accurate, flexible, and deformation-free texture fitting effect. It is also applicable to texture mapping of complex models such as irregular geometric models and dynamically deformable models, improving the applicability and fitting effect of texture mapping. On the other hand, because it directly uses the world space coordinates of each vertex in the model to be processed to dynamically calculate the texture coordinates, the texture "follows" the actual position and orientation of the object's surface, avoiding texture misalignment during dynamic interactions. Therefore, it is applicable to dynamically deformable models. On the other hand, this method uses mixed sampling from multiple world space axes, such as the XYZ axes, combined with texture weights determined by angles. This allows each model vertex to automatically select the most "suitable" projection direction, thus avoiding the texture stretching and distortion issues present in traditional methods. Furthermore, this scheme achieves natural transitions between textures in different directions through smooth angle weight mixing, making the seams virtually invisible to the naked eye. This is particularly suitable for large scenes, thus solving the technical problems of obvious texture seams and breaks caused by dividing UV unwrapping of complex models into multiple UV blocks in related solutions, thereby improving the texture mapping fit.

[0012] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0013] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0014] Figure 1 This schematically illustrates an application architecture diagram of one type of texture mapping system according to this exemplary embodiment; Figure 2 A flowchart illustrating one of the texture mapping methods of this exemplary embodiment is shown schematically; Figure 3 The flowchart illustrating one of the methods for texture projection on multiple world coordinate axes in this exemplary embodiment is shown schematically. Figure 4The flowchart illustrates one method for determining texture weight values ​​on each world coordinate axis according to this exemplary embodiment. Figure 5 The flowchart illustrates another method for determining texture weight values ​​on each world coordinate axis in this exemplary embodiment. Figure 6 This schematic diagram illustrates a structure of a texture mapping device in this exemplary embodiment. Figure 7 The schematic diagram illustrates the structure of an electronic device in this exemplary embodiment. Detailed Implementation

[0015] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this disclosure more comprehensive and complete, and to fully convey the concept of exemplary embodiments to those skilled in the art. The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a full understanding of embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced with one or more specific details omitted, or other methods, components, apparatus, steps, etc., can be employed. In other instances, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of this disclosure.

[0016] Furthermore, the accompanying drawings are merely illustrative of this disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0017] The flowchart shown in the attached diagram is merely an illustrative example and does not necessarily include all steps. For example, some steps may be broken down, while others may be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.

[0018] To help those skilled in the art better understand the technical solutions of this disclosure, the relevant content involved in the technical solutions of this disclosure will be introduced below.

[0019] 1) Texture mapping: This is a technique that enhances visual realism by mapping two-dimensional texture images (such as color, normals, roughness, etc.) onto the surface of a three-dimensional model. UV coordinates act as a bridge to ensure that the two-dimensional texture image fits the surface of the three-dimensional model correctly, so as to avoid stretching or distortion.

[0020] 2) UV unwrapping: This is the process in computer graphics of mapping the surface of a 3D model to 2D texture coordinates (UV coordinates). Its core purpose is to establish a precise correspondence between the surface of the 3D model and the 2D texture image. In the UV coordinates, "U" and "V" represent the horizontal and vertical coordinates of the texture image, respectively. They are separate from the X, Y, and Z coordinates of the 3D model, thus forming an independent 2D coordinate system.

[0021] 3) Model Topology: In 3D modeling, this is a mathematical framework describing the surface geometry (connections of vertices, edges, and faces) of a model. Its core objective is to optimize the geometric distribution and functional adaptability of the model. Vertices are the basic units that make up the model, determining the positions of the vertices; edges are line segments connecting vertices, affecting surface smoothness and deformation control; and faces are polygons (usually quadrilaterals or triangles) enclosed by edges, determining the quality of the model after subdivision.

[0022] 4) World Space Coordinates: In computer graphics and 3D modeling, this is a global absolute coordinate system. It is a 3D coordinate system composed of fixed X, Y, and Z axes, with the origin as the global reference point. It is used to uniformly describe the spatial position, rotation, scaling, and other geometric transformations of all objects in the scene. Therefore, during the rendering process, all objects are positioned and rotated relative to world space.

[0023] 5) Model space coordinates: refers to the local coordinate system of the object itself.

[0024] 6) Vertex Normal: A unit vector defined on a vertex of a 3D model, representing the orientation of the surface at that vertex.

[0025] In the field of computer graphics, texture mapping is commonly used to select appropriate regions of a two-dimensional texture image (such as color, normal, roughness, etc.) for each face on a 3D mesh model as textures to enhance the visual realism.

[0026] Currently, traditional texture mapping methods typically employ processes such as UV coordinate sampling and face projection. Specifically, each vertex of the 3D model corresponds to a UV coordinate on a 2D texture, thereby obtaining the vertex texture coordinate information, i.e., the UV coordinates, of the 3D model. Then, the texture is mapped onto each face of the 3D model according to the UV coordinates.

[0027] However, the texture mapping methods mentioned above are highly dependent on the topological structure of the 3D model (e.g., the size and density of the faces) and UV unwrapping. This makes it easy for problems such as deformation and texture confusion to occur when performing texture mapping on complex models such as irregular geometric models and dynamically deformable models, which in turn affects the texture mapping effect of the 3D model.

[0028] This is because UV unwrapping is difficult for irregular geometries (e.g., natural terrain, rocks, broken objects, etc.), leading to severe stretching issues. When the angle between the model surface and the texture projection direction is too large (e.g., a steep slope), or the aspect ratio of the face is inconsistent with the texture, severe texture stretching or distortion can also occur. Even if complex models are "cut" into multiple UV blocks to avoid overstretching, the texture coordinates between UV blocks are discontinuous, resulting in seams during UV sampling; or simple planar projection (e.g., projection only along the Z-axis) completely fails on vertical surfaces (e.g., walls), causing texture "truncation." For dynamically changing models (e.g., flowing cloth, broken objects, deformed character muscles, etc.), traditional UVs are bound to the model's local space (model space). When an object moves or deforms in world space, the UVs become disconnected from the world position, causing the texture to fail to update with the object's actual posture, resulting in the predefined UVs distorting with model deformation.

[0029] Furthermore, for texture modifications in localized areas (e.g., labeling a part of an object model, temporary projection effects), since a single UV block can correspond to multiple regions of the model, it is difficult to isolate local areas individually using UVs. Therefore, the traditional UV mapping methods described above struggle to precisely control local areas and are easily affected by the overall UV layout. Moreover, texture sampling relies on UV coordinates and cannot directly limit the projection range through world space location. Additionally, for procedurally generated models, the lack of manually optimized UVs in automatically generated models easily leads to texture chaos.

[0030] In summary, traditional texture mapping methods are difficult to apply to complex models such as irregular geometric models and dynamically deformable models, easily leading to problems such as deformation and texture chaos, which in turn affects the texture mapping effect of 3D models. Furthermore, they cannot flexibly and accurately modify the texture of local areas.

[0031] Therefore, there is an urgent need for a texture projection method that can be applied to complex models or local areas such as terrain, irregular geometry, and dynamically deformable objects, in order to achieve a more realistic, natural, accurate, flexible, and deformation-free texture bonding effect.

[0032] This exemplary embodiment addresses the aforementioned problems and proposes a texture mapping method. On one hand, this method dynamically calculates texture coordinates using the world space coordinates of each vertex in the model to be processed, thus completely skipping the UV editing and unwrapping stages, saving significant time in texture adaptation. It is particularly suitable for procedurally generated models, as it eliminates the need to consider the model's topology and can batch adapt all procedurally generated content, ensuring consistent texture proportions and orientations. Therefore, this method eliminates the dependence on the model's topology and UV unwrapping during texture mapping, achieving a more realistic, natural, accurate, flexible, and deformation-free texture fitting effect. It is also applicable to texture mapping of complex models such as irregular geometric models and dynamically deformable models, improving the applicability and fitting effect of texture mapping. On the other hand, because the texture coordinates are dynamically calculated using the world space coordinates of each vertex in the model to be processed, the texture "follows" the actual position and orientation of the object's surface, avoiding texture misalignment during dynamic interactions. Therefore, it is applicable to dynamically deformable models. On the other hand, this method uses mixed sampling from multiple world space axes, such as the XYZ axes, combined with texture weights determined by angles. This allows each model vertex to automatically select the most "suitable" projection direction, thus avoiding the texture stretching and distortion issues present in traditional methods. Furthermore, this scheme achieves natural transitions between textures in different directions through smooth angle weight mixing, making the seams virtually invisible to the naked eye. This is particularly suitable for large scenes, thus solving the technical problems of obvious texture seams and breaks caused by dividing UV unwrapping of complex models into multiple UV blocks in related solutions, thereby improving the texture mapping fit.

[0033] This disclosure proposes a texture mapping method and apparatus, which can be applied to... Figure 1 In the system architecture of the exemplary application environment shown.

[0034] like Figure 1 The diagram shown is an application scenario diagram provided by an embodiment of this disclosure. In this scenario, a terminal device 101 and a backend server 102 may be included.

[0035] Terminal device 101 can be, for example, a mobile phone, tablet, laptop, desktop computer, smart TV, smart wearable device, server, desktop computer, or any other computer device with network connectivity, but is not limited thereto. Terminal device 101 can install applications for texture mapping. Backend server 102 can be the backend server corresponding to the application installed on terminal device 101. Backend server 102 can be, for example, a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms, but is not limited thereto.

[0036] The backend server 102 may include one or more processors 1021, a memory 1022, and an I / O interface 1023 for interacting with the terminal. Furthermore, the backend server 102 may be configured with a database 1024, which can be used to store model data and texture mapping parameter data. The memory 1022 of the backend server 102 may also store program instructions for the texture mapping method provided in the embodiments of this disclosure. When these program instructions are executed by the processor 1021, they can be used to implement the steps of the texture mapping method provided in the embodiments of this disclosure to perform texture mapping on the model to be processed.

[0037] For example, in one possible implementation, a user can trigger a texture mapping request for the model to be processed based on an application running on terminal device 101. For each target model vertex of the model to be processed, the backend server 102 obtains the world space coordinates and world space normal of the target model vertex in the world space coordinate system; the world space coordinates of the target model vertex are textured onto multiple world coordinate axes of the world space coordinate system to obtain the target texture coordinates of the target model vertex on each world coordinate axis; the texture weight value on each world coordinate axis is determined based on the angle between the world space normal and multiple world coordinate axes; texture sampling is performed according to the target texture coordinates to obtain the initial texture sampling results on each world coordinate axis, and the initial texture sampling results are mixed with the texture weight values ​​on the corresponding world coordinate axes to obtain the target texture sampling results, so as to perform texture mapping on the model to be processed based on the target texture sampling results.

[0038] In specific implementations, when the processing power of the terminal device 101 allows, the texture mapping process can also be performed on the terminal device 101, and this application embodiment does not impose any limitations on this. Furthermore, it should be explained that the texture mapping method provided in this disclosure embodiment can be executed on the backend server 102, and correspondingly, the texture mapping device is generally located in the backend server 102. The texture mapping method provided in this disclosure embodiment can also be executed on the terminal device 101, and correspondingly, the texture mapping device can also be located in the terminal device 101. The texture mapping method provided in this disclosure embodiment can also be partially executed on the backend server 102 and partially executed on the terminal device 101; correspondingly, some modules of the texture mapping device can be located in the backend server 102, and some modules can be located in the terminal device 101.

[0039] Furthermore, the terminal device 101 and the backend server 102 can communicate directly or indirectly through one or more networks 103. This network 103 can be a wired network or a wireless network; for example, the wireless network could be a mobile cellular network or a wireless fidelity network. The Fidelity (WIFI) network, or of course other possible networks, is disclosed in this embodiment without any limitation.

[0040] It should be noted that in the embodiments of this disclosure, the number of terminal devices 101 can be one or more, that is, there is no limit to the number of terminal devices 101.

[0041] Of course, the texture mapping method provided in this disclosure is not limited to... Figure 1 The application scenarios shown can also be used in other possible scenarios, and the embodiments disclosed herein do not limit this application. Figure 1 The functions that each device in the application scenario shown can achieve will be described in subsequent method embodiments, and will not be elaborated on here.

[0042] Next, taking the aforementioned terminal device 101 as the execution subject, we will illustrate the application of the texture mapping method to the aforementioned terminal device 101 as an example. Figure 2 A flowchart illustrating one example of a texture mapping method of this exemplary embodiment is shown below. Figure 2 The texture mapping method provided in the embodiments of this disclosure includes the following steps S201-S204: Step S201: For each target model vertex of the model to be processed, obtain the world space coordinates and world space normal of the target model vertex in the world space coordinate system.

[0043] Step S202: Project the world space coordinates of the target model vertices onto multiple world coordinate axes of the world space coordinate system to obtain the target texture coordinates of the target model vertices on each world coordinate axis.

[0044] Step S203: Determine the texture weight value on each world coordinate axis based on the angle between the world space normal and multiple world coordinate axes.

[0045] Step S204: Perform texture sampling based on the target texture coordinates to obtain the initial texture sampling results on each world coordinate axis. Then, perform mixed sampling with the texture weight values ​​on the corresponding world coordinate axes to obtain the target texture sampling results. Based on the target texture sampling results, perform texture mapping on the model to be processed.

[0046] In the above Figure 2 The provided technical solution has two main aspects. First, this method directly uses the world space coordinates of each vertex in the model to be processed to dynamically calculate texture coordinates, thus completely skipping the UV editing and unwrapping stages. This saves a significant amount of time spent on model texture adaptation, making it particularly suitable for procedurally generated models. It eliminates the need to consider the model's topology and can batch adapt all procedurally generated content, ensuring consistent texture proportions and orientations. Therefore, this method can overcome the dependence on the model's topology and UV unwrapping during texture mapping, achieving a more realistic, natural, accurate, flexible, and deformation-free texture bonding effect. It is also applicable to texture mapping of complex models such as irregular geometric models and dynamically deformable models, improving the applicability and bonding effect of texture mapping. Second, because it directly uses the world space coordinates of each vertex in the model to be processed to dynamically calculate texture coordinates, the texture "follows" the actual position and orientation of the object's surface, avoiding texture misalignment during dynamic interactions. Therefore, it is applicable to dynamically deformable models. On the other hand, this method uses mixed sampling from multiple world space axes, such as the XYZ axes, combined with texture weights determined by angles. This allows each model vertex to automatically select the most "suitable" projection direction, thus avoiding the texture stretching and distortion issues present in traditional methods. Furthermore, this scheme achieves natural transitions between textures in different directions through smooth angle weight mixing, making the seams virtually invisible to the naked eye. This is particularly suitable for large scenes, thus solving the technical problems of obvious texture seams and breaks caused by dividing UV unwrapping of complex models into multiple UV blocks in related solutions, thereby improving the texture mapping fit.

[0047] The following will describe in conjunction with specific embodiments Figure 2 The specific implementation methods of each step in the illustrated embodiment are described in detail below: In step S201, for each target model vertex of the model to be processed, the world space coordinates and world space normal of the target model vertex in the world space coordinate system are obtained.

[0048] The model to be processed is a model that requires texture mapping or texturing, which can be a three-dimensional virtual model or a two-dimensional virtual model. In practical applications, the model to be processed is mostly a three-dimensional virtual model, but the embodiments of this disclosure do not impose any special restrictions on this.

[0049] It should be explained that the model surface of the model to be processed usually contains a large number of model vertices. For each model vertex on the model surface corresponding to the model to be processed, the texture mapping method provided by the exemplary embodiments of this disclosure will be executed, that is, the target model vertex is any model vertex on the model surface to be processed.

[0050] For example, for each target model vertex of the model to be processed, the world space coordinates and world space normal of each target model vertex in the world space coordinate system can be obtained. In an optional embodiment, the world space coordinates (for ease of understanding, the world space coordinates of the target model vertex can be represented by (x, y, z)) and the corresponding world space normal (similarly, for ease of understanding, the world space normal of the target model vertex can be represented by (n_x, n_y, n_z)) of each target model vertex on the model to be processed can be obtained by using the World Position algorithm and the World Normal algorithm.

[0051] It needs to be explained that the World Position algorithm is mainly used to reconstruct the world coordinates of pixels in real-time rendering. Its core principle is to calculate the 3D spatial position inversely through the depth buffer and camera parameters to obtain the world space coordinates. The World Normal algorithm, on the other hand, is the key data in 3D graphics that describes the orientation of the object's surface. Its core algorithm is to transform the local normals of the model to the world coordinate system. Specifically, it transforms the vertex normals from the model space coordinate system to the world space coordinate system by using the inverse transpose of the model matrix (to avoid normal distortion caused by scaling) to obtain the world space normal of each target model vertex in the world space coordinate system.

[0052] Based on the steps described above, the world space coordinates of the target model vertices in the world space coordinate system can be obtained. The world space coordinates (x, y, z) of the target model vertices can then be directly used as the reference system for texture projection. This allows the world space coordinates (x, y, z) to be projected along multiple world coordinate axes of the world space coordinate system to obtain texture coordinates for multiple world coordinate axes.

[0053] In step S202, the world space coordinates of the target model vertices are textured onto multiple world coordinate axes of the world space coordinate system to obtain the target texture coordinates of the target model vertices on each world coordinate axis.

[0054] For example, the world space coordinate system contains three fixed world coordinate axes: the first world coordinate axis, the second world coordinate axis, and the third world coordinate axis, namely the X-axis, the Y-axis, and the Z-axis. Therefore, the world space coordinates (x, y, z) of each target model vertex can be textured onto the X-axis, Y-axis, and Z-axis respectively to obtain the target texture coordinates along the three axes.

[0055] The following will combine Figure 3 The texture projection process shown in step S202 will be illustrated by example.

[0056] Figure 3 This schematically illustrates a flowchart of one method for texture projection across multiple world coordinate axes according to this exemplary embodiment. Please refer to [link to relevant documentation]. Figure 3 In an optional embodiment of this disclosure, step S202 above, based on the world space coordinates of each model vertex, performs texture projection on multiple world coordinate axes of the world space coordinate system to obtain the target texture coordinates of each model vertex on multiple world coordinate axes, including the following steps S301-S303: Step S301: In response to texture projection on the first world coordinate axis, based on the second coordinate value of the target model vertex on the second world coordinate axis in the world space coordinates of the target model vertex and the third coordinate value of the target model vertex on the third world coordinate axis in the world space coordinates of the target model vertex, determine the first texture coordinate of the target model vertex on the first world coordinate axis.

[0057] For example, when implementing texture projection on the first world coordinate axis of the world space coordinates of the target model vertex, since the first world coordinate axis, the second world coordinate axis, and the third world coordinate axis are mutually orthogonal axes, the second coordinate value on the second world coordinate axis and the third coordinate value on the third world coordinate axis in the world space coordinates can be used as texture coordinates perpendicular to the plane where the first world coordinate axis is located, which can also be called texture UV or UV.

[0058] For example, assuming the first world coordinate axis is the X-axis, when performing UV projection on the X-axis, the y and z coordinate values ​​in the world space coordinates are used as the UV coordinates, i.e., (y, z).

[0059] In another optional embodiment of this disclosure, when performing the above step S301, determining the first texture coordinates of the target model vertex on the first world coordinate axis based on the second coordinate value corresponding to the second world coordinate axis in the world space coordinates of the target model vertex and the third coordinate value corresponding to the second world coordinate axis in the world space coordinates of the target model vertex, the first texture coordinates of the target model vertex on the first world coordinate axis can be determined based on the product between the second coordinate value and the control repetition frequency factor, and the product between the third coordinate value and the control repetition frequency factor.

[0060] For example, the second and third coordinate values ​​can be multiplied by a control repetition frequency factor, and the result can be used as the first texture coordinate of the target model vertex on the first world coordinate axis.

[0061] The repetition frequency factor can be characterized using Scalar Parameter, which is set based on OpenGL's texture wrapping mode and sampling parameters. Its core is to achieve frequency regulation by adjusting the mapping rules of texture coordinates in order to form a repetitive texture image.

[0062] Continuing with the example of the first-world coordinate axis as the X-axis, we can multiply y and z by the control repetition frequency factor 'a', and then obtain the first texture coordinates of the target model vertex on the first-world coordinate axis as (y... a, z a).

[0063] It should be understood that texture wrapping modes typically include the following modes: GL_REPEAT, GL_MIRRORED_REPEAT, and GL_CLAMP_TO_EDGE. GL_REPEAT is usually the default mode. In this mode, when texture coordinates exceed the range [0,1], the texture image is repeated through modulo operations to create a periodic repetition effect. GL_MIRRORED_REPEAT, on the other hand, mirrors the texture on odd-numbered repetitions to create a symmetrical repetition frequency. GL_CLAMP_TO_EDGE truncates out-of-range coordinates to the edge values ​​and stretches edge pixels to achieve low-frequency repetition.

[0064] Step S302: In response to texture projection on the second world coordinate axis, based on the first coordinate value of the target model vertex on the first world coordinate axis in the world space coordinates of the target model vertex and the third coordinate value of the target model vertex on the third world coordinate axis in the world space coordinates of the target model vertex, determine the second texture coordinates of the target model vertex on the second world coordinate axis.

[0065] For example, when implementing texture projection on the second world coordinate axis of the world space coordinates of the target model vertex, since the first world coordinate axis, the second world coordinate axis, and the third world coordinate axis are mutually orthogonal axes, the first coordinate value on the first world coordinate axis and the third coordinate value on the third world coordinate axis in the world space coordinates can be used as texture coordinates perpendicular to the plane where the second world coordinate axis is located.

[0066] For example, assuming the second world coordinate axis is the Y-axis, when performing UV projection on the Y-axis, the x and z coordinate values ​​in the world space coordinates are used as the UV coordinates, i.e., (x, z).

[0067] In an optional embodiment of this disclosure, when performing step S302 in response to texture projection on the second world coordinate axis, and determining the second texture coordinates of the target model vertex on the second world coordinate axis based on the first coordinate value corresponding to the first world coordinate axis in the world space coordinates of the target model vertex and the third coordinate value corresponding to the third world coordinate axis in the world space coordinates of the target model vertex, the second texture coordinates of each model vertex on the second world coordinate axis can be determined according to the product between the first coordinate value and the first texture scaling factor, and the product between the third coordinate value and the first texture scaling factor.

[0068] For example, the first coordinate value and the third coordinate value can be multiplied by the first texture scaling factor, and the result can be used as the second texture coordinate of the target model vertex on the second world coordinate axis.

[0069] Continuing with the example of the second world coordinate axis as the Y-axis, we can multiply x and z by the first texture scaling factor α1 respectively. This gives us the second texture coordinates of the target model vertex on the second world coordinate axis: (x...z ... α1, z α1).

[0070] Step S303: In response to texture projection on the third world coordinate axis, based on the first coordinate value of the target model vertex on the first world coordinate axis in the world space coordinates of the target model vertex and the second coordinate value of the target model vertex on the second world coordinate axis in the world space coordinates of the target model vertex, determine the third texture coordinate of the target model vertex on the third world coordinate axis.

[0071] For example, when implementing texture projection on the third world coordinate axis of the world space coordinates of the target model vertex, since the first world coordinate axis, the second world coordinate axis, and the third world coordinate axis are mutually orthogonal axes, the second coordinate value on the second world coordinate axis and the first coordinate value on the first world coordinate axis in the world space coordinates can be used as texture coordinates perpendicular to the plane where the third world coordinate axis is located.

[0072] For example, assuming the third-world coordinate axis is the Z-axis, when performing UV projection on the Z-axis, the x and y coordinate values ​​in the world space coordinates are used as the UV coordinates, i.e., (x, y).

[0073] In an optional embodiment of this disclosure, when performing the above step S303 to determine the third texture coordinates of the target model vertex on the third world coordinate axis based on the first coordinate value on the first world coordinate axis in the world space coordinates of the target model vertex and the second coordinate value on the second world coordinate axis in the world space coordinates of the target model vertex, the third texture coordinates of each model vertex on the third world coordinate axis can be determined according to the product between the first coordinate value and the second texture scaling factor, and the product between the second coordinate value and the second texture scaling factor.

[0074] For example, the first coordinate value and the second coordinate value can be multiplied by the second texture scaling factor, and the result can be used as the third texture coordinate of the target model vertex on the third world coordinate axis.

[0075] Continuing with the example of the third-world coordinate axis as the Z-axis, we can multiply x and y by the second texture scaling factor α2 respectively. This gives us the third texture coordinates of the target model's vertices on the third-world coordinate axis: (x...) α2, y α2). It should be explained that the first texture scaling factor and the second texture scaling factor in the above embodiments can be the same or different. The specific scaling factor can be adjusted or determined according to the actual situation, and the embodiments of this disclosure do not impose any special restrictions on this.

[0076] In this embodiment, the number of repetitions per unit period can be changed by modifying the scaling factor of the texture coordinates. For example, taking the second texture scaling factor α2 as an example, when the second texture scaling factor α2 is set to 0.5, the third texture coordinates are repeated twice in the same space.

[0077] pass Figure 3 The illustrated embodiment generates texture coordinates by projecting textures onto multiple world coordinate axes. This avoids the texture stretching and deformation issues caused by projecting textures in only a single direction, thus better adapting to complex models and improving applicability and final texture fitting. Furthermore, by multiplying the generated texture coordinates by a control repetition frequency factor, a first texture scaling factor, and a second texture scaling factor, the formation of repeating textures can be flexibly controlled, enhancing user flexibility and convenience.

[0078] Further, step S203 is executed, in which the texture weight value on each world coordinate axis is determined based on the angle between the world space normal and multiple world coordinate axes.

[0079] For example, the weight value of a texture on each world coordinate axis can be determined by the angle between the world space normal and multiple world coordinate axes. Generally, the smaller the angle between the world space normal and multiple world coordinate axes, the closer the world space normal is to that world coordinate axis, and the larger the texture weight value corresponding to that world coordinate axis; conversely, the larger the angle between the world space normal and multiple world coordinate axes, the farther the world space normal is from that world coordinate axis, and the smaller the texture weight value corresponding to that world coordinate axis.

[0080] Figure 4 This schematically illustrates a flowchart of a method for determining texture weight values ​​on each world coordinate axis according to one of the exemplary embodiments of this invention. Please refer to [link to flowchart illustration]. Figure 4 In an optional embodiment of this disclosure, step S203, determining the texture weight value on each world coordinate axis based on the angle between the world space normal and multiple world coordinate axes, includes the following steps S401-S403: Step S401: For each target world coordinate axis among multiple world coordinate axes, obtain the unit coordinate axis vector of the target world coordinate axis.

[0081] The target world coordinate axis is any one of the multiple world coordinate axes. Since the texture weight value needs to be calculated for each world coordinate axis, it is necessary to calculate the multiple world coordinate axes one by one. The target world coordinate axis can be the X coordinate axis, Y coordinate axis, and Z coordinate axis in sequence.

[0082] For example, the unit coordinate vectors of the target world coordinate axes are, for instance, (1, 0, 0) for the X coordinate axis; (0, 1, 0) for the Y coordinate axis; and (0, 0, 1) for the Z coordinate axis.

[0083] Step S402: Perform a dot product operation on the world space normal and the unit coordinate axis vector to obtain the initial texture weight value on the target world coordinate axis.

[0084] For example, after obtaining the unit coordinate axis vector of each target world coordinate axis, a dot product operation can be performed on the world space normal and the unit coordinate axis vector to obtain the initial texture weight value on each world coordinate axis.

[0085] For example, the initial texture weight value on the X-axis is: Dot Product(World Normal, (1, 0, 0)). Here, Dot Product represents the dot product operation, which calculates the dot product of the world space normal and the X-axis unit vector (1, 0, 0), and the result is the projection length of the world space normal on the X-axis.

[0086] The initial texture weights on the Y-axis are: Dot Product(World Normal, (0, 1, 0)). Here, Dot Product represents the dot product operation, which calculates the dot product of the world space normal and the Y-axis unit vector (0, 1, 0), resulting in the projection length of the world space normal onto the Y-axis.

[0087] Correspondingly, the initial texture weight value on the Z-axis is: Dot Product(World Normal, (0,0, 1)). Here, Dot Product represents the dot product operation, which calculates the dot product of the world space normal and the Z-axis unit vector (0,0,1), and the result is the projection length of the world space normal on the Z-axis.

[0088] Step S403: Calculate the absolute value of the initial texture weight value on the target world coordinate axis to obtain the texture weight value on each world coordinate axis.

[0089] For example, the initial texture weight values ​​calculated based on the above step S402 contain positive and negative signs. In order to eliminate directionality, only the intensity value of the projection is retained so as to reflect the degree of deviation between the world space normal and the X / Y / Z axes (where 0 represents perpendicular and 1 represents completely parallel). The absolute value of the initial texture weight values ​​on the target world coordinate axes can be taken, and the w_x on the X coordinate axis, w_y on the Y coordinate axis, and w_z on the Z coordinate axis obtained after taking the absolute value are used as the final texture weight values.

[0090] It should be explained that the closer the texture weight value obtained by the dot product operation is to 1, the smaller the angle between the world space normal and the world coordinate axis, and the larger the corresponding texture weight value, and the greater its role in the texture mapping process.

[0091] pass Figure 4 The embodiment shown can generate texture UVs along multiple world coordinate axes, avoiding stretching from projection in a single direction. At the same time, it can adjust the weights of texture UVs generated along each world coordinate axis by adjusting the texture weight values ​​on each world coordinate axis to achieve adaptive and accurate texture mapping and improve the texture mapping effect.

[0092] Apart from Figure 4 In addition to the embodiment shown, a flowchart of another method for determining texture weight values ​​on each world coordinate axis is also provided; see reference Figure 5 As shown, in an optional embodiment of this disclosure, step S403, calculating the absolute value of the initial texture weight value on the target world coordinate axis to obtain the texture weight value on each world coordinate axis, may further include the following steps S4031-S4032: Step S4031: Calculate the absolute value of the initial texture weight value on the target world coordinate axis to obtain the intermediate texture weight value on each world coordinate axis.

[0093] Step S4032: Normalize the intermediate texture weight values ​​on each world coordinate axis to obtain the texture weight values ​​on each world coordinate axis.

[0094] For example, after obtaining the absolute value of the initial texture weight on each target world coordinate axis, it can be over-normalized so that the final texture weight values ​​on each world coordinate axis are within the range of 0-1. This process can ensure that the total weight is 1, and thus avoid the final texture result being too bright or too dark.

[0095] Assuming that the absolute values ​​of w_x on the X-axis, w_y on the Y-axis, and w_z on the Z-axis are obtained, then w_x + w_y + w_z = W, and the texture weight values ​​on each world axis are obtained based on the following formula.

[0096] The texture weight value for the X-axis is: w_x / W.

[0097] The texture weight value for the Y-axis is: w_y / W.

[0098] And the texture weight value for the Z-axis is: w_z / W.

[0099] In step S204, texture sampling is performed based on the target texture coordinates to obtain the initial texture sampling results on each world coordinate axis. The initial texture sampling results are then mixed with the texture weight values ​​on the corresponding world coordinate axes to obtain the target texture sampling results. Based on the target texture sampling results, texture mapping is performed on the model to be processed.

[0100] For example, after obtaining the target texture coordinates on each world coordinate axis, texture sampling can be performed on the target texture coordinates on each world coordinate axis to obtain the initial texture sampling results on each world coordinate axis. For instance, texture sampling can be performed on the texture coordinates on the X, Y, and Z axes to obtain tex_x (X-axis projection result), tex_y (Y-axis projection result), and tex_z (Z-axis projection result).

[0101] It needs to be explained that the process of sampling the target texture coordinates on each world coordinate axis is the process of obtaining color values ​​from the selected texture image through two-dimensional texture coordinates (u, v). Its core principle is to map the model vertices to the texture space and then calculate the texture color corresponding to the fragment through interpolation.

[0102] Next, the initial texture sampling result is mixed with the texture weight value on the corresponding world coordinate axis to obtain the final target texture sampling result, and texture mapping is performed on the model to be processed based on the target texture sampling result.

[0103] For example, after sampling the texture coordinates on the X, Y, and Z axes respectively to obtain tex_x (X-axis projection result), tex_y (Y-axis projection result), and tex_z (Z-axis projection result), the texture weight values ​​on each world axis obtained in step S203 can be combined to achieve mixed sampling. The target texture sampling result is shown below: (tex_x w_x) + (tex_y w_y) + (tex_z w_z) Wherein, tex_x represents the initial sampling result under the X-axis in the world space coordinate system; w_x represents the texture weight value under the X-axis in the world space coordinate system; tex_y represents the initial sampling result under the Y-axis in the world space coordinate system; w_y represents the texture weight value under the Y-axis in the world space coordinate system; tex_z represents the initial sampling result under the Z-axis in the world space coordinate system; and w_z represents the texture weight value under the Z-axis in the world space coordinate system.

[0104] Furthermore, in step S204, when performing texture sampling based on the target texture coordinates to obtain the initial texture sampling results on each world coordinate axis, sampling can be performed on the same texture image or on different texture images. The following will describe this in conjunction with specific embodiments.

[0105] Example 1: Sampling the same texture image: In one optional embodiment of this disclosure, the same third texture image is texture sampled according to the target texture coordinates on each world coordinate axis to obtain the initial texture sampling results on each world coordinate axis.

[0106] For example, when the same texture image needs to be used, the target texture coordinates on each world coordinate axis can be sampled from the same texture image. This embodiment can be applied to texture mapping scenarios where it is not necessary to distinguish the coordinate axis orientation.

[0107] Example 2: Sampling for different texture images: In one optional embodiment of this disclosure, a first texture image is texture sampled according to the target texture coordinates on a first world coordinate axis to obtain an initial texture sampling result on the first world coordinate axis, and a second texture image is texture sampled according to the target texture coordinates on a second world coordinate axis to obtain an initial texture sampling result on the second world coordinate axis.

[0108] The model to be processed includes at least a first model sub-region and a second model sub-region. The first model sub-region requires a first texture image, and the first texture image is matched with a first direction corresponding to a first world coordinate axis. The second model sub-region requires a second texture image, and the second texture image is matched with a second direction corresponding to a second world coordinate axis.

[0109] In this regard, when performing the above-mentioned step of performing texture sampling based on the target texture coordinates to obtain the initial texture sampling results on each world coordinate axis, the first texture image can be texture sampled based on the target texture coordinates on the first world coordinate axis to obtain the initial texture sampling results on the first world coordinate axis, so that the first model sub-region can be texture-mapped based on the initial texture sampling results on the first world coordinate axis; and the second texture image can be texture sampled based on the target texture coordinates on the second world coordinate axis to obtain the initial texture sampling results on the second world coordinate axis, so that the second model sub-region can be texture-mapped based on the initial texture sampling results on the second world coordinate axis.

[0110] It should be explained that the first and second world coordinate axes represent the world coordinate axes for different axial textures. They are not a limitation on the number of world coordinate axes, and together they form the world coordinate axes in the world space coordinate system. For example, the first world coordinate axis can be the X-axis and Y-axis, and the corresponding second world axis is the Z-axis. Of course, other combinations are also possible, depending on the direction of the world coordinate axes that the model to be processed needs to match.

[0111] For example, suppose the model to be processed is a composite model, such as a ground model and a wall model. The ground model needs to use textures in the Z-axis direction, while the wall model needs to use textures in the X / Y-axis direction. Therefore, different textures can be associated with the ground model and the wall model.

[0112] Furthermore, based on any of the above embodiments, if it is necessary for the two-dimensional texture image to transform with the deformation of the object, the world coordinates can be transformed to the model space coordinate system through the Transform node before UV coordinate calculation, thereby ensuring that the texture is aligned with the world space.

[0113] Therefore, before performing the above step S202 and performing texture projection on multiple world coordinate axes of the world space coordinate system based on the world space coordinates of each model vertex, in an optional embodiment of this disclosure, each two-dimensional texture coordinate of the target texture image can be mapped to the world space coordinate system to obtain the initial coordinates of each two-dimensional texture coordinate in the target texture image in the world space coordinate system; then, the initial texture coordinates in the world space coordinate system are converted to the model space coordinate system to generate the target coordinates of each two-dimensional texture coordinate in the target texture image in the model space coordinate system, so as to obtain a new target texture image.

[0114] The model space coordinate system is a local coordinate system relative to the model being processed. The target texture image includes a first texture image, a second texture image, or a third texture image.

[0115] For example, by first mapping the two-dimensional coordinates of each pixel in the two-dimensional target texture image to the world space coordinate system to form three-dimensional coordinates, and then mapping the three-dimensional coordinates in the world space coordinate system to the model space coordinate system, the texture image can be made to fit the model to be processed. Furthermore, by combining the world space coordinates, the texture can be ensured to be aligned with the world space, thus eliminating the need for the UV unwrapping step. This improves the texture fitting effect and simplifies the texture mapping process.

[0116] Furthermore, this method can also limit texture mapping to only a local region of the model to be processed.

[0117] In one optional embodiment of this disclosure, the model to be processed includes a projected region and a non-projected region. The distance parameter between the world space coordinates of each target model vertex and the projection center is determined. The projection center is located at the center of the projected region in the model to be processed. The distance parameter is converted into a mask map. The product of the target map sampling result and the mask map is multiplied and superimposed with the product of the non-projected region and the non-mask map to obtain the map sampling result for the projected region. Based on the map sampling result, texture mapping is performed on the projected region in the model to be processed.

[0118] For example, when it is necessary to apply the projection only to a specific area of ​​the model being processed (such as a local area of ​​an object), a range mask map can be added to it. The specific process is as follows: First, the distance parameter can be calculated, that is, the distance between the world position of each target model vertex and the projection center located at the center of the projection region can be calculated using Distance. The distance parameter can be defined using VectorParameter.

[0119] Then, the mask generation step is performed, which uses the Smoothstep algorithm to convert the distance parameter into a 0-1 mask (it should be noted that the closer the distance, the closer the value is to 1, and the value is 0 if the distance is outside the range).

[0120] Finally, a blending of local and global effects is achieved. This involves multiplying the target texture sampling result formed by blending with the mask texture, and then superimposing the product of the non-projection region and the non-mask texture (i.e., 1 - mask texture) to obtain the texture sampling result for the projection region. Based on the texture sampling result, texture mapping is then performed on the projection region in the model to be processed.

[0121] In one optional embodiment of this disclosure, parallel GPU operations are used for some computation nodes (e.g., coordinate transformation, dot product, and mixing) in the above embodiments, thereby achieving a lightweight computation and enabling real-time frame rate updates without being affected.

[0122] It should be understood that although the steps in the flowchart are shown sequentially by connecting lines, these steps are not necessarily executed in the order indicated by the connecting lines. Unless explicitly stated herein, there is no strict order constraint on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the diagram may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.

[0123] To implement the above-described texture mapping method, one embodiment of this disclosure provides a texture mapping apparatus. Figure 6 A schematic diagram of the texture mapping device is shown.

[0124] The texture mapping device 600 includes an acquisition module 601, a texture projection module 602, a weight determination module 603, and a texture sampling module 604.

[0125] The acquisition module 601 is used to acquire the world space coordinates and world space normal of each target model vertex in the world space coordinate system for the model to be processed; the texture projection module 602 is used to project the world space coordinates of the target model vertex onto multiple world coordinate axes of the world space coordinate system to obtain the target texture coordinates of the target model vertex on each world coordinate axis; the weight determination module 603 is used to determine the texture weight value on each world coordinate axis based on the angle between the world space normal and multiple world coordinate axes; the texture sampling module 604 is used to perform texture sampling based on the target texture coordinates to obtain the initial texture sampling results on each world coordinate axis, and to perform mixed sampling with the texture weight value on the corresponding world coordinate axis to obtain the target texture sampling result, so as to perform texture mapping on the model to be processed based on the target texture sampling result.

[0126] In an optional embodiment of this disclosure, the plurality of world coordinate axes include a first world coordinate axis, a second world coordinate axis, and a third world coordinate axis. Specifically, the texture projection module is used to: in response to texture projection on the first world coordinate axis, determine a first texture coordinate of the target model vertex on the first world coordinate axis based on a second coordinate value in the world space coordinates of the target model vertex corresponding to the second world coordinate axis and a third coordinate value in the world space coordinates of the target model vertex corresponding to the third world coordinate axis; the texture projection module is used to: in response to texture projection on the second world coordinate axis, determine a second texture coordinate of the target model vertex on the second world coordinate axis based on the first coordinate value in the world space coordinates of the target model vertex corresponding to the first world coordinate axis and a third coordinate value in the world space coordinates of the target model vertex corresponding to the third world coordinate axis; and the texture projection module is used to: in response to texture projection on the third world coordinate axis, determine a third texture coordinate of the target model vertex on the third world coordinate axis based on the first coordinate value in the world space coordinates of the target model vertex corresponding to the first world coordinate axis and a second coordinate value in the world space coordinates of the target model vertex corresponding to the second world coordinate axis.

[0127] In an optional embodiment of this disclosure, the texture projection module is specifically configured to: determine the first texture coordinates of the target model vertex on the first world coordinate axis based on the product of the second coordinate value and the control repetition frequency factor, and the product of the third coordinate value and the control repetition frequency factor; the texture projection module is specifically configured to: determine the second texture coordinates of the target model vertex on the second world coordinate axis based on the product of the first coordinate value and the first texture scaling factor, and the product of the third coordinate value and the first texture scaling factor; and the texture projection module is specifically configured to: determine the third texture coordinates of the target model vertex on the third world coordinate axis based on the product of the first coordinate value and the second texture scaling factor, and the product of the second coordinate value and the second texture scaling factor.

[0128] In an optional embodiment of this disclosure, the weight determination module is specifically used to obtain the unit coordinate axis vector of the target world coordinate axis for each of the multiple world coordinate axes; perform a dot product operation on the world space normal and the unit coordinate axis vector to obtain the initial texture weight value on the target world coordinate axis; and calculate the absolute value of the initial texture weight value on the target world coordinate axis to obtain the texture weight value on each world coordinate axis.

[0129] In an optional embodiment of this disclosure, the weight determination module is specifically used to calculate the absolute value of the initial texture weight value on the target world coordinate axis to obtain the intermediate texture weight value on each world coordinate axis; and to normalize the intermediate texture weight value on each world coordinate axis to obtain the texture weight value on each world coordinate axis.

[0130] In an optional embodiment of this disclosure, the model to be processed includes at least a first model sub-region and a second model sub-region. The first model sub-region requires a first texture image, and the first texture image is matched with a first direction corresponding to a first world coordinate axis. The second model sub-region requires a second texture image, and the second texture image is matched with a second direction corresponding to a second world coordinate axis. The texture sampling module 604 is used to perform texture sampling on the first texture image according to the target texture coordinates on the first world coordinate axis to obtain an initial texture sampling result on the first world coordinate axis, and to perform texture sampling on the second texture image according to the target texture coordinates on the second world coordinate axis to obtain an initial texture sampling result on the second world coordinate axis.

[0131] In an optional embodiment of this disclosure, the texture sampling module 604 is used to perform texture sampling on the same third texture image according to the target texture coordinates on each world coordinate axis to obtain the initial texture sampling results on each world coordinate axis.

[0132] In an optional embodiment of this disclosure, the device further includes a coordinate mapping module and a spatial transformation module. The coordinate mapping module is used to map each two-dimensional texture coordinate of the target texture image to the world space coordinate system to obtain the initial texture coordinates of each two-dimensional texture coordinate in the target texture image in the world space coordinate system; wherein, the target texture image includes a first texture image, a second texture image, or a third texture image. The spatial transformation module is used to convert the initial coordinates in the world space coordinate system to the model space coordinate system to generate the target coordinates of each two-dimensional texture coordinate in the target texture image in the model space coordinate system, so as to obtain a new target texture image.

[0133] In an optional embodiment of this disclosure, the model to be processed includes a projected region and a non-projected region. The device further includes a parameter determination module and a mask conversion module. The parameter determination module is used to determine the distance parameter between the world space coordinates of each target model vertex and the projection center; wherein the projection center is located at the center of the projected region in the model to be processed. The mask conversion module is used to convert the distance parameter into a mask map; the product of the target map sampling result and the mask map is multiplied and superimposed with the product of the non-projected region and the non-mask map to obtain the map sampling result for the projected region, so as to perform texture mapping on the projected region in the model to be processed based on the map sampling result.

[0134] The texture mapping apparatus 600 provided in this embodiment can execute the technical solution of the texture mapping method in any of the above embodiments. Its implementation principle and beneficial effects are similar to those of the texture mapping method. Please refer to the implementation principle and beneficial effects of the texture mapping method. It will not be repeated here.

[0135] In exemplary embodiments of this disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the methods described above is stored. In some possible embodiments, various aspects of the present invention may also be implemented as a program product comprising program code that, when the program product is run on a terminal device, causes the terminal device to perform the steps of the various exemplary embodiments of the present invention described in the "Exemplary Methods" section above.

[0136] According to embodiments of the present invention, a program product for implementing the above-described method may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.

[0137] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0138] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.

[0139] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, radio frequency (RF), or any suitable combination thereof.

[0140] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0141] In an exemplary embodiment of this disclosure, an electronic device capable of implementing the above-described method is also provided.

[0142] Those skilled in the art will understand that various aspects of the present invention can be implemented as systems, methods, or program products. Therefore, various aspects of the present invention can be specifically implemented in the following forms: entirely in hardware, entirely in software (including firmware, microcode, etc.), or in a combination of hardware and software, collectively referred to herein as “circuit,” “module,” or “system.”

[0143] The following reference Figure 7 To describe an electronic device 700 according to this embodiment of the present invention. Figure 7 The electronic device 700 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.

[0144] like Figure 7 As shown, the electronic device 700 is manifested in the form of a general-purpose computing device. The components of the electronic device 700 may include, but are not limited to: at least one processing unit 710, at least one storage unit 720, a bus 730 connecting different system components (including storage unit 720 and processing unit 710), and a display unit 740.

[0145] The storage unit stores program code, which can be executed by the processing unit 710 to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of the present invention. For example, the processing unit 710 can perform actions such as... Figure 2 Steps S201 to S204 are shown in the figure.

[0146] Storage unit 720 may include readable media in the form of volatile storage units, such as random access memory (RAM) 7201 and / or cache memory 7202, and may further include read-only memory (ROM) 7203.

[0147] The storage unit 720 may also include a program / utility 7204 having a set (at least one) program module 7205, such program module 7205 including but not limited to: an operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.

[0148] Bus 730 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.

[0149] Electronic device 700 can also communicate with one or more external devices 1000 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 700, and / or with any device that enables electronic device 700 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 750. Furthermore, electronic device 700 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 760. As shown, network adapter 760 communicates with other modules of electronic device 700 via bus 730. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, Redundant Arrays of Independent Disks (RAID) systems, tape drives, and data backup storage systems.

[0150] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.

[0151] Furthermore, the above figures are merely illustrative of the processes included in the method according to exemplary embodiments of the present invention, and are not intended to be limiting. It is readily understood that the processes shown in the above figures do not indicate or limit the temporal order of these processes. Additionally, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.

[0152] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0153] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and embodiments are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.

[0154] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is defined only by the appended claims.

Claims

1. A method of texture mapping, characterized by, The method comprises the following steps: For each target model vertex of a to-be-processed model, obtaining a world space coordinate and a world space normal of the target model vertex in a world space coordinate system; Performing texture projection on the world space coordinate of the target model vertex on a plurality of world coordinate axes of the world space coordinate system respectively to obtain target texture coordinates of the target model vertex on each world coordinate axis; Determining a texture weight value on each world coordinate axis based on an included angle between the world space normal and the plurality of world coordinate axes; According to the target texture coordinates, performing texture sampling to obtain an initial mapping sampling result on each world coordinate axis, and performing hybrid sampling on the initial mapping sampling result and the texture weight value on the corresponding world coordinate axis to obtain a target mapping sampling result, so as to perform texture mapping on the to-be-processed model based on the target mapping sampling result.

2. The method of claim 1, wherein, The plurality of world coordinate axes include a first world coordinate axis, a second world coordinate axis and a third world coordinate axis, and the step of performing texture projection on the world space coordinate of the target model vertex on the plurality of world coordinate axes of the world space coordinate system respectively to obtain the target texture coordinates of the target model vertex on each world coordinate axis comprises the following steps: In response to performing texture projection on the first world coordinate axis, determining a first texture coordinate of the target model vertex on the first world coordinate axis based on a second coordinate value corresponding to the second world coordinate axis in the world space coordinate of the target model vertex and a third coordinate value corresponding to the third world coordinate axis in the world space coordinate of the target model vertex; In response to performing texture projection on the second world coordinate axis, determining a second texture coordinate of the target model vertex on the second world coordinate axis based on a first coordinate value corresponding to the first world coordinate axis in the world space coordinate of the target model vertex and the third coordinate value corresponding to the third world coordinate axis in the world space coordinate of the target model vertex; In response to performing texture projection on the third world coordinate axis, determining a third texture coordinate of the target model vertex on the third world coordinate axis based on the first coordinate value corresponding to the first world coordinate axis in the world space coordinate of the target model vertex and a second coordinate value corresponding to the second world coordinate axis in the world space coordinate of the target model vertex.

3. The method of claim 2, wherein the determining the first texture coordinate of the target model vertex on the first world coordinate axis based on the second coordinate value corresponding to the second world coordinate axis in the world space coordinate of the target model vertex and the third coordinate value corresponding to the second world coordinate axis in the world space coordinate of the target model vertex comprises: determining the first texture coordinate of the target model vertex on the first world coordinate axis based on a product between the second coordinate value and a control repetition frequency factor and a product between the third coordinate value and the control repetition frequency factor. ​ Alternatively, determining the second texture coordinate of the target model vertex on the second world coordinate axis based on the first coordinate value in the world space coordinate of the target model vertex corresponding to the first world coordinate axis and the third coordinate value in the world space coordinate of the target model vertex corresponding to the third world coordinate axis comprises: determining the second texture coordinate of the target model vertex on the second world coordinate axis based on the product of the first coordinate value and a first texture scaling factor and the product of the third coordinate value and the first texture scaling factor; Alternatively, determining the third texture coordinate of the target model vertex on the third world coordinate axis based on the first coordinate value in the world space coordinate of the target model vertex corresponding to the first world coordinate axis and the second coordinate value in the world space coordinate of the target model vertex corresponding to the second world coordinate axis comprises: determining the third texture coordinate of the target model vertex on the third world coordinate axis based on the product of the first coordinate value and a second texture scaling factor and the product of the second coordinate value and the second texture scaling factor.

4. The method of claim 1, wherein, determining the texture weight value on each of the world coordinate axes based on the angle between the world space normal and the plurality of world coordinate axes comprises: for each target world coordinate axis in the plurality of world coordinate axes, obtaining a unit coordinate axis vector of the target world coordinate axis; performing dot product operation on the world space normal and the unit coordinate axis vector to obtain an initial texture weight value on the target world coordinate axis; calculating the absolute value of the initial texture weight value on the target world coordinate axis to obtain the texture weight value on each of the world coordinate axes.

5. The method of claim 4, wherein, calculating the absolute value of the initial texture weight value on the target world coordinate axis to obtain the texture weight value on each of the world coordinate axes comprises: calculating the absolute value of the initial texture weight value on the target world coordinate axis to obtain an intermediate texture weight value on each of the world coordinate axes; performing normalization processing on the intermediate texture weight value on each of the world coordinate axes to obtain the texture weight value on each of the world coordinate axes.

6. The method of claim 1, wherein, the to-be-processed model comprises at least a first model sub-region and a second model sub-region, the first model sub-region requires a first texture image, and the first texture image matches a first direction corresponding to a first world coordinate axis, and the second model sub-region requires a second texture image, and the second texture image matches a second direction corresponding to a second world coordinate axis; the texture sampling according to the target texture coordinate to obtain the initial mapping sampling result on each of the world coordinate axes comprises: texture sampling of the first texture image according to the target texture coordinate on the first world coordinate axis to obtain the initial mapping sampling result on the first world coordinate axis; and texture sampling of the second texture image according to the target texture coordinate on the second world coordinate axis to obtain the initial mapping sampling result on the second world coordinate axis.

7. The method of claim 1, wherein, The texture sampling according to the target texture coordinates obtains initial mapping sampling results on each world coordinate axis. The texture sampling according to the target texture coordinates obtains initial mapping sampling results on each world coordinate axis.

8. The method according to claim 6 or 7, characterized in that, Before the world space coordinates of the target model vertex are projected on multiple world coordinate axes of the world space coordinate system respectively, the method further comprises: mapping each two-dimensional texture coordinate of a target texture image into the world space coordinate system to obtain initial texture coordinates of each two-dimensional texture coordinate of the target texture image in the world space coordinate system; wherein the target texture image comprises a first texture image, a second texture image or a third texture image; converting the initial coordinates in the world space coordinate system into model space coordinates to generate target coordinates of each two-dimensional texture coordinate of the target texture image in the model space coordinate system, so as to obtain a new target texture image.

9. The method of claim 1, wherein, The method further comprises: determining a distance parameter of the world space coordinates of each target model vertex from a projection center; wherein the projection center is located at a center position in the projection region in the model to be processed; converting the distance parameter into a mask map; multiplying the target mapping sampling result and the mask map, and superimposing the product of the non-projection region and the non-mask map to obtain a mapping sampling result for the projection region, so as to perform texture mapping on the projection region in the model to be processed based on the mapping sampling result.

10. A texture mapping apparatus characterized by comprising: The device comprises: an acquisition module configured to acquire, for each target model vertex of a model to be processed, world space coordinates and a world space normal of the target model vertex in a world space coordinate system; a texture projection module configured to project the world space coordinates of the target model vertex on multiple world coordinate axes of the world space coordinate system respectively to obtain target texture coordinates of the target model vertex on each world coordinate axis; a weight determination module configured to determine texture weight values on each world coordinate axis based on an angle between the world space normal and the multiple world coordinate axes; a texture sampling module configured to perform texture sampling according to the target texture coordinates to obtain initial mapping sampling results on each world coordinate axis, and to perform hybrid sampling on the initial mapping sampling results and the texture weight values on the corresponding world coordinate axis to obtain a target mapping sampling result, so as to perform texture mapping on the model to be processed based on the target mapping sampling result.

11. A computer readable storage medium having stored thereon a computer program, characterized in that The computer program is executed by a processor to implement the texture mapping method of any one of claims 1 to 9.

12. An electronic device, comprising: comprises: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the texture mapping method of any one of claims 1 to 9 by executing the executable instructions.

Citation Information

Cited By

  • Synchronous correction method and device for navigation visual area of mirror image overturning and storage medium

    CN122155960A

  • Mirror-inverted navigation view area synchronous correction method, device and storage medium

    CN122155960B