Three-dimensional model rendering method and device, electronic equipment and storage medium

By merging and recording displacement vectors, multiple surface models are rendered into a single model facing the viewpoint, solving the problems of excessive rendering pressure and surface management in 3D games, and achieving efficient rendering and a smooth gaming experience.

CN121482230APending Publication Date: 2026-02-06NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511313080.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-15
Publication Date
2026-02-06

AI Technical Summary

Technical Problem

In existing technologies, the rendering of character and scene models in 3D games suffers from problems such as excessive polygon count leading to excessive rendering pressure, decreased frame rate, and cumbersome operation response. Furthermore, the large number of independent bulletin board solutions increases the difficulty of material assignment.

Method used

Multiple facet models are merged into a single model. The center coordinates of the facet and the displacement vectors of the vertices are calculated and stored. The facets are recorded using texture coordinates and restored to facet orientation during rendering, reducing the number of faces and materials and improving rendering efficiency.

Benefits of technology

By merging patch models and utilizing translation vector rendering, the number of model faces and materials was significantly reduced, improving the game's interactive experience and visual realism, and optimizing game performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121482230A_ABST
    Figure CN121482230A_ABST
Patent Text Reader

Abstract

The invention provides a three-dimensional model rendering method and device, electronic equipment and a storage medium. The method comprises the following steps: acquiring a plurality of patch models; combining the plurality of patch models into a single model; for each surface patch in the combined single model, acquiring a center coordinate of the surface patch, and calculating a displacement vector of each vertex coordinate and the center coordinate on the surface patch; the displacement vectors are stored in texture coordinates of all the vertexes; the vertexes of the multiple patches are contracted towards the center coordinates, and a contracted merging model is generated; during rendering, original coordinates of all the vertexes are recovered based on the displacement vectors stored in the texture coordinates, and the patches are rendered in the view angle direction. According to the method, the number of model surfaces and the number of materials are remarkably reduced, the problem of resource occupation in the game running process is effectively solved, and the equipment burden is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the field of multimedia technology, and in particular, to a three-dimensional model rendering method and device, electronic equipment and storage medium. BACKGROUND

[0002] The fineness of character and scene models in a three-dimensional game has an important influence on the expressiveness of the game, and in particular, character decoration details and plant leaves and the like structures often need to be presented with details and stereoscopic effects through a large number of patches. There are mainly two implementation schemes in the related art: one is to directly use a high-patch model for production without considering the patch limit of the model; and the other is to use a large number of independent billboard patches to simulate the stereoscopic effect. However, these schemes have obvious deficiencies. The high-patch model causes excessive rendering pressure, which reduces the game running frame rate and makes the operation response cumbersome. Although the large number of independent billboard scheme is simple in shader, each billboard needs to be separately assigned a material, which increases the production difficulty. SUMMARY

[0003] The purpose of the present disclosure is to provide a three-dimensional model rendering method, device, electronic equipment and storage medium to realize efficient rendering of multi-patch models.

[0004] In a first aspect, the present disclosure provides a three-dimensional model rendering method, comprising: obtaining a plurality of patch models, the plurality of patch models being used to constitute a decoration element of a three-dimensional object; merging the plurality of patch models into a single model; for each patch in the merged single model, obtaining a center coordinate of the patch and calculating a displacement vector of each vertex coordinate on the patch from the center coordinate; storing the displacement vector in a texture coordinate of each vertex; contracting the vertices of the plurality of patches toward the center coordinate to generate a contracted merged model; and during rendering, restoring the original coordinates of each vertex based on the displacement vector stored in the texture coordinate and rendering the patch toward a viewing angle direction.

[0005] In a second aspect, the present disclosure provides a three-dimensional model rendering device, comprising: an obtaining module configured to obtain a plurality of patch models, the plurality of patch models being used to constitute a decoration element of a three-dimensional object; a merging module configured to merge the plurality of patch models into a single model; a calculating module configured to, for each patch in the merged single model, obtain a center coordinate of the patch and calculate a displacement vector of each vertex coordinate on the patch from the center coordinate; a storing module configured to store the displacement vector in a texture coordinate of each vertex; a contracting module configured to contract the vertices of the plurality of patches toward the center coordinate to generate a contracted merged model; and a rendering module configured to, during rendering, restore the original coordinates of each vertex based on the displacement vector stored in the texture coordinate and render the patch toward a viewing angle direction.

[0006] In a third aspect, the present disclosure provides an electronic device including a processor and a memory. The memory stores computer-executable instructions that can be executed by the processor. The processor executes the computer-executable instructions to perform the steps in the rendering method of a three-dimensional model according to any one of the preceding aspects.

[0007] In a fourth aspect, the present disclosure provides a computer-readable storage medium. The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are invoked and executed by a processor, the computer-executable instructions cause the processor to implement the steps in the rendering method of a three-dimensional model according to any one of the preceding aspects.

[0008] The present disclosure provides a rendering method and device of a three-dimensional model, an electronic device, and a storage medium. A plurality of patch models are obtained, and the plurality of patch models are used to constitute a decorative element of a three-dimensional object. The plurality of patch models are merged into a single model. For each patch in the merged single model, a center coordinate of the patch is obtained, and a displacement vector of each vertex coordinate on the patch and the center coordinate is calculated. The displacement vector is stored in a texture coordinate of each vertex. The vertices of the plurality of patches are contracted toward the center coordinate to generate a contracted merged model. During rendering, the original coordinates of the vertices are restored based on the displacement vector stored in the texture coordinate, and the patches are rendered toward a viewing angle direction. The method provided by the present embodiment combines a large number of patches into a single model and restores the patch positions during rendering through displacement vectors, greatly improving the interactive experience and enabling users to obtain a smoother gaming experience. At the same time, the present solution significantly reduces the number of model surfaces and the number of materials, effectively solves the resource occupation problem during game running, and reduces the burden on the device. BRIEF DESCRIPTION OF DRAWINGS

[0009] In order to more clearly illustrate the technical solutions in the specific embodiments of the present disclosure or the prior art, the drawings needed in the specific embodiments or prior art description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present disclosure, and other drawings can be obtained by those skilled in the art without creative labor.

[0010] Figure 1 An example cloud interaction system architecture in the present disclosure; Figure 2 A rendering method of a three-dimensional model provided by an embodiment of the present disclosure; Figure 3 A rendering device of a three-dimensional model provided by an embodiment of the present disclosure; Figure 4 An electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0011] The technical solutions of this disclosure will be clearly and completely described below with reference to the embodiments. Obviously, the described embodiments are only some embodiments of this disclosure, not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.

[0012] It should be noted that the information (including but not limited to user input information, such as information entered by the user into input boxes), data (including but not limited to data used for analysis, stored data, and displayed data, such as context code, all code of the current project, the service pressure corresponding to operations performed on all code of the current project, and the code development status of the current project), and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data must comply with relevant laws, regulations, and standards. For example, the context code, operations performed on all code of the current project, the corresponding service pressure, and the code development status involved in this application were all obtained with full authorization.

[0013] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of the invention described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0014] It should also be noted that the various trigger events disclosed in this manual can be preset, and different trigger events can trigger the execution of different functions.

[0015] A method for rendering a 3D model in one embodiment of this disclosure can run on a terminal device or a server. The terminal device can be a local terminal device. When the 3D model rendering method runs on a server, the method can be implemented and executed based on a cloud interaction system, which includes a server and client devices. Figure 1 The figure shows a cloud interaction system architecture diagram provided in this disclosure. As shown, the cloud interaction system may include: a client device 10 and a server 20, wherein the client device 10 can be connected to the server 20 via a network 30.

[0016] The 3D model rendering method in one embodiment of this disclosure can run on a terminal device or a server. The terminal device can be a local terminal device, such as a touch device or a non-touch device. When the 3D model rendering method runs on a server, the method can be implemented and executed based on a cloud interaction system, which includes a server and client devices.

