Layered rendering method of three-dimensional model and related device

By obtaining the normal position and transparency of the surface of the three-dimensional model, calculating the rendering level and rendering, the problem of translucent surface error rendering in the three-dimensional model is solved, and the display effect of the model is optimized.

CN120388126AActive Publication Date: 2025-07-29HUNAN HAPPLY SUNSHINE INTERACTIVE ENTERTAINMENT MEDIA CO LTD
View PDF 11 Cites 0 Cited by

Patent Information

Application Number
CN202510874377.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-27
Publication Date
2025-07-29
Estimated Expiration
2045-06-27

AI Technical Summary

Technical Problem

In the virtual engine, when translucent surfaces are superimposed on each other in a three-dimensional model, it is treated as the same level and causes incorrect rendering, and the hierarchical relationship of translucent surfaces cannot be adjusted, resulting in misdisplay.

Method used

By obtaining the model surface description information of the three-dimensional model, including the normal position and transparency of the surface, calculate the rendering level of each model surface, and render according to the rendering level and transparency, generate model maps and perform two-dimensional mapping, determine the UV area and RGBA channel values, and optimize the rendering arrangement of semi-transparent surfaces.

Benefits of technology

The problem of translucent surface error rendering was solved, the display effect of the three-dimensional model was optimized, the hierarchical superposition relationship of the translucent surface was maintained, and the appearance display quality of the model was improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120388126A_ABST
    Figure CN120388126A_ABST
Patent Text Reader

Abstract

The invention discloses a hierarchical rendering method of a three-dimensional model and a related device, and relates to the technical field of three-dimensional virtual reconstruction, a target three-dimensional model to be rendered is loaded, the target three-dimensional model comprises a plurality of model vertexes and a plurality of model surfaces, and each model surface is a closed area formed by three adjacent model vertexes; obtaining model surface description information of the target three-dimensional model, wherein the model surface description information comprises a surface normal position and transparency of each model surface; and calculating the rendering level of each model surface according to the surface normal position of each model surface, and rendering according to the rendering level and transparency of each model surface. Therefore, the hierarchical superposition relation of the semitransparent surfaces in the three-dimensional model can be kept, the rendering arrangement mode of the semitransparent surfaces in the three-dimensional model is optimized, the problem that wrong rendering is generated due to the fact that the semitransparent surfaces are regarded as the same hierarchy is solved, and the appearance display effect of the model is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of three-dimensional virtual reconstruction technology, and in particular, to a method for hierarchical rendering of three-dimensional models and related devices. Background Art

[0002] In a virtual engine, a three-dimensional model is recognized as an object and a hierarchy during rendering. When there are translucent faces in the three-dimensional model, the overlapping of translucent faces will result in incorrect rendering with front-to-back interpenetration because they are regarded as the same hierarchy, and the hierarchical relationship of the translucent faces cannot be adjusted sequentially, resulting in a problem of disordered display levels. Summary of the Invention

[0003] In view of the above problems, this application provides a method for hierarchical rendering of three-dimensional models and related devices to achieve the purpose of hierarchical rendering of three-dimensional models. The specific solutions are as follows:

[0004] The first aspect of this application provides a method for hierarchical rendering of a three-dimensional model. The method for hierarchical rendering of the three-dimensional model includes:

[0005] Load a target three-dimensional model to be rendered. The target three-dimensional model includes a plurality of model vertices and a plurality of model faces, and each model face is a closed area composed of three adjacent model vertices;

[0006] Obtain model face description information of the target three-dimensional model. The model face description information includes the face normal position and transparency of each model face;

[0007] Calculate the rendering level of each model face according to the face normal position of each model face, and perform rendering according to the rendering level and transparency of each model face.

[0008] In a possible implementation, the obtaining of the model face description information of the target three-dimensional model includes:

[0009] Generate a model texture map of the target three-dimensional model. The model texture map includes a plurality of UV regions, and the plurality of UV regions correspond to the plurality of model faces one by one, and each UV region records the face normal position and transparency of the corresponding model face;

