Scene rendering method, device and electronic device

By transferring the rendering pipeline to GPU processing, the parallel computing power of the GPU is used to solve the problem of excessive CPU load in large-scale dynamic model scene rendering, real-time rendering and efficient rendering effects are achieved.

CN114494646BActive Publication Date: 2025-08-08上海秉匠信息科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210086701.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-25
Publication Date
2025-08-08
Estimated Expiration
2042-01-25

AI Technical Summary

Technical Problem

In the prior art, when dealing with scene rendering of large-scale dynamic models, the CPU load is too heavy and it is difficult to achieve real-time rendering.

Method used

The vast majority of the rendering pipeline is transferred to the GPU for processing, and the parallel computing power of the GPU is used to reduce the computing burden of the CPU through the division of grid segments and cache management.

Benefits of technology

Real-time rendering of large-scale dynamic models is realized, reducing CPU load, and improving rendering efficiency and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114494646B_ABST
    Figure CN114494646B_ABST
Patent Text Reader

Abstract

The present invention provides a scene rendering method, device, and electronic device, which are applied to a graphics processor. The method includes: obtaining multiple components included in the scene and determining the grid segment of each component; starting multiple processing batches of the graphics processor, respectively determining the target level corresponding to the processing batch and the target grid segment corresponding to the target level, and writing them into multiple rendering target caches of the graphics processor; based on the target levels and target grid segments included in the multiple rendering target caches, determining the total number of grid segments and grid segment information for each grid segment, and writing them into the container cache of the graphics processor; rendering the scene based on the container cache of the graphics processor. In this method, the vast majority of the rendering pipeline can be placed in the GPU for processing, using the powerful parallel computing capabilities of the GPU to cope with the processing load after the sharp increase in the number of models, reducing the computational burden of the CPU, and lowering the CPU load, thereby achieving real-time rendering.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of graphics processors, and in particular to a scene rendering method, device and electronic equipment. Background Art

[0002] During the production phase of BIM (Building Information Modeling) data, it is necessary to create, delete, and edit large-scale single models, requiring all models to be independently processed in terms of spatial and business attributes. Such operations have always been performed in traditional modeling software such as Revit, which is very slow when processing large-scale scenes. It is often necessary to decompose the scenes into numerous sub-scenes by profession and category, and perform modeling and editing in the sub-scenes, which cannot perform rapid data integration.

[0003] During the application phase of BIM data, such as construction simulations and schedule drills, large-scale model components need to be animated in spatial displacement according to a certain sequence. The spatial position of the model cannot be determined in advance and is subject to dynamic change at any time. Traditional BIM rendering engines often perform in-depth optimizations based on the spatial position of the model, establishing a hierarchical tree structure based on the spatial position of the model and using the model's orientation to establish an occlusion culling system, thereby achieving real-time and efficient rendering of the BIM model. However, when the spatial position of the model changes, the acceleration cache structure established on top becomes invalid, making it impossible to render the updated position data in real time.

[0004] For scenes composed of a large number of dynamic models, it is necessary to establish an independent data structure for each model. The spatial position change, creation, and deletion of a single model will not affect the data status of other single models. Only in this way can dynamic modification of all models be achieved. For real-time rendering of a large number of single-component models, traditional rendering engines usually use a rendering pipeline driven by the CPU (Central Processing Unit). That is, in each rendering frame, the CPU first calculates the animation matrix of each single model, determines the LOD (Level of Detail) to be used by the single model based on the distance between the model and the camera, then intersects the single model with the camera's viewing frustum and only retains the single models visible to the camera. For each single model, it calculates whether it is occluded and only retains the single models that are not completely occluded. Then, single models of the same shape and material are merged to generate a triangulated mesh rendering queue classified by material. The rendering queue is sent to the GPU (Graphics Processing Unit), which is responsible for rendering all triangulated meshes.

