Method, device, storage medium and electronic device for rendering virtual natural landscape

By determining the coverage area on the virtual vegetation model using the normal direction and coverage direction, and combining the transition processing of the base color map and normal map, the problem of high performance consumption in virtual natural landscape rendering methods is solved, and the flexibility and reusability are improved.

CN116212370BActive Publication Date: 2026-04-17NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NETEASE (HANGZHOU) NETWORK CO LTD
Filing Date
2022-12-29
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing methods for rendering virtual natural landscapes are resource-intensive, lack flexibility and reusability, and are difficult to effectively control the rendering area and range.

Method used

The coverage area is determined by the normal direction of the virtual vegetation model in the game scene and the coverage direction of the virtual natural landscape. The transition is performed by combining the base color map and the normal map, and the virtual natural landscape is rendered on the virtual vegetation model using the thickness information.

Benefits of technology

This reduces the performance overhead of rendering virtual natural landscapes on virtual vegetation models and improves the flexibility and reusability of the rendering process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116212370B_ABST
    Figure CN116212370B_ABST
Patent Text Reader

Abstract

The application discloses a method and device for rendering a virtual natural landscape, a storage medium and an electronic device. The method comprises the following steps: determining a first coverage range of the virtual natural landscape by using a first direction and a second direction, wherein the first direction is a normal direction of a virtual vegetation model in a game scene, and the second direction is a coverage direction of the virtual natural landscape to the virtual vegetation model; determining thickness information of the virtual natural landscape based on the first coverage range and the second direction; performing transition processing on a first map and a second map by using the first coverage range to obtain a processing result, wherein the first map is a base color map of the virtual natural landscape, and the second map is a normal map of the virtual natural landscape; and rendering the virtual natural landscape on the virtual vegetation model by using the thickness information, the first coverage range and the processing result. The application solves the technical problem of a virtual natural landscape rendering method provided in the related art, which has large performance consumption, poor rendering flexibility and poor reusability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and more specifically, to a method, apparatus, storage medium, and electronic device for rendering virtual natural landscapes. Background Technology

[0002] In virtual game scenes, rendering realistic natural landscapes (such as frost and snow) can enhance the realism and expressiveness of the scene. However, rendering realistic natural landscapes usually requires significant performance overhead. This is especially true when rendering virtual natural landscapes onto virtual vegetation surfaces, which demands substantial device performance.

[0003] In related technologies, the rendering effect of the natural landscape is usually achieved by modifying the background texture of the natural landscape to be rendered, and then manually adding a preset landscape texture to the area of ​​the natural landscape to be rendered in the background texture. However, this method has the drawbacks of being complex, labor-intensive, and having poor reusability, and it is difficult to control the rendering degree and rendering range of the area to be rendered.

[0004] There is currently no effective solution to the above problems.

[0005] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this application, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0006] At least some embodiments of this application provide a method, apparatus, storage medium, and electronic device for rendering virtual natural landscapes, so as to at least solve the technical problems of high performance consumption, poor rendering flexibility, and poor reusability of virtual natural landscape rendering methods provided in the related art.

[0007] According to one embodiment of this application, a method for rendering a virtual natural landscape is provided, comprising: determining a first coverage area of ​​the virtual natural landscape using a first direction and a second direction, wherein the first direction is the normal direction of a virtual vegetation model in a game scene, and the second direction is the coverage direction of the virtual natural landscape on the virtual vegetation model; determining thickness information of the virtual natural landscape based on the first coverage area and the second direction; performing transition processing on a first texture and a second texture using the first coverage area to obtain a processing result, wherein the first texture is a base color texture of the virtual natural landscape, and the second texture is a normal texture of the virtual natural landscape; and rendering the virtual natural landscape on the virtual vegetation model using the thickness information, the first coverage area, and the processing result.

[0008] According to one embodiment of this application, an apparatus for rendering a virtual natural landscape is also provided, comprising: a first determining module, configured to determine a first coverage area of ​​the virtual natural landscape using a first direction and a second direction, wherein the first direction is the normal direction of a virtual vegetation model in a game scene, and the second direction is the coverage direction of the virtual natural landscape over the virtual vegetation model; a second determining module, configured to determine thickness information of the virtual natural landscape based on the second direction; a processing module, configured to perform transition processing on a first texture and a second texture using the first coverage area to obtain a processing result, wherein the first texture is a base color texture of the virtual natural landscape, and the second texture is a normal texture of the virtual natural landscape; and a rendering module, configured to render the virtual natural landscape on the virtual vegetation model using the thickness information, the first coverage area, and the processing result.

[0009] According to one embodiment of this application, a computer-readable storage medium is also provided, in which a computer program is stored, wherein the computer program is configured to execute the method for rendering a virtual natural landscape as described above when running.

[0010] According to one embodiment of this application, an electronic device is also provided, comprising: a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the method of rendering a virtual natural landscape as described above.

[0011] In at least some embodiments of this application, a first coverage area of ​​the virtual natural landscape is determined using a first direction and a second direction. The first direction is the normal direction of the virtual vegetation model in the game scene, and the second direction is the coverage direction of the virtual natural landscape on the virtual vegetation model. Based on the first coverage area and the second direction, the thickness information of the virtual natural landscape is determined. Furthermore, the first texture and the second texture are subjected to transition processing through the first coverage area to obtain a processing result. The first texture is the base color texture of the virtual natural landscape, and the second texture is the normal texture of the virtual natural landscape. By utilizing the thickness information, the first coverage area, and the processing result, the virtual natural landscape is rendered on the virtual vegetation model, achieving the goal of rendering the virtual natural landscape on the virtual vegetation model at a lower cost. This achieves the technical effect of reducing the performance consumption of rendering the virtual natural landscape on the virtual fabrication model while improving the flexibility and reusability of the rendering process, thereby solving the technical problems of high performance consumption, poor rendering flexibility, and poor reusability of the virtual natural landscape rendering methods provided in related technologies. Attached Figure Description