[0010] Read the plurality of UV regions in sequence, and obtain the face normal position and transparency of the corresponding model face from the read UV regions.

[0011] In a possible implementation, the generating of the model texture map of the target three-dimensional model includes:

[0012] Calculate the face normal position of each model face based on the vertex positions of the three model vertices that make up each model face in the first three-dimensional space, where the first three-dimensional space is the three-dimensional space used for face normal space cutting;

[0013] Obtain the transparency of each model face;

[0014] Use the face normal position and transparency of each model face as RGBA channel values to generate the face texture map of each model face;

[0015] Perform a two-dimensional mapping on the target three-dimensional model to obtain a UV view, where the UV regions mapped for each model face are recorded in the UV view;

[0016] Fill the face texture map of each model face into the mapped UV region to generate the model texture map.

[0017] In a possible implementation, the calculating the rendering level of each model face according to the face normal position of each model face includes:

[0018] Transform the face normal position of each model face into the second three-dimensional space to obtain the new face normal position of each model face, where the second three-dimensional space is the three-dimensional space used for model rendering;

[0019] Obtain the camera position of the virtual camera in the second three-dimensional space, and calculate the distance between each model face and the virtual camera according to the camera position and the new face normal position of each model face;

[0020] Determine the rendering level of each model face according to the distance between each model face and the virtual camera, and the rendering level of each model face is negatively correlated with its distance from the virtual camera.

[0021] The second aspect of the present application provides a three-dimensional model hierarchical rendering device, and the three-dimensional model hierarchical rendering device includes:

[0022] A model loading module, configured to load a target three-dimensional model to be rendered, where the target three-dimensional model includes a plurality of model vertices and a plurality of model faces, and each model face is a closed area composed of three adjacent model vertices;

[0023] An information acquisition module, configured to acquire the model face description information of the target three-dimensional model, where the model face description information includes the face normal position and transparency of each model face;

[0024] A rendering module, configured to calculate the rendering level of each model face according to the face normal position of each model face, and perform rendering according to the rendering level and transparency of each model face.

[0025] In a possible implementation, the information acquisition module is specifically configured to:

[0026] Generate a model texture map for the target 3D model, where the model texture map includes multiple UV regions, the multiple UV regions correspond one-to-one with the multiple model faces, and each UV region records the face normal position and transparency of the corresponding model face; sequentially read the multiple UV regions, and obtain the face normal position and transparency of the corresponding model face from the read UV regions.

[0027] In a possible implementation, the information acquisition module for generating the model texture map of the target 3D model is specifically configured to:

[0028] According to the vertex positions of the three model vertices forming each model face in the first 3D space, calculate the face normal position of each model face, where the first 3D space is the 3D space for face normal space cutting; obtain the transparency of each model face; use the face normal position and transparency of each model face as RGBA channel values to generate a face texture map for each model face; perform a 2D mapping on the target 3D model to obtain a UV view, where each model face's mapped UV region is recorded in the UV view; fill the face texture map of each model face into the mapped UV region to generate the model texture map.

[0029] A third aspect of the present application provides a computer program product, including computer-readable instructions, which when running on an electronic device, enable the electronic device to implement the hierarchical rendering method of the 3D model in the above first aspect or any implementation manner of the first aspect.

[0030] A fourth aspect of the present application provides an electronic device, including at least one processor and a memory connected to the processor, where:

[0031] The memory is used to store a computer program;

[0032] The processor is used to execute the computer program so that the electronic device can implement the hierarchical rendering method of the 3D model in the above first aspect or any implementation manner of the first aspect.

[0033] A fifth aspect of the present application provides a computer storage medium, where the storage medium carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, they can enable the electronic device to implement the hierarchical rendering method of the 3D model in the above first aspect or any implementation manner of the first aspect.

