Real-time rendering method and device for virtual forest scene

By generating overlay map tiles for seed nodes and density channels, combining cascaded shadow maps and shader maps, the problems of rendering resources and calculation complexity in virtual forest scenes are solved, and efficient real-time rendering and lighting processing of virtual forest scenes are realized. Avoid jagging or flickering and improve lighting consistency.

CN118096985BActive Publication Date: 2024-12-06BEIJING ALFCON AVIATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310849351.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-11
Publication Date
2024-12-06
Estimated Expiration
2043-07-11

AI Technical Summary

Technical Problem

The existing technology is difficult to effectively reduce rendering resources and computing complexity, while achieving efficient real-time rendering and lighting processing of virtual forest scenes. Especially when dealing with a large number of trees and complex lighting effects, jagged or flickering often occurs, and the lighting is consistent. Insufficient sex.

Method used

By generating cover map tiles for representing seed nodes and density channels of a single tree, combining cascaded shadow maps, preset close-up tree rendering methods and 3D mesh models, the close-up tree lighting process is performed and the shader map is used. The Strahler model renders the vision tree to achieve lighting processing and transition effects on trees from different distances.

Benefits of technology

It realizes efficient real-time rendering and lighting processing of virtual forest scenes, reduces rendering resources and calculation complexity, avoids jagging or flickering, and improves lighting consistency on each scale.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118096985B_ABST
    Figure CN118096985B_ABST
Patent Text Reader

Abstract

The present application provides a method and device for real-time rendering of a virtual forest scene, the method comprising: generating seed nodes and overlay map tiles according to custom configuration parameters for the virtual forest scene, and rendering the terrain corresponding to the virtual forest scene and the near-view trees in the current screen of the virtual forest scene into a cascade shadow map based on the seed nodes, so as to use the cascade shadow map to represent the shadows of the near-view trees; applying the near-view tree rendering method and the tree species 3D mesh model to render the near-view trees and perform lighting processing on the near-view trees; applying the overlay map tiles and the shader map to render the far-view trees in the current screen and perform lighting processing on the far-view trees. The present application can effectively reduce the resources and computational complexity required for rendering, realize real-time and realistic rendering and lighting processing of forest scenes at different distances, ensure the rendering effect, prevent jagged or flickering effects from appearing in the scene, and effectively improve the consistency of lighting at all scales in the virtual forest scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of simulation technology, and in particular to a method and device for real-time rendering of a virtual forest scene. Background Art

[0002] Forests are one of the most common and beautiful elements of natural scenes. Therefore, being able to efficiently render very large virtual forest scenes is very important for many applications, such as flight simulators, geographic information systems, filmmaking, or games. However, it is also a very challenging task due to the large number of trees in a forest, the rich details, and the complex lighting. A realistic aerial view of a forest can show millions of trees, each with thousands of leaves. Portraying consistent forest lighting and reflections at all scales is a challenge, but it is essential for realism. From close up to very far viewpoints, lighting gives important visual cues that help us distinguish trees and understand the shapes of trees and terrain.

[0003] At present, rendering and lighting of individual trees have been widely studied. However, most forest rendering algorithms only use basic lighting models and cannot present the above effects (mainly due to the perspective-lighting correlation). To solve this problem, scholars have proposed a variety of methods to express and render trees. Some of these methods use complex 3D models to express each tree. These models can produce very realistic results, but also require a lot of storage and computing resources. Other methods use simple geometric primitives (such as billboards or ellipsoids) to express each tree. These methods are more efficient, but the effects are not realistic enough. Some methods use textures or shaders to express the entire forest. These methods have the advantage of scalability, but the results are relatively poor.

[0004] Therefore, it is urgent to design a method that can effectively reduce the resources and computational complexity required for rendering while effectively improving the real-time rendering effect of virtual forest scenes. Summary of the invention

[0005] In view of this, the embodiments of the present application provide a method and device for real-time rendering of a virtual forest scene to eliminate or improve one or more defects existing in the prior art.

[0006] One aspect of the present application provides a method for real-time rendering of a virtual forest scene, comprising:

[0007] Generate seed nodes for representing performance parameters of a single tree and overlay map tiles for representing density channels of each tree species according to custom configuration parameters for the virtual forest scene, and render terrain corresponding to the virtual forest scene and foreground trees in a current screen of the virtual forest scene into a cascade shadow map based on the seed nodes, so as to use the cascade shadow map to represent shadows of the foreground trees;

[0008] Applying a preset foreground tree rendering method and a tree species 3D mesh model to render the foreground tree, and performing lighting processing on the foreground tree;

[0009] And, applying the overlay map tiles and the shader map to render the distant trees in the current picture, and performing lighting processing on the distant trees.

[0010] In some embodiments of the present application, the custom configuration parameters include: a height map, a tree density map, a point distribution model, and at least one tree species 3D mesh model corresponding to each tree species for the virtual forest scene;

[0011] Correspondingly, the seed nodes for representing the performance parameters of a single tree and the coverage map tiles for representing the density channel of each tree species are generated according to the custom configuration parameters for the virtual forest scene, including:

[0012] Inputting a height map, a tree density map, a point distribution model, and at least one tree species 3D mesh model corresponding to each tree species for a virtual forest scene into a dynamic quadtree composed of visible quadrilateral regions on a CPU to generate a seed node for representing a performance parameter of a single tree and a coverage map tile for representing a density channel of each tree species, wherein the performance parameters include: 3D position parameters, species parameters, rotation parameters, scaling parameters, and color parameters;

[0013] The seed nodes and coverage map tiles are stored in different caches of the GPU respectively.

[0014] In some embodiments of the present application, the applying a preset foreground tree rendering method and a tree species 3D mesh model to render the foreground tree includes:

[0015] Pre-calculating each of the tree species 3D grid models to obtain a corresponding depth map, and each texel corresponding to each of the depth maps includes: minimum depth, maximum depth, ambient occlusion and opacity;

[0016] A camera-facing proxy quadrilateral is used to render each foreground tree, and the depth map is used to iteratively reconstruct the intersection of each sight line corresponding to each proxy quadrilateral and the foreground tree, the incident point of the light reaching the intersection, and the opacity and ambient occlusion at the intersection.

[0017] In some embodiments of the present application, the performing of illumination processing on the foreground tree includes:

[0018] estimating direct solar insolation at the intersection point using exponential decay;

[0019] estimating direct sky lighting at the intersection based on pre-computed ambient occlusion of a single foreground tree and ambient occlusion on a cylindrical hole axis surrounding the tree of an approximate environment;

[0020] The average ambient occlusion caused by the foreground tree is adjusted to increase the contrast near the location of the foreground tree, and the sunlight reflected by the ground and the sky illumination are calculated.

[0021] In some embodiments of the present application, the applying the coverage map tiles and the shader map to render the distant tree in the current picture and performing lighting processing on the distant tree includes:

[0022] The distant tree is drawn as a disk on the overlay map tile, and then applied to the height map, and based on the Strahler model that introduces four average values, the color of each screen pixel is reconstructed using a view and lighting related shader, and the pixel segmentation ratio and corresponding illumination related to each sight value and light are calculated to complete the rendering and lighting processing of the distant tree in the current picture;

[0023] The four average values ​​include: an average value on the visible and sunlit ground, an average value on the visible ground, an average value on the visible trees illuminated by the sun, and an average value on the visible trees.

[0024] In some embodiments of the present application, it also includes:

[0025] If a trigger instruction for internal transition of a foreground tree is detected, the direct sunlight, direct sky illumination, sunlight reflected by the ground and sky illumination at the intersection are controlled to transition to their respective expected average values.

[0026] In some embodiments of the present application, it also includes:

[0027] If a trigger instruction of a transition within a distant tree is detected, the shader is controlled to color the disk corresponding to the distant tree in the coverage channel using the illumination component of the distant tree, and to color the ground between the disks using the ground component.

