Method, system, electronic device and storage medium for rendering large-scale identical objects

By synthesizing a new model of the same type of object in Internet games, using quad-tree division and visibility detection to generate drawing instructions, the problem of excessive DrawCall and low rendering efficiency is solved, and the game rendering efficiency is improved.

CN112473127BActive Publication Date: 2024-12-06HANGZHOU ELECTRONICS SOUL NETWORK TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011326125.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-24
Publication Date
2024-12-06
Estimated Expiration
2040-11-24

AI Technical Summary

Technical Problem

In Internet games, when Instance technology is not used, a large number of vegetation in the game scene will cause too many DrawCalls and low rendering efficiency. The existing technology has not effectively solved this problem.

Method used

By obtaining the scene to be rendered, counting the total number of objects, synthesize a new model of the same type of objects with a preset number, using a quad-tree to divide the scene, performing visibility detection, saving the object parameter information as a matrix group, and writing it to the vertex shader In, generate a draw instruction to reduce the number of DrawCalls.

Benefits of technology

Improve the rendering efficiency of large-scale identical objects, reduce the number of DrawCalls, solve the problem of low rendering efficiency, and dynamically manage the addition and deletion of objects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112473127B_ABST
    Figure CN112473127B_ABST
Patent Text Reader

Abstract

The present application relates to a method, system, electronic device and storage medium for rendering large-scale identical objects. The method comprises the following steps: by counting the total number of object types in a scene to be rendered, synthesizing a new model for each object type with a preset number of objects of the same type, dividing the scene by using a quadtree, saving the object parameter information contained in the quadtree node as a first matrix, and saving the first matrix to a file. A visibility detection is performed on the information to be rendered, and a visible quadtree node is obtained according to the visibility detection result. The visible object type is obtained according to the visible quadtree node. The first matrix group corresponding to the visible object type is the second matrix group. The new model to be rendered is obtained as the model to be rendered. The second matrix group corresponding to the model to be rendered is written into a vertex shader. A drawing instruction is generated for the model to be rendered. The problem of too many DrawCalls when the Instance technology is not adopted is solved, and the rendering efficiency of large-scale identical objects is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of information processing technology, and in particular to a method, system, electronic device and storage medium for rendering large-scale identical objects. Background Art

[0002] In Internet games, game scenes can bring different experience effects to users. Among them, the diverse vegetation on the game surface can make the game more lively. However, if the instance technology is not used, when rendering a large number of vegetation, for example, when rendering a scene such as a forest, only one tree can be rendered, resulting in too many DrawCalls and low rendering efficiency.

[0003] Currently, no effective solution has been proposed for the problem of too many DrawCalls and low rendering efficiency when the Instance technology is not adopted in related technologies. Summary of the invention

[0004] The embodiments of the present application provide a method, system, electronic device and storage medium for rendering large-scale identical objects, so as to at least solve the problem of too many DrawCalls and low rendering efficiency when the Instance technology is not adopted in the related technology.

[0005] In a first aspect, an embodiment of the present application provides a method for rendering large-scale identical objects, the method comprising:

[0006] Acquire a scene to be rendered, count the total number of object types in the scene to be rendered, and synthesize a new model for the object using a preset number of objects of the same type;

[0007] Dividing the scene to be rendered by using a quadtree to obtain information to be rendered, saving the object parameter information contained in the quadtree node into a first matrix, and saving the first matrix group into a file, wherein the new model includes the preset number of the first matrices, which is a first matrix group;

[0008] Performing visibility detection on the information to be rendered, obtaining a visible quadtree node according to the visibility detection result, obtaining a visible object type according to the visible quadtree node, and the first matrix group corresponding to the visible object type is a second matrix group;

[0009] The new model to be rendered is obtained as the model to be rendered, the second matrix group corresponding to the model to be rendered is written into the vertex shader, and a drawing instruction is generated for the model to be rendered.

[0010] In some embodiments, after obtaining the new model to be rendered as the model to be rendered, the method further includes: determining whether the number of the objects to be rendered in the model to be rendered is less than the preset number, and if so, setting the second matrix of the remaining part of the second matrix group to zero, the second matrix group after being set to zero is the third matrix group, and the third matrix group is written to the vertex shader to generate a drawing instruction for the model to be rendered.