[0034] With the above technical solution, a method for hierarchical rendering of a three-dimensional model and related devices provided by this application load a target three-dimensional model to be rendered. The target three-dimensional model includes a plurality of model vertices and a plurality of model faces, and each model face is a closed area composed of three adjacent model vertices; obtain the model face description information of the target three-dimensional model, and the model face description information includes the face normal position and transparency of each model face; calculate the rendering level of each model face according to the face normal position of each model face, and perform rendering according to the rendering level and transparency of each model face. This application can divide the three-dimensional model into different model faces according to the model vertices, and then obtain the face normal position and transparency of the model faces. Further, the rendering level of the model face to which it belongs is determined by the face normal position. Finally, the model face to which it belongs is rendered according to the rendering level and transparency. This can maintain the hierarchical superposition relationship of the semi-transparent faces in the three-dimensional model, optimize the rendering arrangement of the semi-transparent faces in the three-dimensional model, solve the problem of incorrect rendering caused by treating the semi-transparent faces as the same level, and improve the display effect of the model appearance. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In combination with the accompanying drawings and with reference to the following specific embodiments, the above and other features, advantages and aspects of the various embodiments of the present disclosure will become more apparent. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic and the elements and elements are not necessarily drawn to scale.

[0036] Figure 1 It is a schematic flowchart of a method for hierarchical rendering of a three-dimensional model provided by an embodiment of this application;

[0037] Figure 2 It is an example diagram of a model face provided by an embodiment of this application;

[0038] Figure 3 It is a partial schematic flowchart of a method for hierarchical rendering of a three-dimensional model provided by an embodiment of this application;

[0039] Figure 4 It is another partial schematic flowchart of a method for hierarchical rendering of a three-dimensional model provided by an embodiment of this application;

[0040] Figure 5 It is an example diagram of a three-dimensional space provided by an embodiment of this application;

[0041] Figure 6 It is an example diagram of a two-dimensional mapping provided by an embodiment of this application;

[0042] Figure 7 It is another schematic flowchart of a method for hierarchical rendering of a three-dimensional model provided by an embodiment of this application;

[0043] Figure 8Schematic diagram of a hierarchical rendering device for a 3D model provided by an embodiment of the present application;

[0044] Figure 9 Schematic diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0045] The following describes the embodiments of the present application in conjunction with the accompanying drawings in the embodiments of the present application. The terms used in the implementation manners of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.

[0046] The following describes the embodiments of the present application in conjunction with the accompanying drawings. Those of ordinary skill in the art will know that with the development of technology and the emergence of new scenarios, the technical solutions provided by the embodiments of the present application are equally applicable to similar technical problems.

[0047] The terms "first", "second", etc. in the specification of the present application and the above accompanying drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that such terms can be interchanged under appropriate circumstances, which is only a way of distinguishing objects with the same attributes when describing the embodiments of the present application. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, so that a process, method, system, product or device including a series of units does not have to be limited to those units, but may include other units not clearly listed or inherent to these process, method, product or device.

[0048] See Figure 1 , Figure 1 Flowchart of a hierarchical rendering method for a 3D model provided by an embodiment of the present application. As Figure 1 shown, a hierarchical rendering method for a 3D model adopted in an embodiment of the present application can be applied to a rendering engine, and may include steps S101 to S103. The following describes these steps in detail.

[0049] S101, load a target 3D model to be rendered. The target 3D model includes a plurality of model vertices and a plurality of model faces, and each model face is a closed area formed by three adjacent model vertices.

[0050] In an embodiment of the present application, the target 3D model is the 3D model to be rendered. The user can import the target 3D model into the rendering engine, and the rendering engine loads the target 3D model. In addition, the target 3D model includes a plurality of model vertices, and a closed area formed by any three adjacent model vertices can be used as a model face.

[0051] See Figure 2 , Figure 2This is an example diagram of a model surface provided by an embodiment of the present application. As Figure 2 shown, when the target 3D model is a sphere, adjacent model vertices A, B, and C can form a model surface.

[0052] S102. Obtain the model surface description information of the target 3D model, where the model surface description information includes the surface normal position and transparency of each model surface.

[0053] In an embodiment of the present application, after loading the target 3D model, multiple model vertices and multiple model surfaces therein can be determined. Additionally, by performing a surface normal vector space cut on the target 3D model, the surface normal position of each model surface can be calculated, and the transparency of each model surface can be defined, thereby obtaining the model surface description information.

