Grass rendering processing method, device, medium and program product

By detecting the overlap and incremental areas between the target image and the original image in virtual reality technology, generating grass to be rendered, and determining visible grass according to the grid level, the problem of low rendering efficiency of existing grass is solved and more efficient grass rendering and smoother scenes.

CN114307137BActive Publication Date: 2025-02-18NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111625362.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-28
Publication Date
2025-02-18
Estimated Expiration
2041-12-28

AI Technical Summary

Technical Problem

The existing grass rendering methods are inefficient, resulting in low scene fluency.

Method used

By detecting the overlapping area and incremental area between the target image and the original image, the grass to be rendered is generated, and the visible grass is determined according to the grid position level and level, the overlapping area grass is directly called, and only the incremental area grass is generated.

Benefits of technology

It improves grass generation efficiency and visible grass calculation efficiency, and improves grass rendering efficiency and scene fluency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114307137B_ABST
    Figure CN114307137B_ABST
Patent Text Reader

Abstract

The present application provides a method for grass rendering processing. The method includes: after detecting that the position of the target person in the original image has moved, determining the overlapping area and incremental area between the target image generated after the movement and the original image; generating the grass to be rendered of the target image according to the overlapping area and incremental area; determining the visible grass in the grass to be rendered according to the position level and grid level corresponding to the grid of the grass to be rendered in the target image; generating a drawing call instruction according to the drawing information corresponding to the visible grass, and sending the drawing call instruction to the rendering execution module, so that the rendering execution module renders the grass to be rendered according to the drawing call instruction; wherein the drawing information includes: position information, scaling information and rotation information. The method of the present application can improve the efficiency of grass generation and the calculation efficiency of visible grass, thereby improving the efficiency of grass rendering and improving the fluency of the scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of virtual reality technology, and in particular to a grass rendering processing method, device, medium and program product. Background Art

[0002] With the development of science and technology, virtual reality technology is increasingly used in various fields, such as online games. In virtual reality technology, the rendering of natural scenes is particularly important, and grass is an important component of natural scenes. Therefore, grass rendering largely determines the realism of the entire scene.

[0003] When rendering the grass of the target image generated after the game character moves, the central processing unit (CPU) first needs to generate the grass to be rendered based on the surface information of the target image and the pre-stored grass generation rules. After that, it is necessary to traverse the tree structure data of all the grass in the target image to calculate the set of visible grass in the grass to be rendered. After calculating the visible grass set, a drawing call instruction is generated and sent to the graphics processing unit (GPU). After receiving the drawing call instruction, the GPU will render the target image according to the drawing call instruction to generate a 3D game scene. However, since the grass is widely distributed in the game scene and the density of grass per unit area is very high, the amount of grass that needs to be processed during rendering is particularly large. Therefore, the workload of generating the grass to be rendered and calculating the visible grass set during the rendering process is very large and the efficiency is low, resulting in low grass rendering efficiency and low scene fluency.

[0004] However, existing grass rendering methods cannot solve the above technical problems. Summary of the invention

[0005] The present application provides a grass rendering processing method, device, medium and program product to solve the technical problems of low grass rendering efficiency and low scene fluency.

[0006] In a first aspect, the present application provides a grass rendering processing method, comprising:

[0007] After detecting that the position of the target person in the original image has moved, determining an overlapping area and an incremental area between the target image generated after the movement and the original image;

[0008] Generate the grass to be rendered of the target image according to the overlapping area and the incremental area;

[0009] Determine the visible grass in the grass to be rendered according to the position level and the grid level corresponding to the grid of the grass to be rendered in the target image;

[0010] Generate a drawing call instruction according to the drawing information corresponding to the visible grass, and send the drawing call instruction to a rendering execution module, so that the rendering execution module renders the grass to be rendered according to the drawing call instruction;

[0011] The drawing information includes: position information, scaling information and rotation information.

[0012] In a possible design, generating the grass to be rendered of the target image according to the overlapping area and the incremental area specifically includes:

[0013] Determine the grid coordinates of the overlapping area in the original image, and call the grassland corresponding to the overlapping area in the original image according to the grid coordinates; or determine the position information of the overlapping area, and call the grassland corresponding to the overlapping area in the original image according to the position information;