[0028] In some embodiments of the present application, it also includes:

[0029] If a trigger instruction for the transition from the near-view tree to the far-view tree is detected, the opacity is multiplied by 1, and the ground lighting in the transition area between the near-view tree and the far-view tree is replaced by forest lighting.

[0030] Another aspect of the present application provides a real-time rendering device for a virtual forest scene, comprising:

[0031] An initial processing module, for generating seed nodes for representing performance parameters of a single tree and overlay map tiles for representing density channels of each tree species according to custom configuration parameters for the virtual forest scene, and rendering terrain corresponding to the virtual forest scene and foreground trees in a current screen of the virtual forest scene into a cascade shadow map based on the seed nodes, so as to use the cascade shadow map to represent shadows of the foreground trees;

[0032] A near-foreground tree rendering module, used to render the near-foreground tree using a preset near-foreground tree rendering method and a tree species 3D mesh model, and perform lighting processing on the near-foreground tree;

[0033] A distant tree rendering module is used to apply the coverage map tiles and the shader map to render the distant tree in the current picture, and perform lighting processing on the distant tree.

[0034] A third aspect of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method for real-time rendering of a virtual forest scene when executing the computer program.

[0035] A fourth aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the method for real-time rendering of a virtual forest scene when executed by a processor.

[0036] The real-time rendering method of a virtual forest scene provided in the present application generates seed nodes for representing the performance parameters of a single tree and overlay map tiles for representing the density channel of each tree species according to the custom configuration parameters for the virtual forest scene, and renders the terrain corresponding to the virtual forest scene and the foreground trees in the current screen of the virtual forest scene into a cascade shadow map based on the seed nodes, so as to use the cascade shadow map to represent the shadows of the foreground trees; renders the foreground trees using a preset foreground tree rendering method and a 3D mesh model of the tree species, and performs lighting processing on the foreground trees; and renders the distant trees in the current screen using the overlay map tiles and shader maps, and performs lighting processing on the distant trees, which can effectively reduce the resources and computational complexity required for rendering, realize real-time and realistic rendering and lighting processing of forest scenes at different distances, ensure the rendering effect, prevent jagged or flickering effects from appearing in the scene, and effectively improve the consistency of lighting at various scales in the virtual forest scene.

[0037] Additional advantages, purposes, and features of the present application will be partially described in the following description, and will become partially apparent to those skilled in the art after studying the following, or may be learned from the practice of the present application. The purposes and other advantages of the present application can be achieved and obtained by the structures specifically pointed out in the specification and the drawings.

[0038] Those skilled in the art will understand that the purposes and advantages that can be achieved by the present application are not limited to the above specific description, and the above and other purposes that can be achieved by the present application will be more clearly understood based on the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The drawings described herein are used to provide a further understanding of the present application, constitute a part of the present application, and do not constitute a limitation of the present application. The components in the drawings are not drawn to scale, but are only for the purpose of illustrating the principles of the present application. In order to facilitate the illustration and description of some parts of the present application, the corresponding parts in the drawings may be enlarged, that is, they may become larger relative to other components in the exemplary device actually manufactured according to the present application. In the drawings:

[0040] Figure 1 Schematic diagram of a first flow chart of a method for real-time rendering of a virtual forest scene in an embodiment of the present application.

[0041] Figure 2 Schematic diagram of a second process of a method for real-time rendering of a virtual forest scene in an embodiment of the present application.

[0042] Figure 3 Schematic diagram of the relationship between input and output in a real-time rendering algorithm for a virtual forest scene in one embodiment of the present application.

[0043] FIG. 4( a ) is a schematic diagram showing an example of using a proxy quadrilateral facing the camera to render each foreground tree during foreground tree rendering in an embodiment of the present application.

[0044] FIG. 4( b ) is another exemplary schematic diagram of using a camera-facing proxy quadrilateral to render each foreground tree during foreground tree rendering in an embodiment of the present application.

[0045] FIG4(c) shows a process of using a pre-computed depth map in the near-view tree rendering process in an embodiment of the present application to iteratively reconstruct the intersection point p of each line of sight v with the tree. v , and reach p v The incident point of the light ray is p l Example diagram of .

[0046] FIG. 4( d ) shows the exponential decay exp(-τ||p l -p v ) to estimate p v Direct sunlight at ; p is estimated by multiplying the precomputed ambient occlusion of a single tree by the ambient occlusion on the axis of the cylindrical hole that approximates the environment v Example diagram of direct sky lighting at .

[0047] FIG. 5( a ) is a schematic diagram showing an example of a method for calculating the illumination of a forest area modeled by an ellipsoid in a process of rendering distant trees using an optimized Strahler model in an embodiment of the present application.

[0048] FIG5( b ) shows a process of using the optimized Strahler model to render distant trees in an embodiment of the present application, where the visible area in a pixel is divided into four parts: the ground illuminated by sunlight, the ground in shadow, the tree crown illuminated by sunlight, and the tree crown in shadow. and An example diagram showing the overall illuminance as the weighted sum of the four parts.

[0049] FIG. 5( c ) is a diagram showing a process of rendering a distant view tree using an optimized Strahler model without changing k in an embodiment of the present application. g , k t and An example diagram of spherical trees on horizontal ground obtained by vertical scaling in the case of .

[0050] FIG. 5( d ) is a diagram showing the process of using the optimized Strahler model to render the distant view tree without changing k in an embodiment of the present application. g , k t and An example diagram of a spherical tree on horizontal ground obtained by rotation in the case of .

[0051] FIG. 6( a ) is a schematic diagram showing an example of the first effect of real-time rendering using the real-time rendering method for a virtual forest scene in an application example of the present application.

[0052] FIG6( b ) is a schematic diagram showing an example of the second effect of real-time rendering using the real-time rendering method for a virtual forest scene in the application example of the present application.

[0053] FIG6( c ) is a schematic diagram showing an example of a third effect of real-time rendering using the real-time rendering method for a virtual forest scene in an application example of the present application.

[0054] Figure 7 Schematic diagram of the structure of a real-time rendering device for a virtual forest scene in one embodiment of the present application. DETAILED DESCRIPTION

[0055] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the implementation modes and the accompanying drawings. Here, the illustrative implementation modes and descriptions of the present application are used to explain the present application, but are not intended to limit the present application.

[0056] It should also be noted here that in order to avoid obscuring the present application due to unnecessary details, only the structures and / or processing steps closely related to the scheme according to the present application are shown in the accompanying drawings, while other details that are not very relevant to the present application are omitted.

[0057] It should be emphasized that the term “include / comprises” when used herein refers to the presence of features, elements, steps or components, but does not exclude the presence or addition of one or more other features, elements, steps or components.

[0058] It should also be noted that, unless otherwise specified, the term “connection” herein may refer not only to a direct connection but also to an indirect connection involving an intermediate.

[0059] Hereinafter, embodiments of the present application will be described with reference to the accompanying drawings. In the accompanying drawings, the same reference numerals represent the same or similar components, or the same or similar steps.

[0060] The meaning of each parameter appearing in one or more embodiments of the present application is shown in Table 1.

[0061] Table 1

[0062]

[0063]

[0064] Lighting calculation and real-time rendering of forests is extremely important in simulation applications and games, but is also a difficult technical problem - the amount of geometry to be processed is huge: an aerial forest view shows millions of trees, with a large range of distances from the camera to the ground. Light interaction, whose effects are visible at all scales, is also a problem: contribution of the sun and the sky dome, shadows between trees, light mask correlation inside trees, on the ground and in the viewport.

