Virtual scene rendering method and device, electronic equipment and storage medium

By using preset models and noise map mapping unit panels, determining diffusion parameters and rendering animation effects, the memory usage and resource overhead problems caused by the creation of a large number of instances of particle systems in the prior art are solved, and efficient virtual scene rendering is achieved.

CN120114831APending Publication Date: 2025-06-10NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510315062.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-17
Publication Date
2025-06-10

AI Technical Summary

Technical Problem

When simulating weather effects such as snow, the prior art requires creating a large number of particle instances, resulting in high memory usage and resource overhead.

Method used

By obtaining the preset model and the preset noise map, map the cell panel to the pixel points in the noise map, obtain the color channel parameters, determine the diffusion parameters, and use the texture map to render the animation effect in the virtual scene.

Benefits of technology

Reduces memory usage, improves running performance, ensures that the game runs smoothly on different devices, while meeting a good visual experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120114831A_ABST
    Figure CN120114831A_ABST
Patent Text Reader

Abstract

The invention provides a virtual scene rendering method and device, electronic equipment and a storage medium, and relates to the technical field of computers. The method comprises the following steps: respectively obtaining a preset model and a preset noise map; mapping each unit patch in the preset model to each pixel point in the preset noise map, and obtaining a color channel parameter corresponding to each unit patch; according to the color channel parameters corresponding to the unit patches, diffusion parameters corresponding to the unit patches are determined; and according to the diffusion parameter corresponding to each unit patch and the preset texture map corresponding to the preset virtual overlay, rendering to generate an animation rendering effect that the preset virtual overlay falls along the preset direction in the virtual scene, by applying the method and the device, spatial distribution and movement of the unit patches can be realized based on the preset noise map, and the animation rendering effect is improved. Therefore, the animation rendering effect that the preset virtual overlay falls in the preset direction in the virtual scene is rendered and generated, the method has the advantage of being simple in calculation, and the operation performance can be improved.
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 in particular, to a method, apparatus, electronic device, and storage medium for rendering a virtual scene. Background Art

[0002] In game development, weather effects such as snowing and raining are usually collectively referred to as "weather effects" or "environmental effects". They are one of the elements used to enhance the immersion and realism in the game world. Such effects are common in game products with open-world or realistic environment settings, and usually, such games have relatively high requirements for device performance.

[0003] In the prior art, taking the simulation of snowing weather as an example, the effect of snowflakes falling is often simulated based on a particle system.

[0004] However, in the existing implementation methods, a large number of particle instances often need to be created in the particle system, and each particle instance has a large number of attributes. In practical applications, many of these attributes are not needed. Therefore, the existing implementation methods have problems of large memory occupation and resource overhead. Summary of the Invention

[0005] The purpose of this application is to provide a method, apparatus, electronic device, and storage medium for rendering a virtual scene, which can reduce memory occupation and improve operating performance, aiming at the deficiencies in the above-mentioned prior art.

[0006] To achieve the above purpose, the technical solutions adopted in the embodiments of this application are as follows:

[0007] In a first aspect, the present invention provides a method for rendering a virtual scene, the method comprising:

[0008] Obtaining a preset model and a preset noise map respectively, where the preset model includes: a plurality of unit patches, each unit patch includes a plurality of vertices, the preset noise map includes a plurality of pixel points, and each pixel point includes a plurality of color channel parameters;

[0009] Mapping each unit patch in the preset model to each pixel point in the preset noise map, and obtaining the color channel parameters corresponding to each unit patch;

[0010] Determining the diffusion parameter corresponding to each unit patch according to the color channel parameters corresponding to each unit patch;

[0011] Rendering an animation rendering effect of a preset virtual covering falling along a preset direction in the virtual scene according to the diffusion parameter corresponding to each unit patch and a preset texture map corresponding to the preset virtual covering.

[0012] In a second aspect, the present invention provides a rendering apparatus for a virtual scene, comprising:

[0013] An acquisition module, configured to acquire a preset model and a preset noise map respectively, where the preset model includes: a plurality of unit patches, each unit patch includes a plurality of vertices, the preset noise map includes a plurality of pixel points, and each of the pixel points includes a plurality of color channel parameters;

[0014] A mapping module, configured to map each of the unit patches in the preset model to each of the pixel points in the preset noise map, and acquire the color channel parameters corresponding to each of the unit patches;

[0015] A determination module, configured to determine the diffusion parameter corresponding to each of the unit patches according to the color channel parameters corresponding to each of the unit patches;

[0016] A rendering module, configured to render an animation rendering effect of a preset virtual overlay falling along a preset direction in a virtual scene according to the diffusion parameter corresponding to each of the unit patches and a preset texture map corresponding to the preset virtual overlay.

[0017] In a third aspect, the present invention provides an electronic device, including: a processor, a storage medium, and a bus, where the storage medium stores machine-readable instructions executable by the processor. When the electronic device runs, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of the rendering method of the virtual scene according to any one of the foregoing embodiments.

[0018] In a fourth aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processor, it executes the steps of the rendering method of the virtual scene according to any one of the foregoing embodiments.

[0019] The beneficial effects of the present application are:

[0020] In the rendering method, device, electronic device, and storage medium for virtual scenes provided by the embodiments of the present application, it includes: respectively obtaining a preset model and a preset noise map. The preset model includes multiple unit patches, each unit patch includes multiple vertices, the preset noise map includes multiple pixel points, and each pixel point includes multiple color channel parameters; mapping each unit patch in the preset model to each pixel point in the preset noise map, and obtaining the color channel parameters corresponding to each unit patch; determining the diffusion parameters corresponding to each unit patch according to the color channel parameters corresponding to each unit patch; rendering an animation rendering effect of a preset virtual covering falling along a preset direction in the virtual scene according to the diffusion parameters corresponding to each unit patch and the preset texture map corresponding to the preset virtual covering. By applying the present application, based on the preset noise map, the spatial distribution and movement of unit patches can be realized, so as to render an animation rendering effect of a preset virtual covering falling along a preset direction in the virtual scene, which has the characteristics of simple calculation, avoids creating particle instances through a particle system, and does not need to calculate the attributes and behaviors of each particle, can reduce memory occupancy and improve operation performance while meeting the visual requirements of rainy and snowy weather, that is, it can ensure that the game can provide a good visual experience and run smoothly on different devices. Description of the Drawings

[0021] To more clearly illustrate the technical solutions of the embodiments of the present application, the accompanying drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present application and should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.

[0022] Figure 1 It is a flowchart showing a rendering method for a virtual scene provided by an embodiment of the present application;

[0023] Figure 2 It is a flowchart showing another rendering method for a virtual scene provided by an embodiment of the present application;

[0024] Figure 3 It is a flowchart showing another rendering method for a virtual scene provided by an embodiment of the present application;

[0025] Figure 4 It is a flowchart showing another rendering method for a virtual scene provided by an embodiment of the present application;

[0026] Figure 5 It is a flowchart showing another rendering method for a virtual scene provided by an embodiment of the present application;