[0014] Determine the position information of the incremental area, and generate the grassland corresponding to the incremental area according to the position information and a preset grassland generation rule;

[0015] The grass to be rendered of the target image is generated according to the grass corresponding to the overlapping area and the grass corresponding to the incremental area.

[0016] In a possible design, the position hierarchy includes a first layer and a second layer, and the first distance between any grass in the second layer and the target person is greater than a first preset distance; the grid level includes a first grid and a second grid, the side length of the first grid in the second layer is greater than the side length of the first grid in the first layer, the second grid is located within the first grid, the second grid can accommodate at most a first preset number of grasses, and the second distance between any two grasses in the second grid is less than or equal to the second preset distance.

[0017] In a possible design, determining the visible grass in the grass to be rendered according to the position level and the grid level corresponding to the grid of the grass to be rendered in the target image specifically includes:

[0018] Generate a first enclosing space corresponding to the first grid, and determine whether the first enclosing space is located inside a camera cone area or intersects with the camera cone area according to the position level;

[0019] When the first enclosing space is located inside the camera cone area, the grass in the first grid corresponding to the first enclosing space is visible grass;

[0020] When the first enclosing space intersects with the camera cone area, a second enclosing space corresponding to the second grid in the first grid is generated, and it is determined whether the second enclosing space is located inside the camera cone area or intersects with the camera cone area; if the second enclosing space is located inside the camera cone area or intersects with the camera cone area, the grass in the second grid corresponding to the second enclosing space is visible grass;

[0021] The first enclosed space is a cube space, and the second enclosed space is a spherical space.

[0022] In a possible design, determining whether the first enclosing space is located inside a camera viewing cone area or intersects with the camera viewing cone area according to the position level specifically includes:

[0023] Determine whether the location level of the first grid is the second level;

[0024] If it is the second layer, determining whether the first enclosed space is located inside the camera's visual cone area or intersects with the camera's visual cone area according to the top, bottom, left and right sides of the first enclosed space;

[0025] If it is not the second layer, whether the first enclosed space is located inside the camera's visual cone area or intersects with the camera's visual cone area is determined according to the top, bottom, left, right, front and back of the first enclosed space.

[0026] In a possible design, before generating the first enclosed space corresponding to the first grid, the method further includes:

[0027] Determine whether the location level of the first grid is the second level; if so, randomly delete a second preset number of second grids and the grasses contained therein from the first grid.

[0028] In a possible design, generating a drawing call instruction according to the drawing information corresponding to the visible grass specifically includes:

[0029] Determine drawing information corresponding to each visible grass according to the grid coordinates of the grid where the visible grass is located;

[0030] Determine a third distance between each visible grass and the camera position according to the position information in the drawing information corresponding to each visible grass;

[0031] Determine a distance level corresponding to each visible grass according to the third distance;

[0032] Generates draw calls based on the draw information corresponding to visible grass at the same distance level.

[0033] In a second aspect, the present application provides a grass rendering processing device, comprising: a processor, and a memory communicatively connected to the processor;

[0034] The memory stores computer-executable instructions;

[0035] The processor executes the computer-executable instructions stored in the memory to implement the above method.

[0036] In a third aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to implement the above-mentioned method when executed by a processor.

[0037] In a fourth aspect, the present application provides a computer program product, including a computer program, which implements the above method when executed by a processor.

[0038] The grass rendering method provided in the present application can generate the grass to be rendered of the target image according to the overlapping area and the incremental area between the target image and the original image respectively, and directly call the grass that has been generated in the original image in the overlapping area. It does not need to be generated again, and only the grass in the incremental area needs to be generated. Through such a setting, the rapid generation of the grass to be rendered of the target image can be achieved, and the efficiency of grass generation can be improved to facilitate the subsequent rendering of the grass. In addition, the visible grass in the grass to be rendered can be determined by the position level and grid level corresponding to the grid of the grass to be rendered in the target image, and different methods are used to determine whether the grids of different position levels or grid levels are visible, thereby improving the efficiency of visible grass calculation. Through such a setting, the efficiency of grass generation and the efficiency of visible grass calculation can be improved, thereby improving the efficiency of grass rendering and improving the smoothness of the scene. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0040] Figure 1 System architecture diagram for existing grass rendering methods