[0017] In an optional implementation, cloud gaming can run within the cloud interaction system. Cloud gaming refers to a gaming method based on cloud computing. In the cloud gaming operating mode, the game program and the game screen presentation are separated. The storage and execution of interactive methods in the game are completed on the cloud gaming server. The client device is used for receiving and sending data and presenting the game screen. For example, the client device can be a display device with data transmission capabilities close to the user, such as a mobile terminal, television, computer, or PDA; however, the terminal device for information processing is the cloud gaming server in the cloud. When playing the game, the player operates the client device to send operation commands to the cloud gaming server. The cloud gaming server runs the game according to the operation commands, encodes and compresses the game interface and other data, returns it to the client device through the network, and finally, the client device decodes and outputs the game interface.

[0018] In an optional implementation, the terminal device can be a local terminal device that stores the game program and is used to present the game interface. The local terminal device is used to interact with the player through the game interface; that is, it typically downloads, installs, and runs the game program via an electronic device. The local terminal device can provide the game interface to the player in various ways, such as rendering it on a terminal's display screen or providing it to the player via holographic projection. For example, the local terminal device can include a display screen and a processor. The display screen is used to present the game interface, which includes game scene visuals, and the processor is used to run the game, generate the game interface, and control the display of the game interface on the display screen.

[0019] This embodiment provides a method for rendering a three-dimensional model. Figure 2 This is a flowchart of a rendering method for a three-dimensional model according to an embodiment of the present disclosure, such as... Figure 2 As shown, the process includes the following steps: Step S210: Obtain multiple facet models, which are used to construct decorative elements of a 3D object; Step S220: Merge multiple patch models into a single model; Step S230: For each facet in the merged single model, obtain the center coordinates of the facet and calculate the displacement vector between the coordinates of each vertex and the center coordinates of the facet. Step S240: Store the displacement vectors in the texture coordinates of each vertex; Step S250: Shrink the vertices of multiple facets toward the center coordinates to generate a shrunken merged model; Step S260: During rendering, based on the displacement vector stored in the texture coordinates, the original coordinates of each vertex are restored, and the facets are rendered with the view direction in the orientation of the view.

[0020] The method provided in this embodiment effectively reduces the number of faces and materials in the model by merging multiple facet models into a single model and rendering the facets by recording displacement vectors, thus lowering rendering overhead. Simultaneously, by ensuring that the facets are always rendered facing the viewpoint, the visual performance of the 3D model is improved, enhancing the realism and immersion of the game scene. Furthermore, the method cleverly solves the computer graphics problem of managing a large number of facets uniformly in traditional multi-panel technology through its ingenious design of storing and restoring position information, thereby optimizing game performance.

[0021] The steps described above are explained in detail below.

[0022] In step S210, multiple facet models are obtained. These facet models are used to form decorative elements of a three-dimensional object. When applying them, it is necessary to ensure that the orientation of the multiple facet models remains consistent.

[0023] Specifically, this step involves obtaining a set of facet models that constitute the decorative elements of a 3D object. These facet models are typically used to represent detailed decorations on a 3D object, such as beaded accessories for a character, leaves, and other elements. When obtaining these facet models, it is necessary to ensure that they have the same orientation for subsequent processing.

[0024] In this context, patch models can serve as the basic geometric units that constitute certain decorative elements within a 3D object. Patch models are typically planar geometric structures composed of multiple vertices, used to construct more complex 3D graphical representations.

[0025] Secondly, patch models typically have the ability to represent various decorative elements on a 3D object in a planar form, enabling complex visual effects to be achieved without using too many faces.

[0026] In an alternative implementation, the patch model can be a geometric plane created using modeling software such as Houdini, Maya, or Blender, and these planes can be fitted with texture information to enhance the visual effect. For example, in a character's bead decoration model, each patch can be a quadrilateral containing four vertices and corresponding UV coordinates for mapping the texture of the beads.

[0027] In an alternative implementation, the facet models can be designed to have the same size and shape, but distributed in different positions and orientations in three-dimensional space, thereby creating a complex decorative effect. For example, when creating chain decorations for a character, multiple identical facet models can be used, arranged according to the shape of a chain, with each facet model representing a link on the chain.

[0028] In an alternative implementation, the patch model can be a specially designed geometric shape according to the visual requirements of the target decorative element, such as a fan-shaped or rhomboid patch designed to represent a leaf effect. For example, when designing a leaf model, irregularly shaped triangular or polygonal patches can be used, and the edge contour effect of the leaf can be achieved through the mapping of transparent textures.

[0029] In step S220, multiple patch models are merged into a single model.

[0030] Specifically, this step involves merging the previously acquired multiple independent facet models into a unified geometric model, allowing multiple facets to share the same model space and material resources, facilitating unified management and rendering.

[0031] Model merging can be the process of combining multiple independent geometries into a single entity. Model merging is achieved by integrating the vertex, normal, and texture coordinates of multiple faces into a single data structure.

[0032] Secondly, model merging typically reduces the number of rendering calls, optimizes memory usage, and simplifies resource management.

[0033] In an alternative implementation, model merging can be achieved by preserving the original geometric data of each face while organizing them into a unified vertex buffer and index buffer. For example, during the merging process, the system assigns a unique vertex index range to each face, ensuring that the data of each face can still be independently identified and processed after merging.

[0034] In one alternative implementation, the material properties of the facets can be unified during the model merging process, allowing all facets to share the same set of material parameters and texture resources. For example, when merging multiple facets of a character's bead accessory, the independent facets that originally required multiple rendering calls can be merged into a single model, and all beads can be drawn in a single rendering call, significantly reducing the workload on the GPU.

[0035] In an alternative implementation, model merging may also include preliminary spatial organization of the facets, such as grouping them according to spatial location or material type, to facilitate subsequent processing and rendering optimization. For example, bead facets located in the character's head area and bead facets located in the body area can be organized separately to form two sub-models, and then these sub-models can be merged into a final single model to facilitate subsequent hierarchical processing.

[0036] In one specific application, the development team used a specialized model processing tool to import and merge 200 independent facet models representing beads. During the merging process, the system preserved the original vertex data and spatial position information of each facet, while assigning uniform material parameters to all facets. The merged single model contained the geometric information of all bead facets, but only required a single render call to draw all beads, significantly improving rendering efficiency compared to the original solution that required multiple render calls.

[0037] In step S230, for each facet in the merged single model, the center coordinates of the facet are obtained, and the displacement vectors of each vertex coordinate and the center coordinates on the facet are calculated.

[0038] Specifically, this step is to record the relative position information of each vertex in each facet with respect to the center of the facet. First, the coordinates of the center point of each facet are calculated, and then the displacement vector of each vertex on the facet from the center point is calculated. These displacement vectors will be used to reconstruct the original position of the vertices later.

[0039] The center coordinates of a face can be calculated as the average of the coordinates of all its vertices. The center coordinates represent the center position of the face in three-dimensional space and are the centroid of its geometry.

[0040] In an alternative implementation, the center coordinates of a facet can be calculated by taking the arithmetic mean of the coordinates of all the vertices of the facet, ensuring that the center point is located at the geometric center of the facet. For example, for a quadrilateral facet, its center coordinates can be obtained by adding the x, y, and z coordinates of the four vertices and then dividing by 4. This method is suitable for facets with regular shapes.

[0041] In step S240, the displacement vector is stored in the texture coordinates of each vertex.

[0042] Specifically, this step encodes and stores the calculated displacement vector information into the vertex's texture coordinates (UV coordinates) so that this displacement data can be retrieved and used in subsequent rendering processes. Since graphics APIs (Application Programming Interfaces) typically support multiple sets of texture coordinates, these channels can be used to store non-texture-mapped data.