[0005] In the aforementioned CPU-driven rendering pipeline, the CPU doesn't need to process every triangle mesh, only the individual models it comprises. However, when the number of individual models increases dramatically (to the millions), the CPU load increases rapidly, making real-time rendering difficult. Therefore, a technology is needed to solve the problem of real-time rendering of large dynamic models. Summary of the Invention

[0006] In view of this, the purpose of the present invention is to provide a scene rendering method, device and electronic device to cope with the processing load after the sharp increase in the number of models, reduce the computational burden of the CPU, and reduce the load of the CPU, thereby performing real-time rendering.

[0007] In a first aspect, an embodiment of the present invention provides a scene rendering method, which is applied to a graphics processor, and the method includes: obtaining multiple components included in the scene, and determining the grid segment of each component; wherein each component includes multiple triangular faces of different levels, and a specified number of triangular faces of the same level constitutes a grid segment, and the specified number corresponding to different levels is different; starting multiple processing batches of the graphics processor, and respectively determining the target levels corresponding to the processing batches and the target grid segments corresponding to the target levels; writing the target grid segments into multiple rendering target caches of the graphics processor respectively; based on the target levels and target grid segments included in the multiple rendering target caches, determining the total number of grid segments and grid segment information of each grid segment; starting a processing batch of the graphics processor, and writing the total number of grid segments and grid segment information of each grid segment into the container cache of the graphics processor; rendering the scene based on the total number of grid segments and the grid segment information of each grid segment in the container cache of the graphics processor.

[0008] In a preferred embodiment of the present invention, the above-mentioned steps of obtaining multiple components included in the scene and determining the grid segment of each component include: obtaining multiple components included in the scene; determining the level of each triangular face included in the component; and determining the grid segment of the component based on a specified number of triangular faces of the same level.

[0009] In a preferred embodiment of the present invention, the step of determining the hierarchy of each triangular facet included in the component includes: calculating the distance coefficient between each triangular facet included in the component and a preset camera; and determining the hierarchy of each triangular facet included in the component based on the distance coefficient, the field of view angle of the camera, and the screen resolution of the camera.

[0010] In a preferred embodiment of the present invention, the distance coefficient is negatively correlated with the level of the triangle.

[0011] In a preferred embodiment, after the above-mentioned steps of determining the total number of grid segments and the grid segment information of each grid segment based on the target levels and target grid segments included in the multiple rendering target caches, the method further includes: determining, by the central processing unit, whether the container cache of the graphics processor needs to be expanded based on the total number of grid segments of the multiple rendering target caches; if so, increasing the capacity of the container cache, executing a processing batch of the graphics processor, and writing the total number of grid segments and the grid segment information of each grid segment into the container cache of the graphics processor.

[0012] In a preferred embodiment of the present invention, the above-mentioned step of rendering the scene based on the total number of grid segments in the container cache of the graphics processor and the grid segment information of each grid segment includes: placing the grid segment information into the texture array of the graphics processor; performing scene clipping processing, occlusion culling calculation processing and instance merging processing based on the texture array to obtain a rendering queue of the scene; and rendering the scene based on the rendering queue.

[0013] In a preferred embodiment of the present invention, the step of obtaining the multiple components included in the scene includes: obtaining the multiple components included in the scene through a central processing area.

[0014] In a second aspect, an embodiment of the present invention further provides a scene rendering device, which is applied to a graphics processor, and the method includes: a grid segment determination module, which is used to obtain multiple components included in the scene and determine the grid segment of each component; wherein each component includes multiple triangular faces of different levels, and a specified number of triangular faces of the same level constitutes a grid segment, and the specified number corresponding to different levels is different; a rendering target cache write module, which is used to start multiple processing batches of the graphics processor, and respectively determine the target level corresponding to the processing batch and the target grid segment corresponding to the target level; write the target grid segment into multiple rendering target caches of the graphics processor respectively; a container cache write module, which is used to determine the total number of grid segments and grid segment information of each grid segment based on the target level and target grid segment included in multiple rendering target caches; start a processing batch of the graphics processor, and write the total number of grid segments and grid segment information of each grid segment into the container cache of the graphics processor; a scene rendering module, which is used to render the scene based on the total number of grid segments and grid segment information of each grid segment in the container cache of the graphics processor.