[0054] It should be noted that the surface normal position is the vector position of the corresponding model surface in three-dimensional space, which includes three position components in the x, y, and z axes. Thus, the model surface description information includes information of each model surface in four dimensions, namely, three position components in the x, y, and z axes and the transparency.

[0055] In a possible implementation, to achieve accurate and efficient information reading, the model surface description information can be recorded in the form of a model texture map. Refer to Figure 3 , Figure 3 This is a partial flowchart of a hierarchical rendering method for a 3D model provided by an embodiment of the present application. As Figure 3 shown, in a hierarchical rendering method for a 3D model provided by an embodiment of the present application, where "obtain the model surface description information of the target 3D model" in step S102 may include steps S201 to S202, and these steps will be described in detail below.

[0056] S201. Generate a model texture map of the target 3D model, where the model texture map includes multiple UV regions, and the multiple UV regions correspond to the multiple model surfaces one by one, and each UV region records the surface normal position and transparency of the corresponding model surface.

[0057] In an embodiment of the present application, the surface normal position and transparency of all model surfaces in the target 3D model can be recorded in the model texture map. Specifically, the model texture map can be divided into multiple UV regions corresponding to the multiple model surfaces one by one, and the surface normal position and transparency of the corresponding model surface can be recorded in each UV region.

[0058] It should be noted that each UV region in the model texture map is obtained by two-dimensionally mapping the corresponding model surface using the UV mapping method. Additionally, the numerical ranges of the surface normal position and transparency recorded in the UV region are both 0 to 1.

[0059] Since the current mainstream storage methods do not support adding custom stored content, the present application uses the RGBA (Red, Green, Blue, Alpha) information storage method to generate model textures. See Figure 4 , Figure 4 which is another part of the process schematic diagram of a three-dimensional model hierarchical rendering method provided by an embodiment of the present application. As Figure 4 shown, for a three-dimensional model hierarchical rendering method provided by an embodiment of the present application, in step S201, "generating a model texture of the target three-dimensional model", it may include steps S301 to S305, and the following will describe these steps in detail.

[0060] S301, according to the vertex positions of the three model vertices that make up each model face in the first three-dimensional space, calculate the face normal position of each model face, where the first three-dimensional space is the three-dimensional space used for face normal space cutting.

[0061] See Figure 5 , Figure 5 which is an example diagram of a three-dimensional space provided by an embodiment of the present application. As Figure 5 shown, when the target three-dimensional model is a sphere, the surrounding space can be divided into three-dimensional vectors, and the directions and value ranges (minimum value is 0, maximum value is 1) of the three axes of x, y, and z are set to obtain the three-dimensional space (i.e., the first three-dimensional space) used for face normal space cutting.

[0062] Continuing to refer to Figure 2 , in Figure 2 the first three-dimensional space shown, the vertex positions of model vertex A, model vertex B, and model vertex C can be determined respectively. Assuming the vertex position of model vertex A is , the vertex position of model vertex B is , and the vertex position of model vertex C is , then the position of the centroid point G of the model face composed of model vertex A, model vertex B, and model vertex C can be calculated . By drawing a vertical line P from the centroid point G, the vertical line P is the face normal of the model face composed of model vertex A, model vertex B, and model vertex C. Therefore, the face normal position is , and the direction is generally set to be outward from the sphere.

[0063] Based on this, the face normal position of each model face can be calculated, and this face normal position is located within the first three-dimensional space.

[0064] S302, obtain the transparency of each model face.

[0065] In the embodiments of the present application, the transparency of each model surface can be set according to actual needs, and the transparency is normalized, and the numerical range is also 0 to 1. Specifically, when the transparency is 1, the model surface to which it belongs is in an opaque state; when the transparency is 0, the model surface to which it belongs is in a fully transparent state; when the transparency is between 0 and 1, the model surface to which it belongs is in a semi-transparent state.

[0066] S303. Take the surface normal position and transparency of each model surface as RGBA channel values to generate a surface texture map for each model surface.