[0012] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0013] Figure 1 This is a hardware structure block diagram of a mobile terminal for a method of rendering virtual natural landscapes according to one embodiment of this application.

[0014] Figure 2 This is a flowchart of a method for rendering a virtual natural landscape according to one embodiment of this application;

[0015] Figure 3 This is a schematic diagram of an optional snow cover area on a vegetation surface according to one embodiment of this application;

[0016] Figure 4 This is a schematic diagram of a base color map of a snow layer according to one embodiment of this application;

[0017] Figure 5 This is a schematic diagram of a normal map of a snow layer according to one embodiment of this application;

[0018] Figure 6 This is a schematic diagram of a noise map according to one embodiment of this application;

[0019] Figure 7 This is a structural block diagram of an apparatus for rendering virtual natural landscapes according to one embodiment of this application;

[0020] Figure 8 This is a schematic diagram of an electronic device according to one embodiment of this application. Detailed Implementation

[0021] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0022] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0023] It should be noted that, in the specification of this application, the word "for example" is used to mean "used as an example, illustration, or description." Any embodiment described as "for example" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use this application. In the following description, details are set forth for purposes of explanation. It should be understood that those skilled in the art will recognize that this application can be made without using these specific details. In other instances, well-known structures and processes will not be described in detail to avoid unnecessarily obscuring the description of this application. Therefore, this application is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed in this application.

[0024] The rendering of virtual natural landscapes (such as frost and snow) on the surface of virtual vegetation models is an important part of scene representation in realistic games. Because the trunks (especially the leaves) of virtual vegetation models heavily utilize inlaid transparent textures and often need to consider wind effects that interact with virtual characters, the rendering performance of virtual vegetation models is typically quite high. How to render virtual natural landscapes on virtual vegetation models despite their high rendering performance has become a significant challenge in the relevant technical field.

[0025] In one possible implementation of this application, the inventors, after practice and careful research, found that the method commonly used in computer technology involving the rendering of virtual natural landscapes, which relies on manual modification of the background texture of the natural landscape to be rendered, still suffers from technical problems such as complex processes, large workload, poor reusability, and low flexibility. Therefore, the application scenario of this application can be a scenario involving the rendering of virtual natural landscapes in the field of computer technology, especially in the field of video games. The game types included in the aforementioned field of video games can be action, adventure, simulation, role-playing, and casual games, etc.

[0026] This application proposes a method for rendering virtual natural landscapes. It employs a base color map and normal map based on the virtual natural landscape, and utilizes the normal direction of the virtual vegetation model in the game scene and the coverage direction of the virtual natural landscape on the virtual vegetation model to render the virtual natural landscape. This technical concept reduces the performance consumption of rendering virtual natural landscapes on virtual fabrication models while improving the flexibility and reusability of the rendering process. It thus solves the technical problems of high performance consumption, poor rendering flexibility and reusability of virtual natural landscape rendering methods provided in related technologies.

[0027] The methods described in this application can be executed in a terminal device (e.g., a mobile terminal, a computer terminal, or a similar computing device). Taking a mobile terminal as an example, the mobile terminal can be a smartphone, tablet computer, PDA, mobile internet device, PAD, game console, or other terminal device.