[0015] In a third aspect, an embodiment of the present invention further provides an electronic device, comprising a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the steps of the above-mentioned scene rendering method.

[0016] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the steps of the above-mentioned scene rendering method.

[0017] The embodiments of the present invention bring the following beneficial effects:

[0018] Embodiments of the present invention provide a scene rendering method, device, and electronic device. These methods utilize a graphics processor (GPU) to obtain multiple components included in a scene and determine the grid segments of each component. These methods also write the target grid segments into multiple rendering target caches of the GPU. Furthermore, the total number of grid segments and the grid segment information for each grid segment are written into the GPU's container cache. The scene is then rendered based on the total number of grid segments and the grid segment information for each grid segment in the GPU's container cache. This method allows the vast majority of the rendering pipeline to be processed by the GPU, leveraging the GPU's powerful parallel computing capabilities to cope with the processing load resulting from a dramatic increase in the number of models, reducing the computational burden and load on the CPU, thereby enabling real-time rendering.

[0019] Other features and advantages of the present disclosure will be set forth in the following description, or some features and advantages may be inferred or unambiguously determined from the description, or may be learned by practicing the above-mentioned technology of the present disclosure.

[0020] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0022] Figure 1 A flowchart of a scene rendering method provided by an embodiment of the present invention;

[0023] Figure 2 A flowchart of another scene rendering method provided by an embodiment of the present invention;

[0024] Figure 3 A schematic diagram of components included in a scenario provided by an embodiment of the present invention;

[0025] Figure 4A schematic diagram of a hierarchy of computing components provided by an embodiment of the present invention;

[0026] Figure 5 A schematic diagram of scene rendering provided by an embodiment of the present invention;

[0027] Figure 6 A schematic structural diagram of a scene rendering device provided by an embodiment of the present invention;

[0028] Figure 7 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0029] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0030] Currently, in the aforementioned CPU-driven rendering pipeline, the CPU doesn't need to process every triangle mesh, only the individual models it comprises. However, when the number of individual models increases dramatically (to the millions), the CPU load increases rapidly, making real-time rendering difficult. Therefore, a technology is needed to solve the problem of real-time rendering of large dynamic models.

[0031] Based on this, the embodiments of the present invention provide a scene rendering method, device, and electronic device that can put most of the rendering pipeline into the GPU for processing, and use the powerful parallel computing capabilities of the GPU to cope with the processing load after the sharp increase in the number of models, reduce the computing burden of the CPU, and reduce the load on the CPU, thereby performing real-time rendering.

[0032] To facilitate understanding of this embodiment, a scene rendering method disclosed in an embodiment of the present invention is first introduced in detail.

[0033] Example 1:

[0034] The embodiment of the present invention provides a scene rendering method, which can be applied to a graphics processor; see Figure 1 The flowchart of a scene rendering method shown in FIG. 1 includes the following steps:

[0035] Step S102 , obtaining multiple components included in the scene, and determining the mesh segment of each component; wherein each component includes multiple triangular faces of different levels, a specified number of triangular faces of the same level constitutes a mesh segment, and the specified number corresponding to different levels is different.

[0036] A graphics processor, also known as a display core, visual processor, or display chip, is a microprocessor specifically designed to perform image and graphics-related calculations on personal computers, workstations, game consoles, and some mobile devices (such as tablets and smartphones).

[0037] A scene typically includes multiple models, each of which can be called a component. A component is composed of multiple triangular faces. In embodiments of the present invention, the triangular faces of a component can be divided into different levels (e.g., 10 levels), and a specified number of triangular faces at the same level is considered a mesh segment, where the specified number of faces at different levels is different.