[0027] Figure 6Histogram of the preset noise map provided by the embodiment of the present application on the first color channel parameter;

[0028] Figure 7 Schematic flowchart of another virtual scene rendering method provided by the embodiment of the present application;

[0029] Figure 8 Schematic diagram of a preset model provided by the embodiment of the present application;

[0030] Figure 9 Schematic diagram of the functional modules of a virtual scene rendering device provided by the embodiment of the present application;

[0031] Figure 10 Schematic diagram of the structure of an electronic device provided by the embodiment of the present application. Detailed implementation manners

[0032] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. Usually, the components of the embodiments of the present application described and illustrated in the accompanying drawings here can be arranged and designed in various different configurations.

[0033] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application claimed, but merely represents selected embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.

[0034] It should be noted that: similar reference numerals and letters denote similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.

[0035] In game development, weather effects such as snowing and raining are usually collectively referred to as "weather effects" or "environmental effects". In the prior art, taking the simulation of snowing weather as an example, the effect of snowflakes falling is often simulated based on a particle system.

[0036] However, in the existing implementation methods, a large number of particle instances often need to be created in the particle system. Each particle instance has a large number of attributes (such as velocity, acceleration, angular velocity, etc.). Every frame of the game needs to calculate the motion attributes of each particle instance, update its new spatial position, and then draw it to the screen output through the rendering pipeline. However, in actual applications, many attributes are not needed. Therefore, the existing implementation methods have problems of large memory occupancy and resource overhead.

[0037] In view of this, the embodiments of the present application provide a method for rendering a virtual scene, which can meet the visual requirements of rainy and snowy weather while providing efficient running performance, that is, it can ensure that the game can provide a good visual experience and run smoothly on different devices.

[0038] Figure 1 The following is a schematic flowchart of a method for rendering a virtual scene provided by the embodiments of the present application. The execution subject of this method can be an electronic device such as a computer, a server, or a processor. Optionally, this method is applicable to the simulation of rainy and snowy weather. Of course, the specific application scenario is not limited to this. For example, it can also simulate hail weather or the scenario of any particles falling from the air (such as the scenario of powder falling in an explosion scene). To better understand the present application, the embodiments of the present application will be described by taking the simulation of snowy weather as an example. As Figure 1 shown, the method includes:

[0039] Step 101: Obtain a preset model and a preset noise map respectively. The preset model includes: a plurality of unit patches, each unit patch includes a plurality of vertices, the preset noise map includes a plurality of pixel points, and each pixel point includes a plurality of color channel parameters.

[0040] Among them, each unit patch in the preset model is used to simulate snowflakes. Optionally, each unit patch includes 4 vertices and 2 triangular faces. Of course, the specific setting method is not limited to this.

[0041] In some embodiments, considering that snowflakes only move in the vertical direction and for the convenience of spreading on the horizontal plane to simulate each snowflake in space, the preset model can be a cylindrical model, such as a cylindrical model with a circular cross-section, a cylindrical model with an elliptical cross-section, a cylindrical model with a rectangular cross-section, a cylindrical model with a triangular cross-section, etc. There is no limitation here, and it can be flexibly set according to the actual application scenario.

[0042] The number of pixel points in the preset noise map can be the same as the number of unit patches in the preset model. Among them, one unit patch in the preset model corresponds to one pixel point in the preset noise map, and each unit patch can determine the diffusion parameter corresponding to each unit patch according to the multiple color channel parameters of its corresponding pixel point. Optionally, the color channel parameters corresponding to each pixel point in the preset noise map can be generated by a random algorithm.

[0043] Step 102: Map each unit patch in the preset model to each pixel point in the preset noise map, and obtain the color channel parameters corresponding to each unit patch.

[0044] Among them, the color channel parameters corresponding to each unit patch can be determined according to the color channel parameters of the pixel points corresponding to each unit patch, and the pixel points corresponding to each unit patch can be determined according to the identifier of each unit patch in the preset model and the identifier of each pixel point in the noise map. For example, in the vertex shader, the UV coordinates corresponding to each vertex can be obtained, and further the corresponding unit patch and the identifier (i, j) can be obtained through calculation.

[0045] In addition, for each unit patch, when specifically performing mapping, UV mapping can be performed according to the coordinates of each unit patch in the preset model and the coordinates of each pixel point in the noise map, so as to map each unit patch completely to a single pixel point of the noise map, and the UV coordinates corresponding to each vertex in each unit patch can be obtained through UV mapping.

[0046] In some embodiments, it is noted that the preset model includes M×N unit patches, each unit patch is denoted as U(i,j), and the 4 vertices corresponding to each unit patch U(i,j) are respectively denoted as the lower left vertex V(i,j,1), the upper left vertex V(i,j,2), the lower right vertex V(i,j,3), and the upper right vertex V(i,j,4), where i ∈ [1,M], j ∈ [1,N]; then the constructed preset noise map can include M×N pixels, each pixel is denoted as P(i,j), and according to the values of i and j in the unit patch U(i,j), its corresponding pixel point P(i,j) can be determined.

[0047] In addition, the lower left corner, upper left corner, lower right corner, and upper right corner of the UV coordinates corresponding to each pixel P(i,j) are respectively where i ∈ [1,M], j ∈ [1,N]. After performing UV mapping on the 4 vertices corresponding to each unit patch U(i,j), the UV coordinates corresponding to each vertex are respectively denoted as: UV(i,j,1), UV(i,j,2), UV(i,j,3), UV(i,j,4), where, Δ represents the distance threshold between the unit patch boundary and the pixel boundary, and its value can be any value between 0 and 0.5 to avoid cross-pixel mapping of UV coordinates. For example, Δ = 0.25 can be set. Of course, the specific setting method is not limited to this.

[0048] Step 103: Determine the diffusion parameters corresponding to each unit patch according to the color channel parameters corresponding to each unit patch.

[0049] Optionally, the diffusion parameters corresponding to each unit patch may include: diffusion density, diffusion intensity, etc.

[0050] Among them, the diffusion intensity can indicate the diffusion distance of each unit patch along the diffusion direction. The farther the diffusion distance is, the greater the diffusion intensity is; the closer the diffusion distance is, the smaller the diffusion intensity is. The diffusion density can indicate the diffusion quantity of each unit patch within the diffusion distance range. The more the diffusion quantity is, the greater the diffusion density is; the less the diffusion quantity is, the smaller the diffusion density is.

[0051] Optionally, when specifically performing diffusion, the diffusion intensity, diffusion intensity, etc. corresponding to each unit patch can be determined according to the color channel parameters, preset diffusion radius, etc. corresponding to each unit patch.

[0052] Step 104: Render an animation rendering effect of a preset virtual overlay falling along a preset direction in the virtual scene according to the diffusion parameters corresponding to each unit patch and the preset texture map corresponding to the preset virtual overlay.