[0028] Figure 1 This is a hardware structure block diagram of a mobile terminal for a method of rendering virtual natural landscapes according to one embodiment of this application. Figure 1 As shown, a mobile terminal may include one or more ( Figure 1 (Only one is shown) Processor 102, memory 104, transmission device 106, input / output device 108, and display device 110. Taking the method of rendering virtual natural landscapes applied to a video game scene via this mobile terminal as an example, processor 102 calls and runs the computer program stored in memory 104 to execute the method of rendering virtual natural landscapes. The virtual natural landscape on the rendered virtual vegetation model is transmitted to input / output device 108 and / or display device 110 through transmission device 106, thereby providing the virtual natural landscape to the player.

[0029] Still as Figure 1 As shown, the processor 102 may include, but is not limited to, processing devices such as: Central Processing Unit (CPU), Graphics Processing Unit (GPU), Digital Signal Processing (DSP) chip, Microcontroller Unit (MCU), Field Programmable Gate Array (FPGA), Neural-Network Processing Unit (NPU), Tensor Processing Unit (TPU), Artificial Intelligence (AI) type processor, etc.

[0030] Those skilled in the art will understand that Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.

[0031] In some optional embodiments primarily focused on gaming scenarios, the aforementioned terminal device may also provide a human-computer interaction interface with a touch-sensitive surface. This interface can sense finger contact and / or gestures to interact with a graphical user interface (GUI). The human-computer interaction functions may include the following: creating web pages, drawing, word processing, creating electronic documents, playing games, video conferencing, instant messaging, sending and receiving emails, call interfaces, playing digital videos, playing digital music, and / or web browsing, etc. Executable instructions for performing the aforementioned human-computer interaction functions are configured / stored in one or more processor-executable computer program products or readable storage media.

[0032] The methods described in this application can also be executed on a server. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. Taking the method of rendering virtual natural landscapes applied to a video game scene via a video game server as an example, the video game server can render virtual natural landscapes on a virtual vegetation model based on this method and provide the virtual natural landscapes to the player (e.g., by rendering and displaying them on the player's terminal screen, or by providing them to the player through holographic projection, etc.).

[0033] According to one embodiment of this application, an embodiment of a method for rendering virtual natural landscapes is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0034] This embodiment provides a method for rendering virtual natural landscapes that runs on the aforementioned mobile terminal. Figure 2 This is a flowchart of a method for rendering a virtual natural landscape according to one embodiment of this application, such as... Figure 2 As shown, the method includes the following steps:

[0035] Step S21: Determine the first coverage area of ​​the virtual natural landscape using the first direction and the second direction, wherein the first direction is the normal direction of the virtual vegetation model in the game scene, and the second direction is the coverage direction of the virtual natural landscape on the virtual vegetation model.

[0036] The aforementioned game scene can be a virtual game scene displaying virtual natural landscapes. The game type corresponding to this game scene can be: action (e.g., first-person or third-person shooter games, 2D or 3D fighting games, war action games, and sports action games), adventure (e.g., exploration games, collection games, puzzle games), simulation (e.g., simulation sandbox games, simulation management games, strategy simulation games, city building simulation games, business simulation games), role-playing games, and casual (e.g., board games, casual competitive games, music rhythm games, dress-up and simulation games), etc.

[0037] The game scene described above also includes virtual vegetation models, such as trees, shrubs, grass, and flowerbeds. The normal direction of this virtual vegetation model can be used as the first direction mentioned above (which can be represented in vector form). The virtual natural landscapes (such as frost and snow) can be overlaid on this virtual vegetation model. The direction in which the virtual natural landscapes overlay the virtual vegetation model can be used as the second direction mentioned above (which can be represented in vector form).

[0038] The first coverage area of ​​the virtual natural landscape is determined by using the normal direction of the virtual vegetation model in the game scene and the coverage direction of the virtual natural landscape on the virtual vegetation model. This first coverage area is used to render the virtual natural landscape on the virtual vegetation model.

[0039] Step S22: Determine the thickness information of the virtual natural landscape based on the first coverage area and the second direction;

[0040] Based on the aforementioned first coverage area and the coverage direction of the virtual natural landscape on the virtual vegetation model, the thickness information of the virtual natural landscape is determined. For example, this thickness information could be the thickness of the virtual snow model covering the virtual vegetation model.

[0041] Step S23: Through the first coverage area, perform transition processing on the first texture and the second texture to obtain the processing result, wherein the first texture is the base color texture of the virtual natural landscape and the second texture is the normal texture of the virtual natural landscape.

[0042] The first texture map mentioned above is used to determine the rendering color of the virtual natural landscape; this first texture map is the base color texture of the virtual natural landscape. The second texture map mentioned above is used to determine the 3D detail texture of the virtual natural landscape; this second texture map is the normal map of the virtual natural landscape.

[0043] By applying the first coverage area described above, the base color map and normal map of the virtual natural landscape are subjected to transition processing to obtain the processing result. This processing result can be a new blended map.

[0044] Step S24: Using thickness information, first coverage area and processing results, render virtual natural landscape on virtual vegetation model.

[0045] Using the thickness information of the virtual natural landscape, the first coverage area of ​​the virtual natural landscape on the virtual vegetation model, and the processing results, the virtual natural landscape is rendered on the virtual vegetation model.

[0046] It is easy to understand that the method for rendering virtual natural landscapes provided by steps S21 to S24 of this application does not require manual modification of the background texture of the natural landscape to be rendered. Based on the base color texture and normal texture of the virtual natural landscape, the virtual natural landscape is rendered using the normal direction of the virtual vegetation model in the game scene and the coverage direction of the virtual natural landscape on the virtual vegetation model.

[0047] In at least some embodiments of this application, a first coverage area of ​​the virtual natural landscape is determined using a first direction and a second direction. The first direction is the normal direction of the virtual vegetation model in the game scene, and the second direction is the coverage direction of the virtual natural landscape on the virtual vegetation model. Based on the first coverage area and the second direction, the thickness information of the virtual natural landscape is determined. Furthermore, the first texture and the second texture are subjected to transition processing through the first coverage area to obtain a processing result. The first texture is the base color texture of the virtual natural landscape, and the second texture is the normal texture of the virtual natural landscape. By utilizing the thickness information, the first coverage area, and the processing result, the virtual natural landscape is rendered on the virtual vegetation model, achieving the goal of rendering the virtual natural landscape on the virtual vegetation model at a lower cost. This achieves the technical effect of reducing the performance consumption of rendering the virtual natural landscape on the virtual fabrication model while improving the flexibility and reusability of the rendering process, thereby solving the technical problems of high performance consumption, poor rendering flexibility, and poor reusability of the virtual natural landscape rendering methods provided in related technologies.

[0048] The methods described in the embodiments of this application will be further described below.

[0049] Optionally, in step S21, determining the first coverage area of ​​the virtual natural landscape using the first direction and the second direction may include the following steps:

[0050] Step S211: Obtain the angle relationship between the first direction and the second direction;

[0051] Step S211: Determine the first coverage area based on the included angle relationship.

[0052] The angular relationship between the first and second directions mentioned above can include: perpendicular, parallel, and other angular relationships. The specific method for determining the first coverage area based on this angular relationship is as follows: areas where the angular relationship between the virtual vegetation model's normal direction (i.e., the first direction) and the virtual natural landscape's coverage direction of the virtual vegetation model (i.e., the second direction) is perpendicular are determined as areas that do not need to be covered; areas where the angular relationship between the virtual vegetation model's normal direction and the virtual natural landscape's coverage direction of the virtual vegetation model is parallel are determined as areas that need to be covered; using pre-specified parameters, areas where the angular relationship between the virtual vegetation model's normal direction and the virtual natural landscape's coverage direction of the virtual vegetation model is other angular relationships are calculated as areas that need to be covered; and finally, all areas on the surface of the virtual vegetation model that need to be covered are determined as the aforementioned first coverage area.

[0053] The method for rendering virtual natural landscapes provided in this application can be applied to scenarios involving the rendering of virtual natural landscapes in fields such as video games and virtual reality. This method is particularly suitable for scenarios in video games where virtual natural landscapes (such as snow layers) are rendered on virtual vegetation models. The following uses this scenario as an example to further illustrate the technical solution provided in this application.

[0054] In a video game scene where a snow layer is rendered on a virtual vegetation model, the normal direction of the virtual vegetation model (equivalent to the first direction mentioned above) and the coverage direction of the snow layer on the virtual vegetation model (equivalent to the second direction mentioned above) are first obtained, and the angle between the normal direction of the virtual vegetation model and the coverage direction of the snow layer on the virtual vegetation model is determined. Based on this angle relationship, the first coverage area is determined, which is the area to be rendered where the surface of the virtual vegetation model is covered with snow.

[0055] Figure 3 This is a schematic diagram of an optional snow cover area on a vegetation surface according to one embodiment of this application, as shown below. Figure 3 The image shows a cross-sectional view of a tree model covered with snow. Based on the normal direction of the tree model and the direction in which the snow layer covers the data model, it can be seen that... Figure 3 The area corresponding to the black line segment shown is defined as the area that needs to be covered with snow (equivalent to the first coverage area mentioned above).

[0056] Optionally, the virtual vegetation model includes: a virtual trunk model and a virtual branch model. The first direction includes: the trunk normal direction of the virtual trunk model and the branch normal direction of the virtual branch model. In step S211, obtaining the angle relationship between the first direction and the second direction may include the following steps:

[0057] Step S2111: Perform a dot product calculation on the direction of the main trunk normal and the second direction to obtain the first calculation result;

[0058] Step S2112: Convert the branch normal direction from tangent space to world space to obtain the conversion result;

[0059] Step S2113: Perform a dot product calculation on the transformation result and the second direction to obtain the second calculation result;

[0060] Step S2114: Determine the included angle relationship based on the first calculation result and the second calculation result.

[0061] Taking the rendering of a snow layer on a virtual vegetation model in a video game scene as an example, the virtual vegetation model includes a virtual trunk model and a virtual branch model. Correspondingly, the normal direction of the virtual vegetation model (equivalent to the first direction mentioned above) includes the trunk normal direction of the virtual trunk model and the branch normal direction of the virtual branch model.

[0062] The angle between the first and second directions is obtained by multiplying the normal direction of the virtual vegetation model (equivalent to the first direction mentioned above) and the coverage direction of the virtual natural landscape on the virtual vegetation model (equivalent to the second direction mentioned above).

[0063] For example, a virtual tree model includes a trunk model and branch models (including leaf models). When rendering a snow layer on a virtual tree model, the trunk and branch parts can be calculated and rendered separately.

[0064] Specifically, the branches of a virtual vegetation model are typically rendered using inlay textures. Therefore, when rendering a virtual natural landscape on a branch, the normal of that branch needs to be transformed from tangent space to world space first. Then, the normal of the branch is multiplied by the dot product of the virtual natural landscape's coverage direction on that branch, resulting in the second calculation result mentioned above. The trunk of a virtual vegetation model, however, usually does not require a spatial transformation of its normals; the normal of the branch is directly multiplied by the dot product of the virtual natural landscape's coverage direction on that trunk, resulting in the first calculation result mentioned above.

[0065] Based on the first and second calculation results mentioned above, the angular relationship between the normal direction of the virtual vegetation model and the coverage direction of the virtual natural landscape on the virtual vegetation model can be determined.

[0066] Based on the angle relationship between the first and second directions, for a point on the surface of the virtual vegetation model: when the first and second directions are perpendicular, the point is not covered by snow at all; when the first and second directions are parallel, the point is completely covered by snow; when the first and second directions are in other angular relationships, the degree of snow cover at the point is determined by the dot product of the first and second directions.

[0067] Optionally, in step S22, determining the thickness information of the virtual natural landscape based on the first coverage area and the second direction may include the following steps:

[0068] Step S221: Based on the first coverage area and the second direction, offset the model vertices of the virtual vegetation model to obtain the offset distance of the model vertices;

[0069] Step S222: Determine the thickness information using the offset distance.

[0070] The aforementioned thickness information can be used to determine the degree of offset of the model vertices of the virtual vegetation model. The higher the degree of offset, the greater the thickness value corresponding to the thickness information.

[0071] Taking the rendering of snow layer on a virtual vegetation model in a video game scene as an example, the model vertices of the virtual vegetation model are offset using the coverage area (equivalent to the first coverage area mentioned above) and coverage direction (equivalent to the second direction mentioned above) of the virtual natural landscape, to obtain the offset distance of the model vertices. The thickness of the snow layer is then determined using this offset distance.

[0072] It should be noted that the specific implementation of offsetting the model vertices of the virtual vegetation model can be: offsetting the model vertices of the virtual vegetation model to a new set of positions, or generating a new set of model vertices based on the model vertices of the virtual vegetation model and the second direction mentioned above.

[0073] It is easy to understand that the thickness of the snow layer is obtained by offsetting the model points of the virtual vegetation model. Therefore, it can be ensured that the rendered snow layer has a good virtual vegetation coverage effect (such as the surface shape of the snow layer corresponding to the surface shape of the virtual vegetation model covered by the snow layer).

[0074] Optionally, in step S23, the transition processing of the first texture and the second texture through the first coverage area, and the determination of the processing result may include the following execution steps:

[0075] Step S231: Using the first coverage area, a third texture is used to transition between the first texture and the second texture in the boundary area between the virtual natural landscape and the virtual vegetation model, and the processing result is determined. The third texture is a preset noise texture.

[0076] Taking the rendering of a snow layer on a virtual vegetation model in a video game scene as an example, based on the coverage area of ​​the snow layer on the virtual vegetation model (equivalent to the first coverage area mentioned above), the base color map and normal map of the virtual natural landscape are sampled, and a preset noise map is used to perform transition processing in the boundary area between the base color map and the normal map to obtain the processing result.

[0077] Figure 4 This is a schematic diagram of a base color map of a snow layer according to one embodiment of this application. Figure 5 This is a schematic diagram of a normal map of a snow layer according to one embodiment of this application. Figure 6 This is a schematic diagram of a noise map according to one embodiment of this application. Based on the area on the surface of the virtual vegetation model that needs to be covered with snow (equivalent to the first coverage area mentioned above), using... Figure 6 The noise map shown is for example Figure 4 The base color map shown and as Figure 5 The normal map shown is subjected to transition processing to determine the processing result. This processing result is used to determine the noise-style gradient effect at the boundary between areas on the virtual vegetation model surface that need to be covered with snow and areas that do not need to be covered with snow.

[0078] Therefore, on the surface of the virtual vegetation model, the area farther away from the coverage direction (i.e., the second direction) is more affected by the noise map, which in turn makes the boundary between the area that needs to be covered with snow and the area that does not need to be covered with snow on the surface of the virtual vegetation model have a noise pattern gradient effect, which is conducive to further improving the realism of the virtual natural landscape in the virtual scene.

[0079] Optionally, in step S24, rendering a virtual natural landscape on the virtual vegetation model using the thickness information, the first coverage area, and the processing result may include the following steps:

[0080] Step S241: Mix the first coverage area and the processing result to obtain the second coverage area;

[0081] Step S242: Render a virtual natural landscape on the virtual vegetation model based on the thickness information and the second coverage area.

[0082] Taking the rendering of a snow layer on a virtual vegetation model in a video game scene as an example, within the coverage area of ​​the snow layer on the virtual vegetation model, the processing result is blended onto the surface of the virtual vegetation model to obtain the second coverage area. During the blending process, the coverage area (i.e., the blending range) and blending intensity can be controlled using specified parameters. Further, based on the second coverage area and the thickness of the snow layer, a snow layer is rendered on the virtual vegetation model.

[0083] Specifically, still utilizing the area on the aforementioned virtual vegetation model that needs to be covered by a snow layer, as shown... Figure 6 The noise map shown is used as a weight to perform linear interpolation on the base color map and normal map after the above transition processing to obtain the second coverage area. The above linear interpolation can be represented as Lerp(original color of virtual vegetation model, snow layer color, noise map).

[0084] It should be noted that during the process of mixing the first coverage area and the processing result, parameters can also be used to control the range of snow cover that needs to be covered on the virtual vegetation model. For example, the interpolation result Lerp(completely covered area, completely uncovered area, dot product result) can be used to control the dot product result of the first and second directions; the function Step(dot product result, x) can be used to control "when the dot product result is not greater than x, the dot product result is set to 0 (corresponding to completely uncovered)"; and the parameter y can be used to control the curve of the dot product result function (e.g., changing the slope of the function by multiplying the dot product result by y, and controlling the speed of the snow layer change according to the angle between the first and second directions by setting the value of y).

[0085] Optionally, in step S242, rendering a virtual natural landscape on the virtual vegetation model based on the thickness information and the second coverage area may include the following steps:

[0086] Step S2421: Determine the third coverage area using the second coverage area and the area to be removed, wherein the area to be removed is the area in the virtual vegetation model that is not covered by the virtual natural landscape;

[0087] Step S2422: Render a virtual natural landscape on the virtual vegetation model based on the thickness information and the third coverage area.

[0088] After the aforementioned steps in this embodiment, the second coverage area may still include areas in the virtual vegetation model that are not covered by the virtual natural landscape (equivalent to the areas to be removed). Using the second coverage area and the areas to be removed, a third coverage area is determined. Further, based on the thickness of the snow layer and the third coverage area, a snow layer is rendered on the virtual vegetation model.

[0089] Optionally, in step S2421, determining the third coverage area using the second coverage area and the region to be removed may include the following steps:

[0090] Step S2423: Use a global masking drawing method to determine the area to be removed from the second coverage area;

[0091] Step S2424: Remove the area to be removed from the second coverage area to obtain the third coverage area.

[0092] The aforementioned global masking rendering method can identify and render a second coverage area using pre-defined shader code. From this second coverage area, the region of the virtual vegetation model not covered by the virtual natural landscape (equivalent to the aforementioned area to be removed) is determined. The area to be removed is then removed from the second coverage area to obtain a third coverage area, which is the area to be used for rendering the virtual landscape model on the virtual vegetation model. This allows for a more accurate determination of the areas on the surface of the virtual vegetation model that need to be covered with snow, thereby improving the realism of the rendering of the virtual natural landscape on the virtual vegetation model.

[0093] For example, areas that need to be identified as areas to be removed using the global masking drawing method described above include: areas where the normal of the tree trunk faces upwards, and areas in the tree trunk that are obscured by its own leaves.

[0094] The method provided in this application embodiment can be used to implement a general method for rendering virtual natural landscapes on virtual vegetation models using shader code (such as shader). The rendering effect of virtual natural landscapes on virtual vegetation models (such as the degree of coverage, coverage range, coverage direction of virtual natural landscapes on virtual vegetation models, and the base color map, normal map, etc. of virtual natural landscapes) can be dynamically controlled by parameters. These parameters can also be coupled with other systems in the game engine (such as weather system, time system, etc.), resulting in high reusability and flexibility.

[0095] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as a magnetic disk or optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0096] This embodiment also provides an apparatus for rendering virtual natural landscapes, which is used to implement the above embodiments and preferred embodiments, and will not be repeated as already described. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0097] Figure 7This is a structural block diagram of an apparatus for rendering virtual natural landscapes according to one embodiment of this application, such as... Figure 7 As shown, the device includes: a first determining module 71, used to determine a first coverage area of ​​the virtual natural landscape using a first direction and a second direction, wherein the first direction is the normal direction of the virtual vegetation model in the game scene, and the second direction is the coverage direction of the virtual natural landscape on the virtual vegetation model; a second determining module 72, used to determine the thickness information of the virtual natural landscape based on the second direction; a processing module 73, used to perform transition processing on the first texture and the second texture through the first coverage area to obtain a processing result, wherein the first texture is the base color texture of the virtual natural landscape, and the second texture is the normal texture of the virtual natural landscape; and a rendering module 74, used to render the virtual natural landscape on the virtual vegetation model using the thickness information, the first coverage area, and the processing result.