[0038] For example, a component consists of 100 triangles, 10 of which are level 1 and 23 of which are level 2. If the specified quantity for level 1 is 10, then the 10 level 1 triangles can be divided into 2 mesh segments; if the specified quantity for level 2 is 12, then the 23 level 2 triangles can also be divided into 2 mesh segments. In the second level 2 mesh segment, one invisible invalid triangle can be added to make up the specified quantity.

[0039] Step S104 , starting multiple processing batches of the graphics processor, respectively determining target levels corresponding to the processing batches and target grid segments corresponding to the target levels; and writing the target grid segments into multiple rendering target buffers of the graphics processor.

[0040] After determining multiple components and the grid segments for each component, the target levels and the target grid segments corresponding to the target levels can be recorded using multiple render target buffers of the graphics processor. For example, render target buffer 1 can record level 1 and the target grid segments corresponding to level 1, render target buffer 2 can record level 2 and the target grid segments corresponding to level 2, and so on.

[0041] Step S106, based on the target levels and target grid segments included in the multiple rendering target caches, determine the total number of grid segments and the grid segment information of each grid segment; start a processing batch of the graphics processor, and write the total number of grid segments and the grid segment information of each grid segment into the container cache of the graphics processor.

[0042] After the GPU's multiple render target caches record the target levels and the target grid segments corresponding to the target levels, the GPU's container cache can record the total number of grid segments and grid segment information for each grid segment. The grid segment information for each grid segment can be obtained by the CPU, and the total number of grid segments can be counted based on the target levels and target grid segments included in the multiple render target caches.

[0043] Step S108 : Rendering a scene based on the total number of grid segments in the container cache of the graphics processor and the grid segment information of each grid segment.

[0044] After the total number of grid segments and the grid segment information of each grid segment are written into the container cache of the graphics processor, the scene can be rendered based on the data written into the container cache of the graphics processor. In this embodiment, the scene rendering process is generally performed in the GPU, which can reduce the computing pressure of the CPU, thereby increasing the rendering speed and enabling real-time rendering.

[0045] The embodiments of the present invention solve the drawbacks of the traditional CPU-driven rendering pipeline by placing most of the rendering pipeline into the GPU for processing. The powerful parallel computing capability of the GPU is used to cope with the processing load after the sharp increase in the number of models. The CPU is only responsible for loading and unloading resources, completely relieving the CPU's computing burden.

[0046] An embodiment of the present invention provides a scene rendering method that uses a graphics processor to obtain multiple components included in a scene and determine the grid segments of each component; writes the target grid segments into multiple rendering target buffers of the graphics processor; writes the total number of grid segments and the grid segment information of each grid segment into the graphics processor's container buffer; and renders the scene based on the total number of grid segments and the grid segment information of each grid segment in the graphics processor's container buffer. This method allows the vast majority of the rendering pipeline to be processed by the GPU, leveraging the GPU's powerful parallel computing capabilities to cope with the processing load caused by the sharp increase in the number of models, reducing the computational burden and load on the CPU, thereby achieving real-time rendering.

[0047] Example 2:

[0048] The embodiment of the present invention provides another scene rendering method, which is performed on the basis of the method provided in the above embodiment; see Figure 2 The flowchart of another scene rendering method shown is as follows, and the scene rendering method includes the following steps:

[0049] Step S202 , obtaining a plurality of components included in the scene; determining the level of each triangular face included in the component; and determining a grid segment of the component based on a specified number of triangular faces of the same level.

[0050] Because models in a large scene vary in shape and material, and typically only models (i.e., components) of the same shape and material can be submitted to the GPU for rendering in a single batch, to reduce the number of GPU rendering batches, each primitive model triangulation mesh needs to be pre-divided into several equal-length segments. Each segment is a triangle strip (the number of vertices in a triangle strip minus 2 equals the number of triangle faces) containing a fixed number of triangles. If the model's original triangle count is less than this fixed value, the invisible invalid triangles are supplemented.