[0067] In the embodiments of the present application, the surface normal position of each model surface includes three position components in the x, y, and z axes. Therefore, the three position components can be used as RGB channel values respectively. In addition, take the transparency of each model surface as the A channel value, and thus a surface texture map for each model surface can be generated. That is to say, the surface texture map of each model surface contains RGBA channels, where the RGB channel values are the surface normal positions of each model surface, and the A channel value is the transparency of each model surface.

[0068] S304. Perform a two-dimensional mapping on the target three-dimensional model to obtain a UV view, and the UV regions to which each model surface is mapped are recorded in the UV view.

[0069] In the embodiments of the present application, the UV mapping method is used to perform a two-dimensional mapping on the target three-dimensional model to obtain the corresponding UV view of the target three-dimensional model, and the UV regions to which each model surface is mapped are included in the UV view. See Figure 6 , Figure 6 which is a two-dimensional mapping example diagram provided by the embodiments of the present application. As Figure 6 shown, when the target three-dimensional model is a sphere, performing a two-dimensional mapping on it can obtain its corresponding UV view. One model surface in the target three-dimensional model is mapped to one UV region in the UV view, and there is a mapping relationship between the two.

[0070] S305. Fill the surface texture map of each model surface into the mapped UV region to generate a model texture map.

[0071] In the embodiments of the present application, according to the UV region of each model surface in the UV view, its surface texture map can be filled into the UV region. After the surface texture maps of all model surfaces are filled, the model texture map of the target three-dimensional model can be obtained.

[0072] S202. Read multiple UV regions in sequence, and obtain the surface normal position and transparency of the corresponding model surface from the read UV regions.

[0073] In the embodiments of the present application, for multiple UV regions in a model texture map, the texture maps within each UV region can be read separately in a certain order, and the face normal positions and transparencies of the corresponding model faces can be obtained from the read UV regions. Until all the UV regions in the model texture map are completely read, the face normal positions and transparencies of all the model faces of the target three-dimensional model can be obtained.

[0074] S103. Calculate the rendering level of each model face according to the face normal position of each model face, and perform rendering according to the rendering level and transparency of each model face.

[0075] In the embodiments of the present application, after obtaining the face normal position of each model face, the distance from the virtual camera can be calculated based on the face normal position. Determine the rendering level of each model face according to the distance of each model face from the virtual camera. The closer the model face is to the virtual camera, the higher the rendering level. Render each model face according to the transparency of each model face in the order from the lowest rendering level to the highest rendering level, that is, in the order from far to near the virtual camera, and perform screen display by means of screen overlay. This can accurately divide the rendering levels of different model faces (including semi-transparent faces), and there will be no rendering errors of front and back interpenetration due to being regarded as the same level, and the screen effect can be normally displayed with higher precision.

[0076] In a possible implementation, the three-dimensional space for model rendering is often different from the three-dimensional space for face normal space cutting. Therefore, it is necessary to perform a space transformation on the face normal position of each model face to calculate the rendering level of each model face, so that the current position relationship between the target three-dimensional model and the virtual camera can be obtained in real time, and even if the target three-dimensional model moves and rotates continuously, it will not affect the final effect. Refer to Figure 7 , Figure 7 which is another flowchart of a hierarchical rendering method for a three-dimensional model provided by the embodiments of the present application. As Figure 7 shown, in a hierarchical rendering method for a three-dimensional model provided by the embodiments of the present application, in step S103, "calculate the rendering level of each model face according to the face normal position of each model face" may include steps S401 to S403, and these steps will be described in detail below.

[0077] S401. Transform the face normal position of each model face to the second three-dimensional space to obtain the new face normal position of each model face, and the second three-dimensional space is the three-dimensional space for model rendering.

[0078] In the embodiments of the present application, the face normal position of each model face is transformed to the three-dimensional space for model rendering (i.e., the second three-dimensional space). Assume that the origin of the first three-dimensional space is and the origin of the second three-dimensional space is , the origin of space Compared with the origin of space The translation matrix is , the rotation matrix is , the scaling matrix is , then the face normal position of each model face can be translated, rotated and scaled to obtain the new face normal position of each model face.

[0079] Continuing with the face normal position as as an example, the new face normal position is .