[0041] Figure 2 A system architecture diagram of an embodiment of the present application;

[0042] Figure 3 A flowchart of a grass rendering processing method according to an embodiment of the present application;

[0043] Figure 4 A flowchart of a grass rendering processing method according to another embodiment of the present application;

[0044] Figure 5It is a structural schematic diagram of a grass rendering processing device according to an embodiment of the present application.

[0045] Reference numerals: 1. Central processing unit; 2. Graphics processing unit.

[0046] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0047] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0048] First, the terms involved in this application are explained:

[0049] Camera frustum: refers to the area that the perspective camera can see when rendering an image, that is, the visible area.

[0050] With the development of science and technology, virtual reality technology is increasingly used in various fields, such as online games. After drawing a two-dimensional image, game engineers use virtual reality technology to construct a three-dimensional scene map and character map of the two-dimensional image. Rendering is the last step of three-dimensional modeling, making the image more consistent with the three-dimensional scene. Grass is an important component of natural scenes, so grass rendering largely determines the realism of the entire scene.

[0051] Figure 1 This is a system architecture diagram of an existing grass rendering method. After the game character moves, a target image is generated. First, the CPU obtains the surface information in the target image, and generates grass according to the surface information and preset grass generation rules. Then, the CPU generates a tree data structure of all the grass in the target image. The leaf nodes of the tree data structure store data of several grasses. Several leaf nodes will be merged into an intermediate node, in which the intermediate node stores all the data of the leaf nodes to which it belongs. The intermediate nodes will continue to merge into higher-level intermediate nodes until they are merged into a root node, in which the root node stores data of all the grass in the image. After that, the CPU traverses each node of the tree data structure to determine the visible grass, and generates a draw call instruction based on the data of the visible grass. Finally, the CPU sends the draw call instruction to the GPU, and the GPU renders the grass in the target image according to the draw call instruction.

[0052] However, since grass is widely distributed in the game scene and the density of grass per unit area is very high, a large amount of grass needs to be processed during rendering. Therefore, the workload of generating grass and calculating the visible grass set during the rendering process is very large and inefficient, resulting in low grass rendering efficiency and low scene smoothness.

[0053] The grass rendering processing method provided by the present application is intended to solve the above technical problems of the prior art. The grass rendering processing method obtained by the method can generate the grass to be rendered of the target image according to the overlapping area and the incremental area between the target image and the original image respectively, and directly call the grass that has been generated in the original image in the overlapping area. It does not need to be generated again, and only the grass in the incremental area needs to be generated. Through such a setting, the rapid generation of the grass to be rendered of the target image can be achieved, and the efficiency of grass generation can be improved to facilitate the subsequent rendering of the grass. In addition, the visible grass in the grass to be rendered can be determined by the position level and grid level corresponding to the grid of the grass to be rendered in the target image, and different methods are used to determine whether the grids of different position levels or grid levels are visible, thereby improving the efficiency of visible grass calculation. Through such a setting, the efficiency of grass generation and the efficiency of visible grass calculation can be improved, thereby improving the efficiency of grass rendering and improving the fluency of the scene.

[0054] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0055] Figure 2 This is a system architecture diagram of an embodiment of the present application. First, the CPU determines the overlapping area and the incremental area of ​​the target image; then, the CPU generates the grass to be rendered of the target image according to the overlapping area and the incremental area; then, the CPU determines the position hierarchy and grid level corresponding to the grid of the grass to be rendered in the target image, and determines the visible grass in the grass to be rendered according to the position hierarchy and the grid level; then, the CPU determines the drawing information corresponding to the visible grass according to the grid coordinates of the grid where the visible grass is located, and generates a drawing call instruction according to the drawing information; finally, the CPU sends the drawing call instruction to the GPU, and the GPU renders the grass in the target image according to the drawing call instruction.

[0056] Embodiment 1

[0057] Figure 3 1 is a flowchart of a grass rendering processing method provided by an embodiment of the present application. This embodiment uses the execution subject as a central processing unit to illustrate the tree rendering processing method. Figure 3As shown, the grass rendering processing method may include the following steps:

[0058] S101: after detecting that the position of a target person in an original image has moved, determining an overlapping area and an incremental area between the target image generated after the movement and the original image.