[0053] Among them, after respectively determining the diffusion parameters corresponding to each unit patch, the falling offset of each unit patch along the preset direction can be set, and re - mapping can be performed using the preset texture map corresponding to the preset virtual overlay, so as to render an animation rendering effect of the preset virtual overlay falling along the preset direction in the virtual scene.

[0054] It should be noted that different preset virtual overlays will correspond to different preset texture maps. For example, the preset virtual overlay can be snow, and the corresponding preset texture map can be a snow map. Or, the preset virtual overlay is hail, and the corresponding preset texture map can be a hail map. This is not limited here, and custom mapping can be achieved. In addition, the processing of each unit patch can be realized by vertex control of the vertices corresponding to each unit patch. For example, vertex control is performed on the GPU through Shader code, and the parallel processing ability of the GPU is utilized to improve the processing efficiency.

[0055] In summary, the embodiment of the present application provides a method for rendering a virtual scene. The method includes: respectively obtaining a preset model and a preset noise texture map. The preset model includes multiple unit patches, each unit patch includes multiple vertices, the preset noise texture map includes multiple pixel points, and each pixel point includes multiple color channel parameters; mapping each unit patch in the preset model to each pixel point in the preset noise texture map, and obtaining the color channel parameters corresponding to each unit patch; determining the diffusion parameters corresponding to each unit patch according to the color channel parameters corresponding to each unit patch; rendering an animation rendering effect of a preset virtual overlay falling along a preset direction in the virtual scene according to the diffusion parameters corresponding to each unit patch and a preset texture map corresponding to the preset virtual overlay. By applying the present application, the spatial distribution and movement of unit patches can be realized based on the preset noise texture map, so as to render an animation rendering effect of a preset virtual overlay falling along a preset direction in the virtual scene, which has the characteristics of simple calculation, avoids creating particle instances through a particle system, and does not need to calculate the attributes and behaviors of each particle. It can reduce memory occupancy and improve operation performance while meeting the visual requirements of rainy and snowy weather, that is, it can ensure that the game can provide a good visual experience and run smoothly on different devices.

[0056] Figure 2 It is a schematic flowchart of another method for rendering a virtual scene provided by an embodiment of the present application. In an alternative embodiment, the diffusion parameter includes a diffusion intensity. As Figure 2 shown, the above determining the diffusion parameters corresponding to each unit patch according to the color channel parameters corresponding to each unit patch includes:

[0057] Step 201, obtain the normal direction of each unit patch.

[0058] Step 202, determine the diffusion intensity corresponding to each unit patch according to the color channel parameters corresponding to each unit patch, the normal direction of each unit patch, and a preset diffusion radius.

[0059] Optionally, the normal direction of each unit patch can indicate the diffusion direction of the unit patch in space. In some embodiments, the diffusion direction of the unit patch in space can be the opposite direction of the normal direction of each unit patch.

[0060] For example, the normal direction of each unit patch can point to the axis of the preset model, and the diffusion direction of the unit patch in space can be the reverse of the normal direction.

[0061] In some embodiments, in order to reflect random diffusion, the diffusion intensity corresponding to each unit patch in the preset model can be determined according to the color channel parameters corresponding to each unit patch, the normal direction of each unit patch, and a preset diffusion radius, that is, the final diffusion position corresponding to each unit patch in the preset model.

[0062] Optionally, the preset diffusion radius can be a preset value, or it can be specified by the user according to the diffusion area, which is not limited here.

[0063] Figure 3 It is a schematic flowchart of another method for rendering a virtual scene provided by an embodiment of the present application. In an alternative embodiment, as Figure 3 shown, determining the diffusion intensity corresponding to each unit patch according to the color channel parameters corresponding to each unit patch, the normal direction of each unit patch, and the preset diffusion radius includes:

[0064] Step 301: Determine the first diffusion position of each unit patch in the first diffusion direction and the second diffusion position of each unit patch in the second diffusion direction according to the first color channel parameter corresponding to each unit patch, the normal direction of each unit patch, and the preset diffusion radius. The plane formed by the first diffusion direction and the second diffusion direction is perpendicular to the preset direction.

[0065] Among them, for better understanding of the present application, the preset direction is denoted as the negative y-axis direction, representing the falling direction of the preset virtual covering, the first diffusion direction is the x-axis direction, and the second diffusion direction is the z-axis direction. That is, specifically during diffusion, it is necessary to calculate the diffusion positions of each unit patch on the xz plane.

[0066] Optionally, the first color channel parameter corresponding to each unit patch can be the value of each unit patch on the red channel. Then, for each unit patch, the first diffusion position of each unit patch in the preset model in the first diffusion direction (x-axis direction) and the second diffusion position of each unit patch in the second diffusion direction (z-axis direction) can be determined respectively according to the first color channel parameter corresponding to each unit patch, the normal direction of each unit patch, and the preset diffusion radius.

[0067] Step 302: Determine the diffusion intensity corresponding to each unit patch according to the first diffusion position and the second diffusion position.

[0068] It can be understood that after respectively determining the first diffusion position of each unit patch in the first diffusion direction and the second diffusion position of each unit patch in the second diffusion direction, the diffusion intensity corresponding to each unit patch can be further determined, that is, the final diffusion position corresponding to each unit patch in the preset model, so as to realize the spatial distribution of the unit patches.

[0069] For example, taking the unit patch U(i,j) in the preset model as an example, the four vertices corresponding to the unit patch U(i,j) are respectively denoted as the lower left vertex V1(i,j), the upper left vertex V2(i,j), the lower right vertex V3(i,j), and the upper right vertex V4(i,j). Taking the lower left vertex V1(i,j) as an example, if before diffusion, based on the preset coordinate system, the lower left vertex V1 is represented as (x1, y1, z1), then after diffusion in the first diffusion direction, a new vertex V1_x′ is obtained, and its value in the first diffusion direction is x2; after diffusion in the second diffusion direction, a new vertex V1_z′ is obtained, and its value in the second diffusion direction is z2. Then, after the two diffusions, the position of the new vertex V1_x_z after diffusion in the preset coordinate system is (x2, y1, z2).

[0070] It should be noted that for each of the other vertices, reference can be made to the diffusion process of the lower left vertex V1. It can be understood that after obtaining the positions of each vertex in the preset coordinate system respectively, the final diffusion position corresponding to the unit patch U1 can be determined.

[0071] Figure 4 This is a schematic flowchart of another virtual scene rendering method provided by an embodiment of the present application. In an alternative implementation, as Figure 4 shown, the above-mentioned determining the first diffusion position of each unit patch in the first diffusion direction and the second diffusion position in the second diffusion direction according to the first color channel parameter corresponding to each unit patch, the normal direction of each unit patch, and the preset diffusion radius includes:

[0072] Step 401: Determine the first initial diffusion position of each unit patch in the first diffusion direction and the second initial diffusion position in the second diffusion direction according to the first color channel parameter corresponding to each unit patch, the normal direction of each unit patch, and the preset diffusion radius.

[0073] Among them, the first color channel parameter, the second color channel parameter, and the third color channel parameter corresponding to each unit patch can be the values of each unit patch on the red channel, the green channel, and the blue channel respectively.