[0098] Optionally, the first determining module 71 is further configured to: obtain the angular relationship between the first direction and the second direction; and determine the first coverage area based on the angular relationship.

[0099] Optionally, the virtual vegetation model includes a virtual trunk model and a virtual branch model. The first direction includes the trunk normal direction of the virtual trunk model and the branch normal direction of the virtual branch model. The aforementioned first determining module 71 is further used to: perform a dot product calculation on the trunk normal direction and the second direction to obtain a first calculation result; convert the branch normal direction from tangent space to world space to obtain a conversion result; perform a dot product calculation on the conversion result and the second direction to obtain a second calculation result; and determine the included angle relationship based on the first calculation result and the second calculation result.

[0100] Optionally, the second determining module 72 is further configured to: perform offset processing on the model vertices of the virtual vegetation model based on the first coverage area and the second direction to obtain the offset distance of the model vertices; and use the offset distance to determine the thickness information.

[0101] Optionally, the above-mentioned processing module 73 is further configured to: use a third texture to perform transition processing on the first texture and the second texture in the boundary area between the virtual natural landscape and the virtual vegetation model through the first coverage area, and determine the processing result, wherein the third texture is a preset noise texture.

[0102] Optionally, the rendering module 74 is further configured to: mix the first coverage area and the processing result to obtain a second coverage area; and render a virtual natural landscape on the virtual vegetation model based on the thickness information and the second coverage area.