[0043] Texture coordinates are parameters that define how a 3D model's surface maps to a 2D texture image. Texture coordinates are typically two-dimensional (u,v) values, but modern graphics systems support multiple sets of texture coordinates, which can be used to store additional information.

[0044] In an alternative implementation, to improve data accuracy, the displacement vector can be normalized before storage, and its original size can be restored in the shader using an additional scaling factor. For example, the components of the displacement vector can be mapped to the range of 0-1 before being stored in texture coordinates. When read in the shader, the original value can be restored by multiplying it by the corresponding scaling factor, thus making full use of the precision range of the texture coordinates.

[0045] In step S250, the vertices of multiple facets are shrunk towards the center coordinates to generate a shrunk and merged model.

[0046] Specifically, this step involves shrinking the vertices of each face towards its center, causing the face to occupy a smaller area in space. This shrinking operation prevents overstretching or intersection between faces during skeletal animation deformation and provides a basis for restoring the original shape in the shader later.

[0047] Vertex shrinkage can be the process of moving vertices on a face towards the center of the face. Vertex shrinkage is achieved by proportionally reducing the distance from the vertex to the center of the face, and can be uniform or non-uniform shrinkage.

[0048] Secondly, vertex shrinkage typically reduces the space occupied by the face, prevents excessive stretching in skeletal animation, and provides a starting point for position restoration in the shader.

[0049] In an alternative implementation, vertex shrinkage can be performed using a linear scaling method, that is, the distance from each vertex to the center of the face is reduced by a fixed ratio. For example, a shrinkage coefficient of 0.1 can be set so that the distance from each vertex to the center becomes 10% of its original value. This will significantly reduce the size of the entire face while maintaining its original shape proportions.

[0050] In step S260, during rendering, the original coordinates of each vertex are recovered based on the displacement vector stored in the texture coordinates, and the facets are rendered with the viewpoint facing the direction of view.

[0051] Specifically, this step involves reading the displacement vector data stored in the texture coordinates through the vertex shader during real-time rendering, combining it with the current camera view direction, calculating the direction that the face should face, and restoring the shrunken vertices to their appropriate positions so that the face always faces the view direction.

[0052] Oriented view rendering is a rendering technique that ensures 3D surfaces always face the viewer's perspective. It creates the visual effect of a surface always facing the viewer by adjusting its orientation in real time so that its normals point towards the viewer's position.

[0053] Secondly, orientation-based rendering typically has the functions of creating 3D effects, reducing the number of facets in a model, and improving rendering efficiency.

[0054] In a specific application, when the game camera rotates around the character, the shader program automatically reads the displacement vector data stored in the UV channels and calculates the direction each face should face in conjunction with the current camera position. For example, for a face representing a bead, the shader first constructs a coordinate system based on the camera's viewpoint, then transforms the displacement vectors into this coordinate system, and finally applies the transformed displacement vectors to the shrunken vertices, restoring the face to its original size and ensuring it always faces the camera. In this way, regardless of the player's viewing angle, the bead will appear circular, creating the illusion of three-dimensionality, even though only a single planar geometry is actually used.

[0055] In a rendering method for a 3D model provided in one embodiment of this application, storing the displacement vector into the texture coordinates of each vertex includes: The coordinate components of the displacement vector are stored in multiple texture coordinate channels respectively.

[0056] Specifically, when storing the displacement vectors of each vertex of a face into texture coordinates, since the displacement vector usually contains three coordinate components, X, Y, and Z, and each texture coordinate channel can only store a limited amount of information, it is necessary to store each coordinate component of the displacement vector into different texture coordinate channels.

[0057] The texture coordinate channel can be a storage unit used to store texture mapping information of model vertices. The texture coordinate channel is a data channel used to store the mapping relationship between vertices and textures during the rendering process of a 3D model.

[0058] Secondly, texture coordinate channels typically serve to pass additional vertex attribute information throughout the rendering pipeline. Texture coordinates can be used not only for traditional texture mapping but also for flexibly storing and passing various custom data.

[0059] In an optional implementation, the X and Y components of the displacement vector can be stored in the U and V components of the first texture coordinate channel (e.g., UV0), and the Z component can be stored in the U component of the second texture coordinate channel (e.g., UV1). This storage method makes full use of the model's texture coordinate space and achieves complete preservation of the displacement vector. For example, for a vertex of a face, if its displacement vector to the center of the face is (0.5, -0.3, 0.2), then 0.5 can be stored in the U component of UV0, -0.3 in the V component of UV0, and 0.2 in the U component of UV1.

[0060] In an alternative implementation, normalization can be used to map the coordinate components of the displacement vector to the range [0,1] before storing them in the texture coordinate channel, and then denormalize them to restore the original values ​​during rendering. This approach helps maintain data accuracy and adapts to the texture coordinate range limitations of different rendering APIs.

[0061] In a specific application, when creating beaded accessories for game characters, the system first obtains the center position of each bead facet and calculates the displacement vector of each vertex on the facet relative to the center. These displacement vectors are decomposed into three components: X, Y, and Z. The X and Y components are stored in the first set of UV channels of the model, and the Z component is stored in the U value of the second set of UV channels. When the game engine renders, the shader reads this displacement information stored in texture coordinates and reconstructs the original shape of the facet based on the current camera view, ensuring that the bead facets always face the player's viewpoint. This results in a highly three-dimensional bead effect using only a small number of facets.

[0062] In a rendering method for a three-dimensional model provided in one embodiment of this application, the vertices of multiple facets are shrunk towards the center coordinates to generate a shrunk and merged model, including: For each face, shrink all vertices of the face towards the center coordinates of the face to a preset range.

[0063] Specifically, after merging multiple facet models into a single model and calculating the displacement vectors of each vertex and the center coordinate, each facet in the merged single model needs to be shrunk. This is achieved by scaling each vertex toward the center coordinate of its respective facet, so that the shrunk facet still retains its original shape features, but its size is reduced to a preset range.

[0064] Secondly, the center coordinates of the facet usually serve as a reference point during the facet shrinkage process, and all vertices use this as a reference for displacement calculation.

[0065] In an optional implementation, the preset range can be a threshold range determined comprehensively based on rendering performance requirements and visual effect requirements, used to control the degree of patch shrinkage. For example, the preset range can be set between 0.01% and 1% of the original patch size, which ensures that the patch is sufficiently shrunk to reduce the rendering burden, while avoiding excessive shrinkage that would cause the patch to become too small and be ignored by the rendering engine.

[0066] In one alternative implementation, the degree of facet shrinkage can be dynamically adjusted according to the model type. For complex models with many decorative elements, a larger shrinkage ratio can be used, while for structurally critical model parts, a smaller shrinkage ratio can be used. For example, for beaded accessories for game characters, the facets can be shrunk to 0.5% of their original size, while for natural elements such as leaves, the shrinkage ratio can be adjusted to 0.1% to 0.8% of their original size, depending on their importance in the scene.

[0067] In an alternative implementation, face shrinkage can be achieved by calculating the vector from each face vertex to the center point and then multiplying it by a scaling factor less than 1. This scaling factor can be dynamically adjusted based on the overall size of the model and rendering requirements. For example, for a leaf model composed of hundreds or thousands of faces, a scaling factor of 0.05 can be set to shrink the vertices of each face towards the center to 5% of their original distance, thereby significantly reducing the geometric complexity during rendering while maintaining visual integrity through subsequent translation vector recovery.

[0068] In a specific application, suppose there is a game character bead decoration model composed of multiple facets, each facet representing the surface of a bead. The system first calculates the center point coordinates of each bead facet, and then applies a scaling factor of 0.01 to all vertices of that facet, causing these vertices to shrink towards the center point, reducing the original 2 cm diameter bead to 0.02 cm. In this way, the entire decoration model composed of 200 beads is shrunk into a very small model, greatly reducing the rendering burden. In subsequent rendering, the displacement vector information stored in the texture coordinates can be used to restore these beads to their original size and correctly face the view direction, achieving a perfect combination of performance optimization and visual effect.