[0059] In this embodiment, the overlapping area refers to an area that exists in both the target image and the original image; the incremental area refers to an area that exists only in the target image.

[0060] S102: Generate a target image of grass to be rendered according to the overlapping area and the incremental area.

[0061] In one possible implementation, generating the grass to be rendered of the target image based on the overlapping area and the incremental area may include: determining the grid coordinates of the overlapping area in the original image, and calling the grass corresponding to the overlapping area in the original image based on the grid coordinates; determining the position information of the incremental area, and generating the grass corresponding to the incremental area based on the position information and a preset grass generation rule; and generating the grass to be rendered of the target image based on the grass corresponding to the overlapping area and the grass corresponding to the incremental area.

[0062] In this embodiment, the grass in the overlapping area has been generated in the original image, so there is no need to generate the grass in the area again, and the corresponding grass can be directly called through the grid coordinates of the overlapping area in the original image. The incremental area is a newly added area of ​​the target image, so it is necessary to generate the grass corresponding to the incremental area according to the position information of the incremental area and the preset grass generation rules. Through such a setting, the amount of grass generated in the target image is reduced, the grass to be rendered in the target image is quickly generated, and the efficiency of grass generation is improved, so as to facilitate the subsequent grass rendering.

[0063] In this embodiment, both the original image and the target image are divided into grids, and the position of the grid in the image can be determined by the grid coordinates corresponding to the grid. The preset grass generation rules are pre-stored in the CPU by the staff. After determining the position information of the grass, the CPU can call the preset grass generation rules through the position information and the use information of tools such as art brushes to generate the corresponding grass. The preset grass generation rules can be flexibly set by those skilled in the art, and are not limited here.

[0064] In another possible implementation, generating the grass to be rendered of the target image based on the overlapping area and the incremental area may include: determining the position information of the overlapping area, and calling the grass corresponding to the overlapping area in the original image based on the position information; determining the position information of the incremental area, and generating the grass corresponding to the incremental area based on the position information and a preset grass generation rule; and generating the grass to be rendered of the target image based on the grass corresponding to the overlapping area and the grass corresponding to the incremental area.

[0065] In this embodiment, the grass in the overlapping area has been generated in the original image, so there is no need to generate the grass in this area again. The original image stores the correspondence between the position information and the grass that has been generated, so the grass corresponding to the overlapping area in the original image can be directly called through the position information. The incremental area is a newly added area of ​​the target image, so it is necessary to generate the grass corresponding to the incremental area according to the position information of the incremental area and the preset grass generation rules. Through such a setting, the amount of grass generated in the target image is reduced, the grass to be rendered in the target image is quickly generated, and the efficiency of grass generation is improved to facilitate the subsequent grass rendering.

[0066] In this embodiment, the preset grass generation rules are pre-stored in the CPU by the staff. After determining the location information of the grass, the CPU can call the preset grass generation rules through the location information and the usage information of tools such as art brushes to generate the corresponding grass. The preset grass generation rules can be flexibly set by technicians in this field and are not limited here.

[0067] S103: Determine the visible grass in the grass to be rendered according to the position level and grid level corresponding to the grid of the grass to be rendered in the target image. For details on the specific method of determining the visible grass in the grass to be rendered, please refer to the second embodiment.

[0068] S104: Generate a drawing call instruction according to the drawing information corresponding to the visible grass, and send the drawing call instruction to the rendering execution module, so that the rendering execution module renders the grass to be rendered according to the drawing call instruction; wherein the drawing information includes: position information, scaling information and rotation information.

[0069] In this embodiment, the rendering execution module may be a graphics processing unit (GPU). The drawing information includes, but is not limited to: position information, scaling information and rotation information, and may also include relevant information of subsequent rendering work.

[0070] In this embodiment, after determining that the grass is visible, the central processing unit (CPU) calls the drawing information corresponding to the visible grass and generates a drawing call instruction accordingly, and then sends the drawing call instruction to the GPU. After receiving the drawing call instruction, the GPU renders the grass to be rendered in the target image accordingly.