[0103] Optionally, the rendering module 74 is further configured to: determine a third coverage area using the second coverage area and the area to be removed, wherein the area to be removed is the area in the virtual vegetation model that is not covered by the virtual natural landscape; and render the virtual natural landscape on the virtual vegetation model based on the thickness information and the third coverage area.

[0104] Optionally, the rendering module 74 is further configured to: determine the region to be culled from the second coverage area using a global mask drawing method; and culle the region to be culled from the second coverage area to obtain a third coverage area.

[0105] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.

[0106] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when run.

[0107] Optionally, in this embodiment, the computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.

[0108] Optionally, in this embodiment, the computer-readable storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.

[0109] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:

[0110] S1, the first coverage area of ​​the virtual natural landscape is determined by the first direction and the second direction, wherein the first direction is the normal direction of the virtual vegetation model in the game scene, and the second direction is the coverage direction of the virtual natural landscape on the virtual vegetation model.

[0111] S2, determine the thickness information of the virtual natural landscape based on the first coverage area and the second direction;

[0112] S3, through the first coverage area, perform transition processing on the first texture and the second texture to obtain the processing result, wherein the first texture is the base color texture of the virtual natural landscape, and the second texture is the normal texture of the virtual natural landscape;

[0113] S4 uses thickness information, initial coverage area, and processing results to render a virtual natural landscape on a virtual vegetation model.

