A 3D model rendering method, device, equipment and storage medium

By calculating the number of visible faces of the 3D model and generating a set of blocks, the target LOD model file is determined for rendering, which solves the problem of low 3D model rendering efficiency in the existing technology and improves the image rendering rate and user experience.

CN112435322BActive Publication Date: 2024-09-06XIONGAN GUOJI CREATIVE INTERNET CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202011438287.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-10
Publication Date
2024-09-06
Estimated Expiration
2040-12-10

AI Technical Summary

Technical Problem

Existing 3D model rendering technology is difficult to display more scene details while ensuring high frame rates, resulting in excessive consumption of computing resources and inability to effectively generate and render multiple different levels of LOD model files, affecting image rendering efficiency and user experience.

Method used

By obtaining the initial model of the 3D model, calculating its number of visible faces, generating different numbers of block sets based on the number of visible faces, and determining the target LOD model file for rendering based on the number of visible faces and the actual distance, this avoids repeated modeling operations and quickly generates multiple blocks. LOD model files to improve rendering efficiency.

Benefits of technology

It improves the rendering and display rate of 3D images and the smoothness of the picture, reduces computationally intensive and complex modeling operations, and significantly improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112435322B
    Figure CN112435322B
Patent Text Reader

Abstract

The present application discloses a rendering method, device, electronic device and computer-readable storage medium for a 3D model, the method comprising: obtaining an initial model of a 3D model, calculating an initial value of the visible face count of the initial model; extracting different numbers of blocks from the initial model according to the initial value of the visible face count to generate multiple block sets; calculating the visible face count of each block set; generating multiple LOD model files of different levels according to the initial value of the visible face count and the visible face count of each block set; calculating the actual distance of the 3D model in the current image display screen; determining a target LOD model file according to the actual distance, the actual distance being within the LOD distance range corresponding to the target LOD model file; calling the target LOD model file for rendering in the current image display screen. The present application effectively improves the rendering and display rate of 3D images, improves the smoothness and coherence of the images, and improves the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image rendering technology, and in particular to a 3D model rendering method, device, electronic device and computer-readable storage medium. Background Art

[0002] 3D models are widely used in industrial design, games and other fields. In the prior art, if a 3D model needs to perform transformation operations on all vertex data each time it is rendered, it will take up and consume a large amount of computing resources, and it will be impossible to display more scene details while ensuring a high frame rate. Therefore, in the related art, multiple LOD model files of different levels, i.e., different degrees of precision, are usually used to render images in different scene scenes. After being rendered, an LOD model file is displayed on the display screen, which can present an intuitive and vivid three-dimensional image display effect to the user. The complexity of the LOD model file is directly related to the amount of calculation in the rendering process. In view of this, how to generate multiple LOD model files of different levels and render them to improve the rendering efficiency of 3D models has become a pressing concern for those skilled in the art. Summary of the invention

[0003] The purpose of this application is to provide a 3D model rendering method, device, electronic device and computer-readable storage medium, so as to effectively improve the rendering and display rate of 3D images, thereby improving the smoothness and continuity of the picture and greatly improving the user experience.

[0004] To solve the above technical problems, in a first aspect, the present application discloses a 3D model rendering method, comprising:

[0005] Obtaining an initial model of the 3D model, and calculating an initial value of the visible surface number of the initial model;

[0006] Extracting different numbers of blocks from the initial model according to the initial value of the number of visible surfaces to generate multiple sets of blocks;

[0007] Calculating the number of visible surfaces of the plurality of block sets;

[0008] Generate a plurality of LOD model files at different levels according to the initial value of the number of visible surfaces and the number of visible surfaces of the plurality of block sets, wherein different LOD model files correspond to different LOD distance ranges;

[0009] Calculating the actual distance of the 3D model in the current image display screen;

[0010] Determine a target LOD model file according to the actual distance, wherein the actual distance is within a LOD distance range corresponding to the target LOD model file;

[0011] The target LOD model file is called to render in the current image display screen.

[0012] Optionally, the total number of the LOD model files is positively correlated with the initial value of the number of visible surfaces; the different levels correspond to different ranges of the number of visible surfaces, the ranges of the number of visible surfaces corresponding to the levels do not overlap with each other, and fully cover the interval below the initial value of the number of visible surfaces.

[0013] Optionally, for each target level, the generation process of the corresponding block set includes the following steps:

[0014] Performing block extraction on the initial model to generate a current block set;

[0015] Calculate the number of visible faces of the current block set;