[0051] See also Figure 3 A schematic diagram of components included in a scenario shown in FIG. Figure 3 As shown in the figure, a scene includes N components, each component contains several triangular faces, and each component generates 10 levels of LOD through the face reduction algorithm. The lowest level LOD0 contains the least number of triangular faces and the lowest precision. The highest level LOD9 does not reduce faces and is the model itself. The triangular faces contained in each level of LOD can be divided into several segments according to the above rules.

[0052] In addition, multiple components included in the scene can also be obtained through the central processing area.

[0053] Step S204 , starting multiple processing batches of the graphics processor, respectively determining target levels corresponding to the processing batches and target grid segments corresponding to the target levels; and writing the target grid segments into multiple rendering target buffers of the graphics processor.

[0054] All models in the scene are decomposed into a series of mesh segments with equal number of triangles. The mesh segment is the smallest unit for subsequent scene processing. At the beginning of a rendering frame, all model objects are placed in an information texture. The GPU starts a processing batch, reads the information of each model object in parallel, calculates the distance coefficient between the model and the camera, and determines the LOD precision level to be used for the model in the current frame based on the distance, camera field of view, and screen resolution. The LOD level and the number of mesh segments contained in the LOD level are then written to the rendering target cache. For example, the distance coefficient between each triangle included in the component and the preset camera is calculated; the level of each triangle included in the component is determined based on the distance coefficient, the camera field of view, and the camera's screen resolution.

[0055] See also Figure 4 The diagram below shows a schematic diagram of how component levels are calculated. A texture is created based on the number of components in a scene. For example, a 12×12 texture can contain 144 components. The LOD level to be rendered for each component in the current frame is calculated based on factors such as camera distance. The distance coefficient is negatively correlated with the triangle level. The overall idea is that the farther the component is from the camera, the lower the LOD level to be rendered in the current frame, resulting in lower model accuracy.

[0056] Step S206, based on the target levels and target grid segments included in the multiple rendering target caches, determine the total number of grid segments and the grid segment information of each grid segment; start a processing batch of the graphics processor, and write the total number of grid segments and the grid segment information of each grid segment into the container cache of the graphics processor.

[0057] Based on the render target cache from the previous stage, several GPU processing batches are initiated to calculate the total number of grid segments required for rendering in the current frame. The CPU can then use this number of grid segments to determine whether the container cache storing valid grid segments needs to be expanded. For example, the CPU can determine whether the GPU's container cache needs to be expanded based on the total number of grid segments in multiple render target caches. If so, the container cache capacity is increased, a GPU processing batch is initiated, and the total number of grid segments and the grid segment information for each grid segment are written to the GPU's container cache.

[0058] After the container cache is ready, a GPU batch is started to write a series of mesh segment information corresponding to each model into the container cache. Finally, the container cache stores all the mesh segment information to be rendered in the current frame.

[0059] Step S208 : Rendering the scene based on the total number of grid segments in the container cache of the graphics processor and the grid segment information of each grid segment.

[0060] See also Figure 5 The schematic diagram of a scene rendering shown in FIG. 1 shows that after the step of writing into the container cache of the graphics processor, the mesh segment information can be placed into the texture array of the graphics processor; scene clipping, occlusion culling calculation and instance merging are performed based on the texture array to obtain a rendering queue for the scene; and the scene is rendered based on the rendering queue.

[0061] like Figure 5 As shown in the figure, the container cache stores the link information of each mesh segment, and the actual triangulated mesh data corresponding to the segment is placed in the global texture array. Each triangle vertex corresponds to a pixel in the texture. Since the number of triangles and vertices in all segments is equal, the GPU can easily index the corresponding vertex information based on the segment ID information.

