Dynamic volume cloud rendering method, device and electronic device
By using 2D noise maps to generate 3D noise maps in the game engine, and combining lighting data rendering to generate volume clouds, the problem of game rendering technology being difficult to express fluid effects is solved, and 3D texture map rendering in engines that do not support 3D textures is realized. Improved rendering efficiency and effects.
Patent Information
- Application Number
- CN202011074759.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-09
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2040-10-09
AI Technical Summary
Existing game rendering technology is difficult to effectively express fluid effects, especially the flow characteristics of clouds, and the rendering process of 3D texture maps cannot be realized in game engines that do not support 3D texture.
By reading multiple pre-stored 2D noise maps, using offset sampling in the Z-axis direction to generate a second 3D noise map, and mapping it to the sky area, combined with lighting data rendering to generate volume clouds, to achieve a 3D texture-like material Effect.
The rendering process of 3D texture maps is implemented in game engines that do not support 3D texture, which improves the rendering efficiency of volume clouds and provides better dynamic rendering effects.
Smart Images

Figure CN112190935B
Abstract
Description
Technical Field
[0001] The present application relates to the field of game rendering technology, and in particular to a method, device and electronic device for rendering a dynamic volume cloud. Background Art
[0002] Currently, the rendering of games is mainly based on rasterization. However, it is still difficult to use rasterization rendering structure design to express the effect of fluid. Generally, simple patches are used for simulation, but this patch simulation is difficult to express the flow characteristics of fluid and does not support viewing from different angles. In some mature large-scale commercial projects, some games use raymarching voxel rendering method to achieve it, but some game engines do not support the use of 3D texture, a key resource for voxel rendering, and thus cannot perform subsequent rendering process on 3D texture. Summary of the invention
[0003] The purpose of the present application is to provide a method, device and electronic device for rendering a dynamic volumetric cloud that can achieve an effect similar to a 3D texture material based on a 2D map, obtain a 3D texture map, and then implement the rendering process of the 3D texture map in a game engine that does not support 3D texture.
[0004] In a first aspect, an embodiment of the present application provides a method for rendering a dynamic volumetric cloud, the method being used to render and generate a volumetric cloud in the sky of a computer virtual scene, the method comprising: reading a plurality of pre-stored 2D noise maps, wherein the plurality of 2D noise maps are obtained by performing multiple offset samplings on a first 3D noise map in a Z-axis direction, and each 2D noise map records its offset value; constructing a second 3D noise map based on the plurality of 2D noise maps and their offset values; and mapping the second 3D noise map in a limited sky area to render and generate a volumetric cloud.
[0005] Furthermore, the first 3D noise map is pre-generated by the following steps: obtaining a first Perlin noise map and a first cell noise map; and mixing the first Perlin noise map and the first cell noise map to generate a first 3D noise map.
[0006] Furthermore, the step of mixing the first Perlin noise map and the first cell noise map to generate the first 3D noise map includes: performing image multiplication on the first Perlin noise map and the first cell noise map to obtain the first 3D noise map.
[0007] Furthermore, the first Perlin noise map is pre-generated by the following steps: obtaining a plurality of second Perlin noise maps; and mixing the plurality of second Perlin noise maps to generate a first Perlin noise map.
[0008] Furthermore, the step of mixing the plurality of second Perlin noise maps to generate the first Perlin noise map includes: performing multi-layer mixing of the plurality of second Perlin noise maps through a fractal Brownian motion model to generate the first Perlin noise map.
[0009] Furthermore, before the above step of reading the pre-stored multiple 2D noise maps, the method also includes: performing 2D map sampling along the Z-axis direction of the first 3D noise map according to a preset pixel offset unit; and storing the sampled multiple 2D noise maps and the offset values corresponding to the 2D noise maps.
[0010] Furthermore, the step of constructing a second 3D noise map based on multiple 2D noise maps and their offset values includes: sequentially superimposing the multiple 2D noise maps in the Z-axis direction according to the offset values corresponding to the multiple 2D noise maps respectively, to obtain a second 3D noise map.
[0011] Furthermore, the above-mentioned step of mapping the second 3D noise map in the defined sky area to render and generate volumetric clouds includes: mapping the second 3D noise map in the defined sky area; calculating the illumination data of the second 3D noise map at different heights of the sky area at intervals of a preset unit step size starting from the starting height or the ending height of the defined sky area; and rendering and generating volumetric clouds in the sky area based on the second 3D noise map and the illumination data.
[0012] Furthermore, the calculation method of the above-mentioned illumination data includes: subject light transmittance calculation and / or illumination intensity calculation.
[0013] Furthermore, before the step of mapping the second 3D noise map in the defined sky area to render and generate volumetric clouds, the method further includes: performing edge shaving adjustment and / or density adjustment on the second 3D noise map.
[0014] In a second aspect, an embodiment of the present application further provides a rendering device for dynamic volumetric clouds, the device being used to render and generate volumetric clouds in the sky of a computer virtual scene, the device comprising: a 2D texture reading module, for reading a plurality of pre-stored 2D noise maps, wherein the plurality of 2D noise maps are obtained by performing multiple offset samplings on a first 3D noise map in the Z-axis direction, and each 2D noise map records its offset value; a 3D texture construction module, for constructing a second 3D noise map based on the plurality of 2D noise maps and their offset values; and a volumetric cloud rendering module, for mapping the second 3D noise map in a defined sky area to render and generate volumetric clouds.
[0015] In a third aspect, an embodiment of the present application further provides an electronic device, including a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the above method.
[0016] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above method.
[0017] In the rendering method, device and electronic device of dynamic volumetric cloud provided by the embodiment of the present application, firstly, a plurality of pre-stored 2D noise maps are read, wherein the plurality of 2D noise maps are obtained by performing multiple offset samplings on the first 3D noise map in the Z-axis direction, and each 2D noise map records its offset value; then, based on the plurality of 2D noise maps and their offset values, a second 3D noise map can be constructed; finally, the second 3D noise map can be mapped in a limited sky area to render and generate volumetric cloud. The embodiment of the present application can construct a 3D noise map in the engine by using the plurality of pre-stored 2D noise maps obtained by sampling the 3D map offset, and then can realize the rendering process of dynamic volumetric cloud based on the 3D noise map, and finally render and generate volumetric cloud in the sky of the computer virtual scene. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the specific implementation methods of the present application or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0019] Figure 1 A flowchart of a method for rendering a dynamic volumetric cloud provided in an embodiment of the present application;
[0020] Figure 2 A flowchart of a method for generating a first 3D noise map provided in an embodiment of the present application;
[0021] Figure 3 This is an effect diagram of a second Perlin noise map provided in an embodiment of the present application;
[0022] Figure 4 An effect diagram of a first Perlin noise map provided in an embodiment of the present application;
[0023] Figure 5 This is an effect diagram of a first cell noise map provided in an embodiment of the present application;
[0024] Figure 6 This is an effect diagram of a first 3D noise map provided in an embodiment of the present application;
[0025] Figure 7 A flow chart of a volumetric cloud rendering method provided in an embodiment of the present application;
[0026] Figure 8 A volumetric cloud rendering lighting schematic diagram provided in an embodiment of the present application;
[0027] Fig. 9 An effect diagram of edge culling adjustment of a second 3D noise map provided in an embodiment of the present application;
[0028] Fig.10 This is an effect diagram of density adjustment of a second 3D noise map provided in an embodiment of the present application;
[0029] Fig.11 A structural block diagram of a dynamic volume cloud rendering device provided in an embodiment of the present application;
[0030] Fig.12 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0031] The technical solution of the present application will be described clearly and completely below in conjunction with the embodiments. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0032] Currently, the rendering of games is mainly based on rasterization. However, it is still difficult to use rasterization rendering structure design to express fluid effects. Generally, simple patches are used for simulation, but this kind of patch simulation is difficult to express the flow characteristics of clouds and does not support viewing from different angles. In some mature large-scale commercial projects, some games use raymarching voxel rendering based on 3D textures to achieve this.
[0033] 3D texture is a three-dimensional "graphic". Just as 2D texture is a pixel matrix in the form of (x, y), 3D texture is a three-dimensional pixel matrix in the form of (x, y, z), where each (x, y, z) corresponds to a scalar value; 3D texture mapping is to map this three-dimensional pixel array to the three-dimensional object space; usually objects and 3D textures are processed into cubes or cylinders to better implement the rendering process.
[0034] However, some game engines do not support the use of 3D texture, a key resource for voxel rendering, and many problems are encountered.
[0035] Based on this, the embodiments of the present application provide a method, device and electronic device for rendering a dynamic volumetric cloud, which can achieve an effect similar to a 3D texture material based on a 2D map, obtain a 3D texture map, and then implement the rendering process of the 3D texture map in a game engine that does not support 3D texture.
[0036] Figure 1 A flowchart of a method for rendering a dynamic volumetric cloud provided in an embodiment of the present application, the method can be used to render and generate a volumetric cloud in the sky of a computer virtual scene, the execution subject of the method can be a game engine, and the method specifically includes the following steps:
[0037] Step S102 , reading a plurality of pre-stored 2D noise maps, wherein the plurality of 2D noise maps are obtained by performing multiple offset samplings on the first 3D noise map in the Z-axis direction, and each 2D noise map records its offset value.
[0038] In specific implementation, the game engine stores multiple 2D noise maps (related to clouds) in advance. The multiple 2D noise maps are obtained by performing multiple offset samplings on the first 3D noise map in the Z-axis direction, and each 2D noise map records its offset value. For example, the first 2D noise map has an offset value of 1, the second 2D noise map has an offset value of 2, and so on. In the embodiment of the present application, the offset sampling is 64 times, corresponding to 64 2D noise maps.
[0039] The first 3D noise map may be an existing 3D noise map, or may be pre-made according to the dynamic cloud effect to be achieved, for example, it may be obtained by pre-processing a Perlin noise map and a cell noise map, which is not specifically limited here.
[0040] Step S104: construct a second 3D noise map based on the multiple 2D noise maps and their offset values.
[0041] Since each 2D noise map corresponds to an offset value, multiple 2D noise maps can be sequentially superimposed in the Z-axis direction according to the offset values corresponding to the multiple 2D noise maps to obtain a second 3D noise map.
[0042] Step S106: Map the second 3D noise map in the limited sky area to render and generate volumetric clouds.
[0043] After constructing the second 3D noise map, it is further mapped in a limited sky area to perform a volumetric cloud rendering process. For example, the lighting is calculated by a ray stepping method and a preset lighting algorithm, and then the volumetric cloud is rendered in the limited sky area according to the lighting data and the second 3D noise map.
[0044] In the rendering method of dynamic volumetric clouds provided in an embodiment of the present application, a 3D noise map can be constructed in a game engine by using multiple 2D noise maps obtained by sampling 3D map offsets in advance, and then the rendering process of dynamic volumetric clouds can be implemented based on the 3D noise map, and finally volumetric clouds can be rendered and generated in the sky of a computer virtual scene.
[0045] In order to achieve a better dynamic rendering effect of volumetric cloud, the present application embodiment also provides a method for generating a first 3D noise map, which can be specifically referred to in Figure 2 The flowchart shown implements:
[0046] Step S202, obtaining a first Perlin noise map and a first cell noise map.
[0047] The above-mentioned Perlin noise refers to the natural noise generation algorithm invented by Ken Perlin, and the Perlin noise map is a 2D map of clouds generated by the natural noise generation algorithm. The above-mentioned Cell Noise (also known as Worley noise) map is a map generated by a noise generation algorithm based on the Voronoi diagram, which is a 3D map. Therefore, it is necessary to first process the Perlin noise map into a 3D first Perlin noise map. The generation process of the above-mentioned first Perlin noise map may include the following steps:
[0048] (1) Obtain multiple second Perlin noise maps; Figure 3 As shown, the second Perlin noise map is a 2D map. For example, a second Perlin noise map can be copied multiple times to obtain multiple second Perlin noise maps.
[0049] (2) Mix multiple second Perlin noise maps to generate a first Perlin noise map, such as Figure 4 shown.
[0050] In order to achieve a better detail effect of the multi-layered mixed map, in the embodiment of the present application, multiple second Perlin noise maps can be mixed by a fractal Brownian motion model to generate a first Perlin noise map. In other words, multiple second Perlin noise maps can be added and / or multiplied to obtain a first Perlin noise map, which is a 3D map.
[0051] Fractal Brownian Motion (FBM) is a mathematical model that is mainly used to describe irregular shapes such as mountains, clouds, landforms, and simulated planetary surfaces in nature. In this embodiment, by continuously increasing the frequency by a certain multiple and the amplitude at a certain ratio, the Perlin noise map is continuously superimposed in a cycle, and the resulting multi-layer mixed map will have better volumetric cloud details.
[0052] Step S204: Mix the first Perlin noise map and the first cell noise map to generate a first 3D noise map.
[0053] The first Berlin noise map generated above is a 3D map, such as Figure 4 As shown, the first cell noise map is also a 3D map, such as Figure 5 As shown, the first Perlin noise map and the first cell noise map are then multiplied by an image to obtain a first 3D noise map, as shown in Figure 6 shown.
[0054] For the convenience of calculation, when making the above two 3D textures, it is recommended to make the two 3D textures into textures of the same size. If the sizes of the two are inconsistent, the textures can be adjusted by scaling, shearing and other processing methods.
[0055] Based on the first 3D noise map generated above, multiple 2D noise maps can be obtained by offset sampling. The specific process can be achieved in the following way:
[0056] (1) Along the Z-axis direction of the first 3D noise map, 2D map sampling is performed according to a preset pixel offset unit. The preset pixel offset unit may be one pixel or multiple pixels.
[0057] (2) Store the multiple sampled 2D noise maps and the offset values corresponding to the 2D noise maps. The offset value here can also be regarded as the Z coordinate value of the 2D noise map corresponding to the coordinate system.
[0058] Traditional raymarching is to send out rays from a point (usually the position of the virtual camera) and determine whether they intersect with the rendered object to determine the rendering effect. The step size is averaged, and a large amount of calculation is done in blank pixels. The embodiment of the present application optimizes this process, that is, the rendering height of the cloud is pre-set, that is, the starting height and ending height of the limited sky area.
[0059] In the embodiment of the present application, the rendering process of the volume cloud can be referred to Figure 7 A flowchart implementation of a volume cloud rendering method is shown:
[0060] Step S702: Map the second 3D noise map in the limited sky area.
[0061] Step S704 , starting from the defined starting height or ending height of the sky region, respectively calculates illumination data of the second 3D noise map at different heights of the sky region at intervals of a preset unit step length.
[0062] Step S706: Rendering and generating volumetric clouds in the sky area based on the second 3D noise map and the illumination data.
[0063] When rendering volumetric clouds, you can emit from the starting height of the defined sky area to the ending height, or you can emit from the ending height of the defined sky area to the starting height for ray tracing. For example, you can start emitting rays from the starting height of the defined sky area; perform a lighting calculation on the second 3D noise map every preset unit step until the ending height is reached, and you can calculate the lighting data of the second 3D noise map at different heights of the sky area.
[0064] like Figure 8 As shown, first, the initial height of the sky area and the end height of the cloud are set, and the starting point of the ray emission is the initial height of the sky area. Rays are emitted from the starting height, and then the lighting is calculated once on the bottom plane of the second 3D noise map. Then, it will rise at a preset unit step length, and then calculate the lighting once on the bottom plane of the second 3D noise map until it is rendered to the end height, and the lighting data of the second 3D noise map at different heights of the sky area is obtained, and then the rendering effect of the volumetric cloud is presented in the limited sky area.
[0065] The calculation method of the above-mentioned illumination data may include: subject light transmission calculation and / or illumination intensity calculation. Subject light transmission calculation is based on Beer's law that when light passes through a uniform participating medium, the brightness decays exponentially, for example, the color is darker where the cloud layer is thicker. Illumination intensity calculation can be used to calculate the anisotropic scattering characteristics of clouds, through which the luminous effect at the edge of the cloud can be shown when looking at the cloud towards the sun.
[0066] The above-mentioned method of emitting rays from the initial height of a limited sky area or the end of scheduling for calculation is much more efficient than emitting rays from the initial point of the camera, and the picture will be much better. It can satisfy the problem of rendering all clouds above a certain height. However, rays from the starting point of the camera are prone to incomplete rendering in the distance because the distance is too short.
[0067] In order to achieve a better rendering effect of volumetric clouds, before mapping the second 3D noise map in the defined sky area to render and generate volumetric clouds, the following steps may also be included:
[0068] The second 3D noise map is subjected to edge shaving adjustment and / or density adjustment. The effect of the edge shaving adjustment of the second 3D noise map is as follows: Fig. 9 As shown, the effect of density adjustment of the second 3D noise map is as follows Fig.10 shown.
[0069] The rendering method of dynamic volumetric cloud provided in the embodiment of the present application can achieve the effect similar to 3D texture material based on 2D mapping, obtain 3D texture mapping, and then realize the rendering process of 3D texture mapping in the game engine that does not support 3D texture. It can also improve the rendering efficiency of volumetric cloud, so that artists can combine some simple parameter adjustments to achieve different rendering effects.
[0070] Based on the above method embodiment, the present application embodiment also provides a dynamic volume cloud rendering device, which is used to render and generate volume clouds in the sky of a computer virtual scene, see Fig.11 As shown, the rendering device of the dynamic volume cloud includes:
[0071] A 2D map reading module 112 is used to read a plurality of pre-stored 2D noise maps, wherein the plurality of 2D noise maps are obtained by performing multiple offset samplings on the first 3D noise map in the Z-axis direction, and each 2D noise map records its offset value;
[0072] A 3D map construction module 114, configured to construct a second 3D noise map based on a plurality of 2D noise maps and their offset values;
[0073] The volume cloud rendering module 116 is used to map the second 3D noise map in a defined sky area to render and generate a volume cloud.
[0074] In another possible implementation, the apparatus further includes: a map generation module, configured to obtain a first Perlin noise map and a first cell noise map; and mix the first Perlin noise map and the first cell noise map to generate a first 3D noise map.
[0075] In another possible implementation, the map generation module is further used to perform image multiplication on the first Perlin noise map and the first cell noise map to obtain the first 3D noise map.
[0076] In another possible implementation, the map generation module is further used to obtain a plurality of second Perlin noise maps; and mix the plurality of second Perlin noise maps to generate a first Perlin noise map.
[0077] In another possible implementation, the map generation module is further configured to perform multi-layer mixing on a plurality of second Perlin noise maps through a fractal Brownian motion model to generate a first Perlin noise map.
[0078] In another possible implementation, the device further includes an offset sampling module, which is used to: perform 2D map sampling along the Z-axis direction of the first 3D noise map according to a preset pixel offset unit; and a map storage module, which is used to store multiple sampled 2D noise maps and offset values corresponding to the 2D noise maps.
[0079] In another possible implementation, the 3D map construction module 114 is further configured to: sequentially superimpose multiple 2D noise maps in the Z-axis direction according to the offset values respectively corresponding to the multiple 2D noise maps to obtain a second 3D noise map.
[0080] In another possible implementation, the volumetric cloud rendering module 116 is also used to: map a second 3D noise map in a defined sky area; calculate illumination data of the second 3D noise map at different heights of the sky area at intervals of a preset unit step size starting from a starting height or an ending height of the defined sky area; and render and generate a volumetric cloud in the sky area based on the second 3D noise map and the illumination data.
[0081] In another possible implementation, the calculation method of the above-mentioned illumination data includes: subject light transmittance calculation and / or illumination intensity calculation.
[0082] In another possible implementation, the apparatus further includes: a texture adjustment module, configured to perform edge shaving adjustment and / or density adjustment on the second 3D noise texture.
[0083] The rendering device for dynamic volumetric cloud provided in the embodiment of the present application has the same implementation principle and technical effects as those in the aforementioned embodiment of the rendering method for dynamic volumetric cloud. For the sake of brief description, for parts not mentioned in the embodiment of the rendering device for dynamic volumetric cloud, reference may be made to the corresponding contents in the aforementioned embodiment of the rendering method for dynamic volumetric cloud.
[0084] The present application also provides an electronic device, such as Fig.12 As shown, it is a schematic diagram of the structure of the electronic device, wherein the electronic device includes a processor 121 and a memory 120, the memory 120 stores computer executable instructions that can be executed by the processor 121, and the processor 121 executes the computer executable instructions to implement the above-mentioned dynamic volumetric cloud rendering method.
[0085] exist Fig.12 In the illustrated embodiment, the electronic device further includes a bus 122 and a communication interface 123 , wherein the processor 121 , the communication interface 123 and the memory 120 are connected via the bus 122 .
[0086] Among them, the memory 120 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 123 (which can be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. can be used. The bus 122 can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. The bus 122 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.12 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0087] The processor 121 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 121. The above processor 121 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to be executed, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor 121 reads the information in the memory and completes the steps of the mapping processing method of the above embodiment in combination with its hardware.
[0088] An embodiment of the present application also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned dynamic volumetric cloud rendering method. The specific implementation can be found in the aforementioned method embodiment, which will not be repeated here.
[0089] The computer program product of the dynamic volumetric cloud rendering method, device and electronic device provided in the embodiments of the present application includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be found in the method embodiments, which will not be repeated here.
[0090] Unless otherwise specifically stated, the relative steps, numerical expressions and values of the components and steps set forth in these embodiments do not limit the scope of the present application.
[0091] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0092] In the description of the present application, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present application. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0093] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A method for rendering a dynamic volume cloud, characterized in that: The method is used for rendering and generating volumetric clouds in the sky of a computer virtual scene, and the method comprises: Reading a plurality of pre-stored 2D noise maps, wherein the plurality of 2D noise maps are obtained by performing multiple offset samplings on the first 3D noise map in the Z-axis direction, and each of the 2D noise maps records its offset value; Constructing a second 3D noise map based on the plurality of 2D noise maps and their offset values; Mapping the second 3D noise map in a defined sky area to render and generate volumetric clouds; The step of mapping the second 3D noise map in a defined sky area to render and generate volumetric clouds comprises: Mapping the second 3D noise map in a limited sky area; Starting from the defined starting height or ending height of the sky area, calculating illumination data of the second 3D noise map at different heights of the sky area at intervals of a preset unit step length; Volumetric clouds are generated by rendering in the sky area based on the second 3D noise map and the lighting data.
2. The method according to claim 1, characterized in that The first 3D noise map is pre-generated by the following steps: Get the first Perlin noise map and the first cell noise map; The first Perlin noise map and the first cell noise map are mixed to generate the first 3D noise map.
3. The method according to claim 2, characterized in that The step of mixing the first Perlin noise map and the first cell noise map to generate the first 3D noise map includes: The first Perlin noise map and the first cell noise map are image-multiplied to obtain the first 3D noise map.
4. The method according to claim 2, characterized in that: The first Perlin noise map is pre-generated by the following steps: Get multiple second Perlin noise maps; The plurality of second Perlin noise maps are mixed to generate the first Perlin noise map.
5. The method according to claim 4, characterized in that The step of mixing a plurality of the second Perlin noise maps to generate the first Perlin noise map comprises: The first Perlin noise map is generated by performing multi-layer mixing on a plurality of the second Perlin noise maps through a fractal Brownian motion model.
6. The method according to claim 1, characterized in that Before the step of reading a plurality of pre-stored 2D noise maps, the method further comprises: Performing 2D map sampling according to a preset pixel offset unit along the Z-axis direction of the first 3D noise map; The plurality of sampled 2D noise maps and the offset values corresponding to the 2D noise maps are stored.
7. The method according to claim 1, characterized in that The step of constructing a second 3D noise map based on the plurality of 2D noise maps and their offset values comprises: According to the offset values respectively corresponding to the multiple 2D noise maps, the multiple 2D noise maps are sequentially superimposed in the Z-axis direction to obtain the second 3D noise map.
8. The method according to claim 1, characterized in that The calculation method of the illumination data includes: subject light transmittance calculation and / or illumination intensity calculation.
9. The method according to claim 1, characterized in that: Before the step of mapping the second 3D noise map in a defined sky area to render and generate volumetric clouds, the method further includes: Perform edge shaving adjustment and / or density adjustment on the second 3D noise map.
10. A dynamic volume cloud rendering device, characterized in that: The device is used for rendering and generating volumetric clouds in the sky of a computer virtual scene, and the device comprises: A 2D map reading module, used for reading a plurality of pre-stored 2D noise maps, wherein the plurality of 2D noise maps are obtained by performing multiple offset samplings on the first 3D noise map in the Z-axis direction, and each of the 2D noise maps records its offset value; A 3D map construction module, used to construct a second 3D noise map based on the multiple 2D noise maps and their offset values; A volume cloud rendering module, used for mapping the second 3D noise map in a limited sky area to render and generate a volume cloud; The volumetric cloud rendering module is also used to: map a second 3D noise map in a defined sky area; calculate illumination data of the second 3D noise map at different heights of the sky area at intervals of a preset unit step length starting from a starting height or an ending height of the defined sky area; and render and generate a volumetric cloud in the sky area based on the second 3D noise map and the illumination data.
11. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer executable instructions that can be executed by the processor, and the processor executes the computer executable instructions to implement the method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method according to any one of claims 1 to 9.