[0016] Determining whether the number of visible surfaces is within a range of the number of visible surfaces at the target level;

[0017] If so, determining that the current block set corresponds to the target level;

[0018] If not, the number of blocks extracted is adjusted to update and generate the current block set, and the step of calculating the number of visible faces of the current block set and subsequent steps are performed.

[0019] Optionally, extracting different numbers of blocks from the initial model includes:

[0020] Determining a center point of an axis-aligned bounding box of the initial model;

[0021] Taking the center point as the center, block extraction is performed at even intervals in each direction from the center point to the edge of the axis-aligned bounding box.

[0022] Optionally, extracting different numbers of blocks from the initial model includes:

[0023] Determining a center point of an axis-aligned bounding box of the initial model;

[0024] Taking the center point as the center, in each direction from the center point to the edge of the axis-aligned bounding box, a partial structure of each block is intercepted according to a preset percentage.

[0025] Optionally, after intercepting the partial structure of each block according to a preset percentage in each direction from the center point to the edge of the model, the method further includes:

[0026] The edge of the image data is softened at the cut boundary.

[0027] Optionally, determining the target LOD model file according to the actual distance includes:

[0028] Arrange the LOD model files in ascending order according to the LOD distance range;

[0029] Determine in turn whether the actual distance is within the LOD distance range of each LOD model file;

[0030] If the actual distance is within the LOD distance range of the current LOD model file, the current LOD model file is determined as the target LOD model file.

[0031] In a second aspect, the present application further discloses a 3D model rendering device, comprising:

[0032] A calculation module, used to obtain an initial model of the 3D model and calculate an initial value of the visible surface number of the initial model;

[0033] An extraction module, configured to extract different numbers of blocks from the initial model according to the initial value of the number of visible surfaces, so as to generate a plurality of block sets, and calculate the number of visible surfaces of the plurality of block sets;

[0034] A generating module, used for generating a plurality of LOD model files of different levels according to the initial value of the number of visible surfaces and the number of visible surfaces of the plurality of block sets, wherein different LOD model files correspond to different LOD distance ranges;

[0035] A rendering module is used to calculate the actual distance of the 3D model in the current image display screen, determine the target LOD model file according to the actual distance, and call the target LOD model file to render in the current image display screen if the actual distance is within the LOD distance range corresponding to the target LOD model file.

[0036] Optionally, the total number of the LOD model files is positively correlated with the initial value of the number of visible surfaces; the different levels correspond to different ranges of the number of visible surfaces, the ranges of the number of visible surfaces corresponding to the levels do not overlap with each other, and fully cover the interval below the initial value of the number of visible surfaces.

[0037] Optionally, for each target level, the extraction module is specifically used to:

[0038] Performing block extraction on the initial model to generate a current block set; calculating the number of visible surfaces of the current block set; determining whether the number of visible surfaces is within the range of the number of visible surfaces of the target level; if so, determining that the current block set corresponds to the target level; if not, adjusting the number of block extractions to update and generate the current block set until the number of visible surfaces of the updated current block set is within the range of the number of visible surfaces of the target level.

[0039] Optionally, the extraction module is specifically used for:

[0040] The center point of the axis-aligned bounding box of the initial model is determined; and blocks are evenly extracted in each direction from the center point to the edge of the axis-aligned bounding box with the center point as the center.

[0041] Optionally, the extraction module is specifically used for:

[0042] Determine the center point of the axis-aligned bounding box of the initial model; and take the center point as the center and, in each direction from the center point to the edge of the axis-aligned bounding box, intercept partial structures of each block according to a preset percentage.

[0043] Optionally, the extraction module is further used for:

[0044] After the partial structure of each block is cut off according to a preset percentage in each direction from the center point to the edge of the model, edge softening processing of the image data is performed at the cut-off boundary.

[0045] Optionally, when determining the target LOD model file according to the actual distance, the rendering module is specifically used to:

[0046] Arrange the LOD model files in ascending order according to the LOD distance range; determine in turn whether the actual distance is within the LOD distance range of each LOD model file; if the actual distance is within the LOD distance range of the current LOD model file, determine the current LOD model file as the target LOD model file.

[0047] In a third aspect, the present application further discloses an electronic device, comprising:

[0048] Memory for storing computer programs;

[0049] A processor is used to execute the computer program to implement the steps of any one of the 3D model rendering methods described above.

[0050] In a fourth aspect, the present application further discloses a computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the computer program is used to implement the steps of any one of the 3D model rendering methods described above.