[0114] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: obtaining the angular relationship between the first direction and the second direction; and determining a first coverage area based on the angular relationship.

[0115] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: performing a dot product calculation on the main trunk normal direction and the second direction to obtain a first calculation result; converting the branch normal direction from tangent space to world space to obtain a conversion result; performing a dot product calculation on the conversion result and the second direction to obtain a second calculation result; and determining the included angle relationship based on the first calculation result and the second calculation result.

[0116] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: offsetting the model vertices of the virtual vegetation model based on a first coverage area and a second direction to obtain the offset distance of the model vertices; and determining thickness information using the offset distance.

[0117] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: using a third texture to perform transition processing on a first texture and a second texture in the boundary area between a virtual natural landscape and a virtual vegetation model through a first coverage area, and determining the processing result, wherein the third texture is a preset noise texture.

[0118] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: mixing the first coverage area and the processing result to obtain a second coverage area; and rendering a virtual natural landscape on the virtual vegetation model based on the thickness information and the second coverage area.

[0119] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: determining a third coverage area using a second coverage area and a region to be removed, wherein the region to be removed is a region in the virtual vegetation model not covered by the virtual natural landscape; and rendering the virtual natural landscape on the virtual vegetation model based on thickness information and the third coverage area.

[0120] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: determining the region to be removed from the second coverage area using a global mask drawing method; removing the region to be removed from the second coverage area to obtain a third coverage area.

[0121] In the computer-readable storage medium of the above embodiments, a technical solution is provided for implementing a method for rendering virtual natural landscapes. A first coverage area of ​​the virtual natural landscape is determined using a first direction and a second direction, wherein the first direction is the normal direction of the virtual vegetation model in the game scene, and the second direction is the coverage direction of the virtual natural landscape on the virtual vegetation model. Thickness information of the virtual natural landscape is determined based on the first coverage area and the second direction. Further, a transition processing is performed on a first texture and a second texture using the first coverage area to obtain a processing result. The first texture is the base color texture of the virtual natural landscape, and the second texture is the normal texture of the virtual natural landscape. Using the thickness information, the first coverage area, and the processing result, the virtual natural landscape is rendered on the virtual vegetation model, achieving the goal of rendering the virtual natural landscape on the virtual vegetation model at a lower cost. This achieves the technical effect of reducing the performance consumption of rendering virtual natural landscapes on virtual vegetation models while improving the flexibility and reusability of the rendering process, thereby solving the technical problems of high performance consumption, poor rendering flexibility, and poor reusability in virtual natural landscape rendering methods provided in related technologies.