[0065] Currently, a common way to present forests is to use one or more billboards to represent each tree. This method is simple, and the trees can be arbitrarily distributed. However, many billboards are required to get accurate parallax effects, and flickering occurs when rotating around intersecting trees. Another approach is to use a 3D texture representing the entire forest area, randomly tiled and rendered with slices parallel to the terrain. This greatly reduces geometric complexity, but the distribution of trees and the boundaries of the forest are very difficult to control when dealing with areas smaller than image blocks, such as individual trees or parts of trees. The crown of the tree can also be represented by a height field and rendered with a relief map, which is easier for the user to control, but only supports long-distance views. In contrast, point-based rendering is more suitable for close-up views.

[0066] These methods simply ignore shadows when processing them, and cannot achieve the lighting effects mentioned above. Some methods use spherical harmonic coefficients stored in billboard textures to express light transmission, but the disadvantage of this method is that it cannot take into account the shadows cast by other trees; there are also methods that use canopy height fields to calculate shadows and ambient occlusion, but they cannot achieve self-occlusion inside trees. For tree surfaces below 1 pixel, there is currently no good method to give correct lighting.

[0067] In the calculation method of tree and forest lighting, the calculation of the shadow formed by direct sunlight in a single tree can be calculated using tree geometry, or approximated based on participating media, that is, exponential attenuation based on optical depth. Similarly, direct sky lighting is also calculated in real time or in advance using geometry or participating media approximation. This approximation method is also used to estimate the indirect lighting of trees and the global lighting of forests. According to this method, the lighting transport equations in the three-dimensional grid need to be solved, which is currently not possible in real time and is not scalable. This application combines the above ideas, ignores indirect lighting, and estimates direct sunlight and sky light in the nearest trees. For the farthest trees, this application switches to a shader with line of sight and lighting parameters, which is adjusted using a density map.

[0068] Based on this, the goal of this application is to propose a new model for real-time realistic rendering and lighting processing of medium-distance to long-distance forest scenes, while supporting the transition from close-up trees to the internal view of the tree model. The method focuses on rendering effects and does not use "precise" equations, but successfully avoids jagged or flickering effects. This application can also have consistent lighting at all scales, that is, the average reflectivity of the forest area must be independent of its screen resolution. Finally, this application can support users to control as many parameters as possible: the density and shape of the forest, the geometry, species and size distribution of the trees, etc.

[0069] To achieve the above goals, this application proposes two new ways to present forests, near-view tree rendering and shader mapping, which can achieve seamless transitions between them. Near-view tree rendering combines the ideas of light fields and height fields to render the nearest trees and take into account all lighting effects. The shader map is a texture determined by position, perspective, and lighting, which is used to render the farthest trees.

[0070] The details are described in detail through the following examples.

[0071] Based on this, the embodiment of the present application provides a method for real-time rendering of a virtual forest scene that can be implemented by a real-time rendering device for a virtual forest scene, see Figure 1 The virtual forest scene real-time rendering method specifically includes the following contents:

[0072] Step 100: Generate seed nodes for representing performance parameters of a single tree and overlay map tiles for representing density channels of each tree species according to custom configuration parameters for the virtual forest scene, and render terrain corresponding to the virtual forest scene and foreground trees in the current screen of the virtual forest scene into a cascade shadow map based on the seed nodes, so as to use the cascade shadow map to represent the shadows of the foreground trees.

[0073] It is understood that the virtual forest scene mentioned in this application specifically refers to a virtual forest scene used in a flight simulator, a geographic information system, a movie production, or a game screen display scene. Custom configuration parameters can be customized by the user, and these custom configuration parameters are all parameters required for real-time rendering of the virtual forest scene.

[0074] In one or more embodiments of the present application, the seed node may also be abbreviated as “seed”, and may be automatically generated by user-defined configuration parameters (such as a non-periodic tiled input point distribution model) given by the user.

[0075] In one or more embodiments of the present application, the coverage map tile contains a density channel for each tree species. Loaded from the input map. It also has a channel Γ(x) containing the percentage of the ground covered by trees (looking from above). This channel can be generated by drawing a disk for each tree. When the disk area is less than 1 / 16 of a texel, in order to avoid drawing too many disks, the total density Multiplying by the average tree area A generates this channel.

[0076] Step 200: Apply a preset foreground tree rendering method and a tree species 3D mesh model to render the foreground tree, and perform lighting processing on the foreground tree.

[0077] Because the current forest expression methods are not enough to achieve realistic, real-time goals. The method using 3D forest map textures only allows limited user control, and it is difficult to simulate parallax and lighting effects with billboards. Secondly, neither of these two types of methods can be extended to very distant views (many trees are projected onto one pixel). Therefore, step 200 of the present application solves this problem by using a new near-view tree rendering method to draw each of the nearest trees individually, which is sufficient to express parallax effects, local and global illumination even though only one quadrilateral is used for each tree.

[0078] Step 300: Apply the coverage map tiles and the shader map to render the distant trees in the current picture, and perform lighting processing on the distant trees.

[0079] As for the problem that current forest expression methods cannot be extended to very distant views (many trees are projected onto one pixel), step 300 of the present application solves this problem by using a new shader map to draw the farthest trees. This method does not use any geometry, but instead draws the trees as tiny disks on an overlay map, which are then applied to the terrain and rendered using perspective and lighting-related shaders.

[0080] Specifically, the rendering of each frame of the virtual forest scene includes 3 steps, with the help of textures pre-calculated from 3D tree models. First, the terrain and the nearest tree are rendered into a cascade shadow map using the seed node and near-view tree rendering generated in step 100. Then the terrain is drawn, using the shadow map to express the shadow of the nearest tree, and the cached coverage map tiles and shader map to express the farthest tree. Finally, the application draws the nearest tree using the near-view tree rendering method, using the cached seed node and shadow map. This order can achieve optimization of early z-buffer culling.

[0081] From the above description, it can be seen that the real-time rendering method of the virtual forest scene provided in the embodiment of the present application can effectively reduce the resources and computational complexity required for rendering, realize real-time and realistic rendering and lighting processing of forest scenes at different distances, ensure the rendering effect, and can eliminate jagged or flickering effects in the scene, and can effectively improve the consistency of lighting at various scales in the virtual forest scene.

[0082] In order to further support users to control as many parameters as possible and improve the application reliability of seed nodes and coverage map tiles, in a real-time rendering method of a virtual forest scene provided in an embodiment of the present application, the custom configuration parameters specifically include: a height map, a tree density map, a point distribution model for the virtual forest scene, and at least one tree species 3D mesh model corresponding to each tree species.

[0083] For the corresponding Figure 2 , step 100 in the virtual forest scene real-time rendering method specifically includes the following contents:

[0084] Step 110: Input the height map, tree density map, point distribution model and at least one tree species 3D mesh model corresponding to each tree species for the virtual forest scene into a dynamic quadtree composed of visible quadrilateral areas on the CPU to generate seed nodes for representing performance parameters of a single tree and coverage map tiles for representing density channels of each tree species, wherein the performance parameters include: 3D position parameters, species parameters, rotation parameters, scaling parameters and color parameters.

[0085] Our algorithm requires a set of locations of the nearest trees, and a density map of the farthest trees. In this application, we choose to generate the locations from the density map (or vice versa). To do this, we use a point distribution tiling model with a deduplication mechanism, and remove points where necessary to match the desired density. Therefore, see Figure 3 , the input to this algorithm is:

[0086] (1) A height map, i.e. a digital terrain elevation model.

[0087] (2) A set of tree density maps Describes the number of trees of each tree species i per unit area.

[0088] (3) A set of tileable point distribution models. Each point has a two-dimensional coordinate and a random rotation angle, scaling, color and other attributes.

[0089] (4) Each tree species has one or more 3D mesh models.

[0090] Step 120: Store the seed nodes and coverage map tiles in different caches of the GPU respectively.