[0071] In this embodiment, generating a drawing call instruction according to the drawing information corresponding to the visible grass may include: determining the drawing information corresponding to each visible grass according to the grid coordinates of the grid where the visible grass is located; determining a third distance between each visible grass and the camera position according to the position information in the drawing information corresponding to each visible grass; determining a distance level corresponding to each visible grass according to the third distance; and generating a drawing call instruction according to the drawing information corresponding to the visible grass at the same distance level.

[0072] In this embodiment, the drawing information of each grass in the image can be stored in the memory pool, and each grid does not store various data of the grass in it. After determining the grid coordinates of the grid where the visible grass is located, the drawing information corresponding to the visible grass can be called according to the grid coordinates. Through such a setting, the efficiency of generating drawing call instructions can be improved, thereby improving the efficiency of visible grass rendering and improving the scene fluency.

[0073] In this embodiment, the camera position corresponding to the image has been set, and the third distance between each visible grass and the camera position can be determined according to the position information of the visible grass.

[0074] In this embodiment, due to the different distances of the grass from the camera position, the detailed level of the grass "seen" by the camera is different, and the corresponding rendering process and detail level are also different. For example, the closer the grass is to the camera, the more detailed it is "seen", the better the rendering effect of the grass should be, and the higher the detail level. Therefore, the third distance can be divided into distance levels, the visible grass at the same distance level can be batched together, and the drawing call instructions can be generated according to their corresponding drawing information. Through such a setting, the number of times the drawing call instructions are generated can be further reduced, and the efficiency of grass rendering can be further improved without affecting the rendering effect, thereby improving the smoothness of the scene.

[0075] In this embodiment, those skilled in the art can flexibly set the distance level as needed. For example, the distance level can be divided into four levels: near, medium, far and very far, or can be divided into three levels: near, medium and far, which is not limited here.

[0076] In this embodiment, in the process of generating draw call instructions according to the drawing information corresponding to the visible grass at the same distance level, the draw call instructions corresponding to different distance levels can be generated in batches, that is, multiple draw call instructions can be generated simultaneously according to the drawing information corresponding to multiple distance levels in the same period of time, thereby further improving the efficiency of generating draw call instructions.

[0077] The following is a detailed description of the second embodiment of the specific content of the visible grass in the grassland to be rendered in step S103 of the first embodiment, which is determined according to the position level and grid level corresponding to the grid of the grassland to be rendered in the target image.

[0078] Embodiment 2

[0079] Figure 4 2 is a flowchart of a grass rendering processing method provided by another embodiment of the present application. This embodiment uses the execution subject as a central processing unit to illustrate the tree rendering processing method. Figure 4 As shown, the grass rendering processing method may include the following steps:

[0080] S201: Generate a first enclosing space corresponding to a first grid, where the first enclosing space is a cube space.

[0081] S202: Determine, according to the position level, whether the first bounding space is located inside the camera's visual cone area or intersects with the camera's visual cone area.

[0082] S203: When the first enclosing space is located inside the camera's visual cone area, the grass in the first grid corresponding to the first enclosing space is visible grass.

[0083] S204: When the first enclosing space intersects with the camera cone area, a second enclosing space corresponding to the second grid in the first grid is generated, and the second enclosing space is a spherical space.

[0084] S205: Determine whether the second bounding space is located inside the camera's visual cone area or intersects with the camera's visual cone area.

[0085] S206: If the second enclosing space is located inside the camera's visual cone area or intersects with the camera's visual cone area, the grass in the second grid corresponding to the second enclosing space is visible grass.

[0086] S206: If the second enclosing space is not located inside the camera's visual cone area and does not intersect with the camera's visual cone area, the grass in the second grid corresponding to the second enclosing space is not visible grass.

[0087] In this embodiment, the camera cone area is a visible area, and the grass outside the camera cone area does not need to be rendered. If a first grid is located inside the camera cone area, it means that all the grass in the first grid is visible; if a first grid intersects with the camera cone area, it means that part of the grass in the first grid is visible, and it is necessary to further determine the visible grass in the second grid therein.