[0051] The rendering method of a 3D model provided in the present application includes: obtaining an initial model of the 3D model; calculating an initial value of the visible surface number of the initial model; extracting different numbers of blocks from the initial model according to the initial value of the visible surface number to generate multiple block sets; calculating the visible surface number of the multiple block sets; generating multiple LOD model files of different levels according to the initial value of the visible surface number and the visible surface number of the multiple block sets, wherein the multiple LOD model files correspond to different LOD distance ranges; calculating the actual distance of the 3D model in the current image display screen; determining a target LOD model file according to the actual distance, wherein the actual distance is within the LOD distance range corresponding to the target LOD model file; and calling the target LOD model file for rendering in the current image display screen.

[0052] The 3D model rendering method, device, electronic device and computer-readable storage medium provided by the present application have the following beneficial effects: the present application is based on the initial value of the number of visible surfaces of the initial model, and extracts blocks of different numbers multiple times based on the initial model, and quickly and effectively generates LOD model files of different levels, so as to determine the target LOD model file for real-time rendering and display. Since the present application does not need to repeat the modeling operation with large amount of calculation and complex process, it can effectively improve the generation rate and quality of LOD model files, thereby improving the rendering and display rate of 3D image pictures, improving the smoothness and coherence of the pictures, and greatly improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to more clearly illustrate the technical solutions in the prior art and the embodiments of the present application, the drawings required for use in the description of the prior art and the embodiments of the present application are briefly introduced below. Of course, the drawings described below in relation to the embodiments of the present application are only part of the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without creative work, and the obtained other drawings also belong to the protection scope of the present application.

[0054] Figure 1 A flowchart of a 3D model rendering method disclosed in an embodiment of the present application;

[0055] Figure 2 A flow chart of a method for generating a block set disclosed in an embodiment of the present application;

[0056] Figure 3 A structural block diagram of a 3D model rendering device disclosed in an embodiment of the present application;

[0057] Figure 4 This is a structural block diagram of an electronic device disclosed in an embodiment of the present application. DETAILED DESCRIPTION

[0058] The core of this application is to provide a 3D model rendering method, device, electronic device and computer-readable storage medium, so as to effectively improve the rendering and display rate of 3D image pictures, thereby improving the smoothness and continuity of the pictures, and greatly improving the user experience.

[0059] In order to describe the technical solutions in the embodiments of the present application more clearly and completely, the technical solutions in the embodiments of the present application will be introduced below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0060] See also Figure 1 As shown, the embodiment of the present application discloses a 3D model rendering method, which mainly includes:

[0061] S101: Acquire an initial model of a 3D model, and calculate an initial value of the number of visible surfaces of the initial model.

[0062] The objects of the 3D model may be animals, houses, people, etc. Generally, the initial model of a 3D model is a block model composed of multiple blocks, which is modeled by the user through data in the 3D modeling software. The block is the smallest unit of the 3D model, which is generally a cube composed of six square faces, and each square face is composed of two triangles.

[0063] Based on the modeling function, the initial model can be generated by three-dimensional modeling based on the 3D modeling data of the target body. According to the 3D modeling data of the target body, the cubes contained in the target body can be determined. According to the vertex data of these cubes, that is, the vertex data of the target body, the initial model of the target body can be generated.

[0064] A 3D model is composed of many blocks, and therefore has many faces, which can be divided into visible faces and invisible faces based on user visibility. When rendering and displaying a 3D model, the main thing is to perform relevant processing on the visible faces. Therefore, the number of visible faces of a 3D model will affect the clarity and recognizability of the rendered image. Therefore, this application first calculates the initial value of the number of visible faces of the initial model, and uses this as a basis to determine how many different levels of LOD (Levels of Detail) model files need to be generated later.

[0065] The calculation of the number of visible faces of the model includes the processes of finding coplanar blocks, merging shared faces between adjacent blocks, and eliminating invisible faces surrounded by multiple blocks.

[0066] It is easy to understand that when modeling the same target body, the more vertex data there are, the more total visible faces there are, the more picture details and clearer the image of the corresponding LOD model file will be, and accordingly, the amount of data calculation will be larger and the processing process will be more complicated; on the contrary, the less vertex data there are, the less picture details and poorer image clarity of the generated LOD model file will be, and the data calculation will be simpler.

[0067] Therefore, for a 3D model, its initial model is a model that contains the most detailed vertex data of the target body, that is, it contains the vertex data of each block that initially constitutes the target body, and has the largest total number of visible faces.