[0069] In one embodiment of this application, a method for rendering a three-dimensional model further includes: Step S1010: Obtain the bone weight information of each vertex on the face; Step S1020: Average the bone weight information of each vertex on the same face. Step S1030: The averaged bone weight information is redistributed to each vertex on the face.

[0070] The method provided in this embodiment solves the problem of surface stretching and deformation of characters during animation by averaging bone weights, enabling surface models to maintain a consistent deformation effect, improving the visual performance of game characters or plant models, while also avoiding the tedious operation of manually adjusting bone weights, simplifying the model production process, and effectively solving the deformation problem caused by uneven distribution of animation bone weights in computer graphics.

[0071] The above plan will be explained in detail below.

[0072] In step S1010, the bone weight information of each vertex on the face is obtained.

[0073] Specifically, during the rendering process of a 3D model, for a 3D model associated with a skeleton, it is necessary to obtain the bone weight information corresponding to each vertex on each facet of the model so as to correctly control the deformation of the facets in the skeletal animation.

[0074] Among them, bone weight information can be data on the degree of association between vertices and bones in a 3D model. Bone weight information usually plays a role in controlling the degree to which each vertex is affected by the bones when the model deforms.

[0075] In an optional implementation, bone weight information can be represented as a set of weight values ​​for multiple bones corresponding to each vertex, where each weight value represents the degree to which the vertex is affected by a specific bone. For example, in a beaded accessory for a character model, the vertices on each bead face may be affected by multiple bones, such as finger bones, wrist bones, etc. The system records the weight value of each bone corresponding to each vertex, forming a weight matrix.

[0076] In an alternative implementation, bone weight information can be obtained by reading predefined bone binding data from a model file, which is typically generated automatically after bone binding is completed in 3D modeling software.

[0077] In an alternative implementation, the bone weight information may include the influence weights of multiple bones corresponding to each vertex. These weight values ​​are typically normalized so that the sum of the weights of all bones to a vertex equals 1.

[0078] In a specific application, when processing bead decorations on a character model, the system first identifies the multiple faces that make up the beads, and then obtains the bone weight information of all vertices of each face. For example, a quadrilateral face has four vertices, and the system will read all the bones associated with each of these four vertices and their corresponding weight values. These weight values ​​reflect how each vertex deforms following different bones during the character's animation.

[0079] In step S1020, the bone weight information of each vertex on the same face is averaged.

[0080] Specifically, mean weighting refers to averaging the bone weights of all vertices on the same face so that all vertices on the face have the same bone weight distribution.

[0081] Mean averaging is a process of mathematically averaging the bone weights of each vertex on the same face. Mean averaging typically helps maintain a consistent deformation effect for the face in skeletal animation.

[0082] The step of averaging the bone weight information of each vertex on the same facet includes: For each bone, calculate the average weight value of each vertex on that face corresponding to that bone.

[0083] Specifically, in an optional implementation, the averaging process can be performed individually for each bone, that is, by calculating the average of the weight values ​​of all vertices on the face with respect to a specific bone, and finally obtaining the average weight value corresponding to each bone. For example, for a face with 4 vertices, if the weights of these 4 vertices with respect to bone A are 0.2, 0.3, 0.4 and 0.5 respectively, then after averaging, the weights of these 4 vertices with respect to bone A will all be set to 0.35.

[0084] In an alternative implementation, the averaging process can be achieved by traversing each face, calculating the average weight of all vertices on that face relative to each bone, and then distributing these averages as new weights to all vertices on the face. For example, in Houdini software, a loop node can be used to process each face sequentially, then a pack node can be used to obtain the center position of the face, and then a related node can be used to calculate the average bone weight of all vertices on that face, forming a uniform weight distribution.

[0085] In an alternative implementation, the averaged weights may need to be normalized to ensure that the sum of all bone weights for each vertex is still 1, in order to maintain the correctness of the skeletal animation system. For example, if a vertex is affected by three bones, the averaged weights would be 0.3, 0.4, and 0.35, respectively. The system would then renormalize these values ​​to approximately 0.286, 0.381, and 0.333, ensuring that the sum is 1.

[0086] In step S1030, the mean-processed bone weight information is redistributed to each vertex on the face.

[0087] Specifically, the calculated average bone weight value is reassigned to all vertices on the same face, so that all vertices on the face have the same bone weight distribution.

[0088] Reassignment, in this context, refers to the process of updating the model's vertex attributes with mean-scaled bone weight data. Reassignment typically ensures that facets deform consistently as a whole during skeletal animation, preventing facet distortion or tearing.

[0089] In an alternative implementation, the redistribution process can be achieved by directly modifying the vertex bone weight attribute in the model data structure, replacing the original bone weight value of each vertex on the patch with the calculated average value.

[0090] In one alternative implementation, the redistribution can be done in the 3D modeling software before the model is exported, or it can be dynamically implemented at runtime in the game engine via scripts, depending on the specific workflow requirements.

[0091] In a specific application, for a flower decoration model on a character's head, the model consists of petals composed of multiple facets. The system first averages the bone weights of the vertices on each petal facet to obtain the average weight value of that facet relative to the head bones, neck bones, etc. Then, the system distributes these averaged weight values ​​to all vertices on that petal facet, replacing the original uneven weight distribution. When the character nods or shakes their head, because all vertices on each petal facet now have the same bone weight, the petals move as a whole following the skeletal animation, avoiding the petal distortion or tearing caused by inconsistent vertex bone weights, thus maintaining a natural and beautiful shape in the animation.

[0092] In a rendering method for a three-dimensional model provided in one embodiment of this application, during rendering, the original coordinates of each vertex are recovered based on the displacement vector stored in the texture coordinates, and the facets are rendered facing the view direction, including: Step S2601: Read the displacement vector stored in the texture coordinates; Step S2602: Determine the current viewing direction and construct an orientation coordinate system based on the viewing direction; Step S2603: Based on the orientation coordinate system and the displacement vector, calculate the target position of each vertex when facing the view direction; Step S2604: Render the patch according to the target position.

[0093] The method provided in this embodiment enables the rendering system to dynamically adjust the orientation of facets in real time, ensuring that the facets always face the viewpoint, thereby enhancing the realism and three-dimensionality of the rendering effect. Simultaneously, by storing displacement information in vertex texture coordinates and restoring it during rendering, storage overhead is reduced, rendering efficiency is improved, and the rendering of numerous decorative elements in the game scene can be achieved efficiently, enhancing the game's visual experience and interactive smoothness. This solves the technical problem of excessive computational resource consumption when dealing with a large number of facets in traditional rendering methods.

[0094] The above plan will be explained in detail below.

[0095] In step S2601, the displacement vector stored in the texture coordinates is read.

[0096] Specifically, after the patch models are merged into a single model, the original position information of the vertices has already been stored in texture coordinates via displacement vectors. During the rendering process, the previously stored displacement vector information needs to be read from these texture coordinate channels first.

[0097] In an alternative implementation, reading the displacement vector can be achieved by accessing the vertex's texture coordinates in the vertex shader.

[0098] In an alternative implementation, reading the displacement vector may also require coordinate space transformation to ensure that the displacement vector is used in the correct coordinate system. For example, the displacement vector may be stored in the model's local space and needs to be transformed to world space or view space for correct application.

[0099] In one specific application, when a game character wears an ornament with 200 beads, these beads have been merged into a single model and the vertices have been shrunk. When rendering this ornament, the rendering system first reads the texture coordinates of each vertex. For example, if a vertex's texture coordinates texcoord are (0.12, -0.08) and texcoord1 are (0.05, 0), these values ​​combined represent the vertex's displacement vector relative to the center of its face (0.12, -0.08, 0.05). The rendering system collects the displacement information of all vertices to prepare for position recovery in subsequent steps.