[0011] In some embodiments, after generating a drawing instruction for the model to be rendered, the method includes: obtaining a model vertex stream element of the model to be rendered, indexing the vertex shader with the model vertex stream element to obtain the second matrix group, multiplying the vertices of the model to be rendered and the corresponding second matrix to obtain an output vertex matrix, and rendering the model to be rendered according to the output vertex matrix.

[0012] In some embodiments, after generating a drawing instruction for the model to be rendered, the method includes: determining whether the number of times the drawing instruction is generated is less than the total number of visible object types; if so, jumping to the step of obtaining the new model to be rendered as the model to be rendered.

[0013] In some embodiments, before writing the second matrix group corresponding to the model to be rendered into the vertex shader, the method includes: traversing the deletion buffer, determining whether the second matrix is ​​in the deletion buffer, and if so, setting the second matrix to a zero matrix.

[0014] In some embodiments, after generating a drawing instruction for the model to be rendered, the method includes: traversing an add buffer, writing the second matrix in the add buffer to the vertex shader, and generating a drawing instruction for the new model corresponding to the second matrix.

[0015] In some of the embodiments, the object type includes a vegetation type, and the object parameter information includes information about the type, quantity, location and direction of the object.

[0016] In a second aspect, an embodiment of the present application provides a system for rendering large-scale identical objects, the system comprising a synthesis module, a division module, a detection module and a drawing instruction module.

[0017] The synthesis module is used to obtain a scene to be rendered, count the total number of object types in the scene to be rendered, and synthesize a new model for the objects using a preset number of objects of the same type;

[0018] The division module is used to divide the scene to be rendered by using a quadtree to obtain information to be rendered, save the object parameter information contained in the quadtree node into a first matrix, and save the first matrix group into a file, wherein the new model includes the preset number of the first matrices, which is a first matrix group;

[0019] The detection module is used to perform visibility detection on the information to be rendered, obtain visible quadtree nodes according to the visibility detection result, obtain visible object types according to the visible quadtree nodes, and the first matrix group corresponding to the visible object type is the second matrix group;

[0020] The drawing instruction module is used to obtain the new model to be rendered as the model to be rendered, write the second matrix group corresponding to the model to be rendered into the vertex shader, and generate a drawing instruction for the model to be rendered.

[0021] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for large-scale identical object rendering as described in the first aspect above is implemented.

[0022] In a fourth aspect, an embodiment of the present application provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for large-scale identical object rendering as described in the first aspect above.

[0023] Compared with the related art, the method for rendering large-scale identical objects provided by the embodiment of the present application obtains a scene to be rendered, counts the total number of object types in the scene to be rendered, synthesizes a new model with a preset number of objects of the same type for each object type, divides the scene to be rendered using a quadtree, obtains information to be rendered, saves the object parameter information contained in the quadtree node into a first matrix, and saves the first matrix group into a file, wherein the new model includes a preset number of first matrices, which are the first matrix group, performs visibility detection on the information to be rendered, obtains visible quadtree nodes according to the visibility detection results, obtains visible object types according to the visible quadtree nodes, and the first matrix group corresponding to the visible object type is the second matrix group, obtains the new model to be rendered as the model to be rendered, writes the second matrix group corresponding to the model to be rendered into the vertex shader, and generates a drawing instruction for the model to be rendered, thereby solving the problem of too many DrawCalls and low rendering efficiency when the Instance technology is not used, and improving the rendering efficiency of large-scale identical objects. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0025] Figure 1 is a flowchart of a method for large-scale identical object rendering according to an embodiment of the present application;

[0026] Figure 2 is a schematic diagram of a method for rendering large-scale identical objects according to an embodiment of the present application;

[0027] Figure 3 is a schematic diagram of another method for rendering large-scale identical objects according to an embodiment of the present application;

[0028] Figure 4 is a structural block diagram of a system for large-scale identical object rendering according to an embodiment of the present application;

[0029] Figure 5 It is a schematic diagram of the internal structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0030] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided 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 the present application. In addition, it can also be understood that although the efforts made in this development process may be complex and lengthy, for ordinary technicians in the field related to the contents disclosed in the present application, some changes such as design, manufacturing or production based on the technical contents disclosed in the present application are only conventional technical means, and should not be understood as insufficient contents disclosed in the present application.

[0031] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.

[0032] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantitative limitation, and may represent the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to greater than or equal to two. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships, for example, "A and / or B" can represent: A exists alone, A and B exist at the same time, and B exists alone. The terms "first", "second", "third" and the like involved in the present application are merely used to distinguish similar objects and do not represent a specific ordering of the objects.