[0091] To support very large scenes, this application needs to load the data required for the current view at an appropriate resolution. To this end, this application uses a dynamic quadtree on the CPU and GPU computing power and cache to generate and store terrain data for the currently visible quadrilateral area. Use additional GPU computing power and cache to expand it to accommodate the forest data of this application. Specifically, for each new visible terrain quadrilateral, a set of seed nodes is generated on the GPU to represent the trees, or an overlay map tile is generated to implement the shader map, depending on its level in the quadtree.

[0092] Seeds and coverage map tiles are generated on the GPU and stored in two caches (see Figure 3 ), so that they can be reused as long as the quads remain visible. The first cache is a large vertex cache object, split into equal-sized regions, each storing a "seed" quad. The second cache is a texture array, storing one coverage map tile per layer.

[0093] Now it's just a matter of setting the LOD threshold to decide when to generate seeds or coverage map tiles. Since the coverage tile is mapped on the terrain, it does not add outline details like a solid tree. Therefore, in order to avoid unnatural mutations during the transition, in theory, the two representation methods should be switched when the visual size of the tree is about 1 pixel. In practical applications, this application uses 3 pixels as the standard to reduce the number of solid trees. In short, if the visual size of the tree becomes larger than 3 pixels at the smallest quadtree level l, then this application generates coverage map tiles at all levels 0 to l-1, and generates seeds at level l (other quads reuse the data they inherit from level l).

[0094] exist Figure 3 In , for each new visible terrain quad, a coverage map tile is generated in two caches according to the input map, or for the nearest quad, the seed node of the tree (position, size, etc.). The nearest trees are rendered in combination with precomputed textures for 3D trees to achieve parallax and lighting effects, using only one OpenGL quad per tree; for the farthest trees, a shader adjusted by the coverage map tile is used to render.

[0095] In order to support fine-grained user control, the nearest tree needs to be rendered separately, while considering the effects of self-shadowing, highlights, silver edges and sky lighting, and ensuring high rendering efficiency. In addition, in order to achieve the transition with the 3D tree model in the foreground, this application needs to show accurate parallax effects in every detail. To this end, this application proposes a new expression method called foreground tree rendering. This idea is based on the pre-calculated depth map method and makes improvements to the rendering and lighting models.

[0096] Specifically, it provides new tree expressions, method composition, and how to use it to reconstruct tree shapes, evaluate sun and sky lighting, and lighting on the ground. In terms of lighting, this application considers three layers of light interaction: between trees, between parts of trees, and between leaves. All of these process line-of-sight-light correlation to produce highlight effects. The specific instructions are as follows:

[0097] In order to further improve the effectiveness and accuracy of near-view tree rendering in real-time rendering of virtual forest scenes, in a real-time rendering method for a virtual forest scene provided in an embodiment of the present application, see Figure 2 , step 200 of the virtual forest scene real-time rendering method specifically includes the following contents:

[0098] Step 210: Pre-calculate each of the tree species 3D mesh models to obtain a corresponding depth map, and each texel corresponding to each of the depth maps includes: minimum depth, maximum depth, ambient occlusion and opacity.

[0099] In step 210, see Figure 3 , a set of low-resolution views are precomputed as depth maps for each input tree grid. Each texel in each low-resolution view consists of 4 values: the minimum and maximum depth z and Ambient occlusion δ and opacity α (z, The depth value is obtained by calculating the distance from the vertical plane to the center point o of the line of sight through the tree. For individual trees on the horizontal ground, it is necessary to pre-calculate the ambient occlusion. The method of this application uses 181 uniformly distributed in the upper hemisphere Ω + The line of sight on ω i Each view has 256×256 RGBA8 texels, supporting trees with a visual size of 256 pixels without artifacts (the tree model size used is 45MB / tree).

[0100] A common method is to render a tree by interpolating 3 or 4 pre-computed depth views, but this method will produce artifacts. To solve this problem, this application uses an iterative method to reconstruct a seamless 3D tree shape. Experiments have found that after using 181 views, two iterations for the line of sight and one iteration for the light can avoid this problem. Therefore, this application uses a camera-facing proxy quadrilateral to render each tree. This quadrilateral covers the 3D bounding box of the tree. The pre-computed volume process is as follows:

[0101] (1) Find 3 o The closest precomputed view direction ω i , and a weight value w i , satisfying ω o ∝∑wi ω i , and ∑w i =1.

[0102] (2) Find the intersection point p of the line of sight v and the plane passing through o and perpendicular to ω0.

[0103] (3) Iteration 1: Orthogonally project p onto the three nearest views to obtain three texels, interpolate them to calculate the interpolated point q = p + (∑w i z i ) / ∑w i α i )v.

[0104] (4) Iteration 2: Orthogonally project q onto the three nearest views to obtain three Texture element. Set p v =p+(∑w i z′ i ) / ∑w i α′ i )v. Use p v To set the fragment depth in the z-buffer.

[0105] (5) Using the light direction l and the light passing through p v Repeat steps (1) to (3) for the light ray to obtain p l .

[0106] (6) This gives the artifact-free line of sight and the light incident point p v and p l , and p v Opacity α at v =∑w i a′ i and p v Ambient Occlusion

[0107] Step 220: Use a proxy quadrilateral facing the camera to render each foreground tree, and use the depth map to iteratively reconstruct the intersection of each line of sight corresponding to each proxy quadrilateral and the foreground tree, the incident point of the light reaching the intersection, and the opacity and ambient occlusion at the intersection.

[0108] In step 220, if Figure 4(a) to Figure 4(d) As shown in Figure 4(a) and Figure 4(b), each foreground tree is rendered using a proxy quadrilateral facing the camera. Figure 4(c) uses the precomputed depth map to iteratively reconstruct the intersection point p of each view v with the tree. v , and reach p v The incident point of the light ray is p l Figure 4(d) uses exponential decay exp(-τ||pl -p v ) to estimate p v Direct sunlight at ; p is estimated by multiplying the precomputed ambient occlusion of a single tree by the ambient occlusion on the axis of the cylindrical hole that approximates the environment v Direct sky lighting at . Z1 represents the depth value perpendicular to line of sight 1 (v1), and Z2 represents the depth value perpendicular to line of sight 2 (v2); Z1' represents the change of Z1, and Z2' represents the change of Z2.

[0109] It is understood that factors affecting light include:

[0110] (1) Reflection related to viewing angle: When the observer faces away from the sun, the forest appears brighter because people mainly see the illuminated parts; when observing with their backs to the sun, people mainly see the obscured parts.

[0111] (2) Slope-dependent reflectance: For the same reasons, the average reflectance of a forest varies with the slope of the terrain under given observation and lighting conditions.

[0112] (3) Sun-side highlight effect: There is an obvious bright spot on the side facing the sun, and all shadows are blocked. This effect exists at all scales (whole tree, a group of leaves, and a single leaf).

[0113] (4) Outline highlight effect: The outline of the tree on the backlit side is thinner than the other parts and allows more sunlight to pass through, so it appears brighter, and the tree looks like it has a silver-edged outline.

[0114] (5) The effect of bright top and dark bottom: The lower part and interior of a tree appear darker because it is blocked by itself or the surrounding trees. Similarly, the ground under the tree is also darker.

[0115] Based on this, in order to further improve the effectiveness and accuracy of near-view tree light processing in real-time rendering of virtual forest scenes, in a real-time rendering method for a virtual forest scene provided in an embodiment of the present application, see Figure 2 The method for real-time rendering of a virtual forest scene in step 200 further specifically includes the following contents after step 220:

[0116] Step 230: Estimate the direct sunlight at the intersection point using exponential decay.

[0117] Specifically, this application models the leaves as a participating medium, with an extinction coefficient τ, a phase function p, and a reflectance ρ (in actual operation, this application uses an anisotropic phase function instead of ρ). This application also assumes that light scattering mainly occurs on the "surface" of the tree (τR>>1), so only the light from p is considered. v to pl Therefore, at p v Scattered sunlight I t Then ρp(v,I)exp(-τ||p l -p v ||)I sun This produces silver edges and self-shadowing (and thus highlights) at the scale of a set of leaves. To account for self-shadowing at the scale of leaves, this application adds an empirical highlight term F with amplitude α1 and width Set by user:

[0118] I t (p v )=ρp(v,I)exp(-τ||p l -p v ||)F(v,I)V(p l )I sun (1)

[0119]

[0120] Among them, V(p l ) is the visibility of the sun, calculated using cascaded shadow maps. This application renders these maps and uses Instead of z to avoid shadow artifact errors (i.e. rendering the "backside" of the tree). This application also stores opacity alpha in these maps to get "soft" shadows.

[0121] Step 240: Estimate the direct sky lighting at the intersection point based on the pre-calculated ambient occlusion of the single foreground tree and the ambient occlusion on the cylindrical hole axis surrounding the tree of the approximate environment.

[0122] Specifically, this application uses the average sky illuminance L sky and ambient occlusion δ(p v ) to get the product of v The reflected sky light J t Assuming that the occlusion between trees and within trees is unrelated, this application obtains δ = δ v δ e , where δ e This is due to ambient occlusion caused by other trees. This application uses a cylindrical hole around the tree (see Figure 4d ) axis ambient occlusion δ h To approximate δ e The value of, the radius of the hole is That is, the average distance to the nearest tree. Finally, δ h The approximate value is calculated as follows: Let the depth of the cylindrical hole on the horizontal ground be d and the radius be r, then the ambient occlusion in the hole is Multiply it by the ambient occlusion on the inclined plane (1+nu z ) / 2, the result is a rough approximation, but good enough to get the "sky light" effect:

[0123]

[0124] Step 250: The average ambient occlusion caused by the foreground tree is adjusted to increase the contrast near the location of the foreground tree, and the sunlight reflected by the ground and the sky illumination are calculated.

[0125] Specifically, in order to obtain a darker ground area under the tree, the application adjusts the average ambient occlusion caused by the ground trees, and uses the empirical term Δ(x) to represent δ g , increasing the contrast near the trees. Δ(x) must be less than 1 under the trees, but its average value must be 1. To do this, the application calculates it from the overlay tile:

[0126]

[0127] Where α3 is a user-defined contrast factor. Therefore, if r is the ground BRDF, this application uses the following formulas to calculate the sunlight reflected from the ground and the skylight I g and J g :

[0128] I g (x)=r(v,l,n)max(nl,0)V(x)L sun (5)

[0129] J g (x) = δ g Λ(x)∫ Ω +r(v,ω,u z ) z .ωdωL sky (6)

[0130] Trees and forests have been extensively studied in computer graphics. This application does not explore the modeling and level of detail algorithms for individual trees, but instead focuses on the forest view at medium and long distances, starting from the trees that have already been modeled.

[0131] In addition, there is no large-scale forest reflectivity model in computer graphics. Some hair simulation models are very close to the requirements of this application, but hair is still quite different from trees, and this model ignores the line-of-sight-light relationship, so it cannot restore the highlight effect. There are also some multi-scale tree BRDF models that have very realistic rendering effects, but they cannot be extended to the forest scale. There are 7 forest models in physics. Therefore, based on the theory of light transmission or geometric optics, this application finally selects the Strahler model that best meets the needs for optimization.

[0132] In the field of remote sensing, the Strahler model uses an ellipsoid-based geometric optical model to model the large-scale reflectivity of forests. The premise and parameters of the model are as follows:

[0133] Each tree crown is represented by an opaque ellipsoid with horizontal radius R and height H, which is located above the trunk with radius 0 and height B. The values ​​of R, H, and B can vary, but the proportions of the tree and Set to a constant. This application uses A to represent the average area of ​​trees in the horizontal direction: The center of the ellipsoid conforms to a Poisson distribution with a mean of Λ (the number of trees per unit area). This application uses n to represent the ground normal and u z Indicates the vertical direction. The content of pixel P is divided into four parts: the ground illuminated by sunlight, the ground in shadow, the tree canopy illuminated by sunlight, and the tree canopy in shadow, respectively. and Indicates the illumination of each part, using a constant and It is expressed as, that is, it is independent of the viewing angle and the light vectors v and l. Therefore, the illumination L of the pixel P depends only on the proportion of each part in the pixel, which is expressed as and express:

[0134]

[0135] See also Figure 5(a) to Figure 5(d) , the illumination calculation method of the forest area modeled by the Strahler model using an ellipsoid (Figure 5(a)) is as follows: the visible area in a pixel is divided into four parts: the sunlit ground, the shadowed ground, the sunlit tree crown, and the shadowed tree crown and As shown in Figure 5(b), the weighted sum of the four parts is the overall illumination. and In this case, spherical trees on the horizontal ground are obtained by vertical scaling (Figure 5(c)) and rotation (Figure 5(d)).

[0136] because Just calculate the ratio of each of the 4 parts, which depends on v, l, n, Λ, A, h and b.

[0137] The Strahler model is implemented as follows: first a vertical scaling operation with a ratio of 2 / h is used to obtain a spherical tree, and then a rotation R is used to make the transformed normal RS -1 n becomes vertical. These transformations do not change and their respective proportions and simplify to the case of a spherical tree on horizontal ground. Specifically, this shows that k * The function (v,l,n,Λ,A,h,b) does not have 10 independent parameters, but only 6, namely and β:

[0138]

[0139]

[0140]

[0141]

[0142]