[0122] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a computer-readable storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this application.

[0123] In exemplary embodiments of this application, a computer-readable storage medium stores a program product capable of implementing the methods described above in this embodiment. In some possible implementations, various aspects of the embodiments of this application may also be implemented as a program product including program code, which, when the program product is run on a terminal device, causes the terminal device to perform the steps described in the "Exemplary Methods" section of this embodiment according to various exemplary embodiments of this application.

[0124] The program product for implementing the above-described method according to embodiments of this application may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the embodiments of this application is not limited thereto. In the embodiments of this application, the computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.

[0125] The aforementioned program product may take the form of any combination of one or more computer-readable media. Such computer-readable storage media may be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples (not exhaustive) of computer-readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0126] It should be noted that the program code contained on the computer-readable storage medium can be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0127] Embodiments of this application also provide an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.

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

[0129] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:

[0130] S1, the first coverage area of ​​the virtual natural landscape is determined by the first direction and the second direction, wherein the first direction is the normal direction of the virtual vegetation model in the game scene, and the second direction is the coverage direction of the virtual natural landscape on the virtual vegetation model.

[0131] S2, determine the thickness information of the virtual natural landscape based on the first coverage area and the second direction;

[0132] S3, through the first coverage area, perform transition processing on the first texture and the second texture to obtain the processing result, wherein the first texture is the base color texture of the virtual natural landscape, and the second texture is the normal texture of the virtual natural landscape;

[0133] S4 uses thickness information, initial coverage area, and processing results to render a virtual natural landscape on a virtual vegetation model.

[0134] Optionally, the processor may also be configured to perform the following steps via a computer program: obtaining the angular relationship between the first direction and the second direction; and determining the first coverage area based on the angular relationship.

[0135] Optionally, the processor described above can also be configured to perform the following steps via a computer program: perform a dot product calculation on the main trunk normal direction and the second direction to obtain a first calculation result; convert the branch normal direction from tangent space to world space to obtain a conversion result; perform a dot product calculation on the conversion result and the second direction to obtain a second calculation result; and determine the included angle relationship based on the first calculation result and the second calculation result.

[0136] Optionally, the processor may also be configured to perform the following steps via a computer program: offsetting the model vertices of the virtual vegetation model based on a first coverage area and a second direction to obtain the offset distance of the model vertices; and using the offset distance to determine thickness information.

[0137] Optionally, the processor may also be configured to perform the following steps via a computer program: using a third texture to perform transition processing on the first texture and the second texture in the boundary area between the virtual natural landscape and the virtual vegetation model through a first coverage area, and determining the processing result, wherein the third texture is a preset noise texture.

[0138] Optionally, the processor may also be configured to perform the following steps via a computer program: mixing the first coverage area and the processing result to obtain a second coverage area; and rendering a virtual natural landscape on the virtual vegetation model based on the thickness information and the second coverage area.

[0139] Optionally, the processor may also be configured to perform the following steps via a computer program: determining a third coverage area using a second coverage area and a region to be removed, wherein the region to be removed is a region in the virtual vegetation model that is not covered by the virtual natural landscape; and rendering the virtual natural landscape on the virtual vegetation model based on thickness information and the third coverage area.

[0140] Optionally, the processor may also be configured to perform the following steps via a computer program: determine the region to be removed from the second coverage area using a global masking drawing method; remove the region to be removed from the second coverage area to obtain a third coverage area.

[0141] In the electronic device described in the above embodiments, a technical solution is provided for implementing a method for rendering virtual natural landscapes. A first coverage area of ​​the virtual natural landscape is determined using a first direction and a second direction. The first direction is the normal direction of the virtual vegetation model in the game scene, and the second direction is the coverage direction of the virtual natural landscape over the virtual vegetation model. Thickness information of the virtual natural landscape is determined based on the first coverage area and the second direction. Further, a transition processing is performed on a first texture and a second texture using the first coverage area to obtain a processing result. The first texture is the base color texture of the virtual natural landscape, and the second texture is the normal texture of the virtual natural landscape. Using the thickness information, the first coverage area, and the processing result, a virtual natural landscape is rendered on the virtual vegetation model. This achieves the goal of rendering a virtual natural landscape on a virtual vegetation model at a lower cost, thereby reducing the performance consumption of rendering a virtual natural landscape on a virtual vegetation model while improving the flexibility and reusability of the rendering process. This solves the technical problems of high performance consumption, poor rendering flexibility, and poor reusability in virtual natural landscape rendering methods provided in related technologies.

[0142] Figure 8 This is a schematic diagram of an electronic device according to one embodiment of this application. Figure 8 As shown, the electronic device 800 is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0143] like Figure 8 As shown, the electronic device 800 is presented in the form of a general-purpose computing device. The components of the electronic device 800 may include, but are not limited to: at least one processor 810, at least one memory 820, a bus 830 connecting different system components (including memory 820 and processor 810), and a display 840.

[0144] The memory 820 stores program code that can be executed by the processor 810, causing the processor 810 to perform the steps described in the method section of the embodiments of this application according to various exemplary implementations of this application.

[0145] The memory 820 may include a readable medium in the form of volatile memory cells, such as random access memory (RAM) 8201 and / or cache memory 8202, and may further include read-only memory (ROM) 8203, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.

[0146] In some instances, memory 820 may also include a program / utility 8204 having a set (at least one) of program modules 8205, including but not limited to: an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Memory 820 may further include memory remotely located relative to processor 810, which can be connected to electronic device 800 via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0147] Bus 830 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, peripheral bus, graphics acceleration port, processor 810, or a local bus using any of the various bus structures.