[0033] This embodiment provides a method for rendering large-scale identical objects. Figure 1 is a flowchart of a method for large-scale identical object rendering according to an embodiment of the present application. Figure 1 As shown, the process includes the following steps:

[0034] Step S101, obtaining a scene to be rendered, counting the total number of object types in the scene to be rendered, and synthesizing a new model for the object using a preset number of objects of the same type; in this embodiment, the preset number is the number of constant buffers of the vertex shader. If the number of constant buffers is 30, then 30 objects of the same type are used to synthesize a new model for each object type, that is, the number of the new model is the total number of object types, and each new model includes 30 objects of the same type;

[0035] Step S102, using a quadtree to divide the scene to be rendered to obtain information to be rendered, saving the object parameter information contained in the quadtree node as a first matrix, and saving the first matrix group to a file, wherein the new model includes a preset number of first matrices, which is a first matrix group; in this embodiment, a quadtree, also known as a quadtree, is a tree data structure, and there will be four sub-blocks on each node. Quadtrees are often used for analysis and classification of two-dimensional spatial data. Quadtrees divide data into four quadrants, and the data range can be a square or rectangle or other arbitrary shapes. Quadtree processing is performed on the scene to be rendered, and the object parameter information contained in each quadtree node is calculated. The object parameter information is saved in a matrix as a first matrix, and each object parameter information is saved as a first matrix. Therefore, the new model includes a predicted number of first matrices, which is called a first matrix group. The number of first matrix groups is the total number of object types, and multiple first matrix groups are saved to a file.

[0036] Step S103, performing visibility detection on the information to be rendered, obtaining a visible quadtree node according to the visibility detection result, obtaining a visible object type according to the visible quadtree node, and the first matrix group corresponding to the visible object type is the second matrix group; in this embodiment, visibility detection is frustum culling, and frustum culling is a step before graphics rendering, which is used to remove parts that do not need to be drawn. After frustum culling, quadtree nodes visible in the field of view are obtained, and the types of objects included in the quadtree nodes visible in the field of view are called visible object types, and the first matrix group corresponding to the visible object types is called the second matrix group, that is, there are multiple object types, but only the object types visible in the field of view need to be rendered, which are called visible object types, and the first matrix group of each visible object type is called the second matrix group;

[0037] Step S104, obtaining the new model to be rendered as the model to be rendered, writing the second matrix group corresponding to the model to be rendered into the vertex shader, and generating a drawing instruction for the model to be rendered; in this embodiment, the new model to be rendered among the multiple new models is called the model to be rendered, after writing the second matrix group corresponding to the model to be rendered into the constant buffer of the vertex shader, sending a drawing command to the GPU, that is, generating a drawing instruction for the model to be rendered, and drawing a preset number of objects of the same type with one drawing instruction. If the preset number is 30, when a drawing instruction is generated for the model to be rendered, 30 objects of the same type can be drawn at one time, thereby reducing the number of drawing instructions (DrawCall).

[0038] Through the above steps S101 to S104, compared with the problem of too many DrawCalls and low rendering efficiency when the Instance technology is not used in the related art, the system synthesizes a new model with a preset number of objects of the same type, and then uses a quadtree to divide the scene to be rendered, obtains the object parameter information of each node of the quadtree and saves it into a matrix, and then saves the matrix into a file. After the view cone is culled, the type of new model to be rendered is obtained as the model to be rendered, and then the matrix corresponding to the preset number of the same species contained in the model to be rendered is written to the constant buffer of the vertex shader, and then a drawing instruction is generated for the model to be rendered. The preset number of objects are rendered with one drawing instruction, which reduces the number of DrawCalls and improves rendering efficiency. It also solves the problem of large memory required by engine synthesis in order to reduce DrawCalls.

[0039] In some of the embodiments, after obtaining the new model to be rendered as the model to be rendered, it is determined whether the number of objects to be rendered in the model to be rendered is less than the preset number. If it is less than, the second matrix of the remaining part of the second matrix group is set to zero. The second matrix group after being set to zero is the third matrix group. The third matrix group is written to the vertex shader, and a drawing instruction is generated for the model to be rendered. In this embodiment, if the model to be rendered contains a preset number of objects of the same type, the preset number of objects can be rendered with one drawing instruction. If the number of objects to be rendered is less than the predicted number, the second matrix of the unused part of the second matrix group needs to be set to zero. The second matrix group after being set to zero is the third matrix group. For example, the preset number is 30, and the number of objects to be rendered is 28, and two second matrices need to be set to zero matrices. The third matrix group includes two zero matrices and 28 second matrices. The third matrix group is written to the vertex shader. At this time, 28 objects can be drawn at one time by generating a drawing instruction for the model to be rendered, thereby reducing the number of DrawCalls and being able to dynamically set the number of objects to be drawn in one DrawCall.