[0080] Of course, in some scenarios, each model vertex of the target 3D model can also be transformed from the first 3D space to the second 3D space first, and then the new normal position of each model face can be calculated according to the transformed model vertices. The embodiments of the present application do not limit this.

[0081] S402, obtain the camera position of the virtual camera in the second 3D space, and calculate the distance between each model face and the virtual camera according to the camera position and the new face normal position of each model face.

[0082] In the embodiments of the present application, the camera position of the virtual camera in the second 3D space can be obtained, and then the distance between each model face and the virtual camera can be calculated according to the new face normal position and the camera position of each model face.

[0083] Assume the camera position is , the new face normal position of a certain model face is , then the distance between this model face and the virtual camera .

[0084] S403, determine the rendering level of each model face according to the distance between each model face and the virtual camera, and the rendering level of each model face is negatively correlated with its distance from the virtual camera.

[0085] In the embodiments of the present application, the distances between each model face and the virtual camera are sorted. The larger the distance, the farther the model face belongs to the virtual camera, and the higher the rendering level of the model face. This can perform rendering sorting on all model faces in the target 3D model. The higher the rendering level, the earlier the rendering order.

[0086] Through the above description, a method for hierarchical rendering of a three-dimensional model provided by an embodiment of the present application can calculate the face normal positions of different model faces in the three-dimensional model and store them in the RGBA channels of the corresponding UV regions in combination with transparency, thereby forming a model texture map. During rendering, by reading the RGBA channel values in different UV regions of the model texture map, the face normal positions of different model faces can be determined, and based on this, the rendering hierarchy can be determined to optimize the rendering arrangement of translucent faces in the three-dimensional model, solving the problem of incorrect rendering caused by treating translucent faces as the same level and improving the display effect of the model appearance.

[0087] The above introduced a method for hierarchical rendering of a three-dimensional model provided by an embodiment of the present application. Next, an apparatus for executing the above method for hierarchical rendering of a three-dimensional model will be introduced.

[0088] See Figure 8 , Figure 8 which is a schematic structural diagram of an apparatus for hierarchical rendering of a three-dimensional model provided by an embodiment of the present application. As Figure 8 shown, an apparatus for hierarchical rendering of a three-dimensional model provided by an embodiment of the present application includes:

[0089] A model loading module 501, configured to load a target three-dimensional model to be rendered, where the target three-dimensional model includes a plurality of model vertices and a plurality of model faces, and each model face is a closed area composed of three adjacent model vertices;

[0090] An information acquisition module 502, configured to acquire model face description information of the target three-dimensional model, where the model face description information includes the face normal position and transparency of each model face;

[0091] A rendering module 503, configured to calculate the rendering level of each model face according to the face normal position of each model face, and perform rendering according to the rendering level and transparency of each model face.

[0092] In a possible implementation, the information acquisition module 502 is specifically configured to:

[0093] Generate a model texture map of the target three-dimensional model, where the model texture map includes a plurality of UV regions, the plurality of UV regions correspond to the plurality of model faces one by one, and each UV region records the face normal position and transparency of the corresponding model face; sequentially read the plurality of UV regions, and acquire the face normal position and transparency of the corresponding model face from the read UV regions.

[0094] In a possible implementation, the information acquisition module 502 for generating the model texture map of the target three-dimensional model is specifically configured to:

[0095] According to the vertex positions of the three model vertices that make up each model face in the first three-dimensional space, calculate the face normal position of each model face. The first three-dimensional space is the three-dimensional space used for face normal space cutting; obtain the transparency of each model face; use the face normal position and transparency of each model face as RGBA channel values to generate the face texture map of each model face; perform a two-dimensional mapping on the target three-dimensional model to obtain a UV view, and the UV regions where each model face is mapped are recorded in the UV view; fill the face texture map of each model face into the mapped UV regions to generate a model texture map.

[0096] In a possible implementation, the rendering module 503 for calculating the rendering level of each model face according to the face normal position of each model face is specifically configured to:

[0097] Transform the face normal position of each model face to the second three-dimensional space to obtain the new face normal position of each model face. The second three-dimensional space is the three-dimensional space used for model rendering; obtain the camera position of the virtual camera in the second three-dimensional space, and calculate the distance between each model face and the virtual camera according to the camera position and the new face normal position of each model face; determine the rendering level of each model face according to the distance between each model face and the virtual camera, and the rendering level of each model face is negatively correlated with its distance from the virtual camera.

[0098] It should be noted that the refined functions of each module in the embodiments of the present application can be referred to the corresponding disclosed parts in the embodiments of the hierarchical rendering method of the three-dimensional model above, and will not be elaborated here.

[0099] An electronic device is also provided in the embodiments of the present application. Refer to Figure 9 , Figure 9 which is a schematic structural diagram of an electronic device provided in the embodiments of the present application. The electronic device in the embodiments of the present application may include, but is not limited to, fixed terminals such as mobile phones, laptop computers, PDAs (Personal Digital Assistants), PADs (Tablet Computers), desktop computers, and the like. Figure 9 The electronic device shown is only an example and should not impose any limitation on the functions and usage scope of the embodiments of the present application.

[0100] Such as Figure 9As shown, the electronic device may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 601, which may perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. When the electronic device is powered on, various programs and data required for the operation of the electronic device are also stored in the RAM 603. The processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0101] Generally, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a memory card, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device to communicate with other devices wirelessly or wiredly to exchange data. Although Figure 9 an electronic device with various devices is shown, it should be understood that it is not required to implement or have all the shown devices. Instead, more or fewer devices may be implemented or had.

[0102] In an embodiment of the present application, there is also provided a computer program product including computer-readable instructions. When the computer-readable instructions run on an electronic device, the electronic device is enabled to implement any one of the hierarchical rendering methods of the three-dimensional models provided in the embodiments of the present application.

[0103] In an embodiment of the present application, there is also provided a computer-readable storage medium. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device is enabled to implement any one of the hierarchical rendering methods of the three-dimensional models provided in the embodiments of the present application.

[0104] In addition, it should be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. In addition, in the drawings of the device embodiments provided in the present application, the connection relationships between the modules indicate that they have communication connections, which may be specifically implemented as one or more communication buses or signal lines.

[0105] Through the description of the above embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general hardware. Of course, it can also be implemented by dedicated hardware including application-specific integrated circuits, dedicated CPUs, dedicated memories, dedicated components, etc. Generally, functions accomplished by computer programs can be easily implemented by corresponding hardware, and the specific hardware structures for implementing the same function can also be diverse, such as analog circuits, digital circuits, or dedicated circuits, etc. However, for this application, in more cases, software program implementation is a better embodiment. Based on such understanding, the technical solution of this application, in essence, or the part that makes a contribution to the prior art, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disc of a computer, etc., and includes several instructions for causing a computer device (which can be a personal computer, training device, or network device, etc.) to execute the methods described in various embodiments of this application.

[0106] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product.

[0107] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of this application are generated in whole or in part. The computer can be a general-purpose computer, a dedicated computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, computer, training device, or data center to another website, computer, training device, or data center in a wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) manner. The computer-readable storage medium can be any available medium that a computer can store, or a data storage device such as a training device or data center that includes one or more integrated available media. The available medium can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid-state drive (SSD)), etc.

Claims

1. A hierarchical rendering method for a three-dimensional model, characterized in that, The hierarchical rendering method of the three-dimensional model includes: Loading a target three-dimensional model to be rendered, where the target three-dimensional model includes multiple model vertices and multiple model faces, and each model face is a closed area composed of three adjacent model vertices; Obtaining the model face description information of the target three-dimensional model, where the model face description information includes the face normal position and transparency of each model face; Calculating the rendering level of each model face according to the face normal position of each model face, and performing rendering according to the rendering level and transparency of each model face.

2. The hierarchical rendering method of the three-dimensional model according to claim 1, characterized in that The obtaining of the model face description information of the target three-dimensional model includes: Generating a model texture map of the target three-dimensional model, where the model texture map includes multiple UV regions, and the multiple UV regions correspond to the multiple model faces one by one, and each UV region records the face normal position and transparency of the corresponding model face; Sequentially reading the multiple UV regions, and obtaining the face normal position and transparency of the corresponding model face from the read UV regions.