[0074] Continuing with the above example, for the lower left vertex V1 of the unit patch U(i,j), the first initial diffusion position and the second initial diffusion position can be calculated with reference to the following formula. Among them, its diffusion formula in the first diffusion direction is: Its diffusion formula in the second diffusion direction is:

[0075] Among them, CR(i,j) represents the first color channel parameter corresponding to the unit patch U(i,j). Denote the component of the normal direction of the unit patch U(i,j) in the first diffusion direction. Denote the component of the normal direction of the unit patch U(i,j) in the second diffusion direction. R represents the preset diffusion radius. V1_x(i,j) represents the value of the lower left vertex V1 of the unit patch U(i,j) in the first diffusion direction before diffusion. V1_x(i,j)' represents the first initial diffusion position of the lower left vertex V1 of the unit patch U(i,j) in the first diffusion direction after diffusion. V1_y(i,j) represents the value of the lower left vertex V1 of the unit patch U(i,j) in the second diffusion direction before diffusion. V1_y(i,j)' represents the second initial diffusion position of the lower left vertex V1 of the unit patch U(i,j) in the second diffusion direction after diffusion.

[0076] Step 402: According to the first color channel parameter, the second color channel parameter and the preset diffusion radius corresponding to each unit patch, perform noise offset on each first initial diffusion position to determine the first diffusion position of each unit patch in the first diffusion direction.

[0077] Step 403: According to the first color channel parameter, the third color channel parameter and the preset diffusion radius corresponding to each unit patch, perform noise offset on each second initial diffusion position to determine the second diffusion position of each unit patch in the second diffusion direction.

[0078] Among them, based on the above content, further explanation is as follows. The noise offset for each first initial diffusion position can be seen in the formula: V1_x″(i,j) = V1_x′(i,j) + CR(i,j) × R × CG(i,j); the noise offset for each second initial diffusion position can be seen in the formula: V1_z″(i,j) = V1_z′(i,j) + CR(i,j) × R × CB(i,j).

[0079] Among them, CR(i,j) represents the first color channel parameter corresponding to the unit patch U(i,j), CG(i,j) represents the second color channel parameter corresponding to the unit patch U1(i,j), CB(i,j) represents the third color channel parameter corresponding to the unit patch U1(i,j), V1_x′(i,j) represents the first initial diffusion position of the lower left vertex V1 of the unit patch U(i,j) in the first diffusion direction, V1_z′(i,j) represents the second initial diffusion position of the lower left vertex V1 of the unit patch U(i,j) in the second diffusion direction, V1_x″(i,j) represents the first diffusion position of the lower left vertex V1 of the unit patch U(i,j) in the first diffusion direction, and V1_z″(i,j) represents the second diffusion position of the lower left vertex V1 of the unit patch U(i,j) in the second diffusion direction.

[0080] It should be noted that for other vertices in each unit patch, reference can be made to the diffusion process of the lower left vertex V1. It can be understood that after obtaining the first diffusion positions of each vertex in the first diffusion direction and the second diffusion in the second diffusion direction respectively, the final diffusion position corresponding to the unit patch U1 can be determined.

[0081] Based on the above, it should also be noted that if the normal direction of a unit patch is offset after noise offset is performed on the unit patch, then further processing should be performed on the unit patch. For example, the vertex positions can be rotated around the center of the unit patch so that the normal of the unit patch always points to the axis of the preset model, ensuring the reliability of the method of the present application. Of course, the specific adjustment method is not limited to this.

[0082] In summary, by applying the embodiments of the present application, random offsets of each unit patch in space can be achieved by performing noise offsets on the vertices of each unit patch, making the subsequent simulation distribution of the preset virtual cover in space more realistic and natural.

[0083] Figure 5 It is a schematic flowchart of another virtual scene rendering method provided by the embodiments of the present application. In an optional implementation manner, the diffusion parameter includes diffusion density. Determining the diffusion density corresponding to each unit patch according to the color channel parameter corresponding to each unit patch includes:

[0084] Step 501, obtain a preset density control parameter.

[0085] Optionally, the preset density control parameter can be a preset value, or can be set by the user according to the scene requirements, which is not limited herein.

[0086] Step 502, if it is determined that the third color channel parameter corresponding to each unit patch is less than the preset density control parameter, then render the preset virtual cover corresponding to each unit patch in the virtual scene according to the preset texture map corresponding to the preset virtual cover.

[0087] The diffusion density corresponding to each unit patch is used to indicate the coverage density of the preset virtual cover simulated by each unit patch in the virtual scene.

[0088] Among them, when specifically rendering, the magnitude relationship between the third color channel parameter corresponding to each unit patch and the preset density control parameter q can be compared. If the third color channel parameter corresponding to each unit patch is greater than the preset density control parameter, then the unit patch is ignored and no subsequent rendering operation is performed; if the third color channel parameter corresponding to each unit patch is less than the preset density control parameter (that is, CB(i,j) < q), then render the preset virtual cover corresponding to each unit patch in the virtual scene according to the preset texture map corresponding to the preset virtual cover.

[0089] It can be seen that in the actual application scenario, the preset density control parameter can be flexibly set according to the demand for coverage density. For example, if a larger coverage density is desired, a larger preset density control parameter can be set; otherwise, a smaller preset density control parameter can be set to achieve the falling effect of the preset virtual overlay with variable density.

[0090] It should be noted that the preset density control parameter can be set through the shader, which realizes the flexible control of the snowing effect and the presentation style.

[0091] In an alternative embodiment, the histogram of the preset noise map on the first color channel parameter satisfies the exponential-like function distribution, where the abscissa of the histogram represents the pixel value and the ordinate of the histogram represents the number of pixels.

[0092] Among them, the color channel parameters corresponding to each pixel point in the preset noise map can be generated according to the following formula:

[0093] CR (i,j) = 1.0 - Math.random() * Math.sqrt(Math.random())

[0094] CG (i,j) = Math.random()

[0095] CB (i,j) = Math.random()

[0096] Among them, Math.random() represents the random function, which is used to obtain a random value in the range of [0, 1), Math.sqrt() represents the square root function, CR(i, j) represents the red channel parameter corresponding to the pixel point P(i, j), CG(i, j) represents the green channel parameter corresponding to the pixel point P(i, j), and CB(i, j) represents the blue channel parameter corresponding to the pixel point P(i, j).

[0097] Figure 6 This is the histogram of the preset noise map provided by the embodiment of the present application on the first color channel parameter. In addition, based on the above formula, optionally, the calculated CR(i, j) can be fine-tuned to control the distribution density of the unit patches in space. And through experimental verification, such as Figure 6As shown, the abscissa represents pixel values, and the ordinate represents the number of pixels. When the histogram of the red channel satisfies the exponential-like function distribution, it can ensure that the distribution of the unit patches is relatively uniform when diffusing to a distance, thereby making the subsequent simulation more realistic and natural. Among them, the exponential-like function refers to those functions that are similar to the standard exponential function in form or behavior. For example, the generalized exponential function, hyperbolic function, etc., which are not limited here.