[0062] During the scene culling phase of the rendering pipeline, the GPU processes each mesh segment in the container cache in parallel, intersecting the segment with the current camera's viewing frustum. If the segment is within the frustum, the segment is retained. The segment's bounding box is then compared with the scene depth texture from the previous frame. If the bounding box is smaller than the depth at the corresponding pixel, the segment is unoccluded; otherwise, it is occluded. This process yields the set of mesh segments visible in the current frame, and the GPU is used to pruned the container cache, storing only the visible segments.

[0063] The final stage involves rendering the visible mesh segments. If the number of visible mesh segments is N and the number of triangles within a mesh segment is M, then a multi-instance rendering batch is submitted to the GPU, where N×M triangles are drawn and N instances are drawn. The GPU's vertex shader obtains the instance ID corresponding to the current vertex and the vertex's global sequence ID. The instance ID determines which mesh segment the current vertex belongs to. Since each mesh segment has a constant number of vertices, the local vertex ID within the segment can be calculated. Based on this information, the vertex shader obtains the actual vertex position, normal, and UV data from the global texture array. It then obtains and outputs the pixel position information projected onto the screen. The pixel shader then performs a dot product between the normal direction and the light source direction to obtain the pixel's light intensity. This intensity is then multiplied by the model's material color to obtain the pixel's final color information.

[0064] The rendering pipeline for the current frame ends. Throughout the entire process, the GPU is responsible for most of the rendering pipeline processing, while the CPU is only responsible for occasional tasks such as cache expansion and model loading. The GPU is responsible for most real-time rendering tasks.

[0065] The powerful processing performance of modern GPUs can easily handle the complete rendering pipeline of millions of single models. This is especially true in the web environment, where the CPU runs in a virtual machine environment, and program execution efficiency is greatly reduced compared to native apps (Applications). In real-time rendering, allowing the GPU to drive high-load rendering pipeline scheduling will avoid the problem of low CPU execution efficiency, making the performance of rendering large-scale dynamic models in a network environment close to that of native apps.

[0066] The above method provided by the embodiment of the present invention can make real-time and smooth three-dimensional rendering of applications such as construction demonstration animation, construction progress simulation, and process method simulation that include large-scale dynamic models possible, solving the problem that large-scale scenes can only be displayed statically and the number of dynamic models is limited in the past.

[0067] This method can also achieve efficient and interactive basic scene modeling and model editing, which can partially solve the problems of traditional modeling software loading and editing jams and poor interactive experience when encountering large-scale models. It can be combined with traditional modeling software to combine its professional model building capabilities with efficient real-time secondary editing through data interoperability, thereby improving user work efficiency and usage experience.

[0068] Example 3:

[0069] Corresponding to the above method embodiment, the embodiment of the present invention provides a scene rendering device, which is applied to a graphics processor, such as Figure 6 The schematic diagram of the structure of a scene rendering device shown in FIG. 1 includes:

[0070] A mesh segment determination module 61 is configured to obtain multiple components included in the scene and determine a mesh segment for each component; each component includes multiple triangular faces of different levels, and a specified number of triangular faces of the same level constitutes a mesh segment, with different levels corresponding to different specified numbers;

[0071] A rendering target cache writing module 62 is configured to initiate multiple processing batches of the graphics processor, determine target levels corresponding to the processing batches and target grid segments corresponding to the target levels, and write the target grid segments into multiple rendering target caches of the graphics processor.

[0072] a container cache writing module 63 for determining a total number of grid segments and grid segment information for each grid segment based on target levels and target grid segments included in the plurality of render target caches; initiating a processing batch of the graphics processor, and writing the total number of grid segments and the grid segment information for each grid segment into a container cache of the graphics processor;

[0073] The scene rendering module 64 is configured to render the scene based on the total number of grid segments in the container cache of the graphics processor and the grid segment information of each grid segment.