[0100] In step S2602, the current viewing direction is determined, and an orientation coordinate system is constructed based on the viewing direction.

[0101] Specifically, in order to ensure that the face always faces the view direction, it is necessary to determine the direction that the face should face based on the current position and direction of the camera or observer, and construct an orientation coordinate system based on this, which is used to calculate the target position of the face vertex in subsequent calculations.

[0102] The viewpoint direction can be a directional vector pointing from the virtual camera or viewpoint towards the scene, representing the direction of the user's gaze when observing the 3D scene. The viewpoint direction typically plays a role in determining the orientation of facets and ensuring optimal visibility for rendering.

[0103] In an alternative implementation, the view direction can be determined by calculating the vector from the camera position to the center of the patch. For example, in a game engine, the view direction can be calculated as "viewDirection = normalize(cameraPosition -objectPosition);", where cameraPosition is the camera's position in world space, objectPosition is the position of the rendered object in world space, and viewDirection is the view direction.

[0104] In an alternative implementation, the orientation coordinate system can use the opposite direction of the view direction as the normal direction (z-axis), and then determine the right direction vector (x-axis) and the up direction vector (y-axis) through a cross product operation to form an orthogonal local coordinate system. For example, an up direction vector in world space can be defined first (usually (0,1,0)), then the right direction can be calculated using "rightDir = cross(upDir, normalDir)", and the up direction can be recalculated using "upDir = cross(normalDir,rightDir)" to ensure that the three direction vectors are perpendicular to each other, where normalDir is the normal direction vector, upDir is the up direction vector, and rightDir is the right direction vector.

[0105] In a specific application, when a player controls a character in a game to observe a plant decorated with leaves from one angle, the rendering system obtains the current camera position (10, 5, 20) and the plant position (5, 2, 10), and calculates the view direction as normalize((5, 2, 10) - (10, 5, 20)) = normalize(-5, -3, -10) ≈ (-0.41, -0.24, -0.82). Then, the reverse direction of this view is used as the normal direction (0.41, 0.24, 0.82), and the up direction is defined as (0, 1, 0). The right direction vector (0.82, 0, -0.41) is calculated through the cross product, and the up direction is recalculated as (-0.10, 0.97, -0.22), thus constructing a complete orientation coordinate system.

[0106] In step S2603, the target position of each vertex when facing the view direction is calculated based on the orientation coordinate system and the displacement vector.

[0107] Specifically, using the orientation coordinate system established earlier and the displacement vector read from the texture coordinates, the position that each vertex should be in when facing the current viewpoint is calculated. This step restores the vertices from their shrunken state to their original size and aligns the facets with the viewpoint direction.

[0108] The orientation coordinate system can be a local coordinate system consisting of three mutually perpendicular basis vectors determined by the view direction, used for transforming and locating face vertices. The orientation coordinate system typically ensures that the face is correctly oriented towards the view direction and maintains proper spatial orientation.

[0109] In an alternative implementation, the displacement vector can be transformed from the original coordinate system to the orientation coordinate system using matrix operations. For example, a 3x3 transformation matrix consisting of the three basis vectors of the orientation coordinate system can be constructed, and then the displacement vector can be multiplied by this matrix to obtain the displacement in the orientation coordinate system. In this way, the patch will always remain facing the observer, regardless of changes in the viewing angle.

[0110] In one alternative implementation, the target position can be calculated using a step-by-step approach. First, the shrunken vertex position is considered the starting point; then, the transformed displacement vector is added to this position to obtain the vertex's new position in the facing coordinate system. This step-by-step calculation makes the code clearer and facilitates adding additional position adjustment logic when needed.

[0111] In step S2604, the patch is rendered according to the target position.

[0112] Specifically, using the calculated target positions of each vertex, graphics rendering techniques are applied to perform the final rendering of the face, including but not limited to applying textures, lighting calculations, and transparency processing, so that the face is correctly displayed on the screen.

[0113] The target position can be the final coordinate position of the vertex in three-dimensional space after displacement recovery and orientation adjustment. The target position usually determines the final display position and shape of the face on the screen.

[0114] In an alternative implementation, the rendering process may include texture mapping, which applies a predefined texture image to a facet. For example, for a leaf facet, a texture containing leaf color, transparency, and detail may be applied; for a character bead decoration, a texture with a metallic sheen or gemstone texture may be applied. Texture mapping allows simple faces to present rich visual effects.

[0115] In a specific application, when a tree model in a game contains a large number of leaves, each leaf is a processed facet. Based on the target position of each leaf vertex calculated in the previous steps, the rendering system applies a material containing the leaf texture, calculates lighting effects (such as the effects of sunlight projected from above the canopy and ambient light), and processes the translucent areas of the leaves. When the player character observes the tree from different angles, all the leaves automatically adjust their orientation to always face the player. However, due to the precise calculations in the previous steps, the player still sees a natural tree and will not perceive that these leaves are actually flat faces. At the same time, this rendering method greatly reduces the number of faces in the model and the computational complexity, allowing more trees to be rendered simultaneously in the game scene without affecting performance.

[0116] In a rendering method for a 3D model provided in one embodiment of this application, the step of constructing an orientation coordinate system based on the viewpoint direction includes: The opposite direction of the stated viewpoint direction is taken as the normal direction; Define a preset upward direction vector; Based on the normal direction and the up direction vector, the right direction vector is constructed through cross product operation; Based on the normal direction and the right direction vector, the up direction vector is recalculated to form an orthogonal orientation coordinate system.

[0117] The method provided in this embodiment enables the construction of an orthogonal coordinate system associated with the viewpoint direction. This coordinate system ensures that the surface model always faces the camera's viewpoint direction, thereby maintaining good visual effects for the rendered 3D model from different perspectives. This enhances the realism and three-dimensionality of decorative elements or plant models in the game, improves the player's interactive experience and the richness of the game's visuals, and reduces the number of model faces while ensuring visual effects, thus solving the problem of balancing performance and visual quality in computer graphics rendering.

[0118] The above plan will be explained in detail below.

[0119] Regarding taking the opposite direction of the stated viewpoint direction as the normal direction. Specifically, using the opposite direction of the viewpoint as the normal direction means reversing the direction in which the camera points at the model, and using it as the normal direction for constructing the coordinate system.

[0120] The viewpoint direction can be a unit vector pointing from the camera towards the model, representing the direction of the observer's line of sight. The viewpoint direction is typically a vector formed by the camera position pointing towards the observed target position, and consists of three components in three-dimensional space: x, y, and z.

[0121] Secondly, the viewpoint direction usually plays a role in determining the spatial relationship between the observer and the observed object. By determining the viewpoint direction, the relative positional relationship between the camera and the model can be determined, thereby deciding the direction in which the facets should face during rendering.

[0122] In an alternative implementation, the viewing direction can be determined by obtaining the position of the camera and the position of the center point of the target object, and then calculating the vector from the camera position to the center of the target object. For example, if the camera position is (10, 5, 0) and the center of the observed object is located at (0, 0, 0), the viewing direction can be represented as the vector (-10, -5, 0), which can be standardized to obtain the unit viewing direction.

[0123] In an optional implementation, using the opposite direction of the viewpoint direction as the normal direction means inverting the viewpoint direction vector, that is, multiplying each component of the original viewpoint direction vector by -1, and using the new vector as the normal direction of the patch. For example, if the viewpoint direction is (0.8, 0.6, 0), then its opposite direction is (-0.8, -0.6, 0), and this opposite direction vector will be used as the normal direction for constructing the coordinate system.