[0098] Figure 7 It is a schematic flowchart of another virtual scene rendering method provided by an embodiment of the present application. Figure 8 It is a schematic diagram of a preset model provided by an embodiment of the present application. In an alternative embodiment, as Figure 7 shown, the above-mentioned rendering to generate the animation rendering effect of the preset virtual overlay falling along the preset direction in the virtual scene according to the diffusion parameters corresponding to each unit patch and the preset texture map corresponding to the preset virtual overlay includes:

[0099] Step 601: Determine the falling positions of each unit patch along the preset direction at each time frame according to the color channel parameters corresponding to each unit patch and the preset falling speed.

[0100] Among them, the initial position corresponding to each unit patch is determined according to the position after diffusion of each unit patch, and the maximum fallable position corresponding to each unit patch is determined according to the height of the preset model in the preset direction. As Figure 8 shown, optionally, the preset model can be a cylindrical model with a circular cross-section, that is, the side model of a cylinder. It can be understood that, compared with the side model of a cube, there are no side edges. Therefore, uniform diffusion can be achieved in the xz plane. At this time, the maximum fallable position corresponding to each unit patch is the distance between the top and bottom of the preset model.

[0101] Optionally, the preset falling speed can be a default speed, or it can be flexibly set according to the scene requirements, which is not limited here and can be flexibly set according to the actual application scenario.

[0102] In some embodiments, the falling positions of each unit patch along the preset direction at each time frame can be determined according to the initial position corresponding to each unit patch and the falling offset corresponding to each unit patch along the preset direction at each time frame.

[0103] Among them, the falling offset corresponding to each unit patch along the preset direction at each time frame can be determined according to the color channel parameters corresponding to each unit patch and the preset falling speed. Optionally, the specific calculation formula is as follows:

[0104] Dt(i,j) = Speed × (1 + CG(i,j) × CB(i,j)) × TIME_t

[0105] Among them, Speed represents the preset falling speed, CG(i,j) represents the green channel parameter corresponding to the unit patch U(i,j), CB(i,j) represents the blue channel parameter corresponding to the unit patch U(i,j), TIME_t represents the t-th moment, and Dt(i,j) represents the falling offset corresponding to the unit patch U(i,j) along the preset direction at the t-th moment.

[0106] Furthermore, the falling positions of each unit patch along the preset direction at each time frame can be determined by the following formula: V1_y″(i,j) = V1_y′(i,j) + Dt(i,j), where V1_y′(i,j) represents the initial diffusion position of the lower left vertex V1 of the unit patch U(i,j) in the preset direction, and V1_y″(i,j) represents the falling position of the lower left vertex V1 of the unit patch U(i,j) in the preset direction.

[0107] It should be noted that the preset falling speed can be set through the shader, which realizes the flexible control of the snowing effect and presentation style. In addition, it should be noted that in some embodiments, for the interior of the boundary of the preset model, some unit patches can be selected to be offset to the interior of the boundary of the preset model, and then through rendering, the effect of the preset virtual covering falling in the preset direction can be presented inside the boundary of the preset model.

[0108] Step 602: Based on the falling positions of each unit patch along the preset direction at each time frame, according to the diffusion parameters corresponding to each unit patch and the preset texture map corresponding to the preset virtual covering, render the animation rendering effect of the preset virtual covering falling in the preset direction at each time frame in the virtual scene.

[0109] Optionally, when specifically rendering, it can be determined whether to draw the unit patch according to the diffusion density corresponding to each unit patch; if it is determined to draw, then according to the diffusion intensity corresponding to the unit patch and the falling position of the unit patch along the preset direction at each time frame, the final diffusion position of the unit patch is determined, and according to the preset texture map corresponding to the preset virtual covering, the animation rendering effect of the preset virtual covering falling in the preset direction at each time frame in the virtual scene is rendered.

[0110] In addition, when specifically rendering, each unit patch can be mapped to the preset texture map corresponding to the preset virtual covering. For example, in the fragment shader, the preset texture map can be sampled through the remapped UV for drawing output.

[0111] It should be noted that during the rendering process, the vertex coordinates of each unit patch can also be converted to the coordinates corresponding to the camera coordinate system through the WORLDVIEW matrix, and always bound to the viewing angle of the current camera, so as to ensure that the snowflake effect range always includes the camera position and the snowflake effect always follows.

[0112] In an alternative embodiment, the above method further includes:

[0113] If it is determined that the falling position of each unit patch corresponding to the target time frame is the first preset position according to the color channel parameters and the preset falling speed corresponding to each unit patch, then it is determined that the falling position of each unit patch corresponding to the next time frame is the second preset position, where the second preset position is higher than the first preset position in the preset direction.

[0114] Optionally, the first preset position can be the bottom of the preset model, and the second preset position can be the top of the preset model.

[0115] Based on the above description, in order to achieve the continuous animation effect of the preset virtual covering falling in the preset direction, if it is determined that the falling position of a certain unit patch corresponding to the target time frame is the bottom of the preset model, at this time, the falling position of the unit patch corresponding to the next time frame can be set to the top of the preset model, so as to achieve the falling performance that repeats from top to bottom.

[0116] In summary, by applying the embodiments of the present application, by making a preset model, it is avoided to create drawing units through a particle system, and there is no need to calculate the attributes and behaviors of particles, which greatly avoids the occupation and consumption of resources; when the embodiments of the present application are specifically implemented, through a preset noise map, the spatial distribution and movement of the drawing unit patches are realized, so as to realize the preset virtual covering falling in the preset direction, and the calculation process is all realized during the rendering process, which can be executed on the GPU, making full use of the parallel processing ability of the GPU, avoiding the occupation of resources by the main thread, being fast and efficient. Compared with the prior art, it avoids creating drawing units through a particle system, and there is no need to introduce the attributes of particles and perform behavior calculations, which greatly avoids the occupation and consumption of resources.

[0117] In addition, the present application also supports passing parameters (such as preset falling speed, preset density control parameters, etc.) to the shader, which can flexibly control the snowing effect and presentation style, and improve the flexibility and applicability of the method of the present application.

[0118] Figure 9 It is a schematic diagram of the functional modules of a rendering device for a virtual scene provided by an embodiment of the present application. Among them, the basic principle and the technical effects generated by this device are the same as those of the corresponding method embodiment described above. For a brief description, for the parts not mentioned in this embodiment, reference can be made to the corresponding content in the method embodiment. As Figure 9As shown, the rendering device includes:

[0119] An acquisition module 110, configured to acquire a preset model and a preset noise map respectively. The preset model includes: a plurality of unit patches, each unit patch includes a plurality of vertices, the preset noise map includes a plurality of pixel points, and each pixel point includes a plurality of color channel parameters;

[0120] A mapping module 120, configured to map each unit patch in the preset model to each pixel point in the preset noise map, and acquire the color channel parameters corresponding to each unit patch;