[0143] The proportion of visible ground in the Strahler model Equal to exp(-λP(θ v )), where (P(θ v )=Asecθ v is the average area of ​​the shadow of a scaled tree on the ground in the line of sight. equal where O is the average overlap between the tree's projection on the ground in the direction of sight and the direction of the sun. The model also proposes an approximate analytical model to calculate O. Finally, the model proposes an approximate analytical model to calculate the relative proportion of the visible canopy that is illuminated by sunlight: The calculation is simple for a single tree, but slightly more complicated when trees occlude each other. Formula (7) can be used to complete the solution.

[0144] The Strahler model can reproduce the reflectivity related to the viewing angle and slope, as well as the highlight effect of multiple trees. However, the opaque ellipsoid cannot express the effects caused by the lighting inside the tree: the highlights of the leaves, the silver edges. Moreover, this model cannot express the effects of sky lighting. This model is extended to include arbitrary isotropic tree distribution, realistic tree shape, and each P *After using different illumination levels within the scene, translucent models, and sky lighting, this application is able to express all lighting effects in a consistent way with the foreground trees.

[0145] Based on this, in order to further improve the effectiveness and reliability of distant tree rendering in real-time rendering of virtual forest scenes, see Figure 2 , step 300 of the virtual forest scene real-time rendering method specifically includes the following contents:

[0146] Step 310: Draw the distant tree as a disk on the overlay map tile, and then apply it to the height map, and based on the Strahler model that introduces four average values, use a perspective and lighting-related shader to reconstruct the color of each screen pixel, and calculate the pixel segmentation ratio and corresponding illuminance related to each line of sight value and light to complete the rendering and lighting processing of the distant tree in the current picture; wherein the four average values ​​include: the average value on the visible and sunlit ground, the average value on the visible ground, the average value on the visible trees illuminated by the sun, and the average value on the visible trees.

[0147] To ensure scalability in memory and performance, the application uses a shader (modulated by a terrain map) to render the furthest trees. The terrain map stores the ratio of trees to the ground from a top-down perspective (constructed by rendering trees as tiny disks). Based on this terrain map, the application uses a forest shader to reconstruct the color of each screen pixel, calculating 4 line-of-sight-related pixel segmentation ratios. and and the corresponding illuminance and Refer to the idea of ​​Strahler model. In fact, this application reanalyzes and expands the previous model to consider arbitrary isotropic tree distribution, real tree shape, tree internal lighting and sky lighting.

[0148] The Strahler model requires that the illumination of the ground and trees in sunlight or shadow is constant, which is not sufficient for computer graphics applications. Moreover, this application needs to ensure a consistent and continuous transition with the detailed illumination model of the foreground trees, and requires that the perspective and illumination are related. To this end, this application introduces four values:

[0149] (1) On the visible and sunlit ground I g (x) Average value.

[0150] (2) On the visible ground J on g(x) Average value.

[0151] (3) In the visible trees illuminated by sunlight I g (p v )average value.

[0152] (4) In the visible trees J on g (p v )average value.

[0153] At the same time, redefine: The same definition is applied to trees. Then the reconstructed pixel illumination in formula 1 becomes:

[0154]

[0155] The following describes in detail how to use (v, l, n, Λ h (x),τ,p,ρ,r) and other calculations and Assume that many trees are projected onto one pixel. Regarding the case where the apparent size of a tree is about 1 pixel, this application will discuss it in subsequent embodiments.

[0156] The Strahler model is used to calculate k g and , this theory is used: that is, random two-dimensional shapes with average area P (i.e., the projection of the tree on the ground) are distributed with mean λ according to the Poisson theory, so that a part of the plane f=exp(-λP) is not covered. However, this equation no longer holds for other tree distribution patterns. For example, when the shape is contained within a disk, then the case of the Poisson disk distribution is f=1-λP. In addition, f usually depends on the specific shape under consideration. Therefore, in order to support arbitrary isotropic tree distributions and realistic tree shapes, the present application replaces their analytical model with a pre-computed table. To this end, the present application renders a forest block using the near-view tree rendering method of the present application, scales it vertically by 2 / h times, and measures and k for multiple values ​​of λ g This application stores the results in a four-dimensional table At runtime, this application calculates:

[0157]

[0158]

[0159] Where λ = Δ h (x)u(S -1n).u z .

[0160] The Strahler model calculates the relative proportion of sunlight area in the visible tree canopy When using a binary test (whether it is illuminated by sunlight or not), the disadvantage is that it is only effective for opaque objects. In order to present the self-shadow and silver edge effects inside the tree, this application uses an exponential decay term exp(-τ∥p l -p v ∥) replace this binary test, and then measure multiple views and tree density as described above The values ​​are stored in a four-dimensional table. The following calculations are done at runtime:

[0161]

[0162] The solar component of the visible ground lighting illuminated by the sun Formula 11 is The average value on , where V(x) = 1. Assume that the ground BRDF value r is independent of the distribution of trees, so it is or entire pixel The average values ​​are the same, and this application obtains For a Lambertian surface, this can be approximated by:

[0163]

[0164] in and is the average of the ground reflectance and normal vector in the pixel.

[0165] Sky component of visible ground lighting Formula 12 is and In order to calculate This application first needs to calculate the ambient occlusion δ g . Approximate calculation of δ g The method is: the average ambient occlusion of the trees on the ground, multiplied by the ambient occlusion of the inclined ground, (1+nu z ) / 2, we get:

[0166]

[0167] The results of the precomputed integrals are stored in a one-dimensional table Returning to the remaining terms in formula 12, this application needs to calculate Δ(x) in The average value on the pixel is approximated by the average value on the entire pixel, which is 1. The application finally uses its average value Substituting r, we get for a Lambert ground:

[0168]

[0169] For tree lighting, the solar component of the lighting for visible trees illuminated by the sun Formula 7 is The average value on The only dependent term in this equation is the exponential decay term introduced above, but it has been Other items are considered in The above is a constant, so we have:

[0170]

[0171] Finally, the sky component of the tree lighting is visible Formula 9 is The only dependent In this equation, δ v / (1+d 2 Λ h / 4). This application is rendered The occluded trees are pre-computed as the average over the visible tree area. and Similarly, this application stores the results in a two-dimensional table At runtime, this application performs the following calculations:

[0172]

[0173] If you suddenly switch from near-foreground tree rendering to the shader-mapped model, the transition will be very noticeable. There are several reasons for this: First, near-foreground tree rendering loses visual fidelity at long distances: the length calculated using the iterative algorithm of this application || p l -p v|| becomes very inaccurate because it is calculated on a very coarse MIP-mapped depth map. Moreover, the exponent of this "average" length (i.e. the exponential average over the visible tree pixels) is not what this application needs. Cascaded shadow maps and occlusion effects also become inaccurate at this distance. Second, while the positions of the trees are accurately matched between the two models, the 4 color components of this application (trees and ground, illuminated and unilluminated) are based on statistical calculations and therefore cannot match a given tree. This produces visible color discontinuities during transitions. Third, the shader mapping model of this application ignores forest thickness. Even if this application uses it when the tree size reaches 3 pixels high, it will produce a flickering effect on the terrain outline. To address these issues, this application proposes a seamless transition scheme, which is divided into three parts: the transition within each of the two expression methods, and the transition between them. The specific instructions are as follows:

[0174] Based on this, in order to further improve the effectiveness and reliability of the internal transition of the near-view tree in the real-time rendering of the virtual forest scene, see Figure 2 The method for real-time rendering of a virtual forest scene further specifically includes the following contents after step 300:

[0175] Step 400: If a trigger instruction for internal transition of a foreground tree is detected, the direct sunlight, direct sky illumination, sunlight reflected by the ground and sky illumination at the intersection are controlled to transition to their respective expected average values.

[0176] Although the light I t (P v ),J t (P v ),I g (x),J g (x) becomes imprecise at distances, but we know what these values ​​will converge to, so to solve the problem, we simply force them to converge to their expected average. Specifically, if s is the distance to the observer, s max is the maximum distance represented by near-view tree rendering, so this application uses the following formula to render trees and the ground:

[0177]

[0178]

[0179]

[0180]

[0181] in

[0182] In order to further improve the effectiveness and reliability of the internal transition of distant trees in real-time rendering of virtual forest scenes, see Figure 2 The method for real-time rendering of a virtual forest scene further specifically includes the following contents after step 300:

[0183] Step 500: If a trigger instruction for the internal transition of the distant tree is detected, the shader is controlled to color the disk corresponding to the distant tree in the coverage channel using the illumination component of the distant tree, and to color the ground between each of the disks using the ground component.

[0184] So far, this application has only been applied to the forest model component and The rough density Λ is used in h (x) can only give an average forest illumination value, which cannot match the spatial variation obtained by the near-view tree rendering model during the transition. Therefore, this application needs to use only the tree illumination component when shading the tree disk in the coverage channel Γ(x), and only the ground component between them. That is, when Γ(x) = 1, To this end, this application only needs to replace Λ in Formula 14 and Formula 15 h (x) is replaced by Γ(x) / A. For very distant trees (Γ(x) = Λ h (x) / A), replace Λ h The (x) value does not actually change anything, but for the visible interior of the disk, we get In this application, ensure Under the premise of , the requirements can be met.

[0185] In order to further improve the effectiveness and reliability of the transition between near and far trees in real-time rendering of virtual forest scenes, see Figure 2 The method for real-time rendering of a virtual forest scene further specifically includes the following contents after step 300:

[0186] Step 600: If a trigger instruction for the transition from the near-view tree to the far-view tree is detected, the opacity is multiplied by 1, and the ground lighting in the transition area between the near-view tree and the far-view tree is replaced by forest lighting.

[0187] In order to avoid flickering effects on the terrain contours, this application needs to gradually fade the trees (near-view trees) rendered in depth buffer mode. This application uses opacity α v Multiply by l, that is, smoothstep(0.8,l,s / smax), and replace the ground lighting in this transition area with the forest lighting of this application, and modify it as follows:

[0188]

[0189]

[0190] In order to further illustrate the technical effects of the real-time rendering method of a virtual forest scene provided by the above-mentioned embodiment of the present application, the present application also provides an application example of the specific implementation process of the above-mentioned real-time rendering method of a virtual forest scene, which only requires the use of conventional GPU functions such as geometry shaders, transform feedback, sub-pixel coverage masks, etc.

[0191] The process of generating tree seeds must remove points from a precomputed point stream and store the results in a VBO buffer. This application uses geometry shaders and transform feedback to achieve this step in one step. When generating overlay tiles, tiny disks must be drawn in the texture. This application uses geometry shaders to generate billboards from tree seeds. This application uses geometry shaders to complete the drawing of cascaded shadow maps in one step, selecting the shadow map layer for each tree. Finally, a geometry shader is used to cull trees outside the view frustum and generate camera-facing proxy quads for other trees.

[0192] Generally speaking, rendering transparent objects requires sorting, which is very expensive and sometimes even impossible. One way to avoid this is to replace opacity with a sub-pixel coverage mask. OpenGL's alpha to coverage feature can do this automatically, but it always converts a given transparency at a given pixel position into the same coverage mask. This feature results in: when n trees with similar transparency α are projected onto a pixel, the final opacity value is still α, not 1-(1-α) n , because the transformation is not dependent on the position of the tree. This results in low opacity and discontinuities in the transition between the two models. To solve this problem, the application forces each tree to have a different coverage mask. The application precomputes a combination table that associates several possible coverage masks for each alpha value, and selects a combination at render time using the tree seed.

[0193] One limitation of the approach proposed is the size of the near view render tree data: 45MB per tree model. Therefore, the number of models that can be used simultaneously in a given view is limited. For the same reason, the trees cannot be animated. On the other hand, it is feasible to add a normal per pixel in each pre-computed view (each model would take up 79MB).

[0194] This will enable the application to use a more realistic specular BRDF effect for the leaves of the nearest trees.

[0195] For a given tree model, tree height-to-width ratio h, tree distribution rule and leaf density τ, four tables can be pre-calculated: The file size is small (131kB in total), and multiple versions can be easily used to support spatially varying tree distribution rules or leaf density (the color of spatially varying trees can be ignored because ρ and p are not used in the precomputed data). Similarly, the aspect ratio h of spatially varying trees can also be easily applied by adding this parameter to the 1D and 2D tables. (four-dimensional table remain unchanged since they are computed on the rescaled tree). Support for anisotropic tree distributions is also possible, by adding one or two angle parameters to each table.

[0196] See also Figure 6(a) to Figure 6(c) ,The results of real-time rendering using the method of this application show a large forest scene under different viewing distances, tree densities and lighting conditions.

[0197] In summary, the present application proposes a new method for rendering very large forest scenes, including all views from near to far. The present application uses two new methods for rendering trees, one for near-view trees and one for distant trees. For nearby trees, the present application uses a new near-view tree rendering method, which is an extension of the pre-computed depth map method and can handle parallax and local and global illumination effects. For distant trees, the present application uses a shader mapping method, which is an extension of Strahler's model and can handle arbitrary isotropic tree distributions, realistic tree shapes, internal tree lighting, and sky lighting effects. The present application also proposes a method for seamless transition between the two methods. The method of the present application can achieve efficient rendering of very large forest scenes on the GPU.

[0198] From the software level, the present application also provides a virtual forest scene real-time rendering device for executing all or part of the virtual forest scene real-time rendering method, see Figure 7 The virtual forest scene real-time rendering device specifically includes the following contents:

[0199] The initial processing module 10 is used to generate seed nodes for representing performance parameters of a single tree and overlay map tiles for representing density channels of each tree species according to the custom configuration parameters for the virtual forest scene, and render the terrain corresponding to the virtual forest scene and the foreground trees in the current picture of the virtual forest scene into a cascade shadow map based on the seed nodes, so as to use the cascade shadow map to represent the shadows of the foreground trees;

[0200] The near-view tree rendering module 20 is used to render the near-view tree using a preset near-view tree rendering method and a tree species 3D mesh model, and perform lighting processing on the near-view tree.

[0201] The distant tree rendering module 30 is used to apply the coverage map tiles and the shader map to render the distant tree in the current picture, and perform lighting processing on the distant tree.

[0202] The embodiment of the real-time rendering device for a virtual forest scene provided in the present application can be specifically used to execute the processing flow of the embodiment of the real-time rendering method for a virtual forest scene in the above-mentioned embodiment. Its functions will not be repeated here, and reference can be made to the detailed description of the embodiment of the real-time rendering method for a virtual forest scene.

[0203] The part of the virtual forest scene real-time rendering device that performs the virtual forest scene real-time rendering can be executed in the server or completed in the client device. The specific selection can be made according to the processing capability of the client device and the limitations of the user's usage scenario. This application does not limit this. If all operations are completed in the client device, the client device may also include a processor for specific processing of the virtual forest scene real-time rendering.

[0204] The client device may have a communication module (i.e., a communication unit) that can communicate with a remote server to achieve data transmission with the server. The server may include a server on the task scheduling center side, and other implementation scenarios may also include a server on an intermediate platform, such as a server on a third-party server platform that has a communication link with the task scheduling center server. The server may include a single computer device, or a server cluster consisting of multiple servers, or a server structure of a distributed device.

[0205] The server and the client device may communicate with each other using any suitable network protocol, including network protocols that have not yet been developed on the date of filing this application. The network protocols may include, for example, TCP / IP, UDP / IP, HTTP, HTTPS, etc. Of course, the network protocols may also include, for example, RPC (Remote Procedure Call Protocol) and REST (Representational State Transfer) protocols used on top of the above protocols.

[0206] From the above description, it can be seen that the real-time rendering device of the virtual forest scene provided in the embodiment of the present application can effectively reduce the resources and computational complexity required for rendering, realize real-time and realistic rendering and lighting processing of forest scenes at different distances, ensure the rendering effect, and can eliminate jagged or flickering effects in the scene, and can effectively improve the consistency of lighting at various scales in the virtual forest scene.

[0207] The embodiment of the present application also provides an electronic device, which may include a processor, a memory, a receiver and a transmitter, wherein the processor is used to execute the real-time rendering method of the virtual forest scene mentioned in the above embodiment, wherein the processor and the memory may be connected via a bus or other means, such as by bus connection. The receiver may be connected to the processor and the memory via wired or wireless means.

[0208] The processor may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.

[0209] As a non-transient computer-readable storage medium, the memory can be used to store non-transient software programs, non-transient computer executable programs and modules, such as program instructions / modules corresponding to the method for real-time rendering of a virtual forest scene in the embodiment of the present application. The processor executes various functional applications and data processing of the processor by running the non-transient software programs, instructions and modules stored in the memory, that is, the method for real-time rendering of a virtual forest scene in the above method embodiment is implemented.

[0210] The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the processor, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0211] The one or more modules are stored in the memory, and when executed by the processor, the real-time rendering method of the virtual forest scene in the embodiment is executed.