[0068] Therefore, the level corresponding to the initial value of the number of visible surfaces is the highest level that the target body can obtain; and below the highest level, multiple LOD model files of different levels can also be obtained. At the same time, the initial value of the number of visible surfaces not only determines the highest level of the target body, but also determines the maximum complexity of the amount of rendering data. Therefore, those skilled in the art can set how many different levels of LOD model files to generate and the levels of each LOD model file according to actual application conditions and specific needs.

[0069] S102: Extracting blocks of different numbers from the initial model multiple times according to the initial value of the number of visible surfaces to generate multiple sets of blocks.

[0070] It should be pointed out that this application specifically adopts the method of extracting blocks based on the initial model, and changes the amount of vertex data and the number of visible surfaces by adjusting the number of blocks extracted, thereby generating other multiple LOD model files at different levels, rather than regenerating multiple model files through a repeated modeling process with a large amount of calculation. As a result, this application can easily and quickly generate multiple LOD model files, thereby improving the rendering efficiency of the LOD model files and improving the smoothness of the picture.

[0071] S103: Calculate the number of visible surfaces of multiple block sets.

[0072] S104: Generate multiple LOD model files of different levels according to the initial value of the number of visible surfaces and the number of visible surfaces of the multiple block sets, wherein different LOD model files correspond to different LOD distance ranges.

[0073] After obtaining the block sets corresponding to different levels of detail clarity, the LOD model files of the corresponding levels can be generated respectively. According to the number of extracted blocks, these newly extracted block sets will lose some of the original detail information to varying degrees, achieving different degrees of detail blurring, and reducing the clarity of the corresponding LOD model files to varying degrees.

[0074] For example, based on the initial model, if 50% of the blocks are extracted, the vertex data of the new block set will become half of the vertex data of the original initial model, and a LOD model file with slightly lower definition will be obtained based on the block set. If 25% of the blocks are extracted, the vertex data of the new block set will become a quarter of the vertex data of the original initial model, and a LOD model file with even lower definition will be obtained.

[0075] S105: Calculate the actual distance of the 3D model in the current image display screen, and determine the target LOD model file according to the actual distance. The actual distance is within the LOD distance range corresponding to the target LOD model file.

[0076] After obtaining multiple LOD model files at different levels based on the above steps, the target LOD model file can be determined from the multiple LOD model files at different levels according to the real-time needs of the screen display so as to be rendered and displayed in the image screen.

[0077] Specifically, each level of LOD model file has its corresponding LOD distance range. In order to select the most matching LOD model file, the present application specifically calculates the actual distance of the 3D model in the current image display screen, and compares the actual distance with the LOD distance range of each level of LOD model file, so that the LOD model file corresponding to the LOD distance range matching the actual distance can be determined as the target LOD model file. In other words, the LOD model file corresponding to the LOD distance range within which the actual distance value is within is determined as the target LOD model file.

[0078] For example, assume that four different levels of LOD model files are generated based on step S104: LOD1, LOD2, LOD3, and LOD4; the corresponding LOD distance ranges are 0-5m, 5m-10m, 10m-30m, and 30m-100m, respectively. Therefore, if the actual distance of the 3D model in the current image display screen is calculated to be 3.5m, since the value of 3.5 is between the interval [0,5], LOD1 should be selected as the target LOD model file; similarly, if the actual distance is 6.2m, LOD2 should be selected as the target LOD model file; if the actual distance is 22.9m, LOD3 should be selected as the target LOD model file; if the actual distance is 74m, LOD4 should be selected as the target LOD model file.

[0079] S106: calling the target LOD model file to render in the current image display screen.

[0080] It can be seen that the rendering method of the 3D model provided by the present application sets different levels for the LOD model file according to the initial value of the total number of visible faces, extracts different numbers of blocks multiple times based on the initial model, and quickly and effectively generates LOD model files of different levels, so as to determine the target LOD model file for real-time rendering and display. Since the present application does not need to repeat the modeling operation with large amount of calculation and complex process, it can effectively improve the generation rate and quality of LOD model files, thereby improving the rendering and display rate of 3D image screen, improving the smoothness and coherence of the screen, and greatly improving the user experience.

[0081] As a specific embodiment, the 3D model rendering method provided in the embodiment of the present application is based on the above content, and the total number of LOD model files is positively correlated with the initial value of the number of visible surfaces; different levels correspond to different visible surface number ranges, and the visible surface number ranges corresponding to each level do not overlap with each other, and fully cover the interval below the initial value of the visible surface number.