[0121] A determination module 130, configured to determine the diffusion parameters corresponding to each unit patch according to the color channel parameters corresponding to each unit patch;

[0122] A rendering module 140, configured to render an animation rendering effect of a preset virtual overlay falling along a preset direction in a virtual scene according to the diffusion parameters corresponding to each unit patch and a preset texture map corresponding to the preset virtual overlay.

[0123] In an alternative embodiment, the diffusion parameter includes a diffusion intensity. The determination module 130 is specifically configured to acquire the normal direction of each unit patch;

[0124] Determine the diffusion intensity corresponding to each unit patch according to the color channel parameters corresponding to each unit patch, the normal direction of each unit patch, and a preset diffusion radius.

[0125] In an alternative embodiment, the determination module 130 is specifically configured to determine a first diffusion position of each unit patch in a first diffusion direction and a second diffusion position of each unit patch in a second diffusion direction according to the first color channel parameter corresponding to each unit patch, the normal direction of each unit patch, and a preset diffusion radius. The plane formed by the first diffusion direction and the second diffusion direction is perpendicular to the preset direction;

[0126] Determine the diffusion intensity corresponding to each unit patch according to the first diffusion position and the second diffusion position.

[0127] In an alternative embodiment, the determination module 130 is specifically configured to determine a first initial diffusion position of each unit patch in a first diffusion direction and a second initial diffusion position of each unit patch in a second diffusion direction according to the first color channel parameter corresponding to each unit patch, the normal direction of each unit patch, and a preset diffusion radius;

[0128] Perform noise offset on each first initial diffusion position according to the first color channel parameter and the second color channel parameter corresponding to each unit patch and the preset diffusion radius, and determine the first diffusion position of each unit patch in the first diffusion direction;

[0129] According to the first color channel parameter, the third color channel parameter corresponding to each unit patch, and the preset diffusion radius, perform noise offset on each second initial diffusion position to determine the second diffusion position of each unit patch in the second diffusion direction.

[0130] In an alternative embodiment, the diffusion parameter includes diffusion density. The determination module 130 is specifically configured to obtain a preset density control parameter;

[0131] If it is determined that the third color channel parameter corresponding to each unit patch is less than the preset density control parameter, then render the preset virtual overlay corresponding to each unit patch in the virtual scene according to the preset texture map corresponding to the preset virtual overlay.

[0132] In an alternative embodiment, the histogram of the preset noise map on the first color channel parameter satisfies an exponential-like function distribution, where the abscissa of the histogram represents the pixel value and the ordinate of the histogram represents the number of pixels.

[0133] In an alternative embodiment, the rendering module 140 is specifically configured to determine the falling position of each unit patch corresponding to each time frame along the preset direction according to the color channel parameter corresponding to each unit patch and the preset falling speed;

[0134] Based on the falling positions of each unit patch corresponding to each time frame along the preset direction, according to the diffusion parameter corresponding to each unit patch and the preset texture map corresponding to the preset virtual overlay, render an animation rendering effect in which the preset virtual overlay corresponding to each time frame in the virtual scene falls in the preset direction.

[0135] In an alternative embodiment, the rendering module 140 is further configured to, if it is determined that the falling position of each unit patch corresponding to the target time frame is the first preset position according to the color channel parameter corresponding to each unit patch and the preset falling speed, determine that the falling position of each unit patch corresponding to the next time frame is the second preset position, where the second preset position is higher than the first preset position in the preset direction.

[0136] The above device is used to execute the method provided in the foregoing embodiment, and its implementation principle and technical effect are similar, which will not be elaborated here.

[0137] The above-mentioned modules may be one or more integrated circuits configured to implement the above methods. For example: one or more Application Specific Integrated Circuits (ASICs), or one or more microprocessors, or one or more Field Programmable Gate Arrays (FPGAs), etc. Again, when a certain module above is implemented in the form of a processing element scheduler code, the processing element may be a general-purpose processor, such as a Central Processing Unit (CPU) or other processors that can call program code. Again, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0138] Figure 10 FIG. is a schematic structural diagram of an electronic device provided by an embodiment of the present application. The electronic device may be integrated into the above-mentioned rendering device. As Figure 10 shown, the electronic device may include: a processor 210, a storage medium 220, and a bus 230. The storage medium 220 stores machine-readable instructions executable by the processor 210. When the electronic device runs, the processor 210 communicates with the storage medium 220 through the bus 230, and the processor 210 executes the machine-readable instructions to perform the steps of the following method embodiments:

[0139] Obtain a preset model and a preset noise map respectively. The preset model includes: a plurality of unit patches, each unit patch includes a plurality of vertices, the preset noise map includes a plurality of pixel points, and each pixel point includes a plurality of color channel parameters;

[0140] Map each unit patch in the preset model to each pixel point in the preset noise map, and obtain the color channel parameters corresponding to each unit patch;

[0141] Determine the diffusion parameter corresponding to each unit patch according to the color channel parameters corresponding to each unit patch;

[0142] Render an animation rendering effect of a preset virtual overlay falling along a preset direction in a virtual scene according to the diffusion parameter corresponding to each unit patch and a preset texture map corresponding to the preset virtual overlay.

[0143] In an alternative embodiment, the diffusion parameter includes a diffusion intensity. Determining the diffusion parameter corresponding to each unit patch according to the color channel parameters corresponding to each unit patch includes:

[0144] Obtain the normal direction of each unit patch;

[0145] Determine the diffusion intensity corresponding to each unit patch according to the color channel parameters corresponding to each unit patch, the normal direction of each unit patch, and a preset diffusion radius.

[0146] In an alternative embodiment, determining the diffusion intensity corresponding to each unit patch according to the color channel parameters corresponding to each unit patch, the normal direction of each unit patch, and a preset diffusion radius includes:

[0147] Determine a first diffusion position of each unit patch in a first diffusion direction and a second diffusion position of each unit patch in a second diffusion direction according to the first color channel parameters corresponding to each unit patch, the normal direction of each unit patch, and a preset diffusion radius, where the plane formed by the first diffusion direction and the second diffusion direction is perpendicular to a preset direction;

[0148] Determine the diffusion intensity corresponding to each unit patch according to the first diffusion position and the second diffusion position.

[0149] In an alternative embodiment, determining a first diffusion position of each unit patch in a first diffusion direction and a second diffusion position of each unit patch in a second diffusion direction according to the first color channel parameters corresponding to each unit patch, the normal direction of each unit patch, and a preset diffusion radius includes:

[0150] Determine a first initial diffusion position of each unit patch in a first diffusion direction and a second initial diffusion position of each unit patch in a second diffusion direction according to the first color channel parameters corresponding to each unit patch, the normal direction of each unit patch, and a preset diffusion radius;

[0151] Perform noise offset on each first initial diffusion position according to the first color channel parameters and second color channel parameters corresponding to each unit patch and a preset diffusion radius to determine the first diffusion position of each unit patch in the first diffusion direction;