[0074] An embodiment of the present invention provides a scene rendering device that can obtain multiple components included in a scene through a graphics processor, determine the grid segments of each component, write the target grid segments into multiple rendering target buffers of the graphics processor, write the total number of grid segments and the grid segment information of each grid segment into the graphics processor's container buffer, and render the scene based on the total number of grid segments and the grid segment information of each grid segment in the graphics processor's container buffer. This method can place the majority of the rendering pipeline into the GPU for processing, leveraging the GPU's powerful parallel computing capabilities to cope with the processing load caused by the sharp increase in the number of models, reducing the computational burden and load on the CPU, thereby achieving real-time rendering.

[0075] The mesh segment determination module is used to obtain multiple components included in the scene; determine the level of each triangular face included in the component; and determine the mesh segment of the component based on a specified number of triangular faces of the same level.

[0076] The grid segment determination module is used to calculate the distance coefficient between each triangular face included in the component and a preset camera; and determine the level of each triangular face included in the component based on the distance coefficient, the camera's field of view and the camera's screen resolution.

[0077] The above distance coefficient is negatively correlated with the level of the triangle.

[0078] The container cache write module is further configured to determine, through the central processing unit, whether the container cache of the graphics processor needs to be expanded based on the total number of grid segments in the multiple rendering target caches; if so, to increase the capacity of the container cache, execute a step of starting a processing batch of the graphics processor, and write the total number of grid segments and the grid segment information of each grid segment into the container cache of the graphics processor.

[0079] The above-mentioned scene rendering module is used to put the grid segment information into the texture array of the graphics processor; perform scene clipping, occlusion culling calculation and instance merging based on the texture array to obtain a rendering queue of the scene; and render the scene based on the rendering queue.

[0080] The grid segment determination module is used to obtain multiple components included in the scene through the central processing area.

[0081] The scene rendering device provided in the embodiment of the present invention has the same technical features as the scene rendering method provided in the above embodiment, and therefore can solve the same technical problems and achieve the same technical effects.

[0082] Example 4:

[0083] The embodiment of the present invention further provides an electronic device for executing the above-mentioned scene rendering method; Figure 7 The structure diagram of an electronic device shown in the figure includes a memory 100 and a processor 101, wherein the memory 100 is used to store one or more computer instructions, and the one or more computer instructions are executed by the processor 101 to implement the above-mentioned scene rendering method.

[0084] Further, Figure 7 The electronic device shown further includes a bus 102 and a communication interface 103 , and the processor 101 , the communication interface 103 and the memory 100 are connected via the bus 102 .

[0085] The memory 100 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is achieved through at least one communication interface 103 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 102 may be an ISA bus, a PCI bus, or an EISA bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or one type of bus.

[0086] The processor 101 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits in the processor 101 or by software instructions. The above processor 101 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in conjunction with the embodiments of the present invention can be directly implemented as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium well-known in the art, such as a random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or register. The storage medium is located in the memory 100, and the processor 101 reads the information in the memory 100 and, in conjunction with its hardware, completes the steps of the method of the aforementioned embodiment.

[0087] An embodiment of the present invention further provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned scene rendering method. The specific implementation can be found in the method embodiment and will not be repeated here.

[0088] The computer program products of the scene rendering method, device, and electronic device provided in the embodiments of the present invention include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods in the previous method embodiments. For specific implementation, please refer to the method embodiments and will not be repeated here.

[0089] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device and / or electronic device can refer to the corresponding process in the aforementioned method embodiment and will not be repeated here.

[0090] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the above-described embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above-described embodiments within the technical scope disclosed by the present invention, or replace some of the technical features therein with equivalents. Such modifications, changes, or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be subject to the scope of protection of the claims.

Claims