[0148] The display 840 may be, for example, a touch-screen liquid crystal display (LCD) that allows a user to interact with the user interface of the electronic device 800.

[0149] Optionally, the electronic device 800 can also communicate with one or more external devices 900 (e.g., keyboard, pointing device, Bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 800, and / or any device that enables the electronic device 800 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via the input / output (I / O) interface 850. Furthermore, the electronic device 800 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via a network adapter 860. Figure 8 As shown, network adapter 860 communicates with other modules of electronic device 800 via bus 830. It should be understood that, although... Figure 8 As not shown, other hardware and / or software modules may be used in conjunction with electronic device 800, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, Redundant Arrays of Independent Disks (RAID) systems, tape drives, and data backup storage systems.

[0150] The aforementioned electronic device 800 may also include: a keyboard, a cursor control device (such as a mouse), an input / output interface (I / O interface), a network interface, a power supply, and / or a camera.

[0151] Those skilled in the art will understand that Figure 8 The structure shown is for illustrative purposes only and does not limit the structure of the electronic device described above. For example, the electronic device 800 may also include components that are more... Figure 8 The more or fewer components shown, or having the same Figure 8 Different configurations are shown. The memory 820 can be used to store computer programs and corresponding data, such as the computer program and corresponding data corresponding to the method for rendering virtual natural landscapes in this embodiment. The processor 810 executes various functional applications and data processing by running the computer program stored in the memory 820, thereby implementing the aforementioned method for rendering virtual natural landscapes.

[0152] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0153] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0154] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.

[0155] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0156] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0157] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0158] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method for rendering virtual natural landscapes, characterized in that, include: A first coverage area of ​​the virtual natural landscape is determined by a first direction and a second direction, wherein the first direction is the normal direction of the virtual vegetation model in the game scene, and the second direction is the coverage direction of the virtual natural landscape on the virtual vegetation model. Based on the first coverage area and the second direction, the model vertices of the virtual vegetation model are offset to obtain the offset distance of the model vertices; The thickness information of the virtual natural landscape is determined using the offset distance; The first texture and the second texture are subjected to transition processing through the first coverage area to obtain the processing result, wherein the first texture is the base color texture of the virtual natural landscape and the second texture is the normal texture of the virtual natural landscape. Using the thickness information, the first coverage area, and the processing result, the virtual natural landscape is rendered on the virtual vegetation model.

2. The method of claim 1, wherein, Determining the first coverage area of ​​the virtual natural landscape using the first direction and the second direction includes: Obtain the angular relationship between the first direction and the second direction; The first coverage area is determined based on the included angle relationship.

3. The method of claim 2, wherein, The virtual vegetation model includes a virtual trunk model and a virtual branch model. The first direction includes the trunk normal direction of the virtual trunk model and the branch normal direction of the virtual branch model. Obtaining the angle relationship between the first direction and the second direction includes: The first calculation result is obtained by multiplying the main trunk normal direction with the second direction. The branch normal direction is transformed from tangent space to world space to obtain the transformation result; The conversion result is multiplied by the second direction to obtain the second calculation result; The included angle relationship is determined based on the first calculation result and the second calculation result.

4. The method of claim 1, wherein, By applying a transition process to the first texture and the second texture within the first coverage area, the processing result is determined as follows: Using the first coverage area, a third texture is used to transition between the first texture and the second texture in the boundary area between the virtual natural landscape and the virtual vegetation model, and the processing result is determined, wherein the third texture is a preset noise texture.

5. The method of claim 1, wherein, Rendering the virtual natural landscape on the virtual vegetation model using the thickness information, the first coverage area, and the processing result includes: The first coverage area and the processing result are combined to obtain the second coverage area; Based on the thickness information and the second coverage area, the virtual natural landscape is rendered on the virtual vegetation model.

6. The method of claim 5, wherein, Rendering the virtual natural landscape on the virtual vegetation model based on the thickness information and the second coverage area includes: A third coverage area is determined using the second coverage area and the area to be removed, wherein the area to be removed is the area in the virtual vegetation model that is not covered by the virtual natural landscape; Based on the thickness information and the third coverage area, the virtual natural landscape is rendered on the virtual vegetation model.

7. The method of claim 6, wherein, Determining the third coverage area using the second coverage area and the area to be removed includes: The region to be removed is determined from the second coverage area using a global masking rendering method; The third coverage area is obtained by removing the area to be removed from the second coverage area.

8. A device for rendering virtual natural landscapes, characterized in that, include: The first determining module is used to determine the first coverage area of ​​the virtual natural landscape using a first direction and a second direction, wherein the first direction is the normal direction of the virtual vegetation model in the game scene, and the second direction is the coverage direction of the virtual natural landscape on the virtual vegetation model. The second determining module is used to offset the model vertices of the virtual vegetation model based on the first coverage area and the second direction to obtain the offset distance of the model vertices; and to determine the thickness information of the virtual natural landscape using the offset distance. The processing module is used to perform transition processing on the first texture and the second texture through the first coverage area to obtain a processing result, wherein the first texture is the base color texture of the virtual natural landscape and the second texture is the normal texture of the virtual natural landscape; The rendering module is used to render the virtual natural landscape on the virtual vegetation model using the thickness information, the first coverage area, and the processing result.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute, when run by a processor, the method for rendering a virtual natural landscape as described in any one of claims 1 to 7. 10.An electronic device comprising a memory and a processor, the electronic device characterized by, The memory stores a computer program, and the processor is configured to run the computer program to perform the method for rendering a virtual natural landscape as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Model rendering method, device and equipment and storage medium

    CN112274934A

  • Accumulated snow effect generation method based on Cesium three-dimensional rendering engine

    CN115170717A