[0040] In some of the embodiments, after a drawing instruction is generated for the model to be rendered, the model vertex stream elements of the model to be rendered are obtained, the vertex shader is indexed with the model vertex stream elements to obtain the second matrix group, the vertices of the model to be rendered and the corresponding second matrix are multiplied to obtain an output vertex matrix, and the model to be rendered is rendered according to the output vertex matrix.

[0041] For example, if an object consists of 1000 vertices, the model vertex stream element (bone index) of the model to be rendered increases once for every object vertex number. If the preset number is 3, the model to be rendered is composed of 3 objects of the same type. Then the bone index of the 0th to 999th vertices of the model to be rendered is 0, the bone index of the 1000th to 1999th vertices is 1, and the bone index of the 2000th to 2999th vertices is 2. Use the bone index to index the constant buffer of the vertex shader to obtain the second matrix group written to the constant buffer. Multiply the vertices of the model to be rendered and the corresponding second matrix to obtain the output vertex matrix. The model to be rendered can be rendered according to the output vertex matrix. If the second matrix is ​​zero, the output vertex matrix is ​​also zero, indicating that the object does not exist and is not displayed on the screen.

[0042] In some embodiments, after generating a drawing instruction for the model to be rendered, the method includes: determining whether the number of times the drawing instruction is generated is less than the total number of visible object types; if so, jumping to the step of obtaining a new model to be rendered as the model to be rendered. Figure 2 is a schematic diagram of a method for rendering large-scale identical objects according to an embodiment of the present application, such as Figure 2 As shown, the process includes the following steps:

[0043] Step S104, obtaining a model to be rendered, writing a second matrix group of the model to be rendered into a vertex shader, and generating a drawing instruction for the model to be rendered;

[0044] Step S201, determining whether the number of times the drawing instruction is generated is less than the total number of visible object types, if so, it means that the objects visible in the field of view have not been rendered, and jumping to the step of obtaining a new model to be rendered as a model to be rendered, and continuing to obtain the next model to be rendered;

[0045] Step S202, the number of times the drawing instructions are generated is equal to the total number of visible object types, that is, the objects visible in the field of view are rendered, and the loop ends. For example, the number of visible species is 5, and the number of times the drawing instructions are generated is 1, then jump to the step of obtaining the new model to be rendered as the model to be rendered, that is, obtaining the second model to be rendered, writing the second matrix group corresponding to the second model to be rendered into the vertex shader, and rendering the second model to be rendered.

[0046] In some embodiments, after the second matrix group corresponding to the model to be rendered is written into the vertex shader, the method includes: traversing the deletion buffer, determining whether the second matrix is ​​in the deletion buffer, and if so, setting the second matrix to a zero matrix, and generating a drawing instruction for the model to be rendered. In this embodiment, Figure 3is a schematic diagram of another method for rendering large-scale identical objects according to an embodiment of the present application, such as Figure 3 As shown, the process includes the following steps:

[0047] Step S301, after writing the second matrix group corresponding to the model to be rendered into the vertex shader, if an object is to be deleted, the matrix data of the object is placed in the deletion buffer;

[0048] Step S302, traverse the deletion buffer, traverse the deletion buffer, determine whether the second matrix is ​​in the deletion buffer, if yes, set the second matrix to a zero matrix, that is, determine whether the deletion buffer matrix data and the second matrix in the vertex shader are the same, if yes, set the second matrix to a zero matrix;

[0049] In step S303, after setting the second matrix corresponding to the object to be deleted to a zero matrix, a drawing instruction is generated for the model to be rendered, and the object can be dynamically deleted, thereby solving the problem that objects cannot be dynamically deleted by manual artist drawing in order to reduce DrawCall.