[0082] Specifically, in this embodiment, the larger the initial value of the number of visible faces of the initial model, the greater the total number of LOD model files obtained. However, for 3D models with a particularly large total number of faces, in order to save calculations, it is not necessary to obtain more hierarchical models, so in some embodiments, a threshold can be set to determine different numbers of LOD model files within different threshold ranges.

[0083] For example, the first threshold is set to 4000, the second threshold is set to 2000, and the third threshold is set to 500; when the initial value of the visible surface number is not less than 4000, 4 different LOD model files can be obtained; when the initial value of the visible surface number is less than 4000 but not less than 2000, 3 different LOD model files can be obtained; when the initial value of the visible surface number is less than 2000 but not less than 500, 2 different LOD model files can be obtained; when the initial value of the visible surface number is less than 500, 1 LOD model file can be obtained.

[0084] Moreover, the visible surface count ranges of different levels have no overlapping intervals, and all intervals below the initial visible surface count value (positive number) are covered. For example, when the initial visible surface count value is not less than 4000, for example, when it is 5000, 4 different LOD model files are obtained, and the visible surface count ranges of the LOD model files of each level can be set from low to high in turn as follows:

[0085] (0,500], (500,2000], (2000,4000], (4000,5000]

[0086] Among them, the four visible number ranges shown above not only have no overlapping intervals with each other, but also fully cover the positive number interval below the initial value of the visible number.

[0087] It is easy to understand that when the initial value of the total number of faces is not less than 4000, for example, 4500, the initial model itself corresponds to the level of (4000, 5000], so it is necessary to generate another three lower-level block sets through block extraction.

[0088] For another example, when the initial value of the visible surface count is less than 4000 but not less than 2000, for example, when it is 2500, three different LOD model files are obtained accordingly, and the visible surface count ranges of the LOD model files at each level can be set in order from low to high:

[0089] (0, 500], (500, 2000], (2000, 2500].

[0090] It is easy to understand that when the initial value of the total number of faces is 2500, the initial model itself corresponds to the level of (2000, 2500], so it is necessary to generate two other lower-level block sets through block extraction.

[0091] When the initial value of visible face count is less than 2000 but not less than 500, for example, when it is 1000, two different LOD model files can be obtained, and the visible face count range of each level of LOD model files can be set from low to high as follows:

[0092] (0, 500], (500, 1000].

[0093] It is easy to understand that when the initial value of the total number of faces is 1000, the initial model itself corresponds to the level of (500, 1000], and another lower-level block set needs to be generated through block extraction.

[0094] When the initial value of the number of visible surfaces is less than 500, for example, 300, only one LOD model file is obtained, and no block extraction is required.

[0095] The above thresholds can be set arbitrarily as needed and are not limited here.

[0096] See also Figure 2 , Figure 2 A flow chart of a method for generating a block set disclosed in an embodiment of the present application.

[0097] like Figure 2 As shown in FIG. 1 , as a specific embodiment, for each target level, the generation process of the corresponding block set includes the following steps:

[0098] S201: Extract blocks from the initial model to generate a current block set.

[0099] S202: Calculate the number of visible surfaces of the current block set.

[0100] S203: Determine whether the number of visible surfaces is within the range of the number of visible surfaces of the target layer; if so, proceed to S204; if not, proceed to S205.

[0101] S204: Determine whether the current block set corresponds to the target level.

[0102] S205: Adjust the number of blocks to be extracted to update and generate the current block set, and return to S202.

[0103] Specifically, different levels correspond to different visible surface number ranges. Therefore, when performing block extraction to generate a block set of the corresponding level, it may be necessary to experiment multiple times to change the number of block extractions so that the visible surface number of the obtained block set is exactly within the visible surface number range of the corresponding level.

[0104] As a specific embodiment, the rendering method of the 3D model provided in the embodiment of the present application extracts different numbers of blocks from the initial model based on the above content, including:

[0105] Determine the center point of the axis-aligned bounding box of the initial model;

[0106] Centered on the center point, blocks are evenly extracted in all directions from the center point to the edge of the axis-aligned bounding box.

[0107] Specifically, it is easy for those skilled in the art to understand that the axis-aligned bounding box is the minimum bounding box that contains all vertices of a given model during the modeling process. Generally, the axis-aligned bounding box is a simple hexahedron, and each side is parallel to a coordinate plane.