1. A scene rendering method, characterized in that: Applied to a graphics processor, the method includes: Acquire multiple components included in the scene, and determine a mesh segment of each component; wherein each component includes multiple triangular faces of different levels, a specified number of triangular faces of the same level constitutes one mesh segment, and the specified number corresponding to different levels is different; Initiating multiple processing batches of the graphics processor, respectively determining target levels corresponding to the processing batches and target grid segments corresponding to the target levels; and writing the target grid segments into multiple rendering target buffers of the graphics processor respectively. determining a total number of grid segments and grid segment information of each grid segment based on the target levels and the target grid segments included in the plurality of render target buffers; initiating a processing batch of the graphics processor, and writing the total number of grid segments and the grid segment information of each grid segment into a container buffer of the graphics processor; Rendering the scene based on the total number of the grid segments and the grid segment information of each of the grid segments in the container cache of the graphics processor; The step of obtaining a plurality of components included in the scene and determining a mesh section of each of the components comprises: obtaining a plurality of components included in the scene; determining the level of each triangular face included in the component; and determining the mesh section of the component based on a specified number of triangular faces of the same level; The step of determining the level of each of the triangular faces included in the component includes: calculating the distance coefficient between each of the triangular faces included in the component and a preset camera; and determining the level of each of the triangular faces included in the component based on the distance coefficient, the field of view of the camera, and the screen resolution of the camera.

2. The method according to claim 1, characterized in that The distance coefficient is negatively correlated with the level of the triangle.

3. The method according to claim 1, characterized in that After the step of determining the total number of grid segments and grid segment information of each grid segment based on the target levels and the target grid segments included in the plurality of render target buffers, the method further comprises: Determining, by a central processing unit, whether a container cache of the graphics processor needs to be expanded based on a total number of grid segments of a plurality of the render target caches; If yes, the capacity of the container cache is increased, and the steps of starting a processing batch of the graphics processor and writing the total number of the grid segments and the grid segment information of each grid segment into the container cache of the graphics processor are performed.

4. The method according to claim 1, wherein The step of rendering the scene based on the total number of the grid segments in the container cache of the graphics processor and the grid segment information of each of the grid segments comprises: Putting the mesh segment information into a texture array of the graphics processor; Performing scene clipping processing, occlusion culling calculation processing, and instance merging processing based on the texture array to obtain a rendering queue for the scene; The scene is rendered based on the render queue.

5. The method according to claim 1, characterized in that The steps of obtaining multiple components included in the scene include: The multiple components included in the scene are obtained through the central processing area.

6. A scene rendering device, characterized in that: Applied to a graphics processor, the device comprises: a mesh segment determination module, configured to obtain a plurality of components included in a scene and determine a mesh segment for each component; wherein each component includes a plurality of triangular faces of different levels, a specified number of triangular faces of the same level constitutes a mesh segment, and the specified number of triangular faces corresponding to different levels is different; a rendering target cache writing module, configured to initiate multiple processing batches of the graphics processor, respectively determine target levels corresponding to the processing batches and target grid segments corresponding to the target levels; and respectively write the target grid segments into multiple rendering target caches of the graphics processor; a container cache writing module, configured to determine a total number of grid segments and grid segment information of each grid segment based on the target levels and the target grid segments included in the plurality of render target caches; initiate a processing batch of the graphics processor, and write the total number of grid segments and the grid segment information of each grid segment into a container cache of the graphics processor; a scene rendering module, configured to render the scene based on the total number of the grid segments and the grid segment information of each of the grid segments in the container cache of the graphics processor; The grid segment determination module is used to obtain multiple components included in the scene; determine the level of each triangular face included in the component; and determine the grid segment of the component based on a specified number of triangular faces of the same level; The grid segment determination module is used to calculate the distance coefficient between each of the triangular faces included in the component and a preset camera; and determine the level of each of the triangular faces included in the component based on the distance coefficient, the field of view of the camera and the screen resolution of the camera.

7. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the scene rendering method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the scene rendering method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Building information model-based shell extraction method

    CN108460832A

  • Generating a triangle mesh for an image represented by curves

    GB201816796D0