[0050] In some embodiments, after generating a drawing instruction for the model to be rendered, the method includes: traversing the add buffer, writing the second matrix in the add buffer to the vertex shader, and generating a drawing instruction for the object corresponding to the second matrix. In this embodiment, if one or more objects are to be added, the matrix data of the object is placed in the add buffer, the add buffer is traversed, and the matrix in the add buffer is written to the constant buffer of the vertex shader. If the preset number is 30, and the number of matrices in the add buffer is less than 30, it is padded with zero matrices, and then a drawing command is sent to the GPU, so that objects can be added dynamically. If the number of matrices in the add buffer exceeds 30, the objects corresponding to the 30 matrices are rendered first, and after rendering, the remaining matrices are written to the constant buffer of the vertex shader, and then a drawing command is sent to the GPU, which solves the problem that objects cannot be added dynamically when manual artist combination is used to reduce DrawCall.

[0051] In some embodiments, the object type includes vegetation type, and the object parameter information includes the type, quantity, position and direction information of the object. In this embodiment, the object type includes vegetation type, such as forest and grassland, and the object parameter information includes the type, quantity, position and direction information of the object. The object parameter information is saved as a matrix, and the position and direction information of the object can be known by knowing the matrix of the object.

[0052] It should be noted that the steps shown in the above process or the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0053] This embodiment also provides a system for large-scale identical object rendering, which is used to implement the above embodiments and preferred implementations, and will not be repeated here. As used below, the terms "module", "unit", "sub-unit", etc. can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0054] Figure 4 is a structural block diagram of a system for large-scale identical object rendering according to an embodiment of the present application, such as Figure 4 As shown, the system includes a synthesis module 41, a division module 42, a detection module 43 and a drawing instruction module 44.

[0055] The synthesis module 41 is used to obtain the scene to be rendered, count the total number of object types in the scene to be rendered, and synthesize a new model for each object type using a preset number of objects of the same type; the division module 42 is used to divide the scene to be rendered using a quadtree to obtain information to be rendered, save the object parameter information contained in the quadtree node into a first matrix, and save multiple first matrices into a file; the detection module 43 is used to perform visibility detection on the information to be rendered, obtain a visible quadtree node according to the visibility detection result, obtain a visible object type according to the visible quadtree node, and the multiple first matrices corresponding to the visible object type are a second matrix group; the drawing instruction module 44 is used to obtain the new model to be rendered as the model to be rendered, write the second matrix group corresponding to the model to be rendered into the vertex shader, and generate a drawing instruction for the model to be rendered. In this embodiment, the synthesis module 41 uses a preset number of objects of the same type to synthesize a new model, the division module 42 uses a quadtree to divide the scene to be rendered, and saves the first matrix contained in the quadtree node into a file, the detection module 43 performs visual cone culling to obtain the quadtree nodes visible in the field of view, and the drawing instruction module 44 calculates the new model to be rendered, writes the preset number of matrices corresponding to the new model into the vertex shader, and then generates a drawing instruction for the new model, so that the preset number of objects can be drawn at one time, thereby solving the problem of too many DrawCalls and low rendering efficiency, and improving rendering efficiency.

[0056] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.

[0057] This embodiment further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0058] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0059] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0060] S1, obtaining a scene to be rendered, counting the total number of object types in the scene to be rendered, and synthesizing a new model for the object using a preset number of objects of the same type.

[0061] S2, using a quadtree to divide the scene to be rendered to obtain information to be rendered, saving the object parameter information contained in the quadtree node into a first matrix, and saving the first matrix group into a file, wherein the new model includes a preset number of first matrices, which is a first matrix group.

[0062] S3, performing visibility detection on the information to be rendered, obtaining a visible quadtree node according to the visibility detection result, obtaining a visible object type according to the visible quadtree node, and the first matrix group corresponding to the visible object type is the second matrix group.

[0063] S4, obtaining a new model to be rendered as a model to be rendered, writing the second matrix group corresponding to the model to be rendered into a vertex shader, and generating a drawing instruction for the model to be rendered.

[0064] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0065] In addition, in combination with the method for rendering large-scale identical objects in the above embodiments, the present application embodiment can provide a storage medium for implementation. The storage medium stores a computer program; when the computer program is executed by a processor, any one of the methods for rendering large-scale identical objects in the above embodiments is implemented.

[0066] In one embodiment, a computer device is provided, which may be a terminal. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a method for rendering large-scale identical objects is implemented. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covered on the display screen, or a key, trackball, or touchpad provided on the housing of the computer device, or an external keyboard, touchpad, or mouse, etc.