[0108] In the process of block extraction, when the number of extracted blocks is certain, the specific selection of which blocks to extract determines the degree of restoration of the extracted model file to the initial model, thereby affecting the image quality. Therefore, in order to fully retain the blocks with the general image features of the original target body as much as possible, this embodiment specifically extracts blocks with the center point of the axis-aligned bounding box as the center.

[0109] Specifically, when extracting blocks, this embodiment specifically performs uniform extraction. The so-called uniform means that blocks are uniformly extracted in proportion from all blocks contained in the initial model, so that the extracted blocks are evenly distributed in various parts of the initial model, ensuring that the features of the initial model are retained to the greatest extent. For example, if 50% of the blocks are to be extracted, 1 block is extracted from every 2 adjacent blocks; if 25% of the blocks are to be extracted, 1 block is extracted from every 4 adjacent blocks.

[0110] As a specific embodiment, the rendering method of the 3D model provided in the embodiment of the present application extracts different numbers of blocks from the initial model based on the above content, including:

[0111] Determine the center point of the axis-aligned bounding box of the initial model;

[0112] Taking the center point as the center, in each direction from the center point to the edge of the model, the partial structure of each block is intercepted according to the preset percentage.

[0113] Specifically, when extracting blocks, this embodiment specifically adopts a method of intercepting each block. For example, if 50% of the blocks are to be extracted, each block can be intercepted to retain 50% of its structure; if 25% of the blocks are to be extracted, each block can be intercepted to retain 205% of its structure.

[0114] As a specific embodiment, the 3D model rendering method provided in the embodiment of the present application is based on the above content, and after intercepting the partial structure of each block according to the preset percentage in each direction from the center point to the edge of the model, it also includes:

[0115] The edge of the image data is softened at the cut boundary.

[0116] Furthermore, after the blocks are captured, edge softening processing may be further performed to improve image quality.

[0117] As a specific embodiment, the 3D model rendering method provided in the embodiment of the present application, based on the above content, after generating multiple LOD model files at different levels respectively, further includes:

[0118] Generate a data file for each LOD model file; the data file records the LOD distance range of the corresponding LOD model file.

[0119] Specifically, it is easy for those skilled in the art to understand that LOD technology is an effective method for accelerating graphics generation, and LOD distance is a technical parameter in LOD technology, which refers to the distance between the target object in the picture and the (imaginary) camera that captures the current picture at the spatial visual level. It is easy to understand that the smaller the LOD distance, the richer the level of the corresponding picture should be, otherwise it is the opposite.

[0120] Specifically, during the picture display process, especially the dynamic picture display process, multiple LOD model files of different levels are often switched and called. Therefore, in order to facilitate the selection of appropriate model files for calling, this embodiment records the corresponding LOD distance range in its data file after generating LOD model files of different levels.

[0121] In which, further, the data file can specifically record the LOD distance range in the form of an XML (eXtensible Markup Language) file. As a specific embodiment, the 3D model rendering method provided in the embodiment of the present application is based on the above content and determines the target LOD model file according to the actual distance, including:

[0122] Arrange each LOD model file in the order of LOD distance range from small to large;

[0123] Determine in turn whether the actual distance is within the LOD distance range of each LOD model file;

[0124] If the actual distance is within the LOD distance range of the current LOD model file, the current LOD model file is determined as the target LOD model file.

[0125] Specifically, as mentioned above, the target LOD model file is an LOD model file whose LOD distance range is adapted to the actual distance of the 3D model. When comparing the LOD distance ranges of each LOD model file with the actual distance of the 3D model, this embodiment specifically determines an arrangement order for each LOD model file, so as to determine in turn whether the actual distance is within the LOD distance range of the current LOD model file according to the order.

[0126] Among them, this embodiment specifically sorts in the order of LOD distance range from small to large. Of course, similarly, those skilled in the art may also choose to sort in the order of LOD distance range from large to small.

[0127] See also Figure 3 As shown, the embodiment of the present application discloses a 3D model rendering device, which mainly includes:

[0128] The calculation module 301 is used to obtain an initial model of the 3D model and calculate an initial value of the number of visible surfaces of the initial model;

[0129] An extraction module 302 is used to extract different numbers of blocks from the initial model according to the initial value of the number of visible surfaces, so as to generate multiple block sets, and calculate the number of visible surfaces of each block set;

[0130] The generating module 303 is used to generate a plurality of LOD model files of different levels according to the initial value of the number of visible surfaces and the number of visible surfaces of each block set; different LOD model files correspond to different LOD distance ranges;