[0088] In this embodiment, the shape of the camera cone area is a quadrangular prism with different areas at the front and back. The first enclosing space is a cubic space that can enclose the first grid, and the second enclosing space is a spherical space that can enclose the second grid. When judging the positional relationship between the cubic space and the camera cone area, it is necessary to judge according to the six faces of the cubic space respectively; and when judging the positional relationship between the spherical space and the camera cone area, it is only necessary to judge according to the radius of the spherical space, which has small workload and high calculation efficiency. Since grass plants are usually small and grow in clusters, the second enclosing space corresponding to the second grid with a smaller space can be set as a spherical space, thereby reducing the workload of judging the positional relationship between the second enclosing space and the camera cone area and improving the calculation efficiency of visible grass.

[0089] In this embodiment, the position level may include a first layer and a second layer, and the first distance between any grass in the second layer and the target person is greater than the first preset distance; the grid level may include a first grid and a second grid, the side length of the first grid in the second layer is greater than the side length of the first grid in the first layer, the second grid is located within the first grid, the second grid can accommodate at most a first preset number of grasses, and the second distance between any two grasses in the second grid is less than or equal to the second preset distance.

[0090] In this embodiment, the first layer is the area near the target person in the target image, and the second layer is the area far from the target person. Since the grass is widely distributed in the image, and people usually pay more attention to the area near the target person, the area near the target person is the key area for rendering. By making the side length of the first grid in the second layer larger than the side length of the first grid in the first layer, the first grid near the target person can be divided more finely, improving the accuracy of position determination, so as to facilitate the subsequent calculation of visible grass.

[0091] In this embodiment, the grasses in the second grid are adjacent to each other, and can accommodate at most a first preset number of grasses. This setting can limit the size of the space of the second grid, so as to facilitate the generation of the spherical enclosed space corresponding to the second grid. Those skilled in the art can flexibly set the first preset number according to actual conditions. For example, the first preset number can be 8 or 10, and no limitation is made here. In one possible embodiment, there are 15 adjacent grasses at a certain position in a first grid, and the second distance between any two grasses therebetween is less than or equal to the second preset distance. Since the first preset number corresponding to the second grid is 8, two second grids will be generated at this position, one second grid accommodating 8 grasses and the other second grid accommodating 7 grasses.

[0092] In this embodiment, the first preset distance is much larger than the second preset distance. Those skilled in the art can flexibly set the first preset distance according to actual conditions. For example, the first preset distance can be 15 meters or 20 meters, without any limitation. Similarly, those skilled in the art can flexibly set the second preset distance according to actual conditions. For example, the second preset distance can be 2 centimeters or 5 centimeters, without any limitation.

[0093] In this embodiment, determining whether the first enclosing space is located inside the camera visual cone area or intersects with the camera visual cone area according to the position level in step S202 may include: determining whether the position level where the first grid is located is the second level; if it is the second level, determining whether the first enclosing space is located inside the camera visual cone area or intersects with the camera visual cone area according to the top, bottom, left and right of the first enclosing space; if it is not the second level, determining whether the first enclosing space is located inside the camera visual cone area or intersects with the camera visual cone area according to the top, bottom, left, right, front and back of the first enclosing space.

[0094] In this embodiment, the front of the space formed by the camera cone area is an area close to the screen, which is close to the target person, while the second layer is an area far from the target person, so the grid in the second layer does not need to use the front of the space formed by the camera cone area to determine the visible grass. The back of the space formed by the camera cone area is an area far from the screen, which is very far from the target person, and the visible distance of the grass is close. It is considered invisible beyond a certain distance, so the grid in the second layer does not need to use the back of the space formed by the camera cone area to determine the visible grass. Through such a setting, the calculation efficiency of visible grass can be further improved.

[0095] In this embodiment, before generating the first enclosed space corresponding to the first grid, it may also include: determining whether the location level of the first grid is the second layer; if so, randomly deleting a second preset number of second grids and the grass contained therein from the first grid.

[0096] In this embodiment, since the density of grass per unit area is very high, and people usually pay more attention to the area near the target person and pay little attention to the area far from the target person, the area far from the target person does not need a lot of grass, and the rendering effect does not need to be very good. Therefore, the grass in the area far from the target person, that is, the second layer, can be randomly deleted to reduce the workload of visible grass calculation and rendering, further improve the calculation efficiency of visible grass, thereby improving the efficiency of grass rendering and improving the scene fluency. In addition, by using the second grid as the deletion unit, the efficiency of grass deletion can also be improved.

[0097] In this implementation, those skilled in the art can flexibly set the second preset number according to actual conditions, and no limitation is imposed herein.