[0212] In some embodiments of the present application, the user equipment may include a processor, a memory, and a transceiver unit, which may include a receiver and a transmitter. The processor, memory, receiver, and transmitter may be connected through a bus system. The memory is used to store computer instructions, and the processor is used to execute the computer instructions stored in the memory to control the transceiver unit to send and receive signals.

[0213] As an implementation method, the functions of the receiver and the transmitter in the present application can be considered to be implemented through a transceiver circuit or a dedicated chip for transceiver, and the processor can be considered to be implemented through a dedicated processing chip, a processing circuit or a general chip.

[0214] As another implementation method, it is possible to use a general-purpose computer to implement the server provided in the embodiment of the present application, that is, to store the program code for implementing the functions of the processor, receiver, and transmitter in a memory, and the general-purpose processor implements the functions of the processor, receiver, and transmitter by executing the code in the memory.

[0215] The embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the aforementioned virtual forest scene real-time rendering method are implemented. The computer-readable storage medium can be a tangible storage medium, such as a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a floppy disk, a hard disk, a removable storage disk, a CD-ROM, or any other form of storage medium known in the technical field.

[0216] It should be understood by those skilled in the art that the exemplary components, systems and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software or a combination of the two. Whether it is specifically performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier.

[0217] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.

[0218] In this application, the features described and / or illustrated for one embodiment may be used in the same manner or in a similar manner in one or more other embodiments, and / or combined with or replace the features of other embodiments.