[0131] The rendering module 304 is used to calculate the actual distance of the 3D model in the current image display screen, determine the target LOD model file according to the actual distance, and call the target LOD model file for rendering in the current image display screen if the actual distance is within the LOD distance range corresponding to the target LOD model file.

[0132] It can be seen that the 3D model rendering device provided by the present application is based on the initial value of the number of visible faces of the initial model, and extracts different numbers of blocks multiple times based on the initial model, and quickly and effectively generates LOD model files of different levels, so as to determine the target LOD model file for real-time rendering and display. Since the present application does not need to repeat the modeling operation with large amount of calculation and complex process, it can effectively improve the generation rate and quality of LOD model files, thereby improving the rendering and display rate of 3D image screens, improving the smoothness and coherence of the screens, and greatly improving the user experience.

[0133] For the specific content of the rendering device of the above-mentioned LOD model file, please refer to the detailed introduction of the aforementioned rendering method of the 3D model, which will not be repeated here.

[0134] As a specific embodiment, the rendering device of the 3D model disclosed in the embodiment of the present application is based on the above content, and the total number of LOD model files is positively correlated with the initial value of the number of visible surfaces; different levels correspond to different ranges of the number of visible surfaces, and the visible surface number ranges corresponding to each level do not overlap with each other, and fully cover the interval below the initial value of the number of visible surfaces.

[0135] As a specific embodiment, the 3D model rendering device disclosed in the embodiment of the present application is based on the above content. For each target level, the extraction module 302 is specifically used to:

[0136] Perform block extraction on the initial model to generate a current block set; calculate the number of visible surfaces of the current block set; determine whether the number of visible surfaces is within the visible surface number range of the target level; if so, determine that the current block set corresponds to the target level; if not, adjust the number of block extraction to update and generate the current block set until the number of visible surfaces of the updated current block set is within the visible surface number range of the target level.

[0137] As a specific embodiment, the 3D model rendering device disclosed in the embodiment of the present application is based on the above content, and the extraction module 302 is specifically used for:

[0138] Determine the center point of the axis-aligned bounding box of the initial model; take the center point as the center, and evenly extract blocks in all directions from the center point to the edge of the axis-aligned bounding box.

[0139] As a specific embodiment, the 3D model rendering device disclosed in the embodiment of the present application is based on the above content, and the extraction module 302 is specifically used for:

[0140] The center point of the axis-aligned bounding box of the initial model is determined; taking the center point as the center, in each direction from the center point to the edge of the axis-aligned bounding box, a partial structure of each block is intercepted according to a preset percentage.

[0141] As a specific embodiment, the 3D model rendering device disclosed in the embodiment of the present application is based on the above content, and the extraction module 302 is further used for:

[0142] After a partial structure of each block is cut off according to a preset percentage, edge softening processing of the image data is performed at the cut-off boundary.

[0143] As a specific embodiment, the rendering device of the 3D model disclosed in the embodiment of the present application is based on the above content, and the rendering module 304 is specifically used to determine the target LOD model file according to the actual distance:

[0144] Arrange the LOD model files in ascending order according to the LOD distance range; determine in turn whether the actual distance is within the LOD distance range of each LOD model file; if the actual distance is within the LOD distance range of the current LOD model file, determine the current LOD model file as the target LOD model file.

[0145] As a specific embodiment, the 3D model rendering device disclosed in the embodiment of the present application is based on the above content, and the generating module 303 is further used for:

[0146] After LOD model files of different levels are generated respectively, data files of each LOD model file are generated; the data files record the LOD distance range of the corresponding LOD model file.

[0147] See also Figure 4 As shown, the embodiment of the present application discloses an electronic device, including:

[0148] Memory 401, used for storing computer programs;

[0149] The processor 402 is used to execute the computer program to implement the steps of any one of the 3D model rendering methods described above.

[0150] Furthermore, an embodiment of the present application also discloses a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, it is used to implement the steps of any one of the 3D model rendering methods described above.

[0151] For specific contents of the above-mentioned electronic device and computer-readable storage medium, please refer to the detailed introduction of the aforementioned rendering method of the 3D model, which will not be repeated here.

[0152] In this application, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0153] It should also be noted that, in this application document, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. In addition, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

[0154] The technical solution provided by the present application is described in detail above. The principle and implementation method of the present application are described in detail using specific examples herein, and the description of the above embodiments is only used to help understand the method and core idea of ​​the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the present application.