[0098] The grass rendering processing method of the present application is described below with a specific embodiment.

[0099] Embodiment 3

[0100] In a specific embodiment, during a 3D modeling process of a certain online game, when a game character in a scene moves, a target image generated after the game character moves needs to be rendered to generate a new game scene. First, the CPU determines the overlapping area and incremental area between the target image and the original image.

[0101] Then, the grid coordinates of the overlapping area in the original image are determined, and the grass corresponding to the overlapping area in the original image is called according to the grid coordinates; the position information of the incremental area is determined, and the grass corresponding to the incremental area is generated according to the position information and a preset grass generation rule; the grass to be rendered of the target image is generated according to the grass corresponding to the overlapping area and the grass corresponding to the incremental area.

[0102] Afterwards, the position level and grid level corresponding to the grid of the grass to be rendered in the target image are determined. When the position level corresponding to the grid is the second layer and the grid level is the first grid, a second preset number of second grids and the grass contained therein are randomly deleted from the first grid.

[0103] After that, the visible grass in the grass to be rendered is determined based on the position level and mesh level:

[0104] Generate a first enclosing space of a cube corresponding to the first grid;

[0105] Determine whether the location level of the first grid is the second layer; if it is the second layer, determine whether the first enclosing space is located inside the camera cone area or intersects with the camera cone area according to the top, bottom, left and right sides of the first enclosing space; if it is not the second layer, determine whether the first enclosing space is located inside the camera cone area or intersects with the camera cone area according to the top, bottom, left, right, front and back sides of the first enclosing space;

[0106] When the first enclosing space is located inside the camera's viewing cone, the grass in the first grid corresponding to the first enclosing space is visible grass;

[0107] When the first enclosing space intersects with the camera's frustum area, a second enclosing space of a sphere corresponding to the second grid in the first grid is generated;

[0108] Determine whether the second bounding space is within the camera's viewing cone or intersects with the camera's viewing cone;

[0109] If the second enclosing space is located inside the camera's visual cone area or intersects with the camera's visual cone area, the grass in the second grid corresponding to the second enclosing space is visible grass.

[0110] Afterwards, the CPU determines drawing information corresponding to the visible grass according to the grid coordinates of the grid where the visible grass is located, and generates a drawing call instruction according to the drawing information.

[0111] Finally, the CPU sends the drawing call instruction to the GPU, and the GPU renders the grass in the target image according to the drawing call instruction to generate a 3D scene graph corresponding to the movement of the game character.

[0112] Figure 5 FIG. 1 is a schematic diagram of the structure of a grass rendering processing device according to an embodiment of the present application. Figure 5 As shown, the grass rendering processing device includes: a processor 101, and a memory 102 that is communicatively connected to the processor 101; the memory 102 stores computer execution instructions; the processor 101 executes the computer execution instructions stored in the memory 102 to implement the steps of the grass rendering processing method in the above-mentioned method embodiments.

[0113] The grass rendering processing device may be independent or a part of a central processing unit. The processor 101 and the memory 102 may adopt the existing hardware of the central processing unit.

[0114] In the above-mentioned rendering processing device, the memory 102 and the processor 101 are electrically connected directly or indirectly to realize data transmission or interaction. For example, these elements can be electrically connected to each other through one or more communication buses or signal lines, such as through a bus connection. The memory 102 stores computer-executable instructions for implementing the data access control method, including at least one software function module that can be stored in the memory 102 in the form of software or firmware. The processor 101 executes various functional applications and data processing by running the software programs and modules stored in the memory 102.

[0115] The memory 102 may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electric erasable programmable read-only memory (EEPROM), etc. The memory 102 is used to store programs, and the processor 101 executes the programs after receiving the execution instruction. Furthermore, the software programs and modules in the above-mentioned memory 102 may also include an operating system, which may include various software components and / or drivers for managing system tasks (such as memory management, storage device control, power management, etc.), and may communicate with various hardware or software components to provide an operating environment for other software components.

[0116] The processor 101 may be an integrated circuit chip having the ability to process signals. The processor 101 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc. The methods, steps, and logic diagrams disclosed in the embodiments of the present application may be implemented or executed. The general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.