[0124] In one alternative implementation, the normal direction can represent the perpendicular direction of the facet plane, ensuring that the facet is always perpendicular to the line of sight. For example, in a game scene, when the bead decoration worn by the player's character needs to always face the camera, the system will calculate the direction vector from the camera position to the bead in real time, take its opposite direction as the normal direction, so that the facet of the bead always faces the player, creating a visual effect similar to a three-dimensional sphere.

[0125] Regarding the definition of the preset upward direction vector Specifically, defining a preset up direction vector means specifying an initial up direction reference vector when constructing the orientation coordinate system. This vector is usually parallel to a certain axis of the world coordinate system, providing a basis for the subsequent construction of a complete orthogonal coordinate system.

[0126] The preset up direction vector can be a unit vector pointing "up" in three-dimensional space, usually aligned with the positive Y-axis of the world coordinate system, i.e., (0, 1, 0). It can also be set to other directions according to specific needs.

[0127] Secondly, the pre-defined upward direction vector typically serves to provide a reference direction for constructing the orientation coordinate system. This vector, together with the normal direction, determines the initial orientation of the coordinate system, laying the foundation for subsequently constructing a complete orthogonal coordinate system through cross product operations.

[0128] In an optional implementation, the preset up direction vector is set to the positive Y-axis direction of the world coordinate system, i.e., vector (0, 1, 0). For example, in a 3D game scene, a preset up direction vector of (0, 1, 0) can ensure that the generated patches maintain natural alignment in the vertical direction.

[0129] In an alternative implementation, if the game or application's coordinate system has a specific definition, the preset up direction vector can also be set to other directions. For example, in some coordinate systems, the Z-axis may be defined as the upward direction, in which case the preset up direction vector can be set to (0, 0, 1). This flexibility allows this method to adapt to different 3D engines and coordinate system settings.

[0130] In an optional implementation, under special circumstances, if the normal direction happens to be parallel or nearly parallel to the preset upward direction vector, another direction can be temporarily selected as the preset upward direction vector, such as the X-axis direction (1, 0, 0), to avoid the cross product operation result approaching the zero vector. For example, when the camera is looking vertically downward or upward, the viewing angle direction will be nearly parallel to the Y-axis. At this time, the preset upward direction vector can be dynamically switched to the X-axis or Z-axis direction.

[0131] Regarding the construction of the right direction vector through cross product operation based on the normal direction and the up direction vector; Specifically, constructing the right direction vector based on the normal direction and the up direction vector through the cross product operation means using the property of the cross product of vectors to calculate the cross product of the normal direction and the up direction vector, and obtaining a third vector that is perpendicular to both of these vectors, which serves as the right direction vector of the coordinate system.

[0132] The cross product operation can be the cross product of two three-dimensional vectors, resulting in a new vector that is perpendicular to both original vectors. In three-dimensional space, the formula for calculating the cross product of vectors A and B is: A×B = (Ay×Bz - Az×By, Az×Bx - Ax×Bz, Ax×By - Ay×Bx).

[0133] Secondly, the cross product operation typically generates a new vector perpendicular to the plane of the original two vectors. In constructing an orthogonal coordinate system, the cross product ensures that the resulting three basis vectors are mutually perpendicular, forming a standard orthogonal basis.

[0134] In an alternative implementation, the right direction vector can be constructed using the standard vector cross product formula. Specifically, for the normal direction vector `normal` and the up direction vector `up`, the right direction vector `right` can be calculated using the formula `right = normalize(cross(up, normal))`, where `normalize` represents normalizing the vector to a unit vector. For example, if the normal direction is (0, 0, -1) and the up direction vector is (0, 1, 0), then the right direction vector is `normalize(cross((0, 1, 0), (0, 0, -1))) = normalize((1, 0, 0)) = (1, 0, 0)`.

[0135] In an optional implementation, before performing the cross product operation, it is necessary to ensure that the normal direction vector and the up direction vector are not parallel or are nearly parallel to avoid the cross product result being a zero vector or having unstable values. When two vectors are detected to be nearly parallel, another direction can be temporarily selected as the up direction vector, for example, a vector that is not parallel to the normal direction can be selected from the X-axis (1, 0, 0) or Z-axis (0, 0, 1). For example, if the normal direction is (0.1, 0.99, 0), which is nearly parallel to the Y-axis (0, 1, 0), the X-axis (1, 0, 0) can be temporarily selected as an alternative up direction vector.

[0136] In an alternative implementation, the calculation of the right direction vector needs to be performed in real time during each frame of rendering to adapt to changes in the viewpoint direction. In practical applications, this calculation process can be implemented in the vertex shader or fragment shader.

[0137] Regarding the recalculation of the up direction vector based on the normal direction and the right direction vector to form an orthogonal orientation coordinate system; Specifically, recalculating the up direction vector based on the normal direction and the right direction vector means using the already determined normal direction and the right direction vector to recalculate the up direction vector through the cross product operation, so as to ensure that the three vectors are perpendicular to each other and form a standard orthogonal coordinate system.

[0138] In this method, the orthogonal orientation coordinate system can be a coordinate system consisting of three mutually perpendicular unit vectors, which represent the three axes of the coordinate system. In this method, these three vectors are the normal direction (as the forward axis), the right direction vector (as the right axis), and the recalculated upward direction vector (as the upward axis).

[0139] Secondly, orthogonal orientation coordinate systems typically serve as a standard reference frame for patch models. Orthogonal coordinate systems ensure accuracy and consistency during coordinate transformations and position calculations, allowing patches to be correctly oriented in the viewpoint direction.

[0140] In an alternative implementation, to ensure coordinate system normalization, the recalculated up direction vector needs to be normalized to become a unit vector. This can be achieved by dividing the vector by its length (magnitude). For example, the normalization process for the up direction vector is: up = up / length(up), where the length function calculates the Euclidean length of the vector. This ensures that all three basis vectors of the coordinate system are unit vectors, maintaining the orthogonality and normality of the coordinate system.

[0141] In a rendering method for a 3D model provided in one embodiment of this application, the target position of each vertex when facing the view direction is calculated based on the orientation coordinate system and the displacement vector, including: Transform the displacement vector from the original coordinate system to the orientation coordinate system; The target position is obtained by adding the transformed displacement vector to the shrunken vertex position.

[0142] Regarding the transformation of the displacement vector from the original coordinate system to the orientation coordinate system; Specifically, the displacement vectors stored in the original model space need to be transformed into an orientation coordinate system built based on the current viewpoint direction to ensure that the patch can face the camera correctly while maintaining the original shape and size of the patch.

[0143] In an alternative implementation, the displacement vector can be transformed from the original coordinate system to the orientation coordinate system using matrix multiplication. For example, a transformation matrix can be constructed whose column vectors consist of the three basis vectors of the orientation coordinate system, and then this matrix can be multiplied by the displacement vector to obtain the displacement vector in the orientation coordinate system.

[0144] In an alternative implementation, the displacement vector can be transformed into the orientation coordinate system by vector projection. For example, the displacement vector can be projected onto the right direction vector, the up direction vector, and the normal direction vector of the orientation coordinate system, respectively, to obtain the three components of the displacement vector in the orientation coordinate system.

[0145] The target position is obtained by adding the transformed displacement vector to the shrunken vertex position; Specifically, a vector addition operation is performed between the displacement vector represented in the orientation coordinate system and the vertex position in the current contraction state to obtain the spatial position that the vertex should be in when facing the view direction, which is the final target position during rendering.

[0146] The shrunk vertex positions can be the coordinates obtained by shrinking the face vertices towards the center point. The shrunk vertex positions serve as the starting point and reference position for vertex transformation.

[0147] In an alternative implementation, the transformed displacement vector can be added to the shrunken vertex position using direct vector addition. For example, for each vertex, its shrunken position coordinates are added to the components of the transformed displacement vector to obtain the final position coordinates of the vertex in the direction of the view.