[0219] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the embodiments of the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for real-time rendering of a virtual forest scene, characterized in that: include: Generate seed nodes for representing performance parameters of a single tree and overlay map tiles for representing density channels of each tree species according to custom configuration parameters for the virtual forest scene, and render terrain corresponding to the virtual forest scene and foreground trees in a current screen of the virtual forest scene into a cascade shadow map based on the seed nodes, so as to use the cascade shadow map to represent shadows of the foreground trees; Applying a preset foreground tree rendering method and a tree species 3D mesh model to render the foreground tree, and performing lighting processing on the foreground tree; and, applying the overlay map tiles and the shader map to render the distant trees in the current picture, and performing lighting processing on the distant trees; The custom configuration parameters include: a height map, a tree density map, a point distribution model, and at least one tree species 3D grid model corresponding to each tree species for the virtual forest scene; Correspondingly, the seed nodes for representing the performance parameters of a single tree and the coverage map tiles for representing the density channel of each tree species are generated according to the custom configuration parameters for the virtual forest scene, including: Inputting a height map, a tree density map, a point distribution model, and at least one tree species 3D mesh model corresponding to each tree species for a virtual forest scene into a dynamic quadtree composed of visible quadrilateral regions on a CPU to generate a seed node for representing a performance parameter of a single tree and a coverage map tile for representing a density channel of each tree species, wherein the performance parameters include: 3D position parameters, species parameters, rotation parameters, scaling parameters, and color parameters; storing the seed nodes and coverage map tiles in different caches of the GPU respectively; The method of applying a preset foreground tree rendering method and a tree species 3D mesh model to render the foreground tree includes: Pre-calculating each of the tree species 3D grid models to obtain a corresponding depth map, and each texel corresponding to each of the depth maps includes: minimum depth, maximum depth, ambient occlusion and opacity; Using a camera-facing proxy quadrilateral to render each foreground tree, and using the depth map to iteratively reconstruct the intersection of each line of sight corresponding to each of the proxy quadrilaterals with the foreground tree, the incident point of the light reaching the intersection, and the opacity and ambient occlusion at the intersection; The performing illumination processing on the foreground tree includes: estimating direct solar insolation at the intersection point using exponential decay; estimating direct sky lighting at the intersection based on pre-computed ambient occlusion of a single foreground tree and ambient occlusion on a cylindrical hole axis surrounding the tree of an approximate environment; The average ambient occlusion caused by the foreground tree is adjusted to increase the contrast near the foreground tree, and the sunlight reflected by the ground and the sky illumination are calculated; The applying the overlay map tiles and the shader map to render the distant tree in the current picture, and performing lighting processing on the distant tree, includes: The distant tree is drawn as a disk on the overlay map tile, and then applied to the height map, and based on the Strahler model that introduces four average values, the color of each screen pixel is reconstructed using a view and lighting related shader, and the pixel segmentation ratio and corresponding illumination related to each sight value and light are calculated to complete the rendering and lighting processing of the distant tree in the current picture; The four average values ​​include: an average value on the visible and sunlit ground, an average value on the visible ground, an average value on the visible trees illuminated by the sun, and an average value on the visible trees.

2. The method for real-time rendering of a virtual forest scene according to claim 1, characterized in that: Also includes: If a trigger instruction for internal transition of a foreground tree is detected, the direct sunlight, direct sky illumination, sunlight reflected by the ground and sky illumination at the intersection are controlled to transition to their respective expected average values.

3. The real-time rendering method of a virtual forest scene according to claim 1, characterized in that: Also includes: If a trigger instruction of a transition within a distant tree is detected, the shader is controlled to color the disk corresponding to the distant tree in the coverage channel using the illumination component of the distant tree, and to color the ground between the disks using the ground component.

4. The method for real-time rendering of a virtual forest scene according to claim 1, characterized in that: Also includes: If a trigger instruction for the transition from the near-view tree to the far-view tree is detected, the opacity is multiplied by 1, and the ground lighting in the transition area between the near-view tree and the far-view tree is replaced by forest lighting.

5. A real-time rendering device for a virtual forest scene, characterized in that: include: An initial processing module, for generating seed nodes for representing performance parameters of a single tree and overlay map tiles for representing density channels of each tree species according to custom configuration parameters for the virtual forest scene, and rendering terrain corresponding to the virtual forest scene and foreground trees in a current screen of the virtual forest scene into a cascade shadow map based on the seed nodes, so as to use the cascade shadow map to represent shadows of the foreground trees; A near-foreground tree rendering module, used to render the near-foreground tree using a preset near-foreground tree rendering method and a tree species 3D mesh model, and perform lighting processing on the near-foreground tree; A distant tree rendering module, used for applying the overlay map tiles and the shader map to render the distant tree in the current picture, and performing lighting processing on the distant tree; The custom configuration parameters include: a height map, a tree density map, a point distribution model, and at least one tree species 3D grid model corresponding to each tree species for the virtual forest scene; Correspondingly, the seed nodes for representing the performance parameters of a single tree and the coverage map tiles for representing the density channel of each tree species are generated according to the custom configuration parameters for the virtual forest scene, including: Inputting a height map, a tree density map, a point distribution model, and at least one tree species 3D mesh model corresponding to each tree species for a virtual forest scene into a dynamic quadtree composed of visible quadrilateral regions on a CPU to generate a seed node for representing a performance parameter of a single tree and a coverage map tile for representing a density channel of each tree species, wherein the performance parameters include: 3D position parameters, species parameters, rotation parameters, scaling parameters, and color parameters; storing the seed nodes and coverage map tiles in different caches of the GPU respectively; The method of applying a preset foreground tree rendering method and a tree species 3D mesh model to render the foreground tree includes: Pre-calculating each of the tree species 3D grid models to obtain a corresponding depth map, and each texel corresponding to each of the depth maps includes: minimum depth, maximum depth, ambient occlusion and opacity; Using a camera-facing proxy quadrilateral to render each foreground tree, and using the depth map to iteratively reconstruct the intersection of each line of sight corresponding to each of the proxy quadrilaterals with the foreground tree, the incident point of the light reaching the intersection, and the opacity and ambient occlusion at the intersection; The performing illumination processing on the foreground tree includes: estimating direct solar insolation at the intersection point using exponential decay; estimating direct sky lighting at the intersection based on pre-computed ambient occlusion of a single foreground tree and ambient occlusion on a cylindrical hole axis surrounding the tree of an approximate environment; The average ambient occlusion caused by the foreground tree is adjusted to increase the contrast near the foreground tree, and the sunlight reflected by the ground and the sky illumination are calculated; The applying the overlay map tiles and the shader map to render the distant tree in the current picture, and performing lighting processing on the distant tree, includes: The distant tree is drawn as a disk on the overlay map tile, and then applied to the height map, and based on the Strahler model that introduces four average values, the color of each screen pixel is reconstructed using a view and lighting related shader, and the pixel segmentation ratio and corresponding illumination related to each sight value and light are calculated to complete the rendering and lighting processing of the distant tree in the current picture; The four average values ​​include: an average value on the visible and sunlit ground, an average value on the visible ground, an average value on the visible trees illuminated by the sun, and an average value on the visible trees.

6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the computer program, the real-time rendering method for a virtual forest scene according to any one of claims 1 to 4 is implemented.