[0117] An embodiment of the present application further provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the steps of each method embodiment of the present application.

[0118] An embodiment of the present application further provides a computer program product, including a computer program, which implements the steps of each method embodiment of the present application when executed by a processor.

[0119] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0120] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A grass rendering processing method, characterized in that: include: After detecting that the position of the target person in the original image has moved, determining an overlapping area and an incremental area between the target image generated after the movement and the original image; Generate the grass to be rendered of the target image according to the overlapping area and the incremental area; Determine the visible grass in the grass to be rendered according to the position level and grid level corresponding to the grid of the grass to be rendered in the target image, wherein the position level includes a first layer and a second layer, and a first distance between any grass in the second layer and the target person is greater than a first preset distance; the grid level includes a first grid and a second grid, and a side length of the first grid in the second layer is greater than a side length of the first grid in the first layer; Generate a drawing call instruction according to the drawing information corresponding to the visible grass, and send the drawing call instruction to a rendering execution module, so that the rendering execution module renders the grass to be rendered according to the drawing call instruction; The drawing information includes: position information, scaling information and rotation information.

2. The method according to claim 1, characterized in that: The step of generating the grass to be rendered of the target image according to the overlapping area and the incremental area specifically includes: Determine the grid coordinates of the overlapping area in the original image, and call the grassland corresponding to the overlapping area in the original image according to the grid coordinates; or determine the position information of the overlapping area, and call the grassland corresponding to the overlapping area in the original image according to the position information; Determine the position information of the incremental area, and generate the grassland corresponding to the incremental area according to the position information and a preset grassland generation rule; The grass to be rendered of the target image is generated according to the grass corresponding to the overlapping area and the grass corresponding to the incremental area.

3. The method according to claim 1 or 2, characterized in that: The second grid is located within the first grid, the second grid can accommodate at most a first preset number of grasses, and a second distance between any two grasses in the second grid is less than or equal to a second preset distance.

4. The method according to claim 3, characterized in that The determining the visible grass in the grass to be rendered according to the position level and the grid level corresponding to the grid of the grass to be rendered in the target image specifically includes: Generate a first enclosing space corresponding to the first grid, and determine whether the first enclosing space is located inside a camera cone area or intersects with the camera cone area according to the position level; When the first enclosing space is located inside the camera viewing cone, the grass in the first grid corresponding to the first enclosing space is visible grass; When the first enclosing space intersects with the camera cone area, a second enclosing space corresponding to the second grid in the first grid is generated, and it is determined whether the second enclosing space is located inside the camera cone area or intersects with the camera cone area; if the second enclosing space is located inside the camera cone area or intersects with the camera cone area, the grass in the second grid corresponding to the second enclosing space is visible grass; The first enclosed space is a cube space, and the second enclosed space is a spherical space.

5. The method according to claim 4, characterized in that The determining, according to the position level, whether the first enclosing space is located inside the camera's visual cone area or intersects with the camera's visual cone area specifically includes: Determine whether the location level of the first grid is the second level; If it is the second layer, determining whether the first enclosed space is located inside the camera's visual cone area or intersects with the camera's visual cone area according to the top, bottom, left and right sides of the first enclosed space; If it is not the second layer, whether the first enclosed space is located inside the camera's visual cone area or intersects with the camera's visual cone area is determined according to the top, bottom, left, right, front and back of the first enclosed space.

6. The method according to claim 4, characterized in that Before generating the first enclosing space corresponding to the first grid, the method further includes: Determine whether the location level of the first grid is the second level; if so, randomly delete a second preset number of second grids and the grasses contained therein from the first grid.

7. The method according to claim 3, characterized in that The generating a drawing call instruction according to the drawing information corresponding to the visible grass specifically includes: Determine drawing information corresponding to each visible grass according to the grid coordinates of the grid where the visible grass is located; Determine a third distance between each visible grass and the camera position according to the position information in the drawing information corresponding to each visible grass; Determine a distance level corresponding to each visible grass according to the third distance; Generates draw calls based on the draw information corresponding to visible grass at the same distance level.

8. A grass rendering processing device, comprising a processor and a memory connected to the processor in communication; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 7.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.

10. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Method and apparatus for rendering animation scene, electronic device, and readable storage medium

    CN108389245A