[0148] In an alternative implementation, the transformed displacement vector can be added to the shrunken vertex position using component addition. For example, the vertex position and the components of the displacement vector along the X, Y, and Z axes can be calculated and added separately to obtain the final X, Y, and Z coordinates of the vertex when facing the viewpoint direction.

[0149] In a rendering method for a three-dimensional model provided in one embodiment of this application, the decorative elements include accessory elements of game characters and / or leaf elements of plant models.

[0150] The method provided in this embodiment enables optimized rendering of decorative elements, such as beads and ornaments for game characters and leaves for plant models, by clearly defining the scope of decorative elements. This effectively reduces the polygon count of the models and improves rendering efficiency. This optimized rendering scheme for specific decorative elements not only enhances the interactive experience, allowing users to enjoy smoother visuals during gameplay, but also enriches the game, enabling developers to add more exquisite decorative details without increasing performance pressure. This solves the performance problems caused by a large number of small decorative elements in computer graphics rendering.

[0151] Specifically, in the rendering process of 3D models, decorative elements refer to secondary model units attached to the main model to increase the model's details and aesthetics. These elements are usually numerous but small in size, and if traditional rendering methods are used, they will result in a large number of polygons consuming rendering resources.

[0152] In an alternative implementation, accessory elements for game characters can include small ornaments such as beads, chains, tassels, badges, feathers, and flowers worn by the character. These elements typically require high geometric detail to achieve a good visual effect. For example, in a character model, each bead on a beaded chain might require 30 faces if using a traditional sphere model. With 200 beads, a total of 6000 faces would be needed. Using this method, a similar visual effect can be achieved with only 2 faces per bead, requiring only 400 faces in total, significantly reducing rendering overhead.

[0153] In an optional implementation, the leaf elements of the plant model can include leaves, petals, fruits, and other elements on plant models such as trees, shrubs, and flowers that require a large number of repetitions and are oriented towards the viewpoint. These elements would consume a large number of facet resources in traditional rendering methods. For example, in a game scene, if each leaf requires 8-10 facets to be represented using a geometric model, a tree may have thousands of leaves. However, using this method, a similar effect can be achieved with only 1 or 2 facets per leaf, greatly reducing the number of facets in the model.

[0154] In a rendering method for a three-dimensional model provided in one embodiment of this application, the method further includes the following steps before obtaining multiple patch models: Ensure that the orientation of the multiple patch models remains consistent.

[0155] The method provided in this embodiment ensures the consistency of the orientation of the facet models before acquisition, laying the foundation for subsequent model merging and displacement vector calculation. This ensures the correct orientation of the facets and the consistency of visual effects throughout the rendering process, thereby improving rendering quality and game experience, enhancing the naturalness and realism of decorative elements in the game scene, and effectively solving the problem of visual confusion caused by inconsistent orientation of a large number of facet models in three-dimensional space.

[0156] In an alternative implementation, ensuring that multiple facet models have the same orientation can be achieved by uniformly setting the direction of the normal vector for each facet. For example, in modeling software, all faces can be selected, and their normal vectors can be uniformly set to the same direction, such as all pointing towards the positive Z-axis, ensuring that all faces have the same reference orientation in subsequent processing.

[0157] Based on the above method embodiments, this disclosure also provides a rendering device for a three-dimensional model, see [link to relevant documentation]. Figure 3 The device includes the following modules: The acquisition module 301 is used to acquire multiple facet models, which are used to form decorative elements of a 3D object. Merging module 302 is used to merge multiple patch models into a single model; The calculation module 303 is used to obtain the center coordinates of each facet in the merged single model and calculate the displacement vector between the coordinates of each vertex and the center coordinates of the facet. Storage module 304 is used to store the displacement vector into the texture coordinates of each vertex; The shrinking module 305 is used to shrink the vertices of multiple facets toward the center coordinates to generate a shrunken merged model; The rendering module 306 is used to recover the original coordinates of each vertex based on the displacement vector stored in the texture coordinates during rendering, and to render the facets facing the view direction.

[0158] The aforementioned device acquires multiple facet models, which are used to construct decorative elements of a 3D object; merges these facet models into a single model; for each facet in the merged single model, it acquires the center coordinates of the facet and calculates the displacement vectors between the coordinates of each vertex on the facet and the center coordinates; stores the displacement vectors in the texture coordinates of each vertex; shrinks the vertices of the multiple facets towards the center coordinates to generate a shrunken merged model; during rendering, based on the displacement vectors stored in the texture coordinates, it restores the original coordinates of each vertex and renders the facets facing the viewpoint. Through the device provided in this embodiment, a large number of facets are merged into a single model, and the facet positions are restored during rendering using displacement vectors, greatly improving the interactive experience and providing users with a smoother gaming experience; at the same time, this solution significantly reduces the number of facets and materials in the model, effectively solving the resource consumption problem during game operation and reducing the burden on the device.

[0159] The rendering apparatus for three-dimensional models provided in this disclosure has the same implementation principle and technical effects as the aforementioned method embodiments. For the sake of brevity, any parts not mentioned in the embodiments of the display control device can be referred to the corresponding content in the aforementioned three-dimensional model rendering method embodiments.

[0160] In this document, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent three cases: A alone, A and B simultaneously, and B alone. Furthermore, the term "at least one" in this document means any combination of at least two of any one or more elements. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C.

[0161] This disclosure also provides an electronic device, such as... Figure 4 The diagram shows the structure of the electronic device, which includes a processor 111 and a memory 110. The memory 110 stores computer-executable instructions that can be executed by the processor 111. The processor 111 executes the computer-executable instructions to implement the following three-dimensional model rendering method steps: Obtain multiple facet models, which are used to construct decorative elements of a 3D object; Merge multiple patch models into a single model; For each facet in the merged single model, obtain the center coordinates of the facet and calculate the displacement vector between the coordinates of each vertex on the facet and the center coordinates; Store the displacement vectors in the texture coordinates of each vertex; The vertices of multiple facets are shrunk towards the center coordinates to generate a shrunk and merged model; During rendering, the original coordinates of each vertex are restored based on the displacement vector stored in the texture coordinates, and the facets are rendered with the view direction in mind.

[0162] Optionally, the coordinate components of the displacement vector can be stored in multiple texture coordinate channels respectively.

[0163] Optionally, the vertices of multiple facets are scaled toward the center coordinates, including: For each face, shrink all vertices of the face towards the center coordinates of the face to a preset range.

[0164] Optionally, it also includes: Obtain the bone weight information of each vertex on the face; The bone weight information of each vertex on the same face is averaged. The averaged bone weights are then redistributed to the vertices on the face.

[0165] Optionally, the skeletal weight information of each vertex on the same face is averaged, including: For each bone, calculate the average weight value of each vertex on that face corresponding to that bone.

[0166] Optionally, during rendering, the original coordinates of each vertex are recovered based on the displacement vector stored in the texture coordinates, and the facets are rendered with the view direction facing upwards, including: Read the displacement vector stored in the texture coordinates; Determine the current view direction and construct an orientation coordinate system based on the view direction; Based on the orientation coordinate system and displacement vector, calculate the target position of each vertex when facing the view direction; Render the face based on the target location.

[0167] Optionally, an orientation coordinate system is constructed based on the viewpoint direction, including: Use the opposite direction of the viewing angle as the normal direction; Define a preset upward direction vector; Based on the normal direction and the up direction vector, the right direction vector is constructed through cross product operation; Based on the normal direction and the right direction vector, the up direction vector is recalculated to form an orthogonal orientation coordinate system.

[0168] Optionally, based on the orientation coordinate system and the displacement vector, the target position of each vertex in the direction of the view is calculated, including: Transform the displacement vector from the original coordinate system to the orientation coordinate system; The target position is obtained by adding the transformed displacement vector to the shrunken vertex position.

[0169] Optionally, decorative elements may include accessories for game characters and / or leaf elements for plant models.