[0152] Perform noise offset on each second initial diffusion position according to the first color channel parameters and third color channel parameters corresponding to each unit patch and a preset diffusion radius to determine the second diffusion position of each unit patch in the second diffusion direction.

[0153] In an alternative embodiment, the diffusion parameter includes a diffusion density. Determining the diffusion density corresponding to each unit patch according to the color channel parameters corresponding to each unit patch includes:

[0154] Obtain a preset density control parameter;

[0155] If it is determined that the third color channel parameter corresponding to each unit patch is less than the preset density control parameter, then render the preset virtual cover corresponding to each unit patch in the virtual scene according to the preset texture map corresponding to the preset virtual cover.

[0156] In an alternative embodiment, the histogram of the preset noise map on the first color channel parameter satisfies a class exponential function distribution, where the abscissa of the histogram represents the pixel value and the ordinate of the histogram represents the number of pixels.

[0157] In an alternative embodiment, according to the diffusion parameters corresponding to each unit patch and the preset texture map corresponding to the preset virtual overlay, an animation rendering effect of the preset virtual overlay falling along a preset direction in the virtual scene is rendered, including:

[0158] Determine the falling positions of each unit patch along the preset direction at each time frame according to the color channel parameters corresponding to each unit patch and the preset falling speed;

[0159] Based on the falling positions of each unit patch along the preset direction at each time frame, according to the diffusion parameters corresponding to each unit patch and the preset texture map corresponding to the preset virtual overlay, an animation rendering effect of the preset virtual overlay falling towards the preset direction at each time frame in the virtual scene is rendered.

[0160] In an alternative embodiment, the above method further includes: if it is determined that the falling position of each unit patch at the target time frame is the first preset position according to the color channel parameters corresponding to each unit patch and the preset falling speed, then determine that the falling position of each unit patch at the next time frame is the second preset position, where the second preset position is higher than the first preset position in the preset direction.

[0161] The specific implementation manners and technical effects of the above method embodiments are similar to the foregoing related ones, and will not be elaborated here.

[0162] Optionally, the present application further provides a storage medium, on which a computer program is stored, and when the computer program is run by a processor, the steps of the following method embodiments are executed:

[0163] Obtain a preset model and a preset noise map respectively, the preset model includes: a plurality of unit patches, each unit patch includes a plurality of vertices, the preset noise map includes a plurality of pixel points, and each pixel point includes a plurality of color channel parameters;

[0164] Map each unit patch in the preset model to each pixel point in the preset noise map, and obtain the color channel parameters corresponding to each unit patch;

[0165] Determine the diffusion parameters corresponding to each unit patch according to the color channel parameters corresponding to each unit patch;

[0166] According to the diffusion parameters corresponding to each unit patch and the preset texture map corresponding to the preset virtual overlay, an animation rendering effect of the preset virtual overlay falling along a preset direction in the virtual scene is rendered.

[0167] In an alternative embodiment, the diffusion parameter includes a diffusion intensity. Determining the diffusion parameter corresponding to each unit patch according to the color channel parameter corresponding to each unit patch includes:

[0168] Obtaining the normal direction of each unit patch;

[0169] Determining the diffusion intensity corresponding to each unit patch according to the color channel parameter corresponding to each unit patch, the normal direction of each unit patch, and a preset diffusion radius.

[0170] In an alternative embodiment, determining the diffusion intensity corresponding to each unit patch according to the first color channel parameter corresponding to each unit patch, the normal direction of each unit patch, and a preset diffusion radius includes:

[0171] Determining a first diffusion position of each unit patch in a first diffusion direction and a second diffusion position of each unit patch in a second diffusion direction according to the first color channel parameter corresponding to each unit patch, the normal direction of each unit patch, and a preset diffusion radius, wherein the plane formed by the first diffusion direction and the second diffusion direction is perpendicular to a preset direction;

[0172] Determining the diffusion intensity corresponding to each unit patch according to the first diffusion position and the second diffusion position.

[0173] In an alternative embodiment, determining a first diffusion position of each unit patch in a first diffusion direction and a second diffusion position of each unit patch in a second diffusion direction according to the first color channel parameter corresponding to each unit patch, the normal direction of each unit patch, and a preset diffusion radius includes:

[0174] Determining a first initial diffusion position of each unit patch in the first diffusion direction and a second initial diffusion position of each unit patch in the second diffusion direction according to the first color channel parameter corresponding to each unit patch, the normal direction of each unit patch, and a preset diffusion radius;

[0175] Performing noise offset on each first initial diffusion position according to the first color channel parameter and the second color channel parameter corresponding to each unit patch and a preset diffusion radius to determine the first diffusion position of each unit patch in the first diffusion direction;

[0176] Performing noise offset on each second initial diffusion position according to the first color channel parameter and the third color channel parameter corresponding to each unit patch and a preset diffusion radius to determine the second diffusion position of each unit patch in the second diffusion direction.

[0177] In an alternative embodiment, the diffusion parameter includes a diffusion density. Determining the diffusion density corresponding to each unit patch according to the color channel parameter corresponding to each unit patch includes:

[0178] Obtain the preset density control parameter;

[0179] If it is determined that the third color channel parameter corresponding to each unit patch is less than the preset density control parameter, then render the preset virtual overlay corresponding to each unit patch in the virtual scene according to the preset texture map corresponding to the preset virtual overlay.

[0180] In an alternative embodiment, the histogram of the preset noise map on the first color channel parameter satisfies an exponential-like function distribution, where the abscissa of the histogram represents the pixel value and the ordinate of the histogram represents the number of pixels.

[0181] In an alternative embodiment, according to the diffusion parameter corresponding to each unit patch and the preset texture map corresponding to the preset virtual overlay, render an animation rendering effect in which the preset virtual overlay in the virtual scene falls along the preset direction, including:

[0182] Determine the falling position corresponding to each unit patch along the preset direction at each time frame according to the color channel parameter corresponding to each unit patch and the preset falling speed;

[0183] Based on the falling position corresponding to each unit patch along the preset direction at each time frame, according to the diffusion parameter corresponding to each unit patch and the preset texture map corresponding to the preset virtual overlay, render an animation rendering effect in which the preset virtual overlay corresponding to each time frame in the virtual scene falls towards the preset direction.

[0184] In an alternative embodiment, the above method further includes: if it is determined that the falling position corresponding to each unit patch at the target time frame is the first preset position according to the color channel parameter corresponding to each unit patch and the preset falling speed, then determine that the falling position corresponding to each unit patch at the next time frame is the second preset position, where the second preset position is higher than the first preset position in the preset direction.

[0185] The specific implementation manners and technical effects of the above method embodiments are similar to the foregoing related ones, and will not be elaborated here.

[0186] Optionally, the present application further provides a computer program product, which includes instructions that cause an electronic device to implement the steps of the above method embodiments when executed on the electronic device.

[0187] In several embodiments provided by the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of unit patches is only a logical function division. In actual implementation, there may be other division methods. For example, multiple unit patches or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other can be through some interfaces. The indirect coupling or communication connection of devices or unit patches can be in electrical, mechanical or other forms.