3. The hierarchical rendering method of the three-dimensional model according to claim 2, characterized in that, The generating of the model texture map of the target three-dimensional model includes: Calculating the face normal position of each model face according to the vertex positions of the three model vertices forming each model face in the first three-dimensional space, where the first three-dimensional space is a three-dimensional space for face normal space cutting; Obtaining the transparency of each model face; Taking the face normal position and transparency of each model face as RGBA channel values to generate a face texture map of each model face; Performing a two-dimensional mapping on the target three-dimensional model to obtain a UV view, where each model face's mapped UV region is recorded in the UV view; Filling the face texture map of each model face into the mapped UV region to generate the model texture map.

4. The hierarchical rendering method of the three-dimensional model according to claim 1, characterized in that The calculating of the rendering level of each model face according to the face normal position of each model face includes: Transforming the face normal position of each model face to the second three-dimensional space to obtain the new face normal position of each model face, where the second three-dimensional space is a three-dimensional space for model rendering; Obtaining the camera position of the virtual camera in the second three-dimensional space, and calculating the distance between each model face and the virtual camera according to the camera position and the new face normal position of each model face; Determining the rendering level of each model face according to the distance between each model face and the virtual camera, and the rendering level of each model face is negatively correlated with its distance from the virtual camera.

5. A three-dimensional model hierarchical rendering device, characterized in that, The hierarchical rendering device of the three-dimensional model includes: A model loading module for loading a target three-dimensional model to be rendered, where the target three-dimensional model includes multiple model vertices and multiple model faces, and each model face is a closed area composed of three adjacent model vertices; An information obtaining module for obtaining the model face description information of the target three-dimensional model, where the model face description information includes the face normal position and transparency of each model face; A rendering module for calculating the rendering level of each model face according to the face normal position of each model face, and performing rendering according to the rendering level and transparency of each model face.

6. The layered rendering device for a three-dimensional model according to claim 5, characterized in that, The information obtaining module is specifically used for: Generate a model texture map for the target 3D model, where the model texture map includes multiple UV regions, and the multiple UV regions correspond one-to-one to the multiple model faces, and each UV region records the face normal position and transparency of the corresponding model face; Read the multiple UV regions in sequence, and obtain the face normal position and transparency of the corresponding model face from the read UV regions.

7. The hierarchical rendering device for a three-dimensional model according to claim 6, wherein The information acquisition module for generating the model texture map of the target 3D model is specifically configured to: Calculate the face normal position of each model face according to the vertex positions of the three model vertices constituting each model face in the first 3D space, where the first 3D space is the 3D space for face normal space cutting; obtain the transparency of each model face; use the face normal position and transparency of each model face as RGBA channel values to generate a face texture map for each model face; perform a 2D mapping on the target 3D model to obtain a UV view, and the UV view records the UV region to which each model face is mapped; Fill the face texture map of each model face into the mapped UV region to generate the model texture map.

8. A computer program product, characterized in that, Includes computer-readable instructions that, when run on an electronic device, cause the electronic device to implement the hierarchical rendering method of the 3D model according to any one of claims 1 to 4.

9. An electronic device, characterized in that, Includes at least one processor and a memory connected to the processor, where: The memory is used to store a computer program; The processor is configured to execute the computer program so that the electronic device can implement the hierarchical rendering method of the 3D model according to any one of claims 1 to 4.

10. A computer storage medium, characterized in that, The storage medium carries one or more computer programs that, when executed by an electronic device, can cause the electronic device to implement the hierarchical rendering method of the 3D model according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Model processing method and device, electronic equipment and storage medium

    CN111402385A

  • Model processing method and device, computer equipment and storage medium

    CN116212374A

  • Volume rendering method and device, computer equipment and computer readable storage medium

    CN116402931A

  • Model rendering order determination method and device, electronic equipment and storage medium

    CN117252976A

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

    CN117635799A