[0170] Optionally, the process of obtaining multiple patch models may include: Ensure that the orientation of multiple patch models remains consistent.

[0171] exist Figure 4 In the illustrated embodiment, the electronic device further includes a bus 112 and a communication interface 113, wherein the processor 111, the communication interface 113, and the memory 110 are connected via the bus 112.

[0172] The memory 110 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 113 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc. The bus 112 may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. The bus 112 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0173] The processor 111 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the processor 111 or by instructions in software form. The processor 111 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this disclosure can be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software modules may reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in the memory. The processor 111 reads the information in the memory and, in conjunction with its hardware, completes the steps of the rendering method for the three-dimensional model in the aforementioned embodiment.

[0174] This disclosure also provides a computer-readable storage medium storing computer-executable instructions. When these computer-executable instructions are invoked and executed by a processor, they cause the processor to implement a method for rendering a 3D model. This method specifically includes: Obtain multiple facet models, which are used to construct decorative elements of a 3D object; Merge multiple patch models into a single model; For each facet in the merged single model, obtain the center coordinates of the facet and calculate the displacement vector between the coordinates of each vertex on the facet and the center coordinates; Store the displacement vectors in the texture coordinates of each vertex; The vertices of multiple facets are shrunk towards the center coordinates to generate a shrunk and merged model; During rendering, the original coordinates of each vertex are restored based on the displacement vector stored in the texture coordinates, and the facets are rendered with the view direction in mind.

[0175] Optionally, the coordinate components of the displacement vector can be stored in multiple texture coordinate channels respectively.

[0176] Optionally, the vertices of multiple facets are scaled toward the center coordinates, including: For each face, shrink all vertices of the face towards the center coordinates of the face to a preset range.

[0177] Optionally, it also includes: Obtain the bone weight information of each vertex on the face; The bone weight information of each vertex on the same face is averaged. The averaged bone weights are then redistributed to the vertices on the face.

[0178] Optionally, the skeletal weight information of each vertex on the same face is averaged, including: For each bone, calculate the average weight value of each vertex on that face corresponding to that bone.

[0179] Optionally, during rendering, the original coordinates of each vertex are recovered based on the displacement vector stored in the texture coordinates, and the facets are rendered with the view direction facing upwards, including: Read the displacement vector stored in the texture coordinates; Determine the current view direction and construct an orientation coordinate system based on the view direction; Based on the orientation coordinate system and displacement vector, calculate the target position of each vertex when facing the view direction; Render the face based on the target location.

[0180] Optionally, an orientation coordinate system is constructed based on the viewpoint direction, including: Use the opposite direction of the viewing angle as the normal direction; Define a preset upward direction vector; Based on the normal direction and the up direction vector, the right direction vector is constructed through cross product operation; Based on the normal direction and the right direction vector, the up direction vector is recalculated to form an orthogonal orientation coordinate system.

[0181] Optionally, based on the orientation coordinate system and the displacement vector, the target position of each vertex in the direction of the view is calculated, including: Transform the displacement vector from the original coordinate system to the orientation coordinate system; The target position is obtained by adding the transformed displacement vector to the shrunken vertex position.

[0182] Optionally, decorative elements may include accessories for game characters and / or leaf elements for plant models.

[0183] Optionally, the process of obtaining multiple patch models may include: Ensure that the orientation of multiple patch models remains consistent.

[0184] The computer program products of the three-dimensional model rendering method, apparatus and electronic device provided in the embodiments of this disclosure include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.

[0185] Unless otherwise specifically stated, the relative steps, numerical expressions, and values ​​of the components and steps set forth in these embodiments do not limit the scope of this disclosure.

[0186] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0187] In the description of this disclosure, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, and are only for the convenience of describing this disclosure and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this disclosure. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0188] Finally, it should be noted that the above-described embodiments are merely specific implementations of this disclosure, used to illustrate the technical solutions of this disclosure, and not to limit it. The protection scope of this disclosure is not limited thereto. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this disclosure. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be covered within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the protection scope of the claims.

Claims

1. A method for rendering a three-dimensional model, characterized in that, include: Obtain multiple patch models, which are used to constitute decorative elements of a three-dimensional object; Merge the multiple patch models into a single model; For each facet in the merged single model, obtain the center coordinates of the facet, and calculate the displacement vector between the coordinates of each vertex on the facet and the center coordinates; The displacement vector is stored in the texture coordinates of each vertex; The vertices of the multiple facets are shrunk towards the center coordinates to generate a shrunk and merged model; During rendering, the original coordinates of each vertex are recovered based on the displacement vector stored in the texture coordinates, and the facet is rendered with the viewpoint facing the view direction.

2. The method according to claim 1, characterized in that, The step of storing the displacement vector into the texture coordinates of each vertex includes: The coordinate components of the displacement vector are stored in multiple texture coordinate channels respectively.

3. The method according to claim 1, characterized in that, The scaling of the vertices of the plurality of facets toward the center coordinates includes: For each of the aforementioned facets, all vertices of the facet are shrunk to a preset range towards the center coordinates of the facet.

4. The method according to claim 1, characterized in that, Also includes: Obtain the bone weight information of each vertex on the face; The bone weight information of each vertex on the same face is averaged. The averaged bone weight information is then redistributed to each vertex on the face.

5. The method according to claim 4, characterized in that, The process of averaging the bone weight information of each vertex on the same face includes: For each bone, calculate the average weight value of each vertex on that face corresponding to that bone.

6. The method according to claim 1, characterized in that, During rendering, based on the displacement vector stored in the texture coordinates, the original coordinates of each vertex are recovered, and the facet is rendered facing the view direction, including: Read the displacement vector stored in the texture coordinates; Determine the current viewpoint direction and construct an orientation coordinate system based on the viewpoint direction; Based on the orientation coordinate system and the displacement vector, calculate the target position of each vertex when facing the view direction; The patch is rendered based on the target location.

7. The method according to claim 6, characterized in that, The construction of the orientation coordinate system based on the viewpoint direction includes: The opposite direction of the stated viewpoint direction is taken as the normal direction; Define a preset upward direction vector; Based on the normal direction and the up direction vector, the right direction vector is constructed through cross product operation; Based on the normal direction and the right direction vector, the up direction vector is recalculated to form an orthogonal orientation coordinate system.

8. The method according to claim 6, characterized in that, The calculation of the target position of each vertex in the direction of the view, based on the orientation coordinate system and the displacement vector, includes: Transform the displacement vector from the original coordinate system to the orientation coordinate system; The target position is obtained by adding the transformed displacement vector to the shrunken vertex position.

9. The method according to claim 1, characterized in that, The decorative elements include accessories for game characters and / or leaf elements for plant models.

10. The method according to claim 1, characterized in that, Before obtaining multiple patch models, the process also includes: Ensure that the orientation of the multiple patch models remains consistent.

11. A rendering device for a three-dimensional model, characterized in that, include: The acquisition module is used to acquire multiple patch models, which are used to constitute decorative elements of a three-dimensional object. The merging module is used to merge the multiple patch models into a single model; The calculation module is used to obtain the center coordinates of each facet in the merged single model, and to calculate the displacement vector between the coordinates of each vertex on the facet and the center coordinates. A storage module is used to store the displacement vector into the texture coordinates of each vertex; The shrinking module is used to shrink the vertices of the multiple facets toward the center coordinates to generate a shrunken merged model; The rendering module is used to recover the original coordinates of each vertex based on the displacement vector stored in the texture coordinates during rendering, and to render the facets facing the view direction.

12. An electronic device, characterized in that, The method includes a processor and a memory, the memory storing computer-executable instructions executable by the processor, the processor executing the computer-executable instructions to implement the method of any one of claims 1 to 10.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions that, when invoked and executed by a processor, cause the processor to implement the method of any one of claims 1 to 10.