[0188] The unit patches described as separate components may or may not be physically separated. The components shown as unit patches may or may not be physical unit patches, that is, they can be located in one place, or can be distributed to multiple network unit patches. Some or all of the unit patches can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0189] In addition, the functional unit patches in each embodiment of the present application can be integrated in a processing unit patch, or each unit patch can exist physically alone, or two or more unit patches can be integrated in one unit patch. The above-mentioned integrated unit patches can be implemented in the form of hardware, or in the form of hardware plus software functional unit patches.

[0190] The above-mentioned integrated unit patches implemented in the form of software functional unit patches can be stored in a computer-readable storage medium. The above-mentioned software functional unit patches are stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to execute some steps of the methods in each embodiment of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (English: Read-Only Memory, abbreviated as: ROM), random access memories (English: RandomAccess Memory, abbreviated as: RAM), magnetic disks or optical discs that can store program codes.

[0191] It should be noted that in this text, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprising", "including" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising one..." does not exclude the existence of additional identical elements in the process, method, article or device comprising the element.

[0192] The above are only the preferred embodiments of the present application and are not used to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the protection scope of the present application. It should be noted that similar reference numerals and letters denote similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. The above are only the preferred embodiments of the present application and are not used to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the protection scope of the present application.

Claims

1. A method for rendering a virtual scene, characterized in that: The method comprises: Respectively obtain a preset model and a preset noise map, wherein the preset model includes: a plurality of unit patches, each of which includes a plurality of vertices, and the preset noise map includes a plurality of pixel points, each of which includes a plurality of color channel parameters; Mapping each unit patch in the preset model to each pixel point in the preset noise map, and obtaining color channel parameters corresponding to each unit patch; Determine the diffusion parameters corresponding to each of the unit patches according to the color channel parameters corresponding to each of the unit patches; According to the diffusion parameters corresponding to each of the unit facets and the preset texture map corresponding to the preset virtual covering, an animation rendering effect of a preset virtual covering falling along a preset direction in a virtual scene is rendered and generated.

2. The method according to claim 1, characterized in that: The diffusion parameter includes diffusion intensity, and determining the diffusion parameter corresponding to each unit patch according to the color channel parameter corresponding to each unit patch includes: Obtaining the normal direction of each unit face patch; The diffusion intensity corresponding to each of the unit patches is determined according to the color channel parameters corresponding to each of the unit patches, the normal direction of each of the unit patches, and a preset diffusion radius.

3. The method according to claim 2, characterized in that Determining the diffusion intensity corresponding to each of the unit patches according to the color channel parameters corresponding to each of the unit patches, the normal direction of each of the unit patches, and a preset diffusion radius includes: Determine, according to the first color channel parameter corresponding to each of the unit patches, the normal direction of each of the unit patches, and a preset diffusion radius, a first diffusion position of each of the unit patches in a first diffusion direction and a second diffusion position in a second diffusion direction, wherein a plane formed by the first diffusion direction and the second diffusion direction is perpendicular to the preset direction; The diffusion intensity corresponding to each of the unit facets is determined according to the first diffusion position and the second diffusion position.

4. The method according to claim 3, characterized in that The determining, according to the first color channel parameter corresponding to each of the unit patches, the normal direction of each of the unit patches, and a preset diffusion radius, a first diffusion position of each of the unit patches in the first diffusion direction and a second diffusion position in the second diffusion direction, comprises: Determine, according to the first color channel parameter corresponding to each of the unit patches, the normal direction of each of the unit patches, and a preset diffusion radius, a first initial diffusion position of each of the unit patches in the first diffusion direction and a second initial diffusion position of each of the unit patches in the second diffusion direction; According to the first color channel parameter, the second color channel parameter and the preset diffusion radius corresponding to each of the unit patches, noise shift is performed on each of the first initial diffusion positions to determine a first diffusion position of each of the unit patches in the first diffusion direction; According to the first color channel parameter, the third color channel parameter and the preset diffusion radius corresponding to each of the unit patches, noise shift is performed on each of the second initial diffusion positions to determine the second diffusion position of each of the unit patches in the second diffusion direction.

5. The method according to claim 1, characterized in that The diffusion parameter includes diffusion density, and determining the diffusion density corresponding to each of the unit patches according to the color channel parameter corresponding to each of the unit patches includes: Get preset density control parameters; If it is determined that the third color channel parameter corresponding to each of the unit patches is less than the preset density control parameter, the preset virtual covering corresponding to each of the unit patches in the virtual scene is rendered according to the preset texture map corresponding to the preset virtual covering.

6. The method according to claim 1, characterized in that The histogram of the preset noise map on the first color channel parameter satisfies a quasi-exponential function distribution, wherein the abscissa of the histogram represents the pixel value, and the ordinate of the histogram represents the number of pixels.

7. The method according to claim 1, characterized in that The step of rendering and generating an animation rendering effect of a preset virtual covering falling in a preset direction in a virtual scene according to the diffusion parameters corresponding to each of the unit facets and the preset texture map corresponding to the preset virtual covering includes: Determining the falling position corresponding to each of the unit face pieces in each time frame along the preset direction according to the color channel parameters corresponding to each of the unit face pieces and the preset falling speed; Based on the falling position of each unit facet along the preset direction in each time frame corresponding to the falling position, according to the diffusion parameters corresponding to each unit facet and the preset texture map corresponding to the preset virtual cover, an animation rendering effect of the preset virtual cover corresponding to each time frame in the virtual scene falling in the preset direction is rendered and generated.

8. The method according to claim 7, characterized in that The method further comprises: If the falling position corresponding to each unit face piece in the target time frame is determined to be the first preset position based on the color channel parameters corresponding to each unit face piece and the preset falling speed, then the falling position corresponding to each unit face piece in the next time frame is determined to be the second preset position, wherein the second preset position is higher than the first preset position in the preset direction.

9. A virtual scene rendering device, characterized in that: include: An acquisition module, used to respectively acquire a preset model and a preset noise map, wherein the preset model includes: a plurality of unit patches, each of which includes a plurality of vertices, and the preset noise map includes a plurality of pixel points, each of which includes a plurality of color channel parameters; A mapping module, used to map each unit patch in the preset model to each pixel point in the preset noise map, and obtain color channel parameters corresponding to each unit patch; A determination module, used to determine the diffusion parameters corresponding to each of the unit patches according to the color channel parameters corresponding to each of the unit patches; The rendering module is used to render and generate an animation rendering effect of a preset virtual covering falling along a preset direction in a virtual scene according to the diffusion parameters corresponding to each of the unit face patches and the preset texture map corresponding to the preset virtual covering.

10. An electronic device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the storage medium communicate via the bus, and the processor executes the machine-readable instructions to perform the steps of the virtual scene rendering method as described in any one of claims 1-8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the virtual scene rendering method according to any one of claims 1 to 8 are executed.