Claims

1. A method for rendering a 3D model, characterized in that: include: Obtaining an initial model of the 3D model, and calculating an initial value of the visible surface number of the initial model; According to the initial value of the number of visible surfaces, extracting blocks of different numbers from the initial model to generate multiple block sets, so as to change the amount of vertex data and the number of visible surfaces by adjusting the number of block extractions, thereby generating multiple LOD model files of different levels; Calculating the number of visible surfaces of the plurality of block sets; Generate a plurality of LOD model files at different levels according to the initial value of the number of visible surfaces and the number of visible surfaces of the plurality of block sets, wherein different LOD model files correspond to different LOD distance ranges; Calculating the actual distance of the 3D model in the current image display screen; Determine a target LOD model file according to the actual distance, wherein the actual distance is within the LOD distance range corresponding to the target LOD model file; Calling the target LOD model file to render in the current image display screen; Among them, the total number of LOD model files is positively correlated with the initial value of the visible surface number; the different levels correspond to different visible surface number ranges; the visible surface number ranges corresponding to each level do not overlap with each other, and fully cover the interval below the initial value of the visible surface number.

2. The method according to claim 1, characterized in that: For each target level, the generation process of the corresponding block set includes the following steps: Performing block extraction on the initial model to generate a current block set; Calculate the number of visible faces of the current block set; Determining whether the number of visible surfaces is within a range of the number of visible surfaces at the target level; If so, determining that the current block set corresponds to the target level; If not, the number of blocks extracted is adjusted to update and generate the current block set, and the step of calculating the number of visible faces of the current block set and subsequent steps are performed.

3. The method according to claim 1, characterized in that The extracting different numbers of blocks from the initial model includes: Determining a center point of an axis-aligned bounding box of the initial model; Taking the center point as the center, block extraction is performed at even intervals in each direction from the center point to the edge of the axis-aligned bounding box.

4. The method according to claim 1, characterized in that: The extracting different numbers of blocks from the initial model includes: Determining a center point of an axis-aligned bounding box of the initial model; Taking the center point as the center, in each direction from the center point to the edge of the axis-aligned bounding box, a partial structure of each block is intercepted according to a preset percentage.

5. The method according to claim 4, characterized in that After intercepting the partial structure of each block according to a preset percentage in each direction from the center point to the edge of the model, the method further includes: The edge of the image data is softened at the cut boundary.

6. The method according to claim 1, characterized in that The step of determining the target LOD model file according to the actual distance includes: Arrange the LOD model files in ascending order according to the LOD distance range; Determine in turn whether the actual distance is within the LOD distance range of each LOD model file; If the actual distance is within the LOD distance range of the current LOD model file, the current LOD model file is determined as the target LOD model file.

7. A 3D model rendering device, characterized in that: include: A calculation module, used to obtain an initial model of the 3D model and calculate an initial value of the visible surface number of the initial model; An extraction module, configured to extract blocks of different numbers from the initial model according to the initial value of the number of visible surfaces, so as to generate a plurality of block sets, so as to change the amount of vertex data and the number of visible surfaces by adjusting the number of blocks extracted, thereby generating a plurality of LOD model files of different levels, and calculating the number of visible surfaces of the plurality of block sets; A generating module, used for generating a plurality of LOD model files of different levels according to the initial value of the number of visible surfaces and the number of visible surfaces of the plurality of block sets, wherein different LOD model files correspond to different LOD distance ranges; A rendering module, used to calculate the actual distance of the 3D model in the current image display screen, determine the target LOD model file according to the actual distance, and call the target LOD model file to render in the current image display screen if the actual distance is within the LOD distance range corresponding to the target LOD model file; Among them, the total number of LOD model files is positively correlated with the initial value of the visible surface number; the different levels correspond to different visible surface number ranges; the visible surface number ranges corresponding to each level do not overlap with each other, and fully cover the interval below the initial value of the visible surface number.

8. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to execute the computer program to implement the steps of the 3D model rendering method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it is used to implement the steps of the 3D model rendering method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • System, method and computer program product for automatic optimization of 3D textured models for network transfer and real-time rendering

    CN107077746A

  • VR-oriented ship giant data model lightweight method and system, terminal and medium

    CN111210521A

  • Image-based methods of representation and rendering of three-dimensional object and animated three-dimensional object

    US20030001838A1

  • Adaptive computation of subdivision surfaces

    US20070247458A1

  • Fly-through computer aided design method and apparatus

    US5999187A