[0067] In one embodiment, Figure 5 is a schematic diagram of the internal structure of an electronic device according to an embodiment of the present application, such as Figure 5 As shown, an electronic device is provided, which may be a server, and its internal structure diagram may be as shown in Figure 5 As shown. The electronic device includes a processor, a memory, a network interface and a database connected via a system bus. The processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the electronic device is used to store data. The network interface of the electronic device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a method for rendering large-scale identical objects is implemented.

[0068] Those skilled in the art will understand that Figure 5 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0069] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0070] Those skilled in the art should understand that the technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0071] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A method for rendering large-scale identical objects, characterized in that: The method comprises: Acquire a scene to be rendered, count the total number of object types in the scene to be rendered, and synthesize a new model for the object using a preset number of objects of the same type; Dividing the scene to be rendered by using a quadtree to obtain information to be rendered, saving object parameter information contained in the quadtree node into a first matrix, and saving the first matrix into a file, wherein the new model includes the preset number of the first matrices, which is a first matrix group; Performing visibility detection on the information to be rendered, obtaining a visible quadtree node according to a result of the visibility detection, obtaining a visible object type according to the visible quadtree node, and the first matrix group corresponding to the visible object type is a second matrix group; Acquire the new model to be rendered as the model to be rendered, write the second matrix group corresponding to the model to be rendered into the vertex shader, and generate a drawing instruction for the model to be rendered; After generating a drawing instruction for the model to be rendered, the method includes: obtaining a model vertex stream element of the model to be rendered, indexing the vertex shader with the model vertex stream element to obtain the second matrix group, multiplying the vertices of the model to be rendered and the corresponding second matrix to obtain an output vertex matrix, and rendering the model to be rendered according to the output vertex matrix.

2. The method according to claim 1, characterized in that After obtaining the new model to be rendered as the model to be rendered, the method also includes: determining whether the number of the objects to be rendered in the model to be rendered is less than the preset number; if so, setting the second matrix of the remaining part of the second matrix group to zero; the second matrix group after being set to zero is the third matrix group; the third matrix group is written to the vertex shader, and a drawing instruction is generated for the model to be rendered.

3. The method according to claim 1, characterized in that After generating a drawing instruction for the model to be rendered, the method includes: determining whether the number of times the drawing instruction is generated is less than the total number of visible object types; if so, jumping to the step of obtaining the new model to be rendered as the model to be rendered.

4. The method according to claim 1, characterized in that After writing the second matrix group corresponding to the model to be rendered into the vertex shader, the method includes: traversing the deletion buffer, determining whether the second matrix is ​​in the deletion buffer, and if so, setting the second matrix to a zero matrix, and generating a drawing instruction for the model to be rendered.

5. The method according to claim 1, characterized in that After generating a drawing instruction for the model to be rendered, the method includes: traversing an addition buffer, writing the second matrix in the addition buffer to the vertex shader, and generating a drawing instruction for the new model corresponding to the second matrix.

6. The method according to claim 1, characterized in that The object types include vegetation types, and the object parameter information includes object type, quantity, position and direction information.

7. A system for rendering large-scale identical objects, characterized in that: The system includes a synthesis module, a division module, a detection module and a drawing instruction module. The synthesis module is used to obtain a scene to be rendered, count the total number of object types in the scene to be rendered, and synthesize a new model for the objects using a preset number of objects of the same type; The division module is used to divide the scene to be rendered by using a quadtree to obtain information to be rendered, save the object parameter information contained in the quadtree node into a first matrix, and save the first matrix to a file, wherein the new model includes the preset number of the first matrices, which is a first matrix group; The detection module is used to perform visibility detection on the information to be rendered, obtain visible quadtree nodes according to the visibility detection result, obtain visible object types according to the visible quadtree nodes, and the first matrix group corresponding to the visible object type is the second matrix group; The drawing instruction module is used to obtain the new model to be rendered as the model to be rendered, write the second matrix group corresponding to the model to be rendered into the vertex shader, and generate a drawing instruction for the model to be rendered; wherein, after generating a drawing instruction for the model to be rendered, obtain the model vertex stream element of the model to be rendered, use the model vertex stream element to index the vertex shader to obtain the second matrix group, multiply the vertices of the model to be rendered and the corresponding second matrix to obtain an output vertex matrix, and render the model to be rendered according to the output vertex matrix.

8. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to execute the method for large-scale identical object rendering according to any one of claims 1 to 6.

9. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method for large-scale identical object rendering according to any one of claims 1 to 6 when running.