Method, device, storage medium and electronic device for rendering virtual fog model

By obtaining virtual scene data on mobile devices and generating target maps for post-processing and rendering, the problems of high resource consumption and poor effect when rendering volume fog are solved, and efficient volume fog rendering and virtual reality effects are achieved.

CN115089964BActive Publication Date: 2024-12-20NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210744157.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-28
Publication Date
2024-12-20
Estimated Expiration
2042-06-28

AI Technical Summary

Technical Problem

The prior art consumes high resources when rendering volume fog, making it difficult to support mobile devices, and the effect is poor, which fails to effectively solve the demand for volume fog display in mobile virtual scenes.

Method used

By obtaining the depth data and scene data of the virtual scene, the target map is generated based on the size information and shape information of the virtual fog model, and the depth data, scene data and target map are used for post-processing and rendering, and the virtual fog model is generated within the frame of the image to be rendered. Target rendering results, reducing rendering difficulty and enhancing virtual reality effects.

Benefits of technology

It realizes efficient rendering of volume fog on mobile devices, reduces resource consumption, improves the technical effect of virtual reality, and solves the problems of difficult rendering and poor effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115089964B_ABST
    Figure CN115089964B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, device, storage medium and electronic device for rendering a virtual fog model. The method comprises: obtaining depth data and scene data corresponding to an image frame to be rendered of a virtual scene; generating a target map corresponding to the virtual fog model based on size information and shape information of the virtual fog model, wherein the target map is used to render the virtual fog model in the virtual scene; performing post-processing rendering using the depth data, scene data and target map to obtain a target rendering result of the virtual fog model in the image frame to be rendered. The present invention solves the technical problem that the method for rendering a fog model provided in the related art is difficult to render and has poor effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method, device, storage medium and electronic device for rendering a virtual fog model. Background Art

[0002] In the design and production of virtual scenes, it is often necessary to render volumetric fog to simulate realistic effects (for example, foggy weather, smoke bomb effects, etc.). However, rendering volumetric fog usually requires computers (CPU and GPU) to perform multiple sampling and mixed calculations, which consumes a lot of resources and is difficult to apply to mobile devices. In this regard, technicians in this field continue to try various volumetric fog rendering methods to meet the volumetric fog display requirements in mobile virtual scenes.

[0003] In the related technology, the first solution is to use the same multi-sampling hybrid calculation method as the PC side to render volumetric fog on the mobile side. However, this solution consumes a lot of resources and has high requirements on the performance of mobile devices. It cannot support large-area display of volumetric fog on the same screen, and the display effect of volumetric fog is poor. The second solution is to use a large number of translucent cotton pieces to intersperse each other to simulate volumetric fog. However, too many translucent patches will lead to overdraw problems, and there are a lot of interlaced interfaces between translucent patches, so the display effect of volumetric fog is poor.

[0004] To address the above-mentioned problems, no effective solution has been proposed yet.

[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present invention, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0006] The embodiments of the present invention provide a method, device, storage medium and electronic device for rendering a virtual fog model, so as to at least solve the technical problems that the methods for rendering fog models provided in the related art are difficult to render and have poor rendering effects.

[0007] According to one aspect of an embodiment of the present invention, a method for rendering a virtual fog model is provided, comprising:

[0008] Acquire depth data and scene data corresponding to the image frame to be rendered of the virtual scene; generate a target map corresponding to the virtual fog model based on the size information and shape information of the virtual fog model, wherein the target map is used to render the virtual fog model in the virtual scene; perform post-processing rendering using the depth data, scene data and target map to obtain a target rendering result of the virtual fog model in the image frame to be rendered.

[0009] Optionally, based on the size information and shape information of the virtual fog model, generating a target map corresponding to the virtual fog model includes: obtaining a first map, wherein the first map is used to determine initial information of the target map; based on the size information and shape information, rendering the first map to obtain a second map; and generating a target map corresponding to the virtual fog model according to the second map and a preset noise map.

[0010] Optionally, generating a target map corresponding to the virtual fog model according to the second map and the preset noise map includes: determining a first mask of the virtual fog model according to the second map, wherein the first mask is used to determine the area to be rendered corresponding to the virtual fog model; performing smooth sampling on the preset noise map to obtain a second mask of the virtual fog model, wherein the second mask is used to determine the noise information corresponding to the virtual fog model; and superimposing the second map based on the first mask and the second mask to obtain a target map.

[0011] Optionally, post-processing rendering is performed using depth data, scene data and a target map to obtain a target rendering result of a virtual fog model in an image frame to be rendered, including: sampling the target map to obtain a third mask, wherein the third mask is used to render the virtual fog model in an area to be rendered in the image frame to be rendered; determining a fourth mask using the target map and depth data, wherein the fourth mask is used to determine depth information of virtual objects displayed in the image frame to be rendered; sampling the scene data to obtain a map to be rendered corresponding to the image frame to be rendered; and rendering the map to be rendered according to the third mask and the fourth mask to obtain a target rendering result of the virtual fog model in the image frame to be rendered.

[0012] Optionally, the third mask is a regional noise mask, wherein the regional noise mask is used to determine noise information of a to-be-rendered area corresponding to the virtual fog model in the to-be-rendered image frame.

[0013] Optionally, using the target map and depth data, determining the fourth mask includes: performing interpolation calculations based on the target map and fog model intensity parameters to obtain interpolation calculation results, wherein the fog model intensity parameters are used to determine a preset visible distance threshold corresponding to the virtual fog model; sampling the depth data to obtain a depth sampling result; and determining the fourth mask based on the interpolation calculation results and the depth sampling results.

[0014] Optionally, rendering the map to be rendered according to the third mask and the fourth mask to obtain a target rendering result of the virtual fog model in the image frame to be rendered includes: using the fourth mask to interpolate the map to be rendered and the fog model color parameters to obtain candidate rendering results of the virtual fog model in the image frame to be rendered, wherein the fog model color parameters are used to determine the corresponding color information of the virtual fog model in the image frame to be rendered; and determining the target rendering result from the candidate rendering results according to the third mask.

[0015] According to another aspect of an embodiment of the present invention, there is also provided a device for rendering a virtual fog model, comprising:

[0016] An acquisition module is used to acquire depth data and scene data corresponding to an image frame to be rendered of a virtual scene; a generation module is used to generate a target map corresponding to a virtual fog model based on size information and shape information of the virtual fog model, wherein the target map is used to render the virtual fog model in the virtual scene; a rendering module is used to perform post-processing rendering using the depth data, scene data and target map to obtain a target rendering result of the virtual fog model in the image frame to be rendered.

[0017] Optionally, the above-mentioned generation module is also used to: obtain a first map, wherein the first map is used to determine initial information of a target map; render the first map based on size information and shape information to obtain a second map; and generate a target map corresponding to a virtual fog model according to the second map and a preset noise map.

[0018] Optionally, the above-mentioned generation module is also used to: determine a first mask of the virtual fog model based on the second map, wherein the first mask is used to determine the area to be rendered corresponding to the virtual fog model; smoothly sample the preset noise map to obtain a second mask of the virtual fog model, wherein the second mask is used to determine the noise information corresponding to the virtual fog model; based on the first mask and the second mask, superimpose the second map to obtain the target map.

[0019] Optionally, the above-mentioned rendering module is also used to: sample the target map to obtain a third mask, wherein the third mask is used to render the virtual fog model in the to-be-rendered area of ​​the to-be-rendered image frame; determine the fourth mask using the target map and depth data, wherein the fourth mask is used to determine the depth information of the virtual object displayed in the to-be-rendered image frame; sample the scene data to obtain the to-be-rendered map corresponding to the to-be-rendered image frame; render the to-be-rendered map according to the third mask and the fourth mask to obtain the target rendering result of the virtual fog model in the to-be-rendered image frame.

[0020] Optionally, the above-mentioned generation module is also used to: perform interpolation calculation based on the target map and the fog model intensity parameter to obtain the interpolation calculation result, wherein the fog model intensity parameter is used to determine the preset visible distance threshold corresponding to the virtual fog model; sample the depth data to obtain the depth sampling result; determine the fourth mask according to the interpolation calculation result and the depth sampling result.

[0021] Optionally, the above-mentioned generation module is also used to: use the fourth mask to interpolate the color parameters of the rendering map and the fog model to obtain candidate rendering results of the virtual fog model in the image frame to be rendered, wherein the fog model color parameters are used to determine the corresponding color information of the virtual fog model in the image frame to be rendered; according to the third mask, determine the target rendering result from the candidate rendering results.

[0022] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute any of the above methods for rendering a virtual fog model when running.

[0023] According to another aspect of an embodiment of the present invention, an electronic device is provided, comprising: a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute any of the above methods for rendering a virtual fog model.

[0024] In at least some embodiments of the present invention, the depth data and scene data corresponding to the image frame to be rendered of the virtual scene are first obtained, and a target map corresponding to the virtual fog model is generated based on the size information and shape information of the virtual fog model, wherein the target map is used to render the virtual fog model in the virtual scene, and the target rendering result of the virtual fog model in the image frame to be rendered is obtained by post-processing rendering using the depth data, scene data and fog model data, thereby achieving the purpose of post-processing rendering using the depth data, scene data and fog model data to achieve the volumetric fog effect, thereby achieving the technical effect of reducing the difficulty of volumetric fog rendering and enhancing virtual reality, and further solving the technical problem of high rendering difficulty and poor effect of the method for rendering the fog model provided in the related art. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0026] Figure 1 It is a hardware structure block diagram of a mobile terminal for a method of rendering a virtual fog model according to an embodiment of the present invention;

[0027] Figure 2 is a flowchart of a method for rendering a virtual fog model according to one embodiment of the present invention;

[0028] Figure 3 is a schematic diagram of an optional mask of an area to be rendered according to one embodiment of the present invention;

[0029] Figure 4is a schematic diagram of an optional noise mask to be rendered according to one embodiment of the present invention;

[0030] Figure 5 is a schematic diagram of an optional target map to be rendered according to one embodiment of the present invention;

[0031] Figure 6 is a schematic diagram of an optional virtual fog model post-processing rendering process according to one embodiment of the present invention;

[0032] Figure 7 is a schematic diagram of an optional virtual fog model rendering result according to one embodiment of the present invention;

[0033] Figure 8 is a structural block diagram of a device for rendering a virtual fog model according to one embodiment of the present invention;

[0034] Fig. 9 is a schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0035] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0036] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0037] According to one embodiment of the present invention, an embodiment of a method for rendering a virtual fog model is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in an order different from that shown here.

[0038] In one embodiment of the present invention, the method for rendering a virtual fog model can be run on a terminal device or a server. The terminal device can be a local terminal device. When the method for rendering a virtual fog model is run on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.

[0039] In an optional embodiment, various cloud applications can be run under the cloud interaction system, such as cloud games. Taking cloud games as an example, cloud games refer to a game mode based on cloud computing. In the operation mode of cloud games, the operating body of the game program and the main body of the game screen presentation are separated. The storage and operation of the method for rendering the virtual fog model are completed on the cloud game server. The role of the client device is used for receiving and sending data and presenting the game screen. For example, the client device can be a display device with data transmission function close to the user side, such as a mobile terminal, a TV, a computer, a handheld computer, etc.; but the terminal device for information processing is a cloud game server in the cloud. When playing the game, the player operates the client device to send an operation instruction to the cloud game server. The cloud game server runs the game according to the operation instruction, encodes and compresses the game screen and other data, and returns it to the client device through the network. Finally, the client device decodes and outputs the game screen.

[0040] In an optional embodiment, the terminal device may be a local terminal device. Taking a game as an example, the local terminal device stores a game program and is used to present a game screen. The local terminal device is used to interact with the player through a graphical user interface, that is, the game program is downloaded and installed by an electronic device and run conventionally. The local terminal device may provide the graphical user interface to the player in a variety of ways, for example, it may be rendered and displayed on a display screen of the terminal, or provided to the player through a holographic projection. For example, the local terminal device may include a display screen and a processor, the display screen is used to present a graphical user interface, the graphical user interface includes a game screen, and the processor is used to run the game, generate a graphical user interface, and control the display of the graphical user interface on the display screen.

[0041] In a possible implementation, an embodiment of the present invention provides a method for rendering a virtual fog model, providing a graphical user interface through a terminal device, wherein the terminal device may be the local terminal device mentioned above, or may be a client device in the cloud interaction system mentioned above.

[0042] Taking a mobile terminal running in a local terminal device as an example, the mobile terminal can be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, referred to as MID), a PAD, a game console, and other terminal devices. Figure 1 FIG. 1 is a hardware structure block diagram of a mobile terminal for rendering a virtual fog model according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) processor 102 (processor 102 may include but is not limited to a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processing (DSP) chip, a microprocessor (MCU), a programmable logic device (FPGA), a neural network processor (NPU), a tensor processor (TPU), an artificial intelligence (AI) type processor, etc.) and a memory 104 for storing data. Optionally, the mobile terminal may also include a transmission device 106 for communication functions, an input and output device 108, and a display device 110. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.

[0043] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for rendering a virtual fog model in an embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, the method for rendering a virtual fog model is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0044] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0045] The inputs in the input / output device 108 may come from a plurality of human interface devices (HIDs), such as keyboards and mice, game controllers, and other dedicated game controllers (such as steering wheels, fishing rods, dance mats, remote controls, etc.). In addition to providing input functions, some human interface devices may also provide output functions, such as force feedback and vibration of game controllers, audio output of controllers, etc.

[0046] The display device 110 may be, for example, a head-up display (HUD), a touch-screen liquid crystal display (LCD), and a touch display (also referred to as a "touch screen" or "touch display screen"). The liquid crystal display may enable a user to interact with a user interface of the mobile terminal. In some embodiments, the mobile terminal has a graphical user interface (GUI), and a user may interact with the GUI by finger contacts and / or gestures on a touch-sensitive surface, wherein the human-computer interaction functions here may optionally include the following interactions: creating web pages, drawing, word processing, making electronic documents, games, video conferencing, instant messaging, sending and receiving emails, call interfaces, playing digital videos, playing digital music, and / or web browsing, etc. The executable instructions for executing the above-mentioned human-computer interaction functions are configured / stored in a computer program product or a readable storage medium executable by one or more processors.

[0047] In one embodiment of the present invention, the method for rendering a virtual fog model can be run on a local terminal device or a server. When the method for rendering a virtual fog model is run on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.

[0048] In an optional implementation, various cloud applications can be run under the cloud interaction system, such as cloud games. Taking cloud games as an example, cloud games refer to a game mode based on cloud computing. In the operation mode of cloud games, the operating body of the game program and the main body of the game screen presentation are separated. The storage and operation of the method for rendering the virtual fog model are completed on the cloud game server. The role of the client device is used for receiving and sending data and presenting the game screen. For example, the client device can be a display device with data transmission function close to the user side, such as a mobile terminal, a TV, a computer, a handheld computer, etc.; but the cloud game server in the cloud is used for information processing. When playing the game, the player operates the client device to send an operation instruction to the cloud game server. The cloud game server runs the game according to the operation instruction, encodes and compresses the game screen and other data, and returns it to the client device through the network. Finally, the client device decodes and outputs the game screen.

[0049] In an optional embodiment, taking a game as an example, a local terminal device stores a game program and is used to present a game screen. The local terminal device is used to interact with the player through a graphical user interface, that is, the game program is downloaded and installed by an electronic device and run conventionally. The local terminal device may provide the graphical user interface to the player in a variety of ways, for example, it may be rendered and displayed on a display screen of the terminal, or provided to the player through a holographic projection. For example, the local terminal device may include a display screen and a processor, the display screen is used to present a graphical user interface, the graphical user interface includes a game screen, and the processor is used to run the game, generate a graphical user interface, and control the display of the graphical user interface on the display screen.

[0050] In a possible implementation, an embodiment of the present invention provides a method for rendering a virtual fog model, providing a graphical user interface through a terminal device, wherein the terminal device may be the local terminal device mentioned above, or may be a client device in the cloud interaction system mentioned above. Figure 2 is a flow chart of a method for rendering a virtual fog model according to one embodiment of the present invention. Figure 2 As shown, the method comprises the following steps:

[0051] Step S21, obtaining depth data and scene data corresponding to the image frame to be rendered of the virtual scene;

[0052] The virtual scene may be a virtual game scene, a virtual building scene, a virtual advertising scene, etc. The virtual scene may include multiple image frames. The image frame to be rendered may be an image frame for which a fog model needs to be rendered among the multiple image frames of the virtual scene.

[0053] The depth data corresponding to the image frame to be rendered may be the depth data of the virtual object displayed by the image frame to be rendered. The depth data may be used to indicate the distance from the virtual object to the virtual camera corresponding to the virtual scene. The scene data corresponding to the image frame to be rendered may be the virtual scene data displayed by the image frame to be rendered.

[0054] The depth data may be data stored in a depth buffer object (Render Target, RT for short) provided by a preset engine; the scene data may be data stored in a scene RT provided by a preset engine. When rendering a virtual fog model, the depth data and the scene data may be obtained by obtaining the depth RT and the scene RT in real time from the preset engine.

[0055] Step S22, generating a target map corresponding to the virtual fog model based on the size information and shape information of the virtual fog model, wherein the target map is used to render the virtual fog model in the virtual scene;

[0056] The virtual fog model can be a fog model made by an artist using three-dimensional graphic design software. The virtual fog model can be used to render a virtual fog effect in a virtual scene. The size information of the virtual fog model can be the basic size of the virtual fog model (such as the size information of a spherical fog model can be the radius); the shape information of the virtual fog model can be the basic shape of the virtual fog model (such as spherical, ellipsoidal, annular, etc.).

[0057] Based on the size information and shape information of the virtual fog model, a target map corresponding to the virtual fog model can be generated. The target map can store mask information, which can be used to render the virtual fog model in the virtual scene, wherein the mask information may include a mask for determining a rendering area of ​​the virtual fog model in the virtual scene and a mask for determining a rendering noise effect.

[0058] Specifically, the above-mentioned generation of the target map corresponding to the virtual fog model based on the size information and shape information of the virtual fog model also includes other method steps, which can be referred to the further introduction of the embodiments of the present invention below and will not be repeated here.

[0059] Step S23, performing post-processing rendering using the depth data, scene data and target map to obtain a target rendering result of the virtual fog model in the image frame to be rendered.

[0060] Using the depth data, scene data and target map corresponding to the image frame to be rendered of the virtual scene and the target map corresponding to the virtual fog model, post-processing rendering can be performed to obtain the target rendering result of the virtual fog model in the image frame to be rendered. The post-processing rendering process can include: processing of depth data, processing of scene data, processing of target map, rendering and processing of rendering results according to the actual application scenario requirements.

[0061] Specifically, the above-mentioned post-processing rendering using depth data, scene data and target map to obtain the target rendering result of the virtual fog model in the image frame to be rendered also includes other method steps, which can be referred to the further introduction of the embodiments of the present invention below and will not be repeated here.

[0062] In at least some embodiments of the present invention, the depth data and scene data corresponding to the image frame to be rendered of the virtual scene are first obtained, and a target map corresponding to the virtual fog model is generated based on the size information and shape information of the virtual fog model, wherein the target map is used to render the virtual fog model in the virtual scene, and the target rendering result of the virtual fog model in the image frame to be rendered is obtained by post-processing rendering using the depth data, scene data and fog model data, thereby achieving the purpose of post-processing rendering using the depth data, scene data and fog model data to achieve the volumetric fog effect, thereby achieving the technical effect of reducing the difficulty of volumetric fog rendering and enhancing virtual reality, and further solving the technical problem of high rendering difficulty and poor effect of the method for rendering the fog model provided in the related art.

[0063] It should be noted that the embodiments of the present invention can be applied to, but are not limited to, the following practical application scenarios: foggy weather rendering scenes, smoke bomb prop rendering scenes, foggy special effects rendering scenes, etc. in the virtual game field; foggy weather rendering scenes in the virtual building field; foggy special effects rendering scenes in the virtual advertising field, etc.

[0064] The above method of the embodiment of the present invention is further introduced below.

[0065] Optionally, in step S22, based on the size information and shape information of the virtual fog model, generating a target map corresponding to the virtual fog model may include the following execution steps:

[0066] Step S221, obtaining a first map, wherein the first map is used to determine initial information of a target map;

[0067] Step S222, rendering the first texture based on the size information and the shape information to obtain a second texture;

[0068] Step S223: Generate a target map corresponding to the virtual fog model according to the second map and the preset noise map.

[0069] The first map may be a RT (denoted as RT1) storing preset initial image information. The preset initial image may be an image preset by a user according to actual application scenario requirements for determining the initial information of the target map.

[0070] Based on the size information and shape information of the virtual fog model, rendering the first map may be: rendering the size information and shape information of the virtual fog model to the first map. Further, the obtained second map may be an RT (denoted as RT2) corresponding to the first map and storing the size information and shape information of the virtual fog model.

[0071] The preset noise map can be a map pre-set by the user according to the actual application scenario requirements for determining the noise effect of the virtual fog model. According to the second map RT2 and the preset noise map, a target map (denoted as RT_A) corresponding to the virtual fog model can be generated.

[0072] Specifically, for example, when generating the target map RT_A of the fog model fog01 in a virtual game scene: first, the user's pre-defined image image01 can be stored in the initial RT named FogArea through the preset game engine to obtain RT1; then, based on the fog model fog01 pre-made by the artist, the basic size and basic shape of the fog model fog01 are determined, and the basic size and basic shape are rendered into the above RT1 to obtain RT2.

[0073] Optionally, in step S223, generating a target map corresponding to the virtual fog model according to the second map and the preset noise map may include the following execution steps:

[0074] Step S2231, determining a first mask of the virtual fog model according to the second map, wherein the first mask is used to determine an area to be rendered corresponding to the virtual fog model;

[0075] Step S2232, performing smooth sampling on the preset noise map to obtain a second mask of the virtual fog model, wherein the second mask is used to determine noise information corresponding to the virtual fog model;

[0076] Step S2233: Based on the first mask and the second mask, the second map is overlaid to obtain a target map.

[0077] The first mask of the virtual fog model can be used to determine the area to be rendered corresponding to the virtual fog model. The first mask can be determined according to the second map.

[0078] For example, when generating the target map RT_A of the fog model fog01 in an actual application scenario, the display size of the fog model on the graphical user interface (such as the screen of a mobile terminal) can be determined according to the second map RT2 corresponding to the fog model fog01 and the basic size and basic shape of the fog model; then, a geometric model is created according to the display size to determine the area to be rendered corresponding to the fog model (such as the area to be rendered can be specified as the projection area of ​​the geometric model on the graphical user interface); and then, the mask of the area to be rendered of the fog model fog01 (equivalent to the above-mentioned first mask) can be obtained.

[0079] Figure 3 is a schematic diagram of an optional mask of a region to be rendered according to one embodiment of the present invention, such as Figure 3 As shown in FIG. 1 , according to the basic shape (spherical in this example) and basic size (radius of the spherical fog model in this example) of the fog model fog01, the following is determined: Figure 3 The circular mask of the area to be rendered is shown (equivalent to the first mask mentioned above), wherein the radius of the circular mask of the area to be rendered corresponds to the size of the basic size of the fog model fog01 displayed on the device screen, and the shape of the circular mask of the area to be rendered corresponds to the projection shape of the basic shape of the fog model fog01 on the device screen.

[0080] The preset noise map can be a map pre-set by the user according to the actual application scenario requirements for determining the noise effect of the virtual fog model. The preset noise map is smoothly sampled to obtain a second mask of the virtual fog model. The noise information corresponding to the virtual fog model can be determined through the second mask.

[0081] According to the first mask and the second mask, the second map can be superimposed to obtain the target map. Therefore, the target map can be used to determine the area to be rendered corresponding to the virtual fog model, and can also be used to determine the noise information corresponding to the virtual fog model.

[0082] Figure 4 is a schematic diagram of an optional noise mask to be rendered according to one embodiment of the present invention, based on Figure 3 The 3D world coordinates of the circular mask of the area to be rendered shown in FIG. 1 (obtained from the preset game engine) are sampled for the noise texture map predefined by the user (equivalent to the preset noise map mentioned above), and the noise sampling result can be obtained; the edge of the noise sampling result is smoothed using the Fresnel function in the preset game engine (to eliminate the hard cutting effect between the edge of the fog model and the virtual scene), and the following can be obtained: Figure 4 The noise mask to be rendered is shown (equivalent to the second mask mentioned above).

[0083] Figure 5FIG. 1 is a schematic diagram of an optional target texture to be rendered according to one embodiment of the present invention. Still for example, when generating the target texture RT_A of the fog model fog01 in the virtual game scene: using Figure 3 The mask of the area to be rendered is shown as Figure 4 The noise mask to be rendered shown in FIG. 1 is superimposed on the aforementioned RT2 (equivalent to the aforementioned second map), and the following can be obtained: Figure 5 The target map RT_A to be rendered is shown.

[0084] Optionally, in step S23, performing post-processing rendering using the depth data, the scene data and the target map to obtain a target rendering result of the virtual fog model in the image frame to be rendered may include the following execution steps:

[0085] Step S231, sampling the target map to obtain a third mask, wherein the third mask is used to render a virtual fog model in the to-be-rendered area of ​​the to-be-rendered image frame;

[0086] Step S232, using the target map and the depth data, determining a fourth mask, wherein the fourth mask is used to determine the depth information of the virtual object displayed in the image frame to be rendered;

[0087] Step S233, sampling the scene data to obtain a texture to be rendered corresponding to the image frame to be rendered;

[0088] Step S234, rendering the to-be-rendered map according to the third mask and the fourth mask to obtain a target rendering result of the virtual fog model in the to-be-rendered image frame.

[0089] The target map of the virtual fog model is sampled to obtain the third mask, which can be used to determine the area to be rendered corresponding to the virtual fog model and can also be used to determine the noise information corresponding to the virtual fog model.

[0090] The fourth mask can be determined using the target map of the virtual fog model and the depth data of the image frame to be rendered. The fourth mask can be used to determine the depth information of the virtual object displayed in the image frame to be rendered. In actual application scenarios, the depth information can be used to represent the distance between the virtual object and the virtual camera of the virtual scene, and the fourth mask corresponding to the depth information can be a depth map displayed in grayscale (the closer the virtual object is to the virtual camera, the smaller the grayscale value, and the closer the color of the virtual object is to black; the farther the virtual object is from the virtual camera, the larger the grayscale value, and the closer the color of the virtual object is to white).

[0091] By sampling the scene data of the image frame to be rendered, a texture to be rendered corresponding to the image frame to be rendered can be obtained. The texture to be rendered can be part or all of the scene image displayed by the image frame to be rendered.

[0092] According to the third mask and the fourth mask, the to-be-rendered map corresponding to the to-be-rendered image frame is rendered, thereby obtaining a target rendering result of the virtual fog model in the to-be-rendered image frame.

[0093] For example, when rendering the fog model fog01 in the image frame to be rendered in the virtual game scene: Figure 6 is a schematic diagram of an optional virtual fog model post-processing rendering process according to one embodiment of the present invention, such as Figure 6 As shown, the post-processing rendering process of the virtual fog model includes three sampling operations: sampling of mask data (such as the target map RT_A to be rendered), sampling of depth data (such as depth RT) and sampling of scene data (such as scene RT); and also includes one rendering operation: rendering the virtual fog model to the virtual scene based on the sampling results of the aforementioned three sampling operations.

[0094] Optionally, in the above method for rendering a virtual fog model: the third mask is a regional noise mask, wherein the regional noise mask is used to determine noise information of a to-be-rendered area corresponding to the virtual fog model in the to-be-rendered image frame.

[0095] Specifically, in Figure 6 In the mask data sampling shown in the figure, the target map RT_A to be rendered can be sampled to obtain the following Figure 5 The target map shown corresponds to the mask of the area to be rendered, which is recorded as area_mask (equivalent to the third mask mentioned above). The third mask can be a superimposed mask of the first mask and the second mask mentioned above. The third mask can determine the area to be rendered of the virtual fog model in the map to be rendered by the area to be rendered corresponding to the first mask. The third mask can also determine the noise effect of the virtual fog model in the map to be rendered by the noise information corresponding to the second mask.

[0096] Optionally, in step S232, using the target map and the depth data, determining the fourth mask may include the following execution steps:

[0097] Step S2321, performing interpolation calculation based on the target map and the fog model strength parameter to obtain an interpolation calculation result, wherein the fog model strength parameter is used to determine a preset visible distance threshold corresponding to the virtual fog model;

[0098] Step S2322, sampling the depth data to obtain a depth sampling result;

[0099] Step S2323, determining a fourth mask according to the interpolation calculation result and the depth sampling result.

[0100] The above-mentioned fog model intensity parameter (denoted as fogIntensity) can be used to determine the preset visible distance threshold corresponding to the virtual fog model (for example, the visible distance in the fog of the real scene). When the distance between the virtual object and the virtual camera of the virtual scene exceeds the preset visible distance threshold, the virtual object is completely covered by fog and cannot be displayed in the graphical user interface.

[0101] Still for example, when rendering the fog model fog01 in the image frame to be rendered in the virtual game scene: interpolation calculation is performed based on the data stored in the target map RT_A and the fog model intensity parameter fogIntensity, and the method for obtaining the interpolation calculation result R1 can be shown in the following formula (1):

[0102] R1=X×t+Y×(1-t) Formula (1)

[0103] In the above formula (1), X=fogIntensity-250, Y=fogIntensity+250, and t represents the data stored in the target map RT_A. The relative size of X and Y can be controlled by t through the above formula (1).

[0104] It should be noted that the interpolation calculation result R1 may be a changing distance value, and the distance value may be used to determine the uneven change effect of the virtual volume fog model.

[0105] The depth RT is sampled to obtain the above-mentioned depth sampling result, which may be the actual distance between the virtual object displayed in the image frame to be rendered and the virtual camera of the virtual scene, denoted as depth.

[0106] The method for determining the fourth mask according to the interpolation calculation result and the depth sampling result can be shown in the following formula (2):

[0107] Mask4=depth / R1 formula (2)

[0108] It should be noted that the fourth mask may be a depth mask with varying depths, and the value of the depth mask is between 0 and 1 and varies according to the actual distance depth.

[0109] Optionally, in step S234, rendering the to-be-rendered map according to the third mask and the fourth mask to obtain a target rendering result of the virtual fog model in the to-be-rendered image frame may include the following execution steps:

[0110] Step S2341, using the fourth mask, interpolating the to-be-rendered map and the fog model color parameters to obtain a candidate rendering result of the virtual fog model in the to-be-rendered image frame, wherein the fog model color parameters are used to determine the color information corresponding to the virtual fog model in the to-be-rendered image frame;

[0111] Step S2342: Determine a target rendering result from the candidate rendering results according to the third mask.

[0112] The above fog model color parameters can be used to determine the color information corresponding to the virtual fog model in the image frame to be rendered. For example, if the actual application scene is in snowy weather, the fog model color parameters can be set to a color with a cooler tone; if the actual application scene requires rendering the fog model of a colored smoke bomb prop, the fog model color parameters can be set to a color corresponding to the preset color parameters of the colored smoke bomb prop.

[0113] By using the fourth mask, the texture to be rendered and the fog model color parameters can be interpolated to obtain a candidate rendering result of the virtual fog model in the image frame to be rendered. The candidate rendering result can be a virtual fog model rendering result in the entire range of the scene image displayed by the image frame to be rendered.

[0114] According to the third mask, the target rendering result can be determined from the candidate rendering results. The target rendering result can be the rendering result of the virtual fog model in the to-be-rendered texture.

[0115] The third mask can be used to determine the area to be rendered corresponding to the virtual fog model, and can also be used to determine the noise information corresponding to the virtual fog model. Determining the target rendering result from the candidate rendering results can also be: according to the third mask, removing the rendering results outside the area to be rendered corresponding to the third mask from the candidate rendering results.

[0116] Still for example, when rendering the fog model fog01 in the image frame to be rendered in the virtual game scene: Figure 7 is a schematic diagram of an optional virtual fog model rendering result according to one embodiment of the present invention, such as Figure 7 As shown, through the method provided by the embodiment of the present invention, the volumetric fog effect corresponding to the fog model fog01 can be rendered in the image frame to be rendered in the virtual game scene.

[0117] It is easy to notice that the method provided by the embodiment of the present invention can be used to render based on the results of three samplings to obtain the rendering effect of virtual volumetric fog in the virtual scene. Compared with the method of rendering volumetric fog in the prior art, the rendering difficulty is reduced, the device performance that the rendering depends on is reduced, and it is easier to use in mobile devices.

[0118] It is easy to notice that according to the method provided by the embodiment of the present invention, the volumetric fog effect in the virtual scene is rendered using the depth information of the image frame to be rendered in the virtual scene and the noise information of the area to be rendered corresponding to the virtual fog model. The present invention does not limit the method for obtaining the image frame to be rendered in the virtual scene, the method for obtaining the depth information, the method for making the virtual fog model, and the method for obtaining the noise information. Each of the above-mentioned multiple methods without limitation can be any method that can be implemented in the relevant technical field.

[0119] It should be noted that the depth map corresponding to the depth information of the image frame to be rendered in the virtual scene represents the distance from the corresponding virtual object to the virtual camera in the form of a grayscale image. The visual expression of the depth map is similar to the volumetric fog effect in the real scene. Based on the depth map, the noise mask of the area to be rendered of the virtual fog model is used to remove the area in the image frame to be rendered where the fog model does not need to be rendered. Then, combined with relevant material information and post-processing operations, a volumetric fog model with better virtual reality effect can be rendered in the image frame to be rendered.

[0120] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0121] In this embodiment, a device for rendering a virtual fog model is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and will not be repeated here. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0122] Figure 8 is a structural block diagram of a device for rendering a virtual fog model according to one embodiment of the present invention, such as Figure 8As shown, the device includes: an acquisition module 81, which is used to acquire depth data and scene data corresponding to the image frame to be rendered of the virtual scene; a generation module 82, which is used to generate a target map corresponding to the virtual fog model based on the size information and shape information of the virtual fog model, wherein the target map is used to render the virtual fog model in the virtual scene; a rendering module 83, which is used to perform post-processing rendering using the depth data, scene data and target map to obtain a target rendering result of the virtual fog model in the image frame to be rendered.

[0123] Optionally, the above-mentioned generation module 82 is also used to: obtain a first map, wherein the first map is used to determine initial information of a target map; render the first map based on size information and shape information to obtain a second map; and generate a target map corresponding to a virtual fog model according to the second map and a preset noise map.

[0124] Optionally, the above-mentioned generation module 82 is also used to: determine a first mask of the virtual fog model according to the second map, wherein the first mask is used to determine the area to be rendered corresponding to the virtual fog model; perform smooth sampling on the preset noise map to obtain a second mask of the virtual fog model, wherein the second mask is used to determine the noise information corresponding to the virtual fog model; based on the first mask and the second mask, superimpose the second map to obtain the target map.

[0125] Optionally, the above-mentioned rendering module 83 is also used to: sample the target map to obtain a third mask, wherein the third mask is used to render the virtual fog model in the to-be-rendered area of ​​the to-be-rendered image frame; determine the fourth mask using the target map and depth data, wherein the fourth mask is used to determine the depth information of the virtual object displayed in the to-be-rendered image frame; sample the scene data to obtain the to-be-rendered map corresponding to the to-be-rendered image frame; render the to-be-rendered map according to the third mask and the fourth mask to obtain the target rendering result of the virtual fog model in the to-be-rendered image frame.

[0126] Optionally, the above-mentioned rendering module 83 is also used to: perform interpolation calculation based on the target map and the fog model intensity parameter to obtain the interpolation calculation result, wherein the fog model intensity parameter is used to determine the preset visible distance threshold corresponding to the virtual fog model; sample the depth data to obtain the depth sampling result; determine the fourth mask according to the interpolation calculation result and the depth sampling result.

[0127] Optionally, the above-mentioned rendering module 83 is also used to: use the fourth mask to interpolate the color parameters of the rendering map and the fog model to obtain candidate rendering results of the virtual fog model in the image frame to be rendered, wherein the fog model color parameters are used to determine the corresponding color information of the virtual fog model in the image frame to be rendered; according to the third mask, determine the target rendering result from the candidate rendering results.

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

[0129] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0130] Optionally, in this embodiment, the above-mentioned computer-readable storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.

[0131] Optionally, in this embodiment, the non-volatile storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.

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

[0133] Acquire depth data and scene data corresponding to the image frame to be rendered of the virtual scene; generate a target map corresponding to the virtual fog model based on the size information and shape information of the virtual fog model, wherein the target map is used to render the virtual fog model in the virtual scene; perform post-processing rendering using the depth data, scene data and target map to obtain a target rendering result of the virtual fog model in the image frame to be rendered.

[0134] Optionally, based on the size information and shape information of the virtual fog model, generating a target map corresponding to the virtual fog model includes: obtaining a first map, wherein the first map is used to determine initial information of the target map; based on the size information and shape information, rendering the first map to obtain a second map; and generating a target map corresponding to the virtual fog model according to the second map and a preset noise map.

[0135] Optionally, generating a target map corresponding to the virtual fog model according to the second map and the preset noise map includes: determining a first mask of the virtual fog model according to the second map, wherein the first mask is used to determine the area to be rendered corresponding to the virtual fog model; performing smooth sampling on the preset noise map to obtain a second mask of the virtual fog model, wherein the second mask is used to determine the noise information corresponding to the virtual fog model; and superimposing the second map based on the first mask and the second mask to obtain a target map.

[0136] Optionally, post-processing rendering is performed using depth data, scene data and a target map to obtain a target rendering result of a virtual fog model in an image frame to be rendered, including: sampling the target map to obtain a third mask, wherein the third mask is used to render the virtual fog model in an area to be rendered in the image frame to be rendered; determining a fourth mask using the target map and depth data, wherein the fourth mask is used to determine depth information of virtual objects displayed in the image frame to be rendered; sampling the scene data to obtain a map to be rendered corresponding to the image frame to be rendered; and rendering the map to be rendered according to the third mask and the fourth mask to obtain a target rendering result of the virtual fog model in the image frame to be rendered.

[0137] Optionally, the third mask is a regional noise mask, wherein the regional noise mask is used to determine noise information of a to-be-rendered area corresponding to the virtual fog model in the to-be-rendered image frame.

[0138] Optionally, using the target map and depth data, determining the fourth mask includes: performing interpolation calculations based on the target map and fog model intensity parameters to obtain interpolation calculation results, wherein the fog model intensity parameters are used to determine a preset visible distance threshold corresponding to the virtual fog model; sampling the depth data to obtain a depth sampling result; and determining the fourth mask based on the interpolation calculation results and the depth sampling results.

[0139] Optionally, rendering the map to be rendered according to the third mask and the fourth mask to obtain a target rendering result of the virtual fog model in the image frame to be rendered includes: using the fourth mask to interpolate the map to be rendered and the fog model color parameters to obtain candidate rendering results of the virtual fog model in the image frame to be rendered, wherein the fog model color parameters are used to determine the corresponding color information of the virtual fog model in the image frame to be rendered; and determining the target rendering result from the candidate rendering results according to the third mask.

[0140] In the computer-readable storage medium of this embodiment, a technical solution for rendering a virtual fog model is provided. By acquiring the depth data and scene data corresponding to the image frame to be rendered of the virtual scene, a target map corresponding to the virtual fog model is generated based on the size information and shape information of the virtual fog model, wherein the target map is used to render the virtual fog model in the virtual scene, and the depth data, scene data and target map are used for post-processing rendering to obtain the target rendering result of the virtual fog model in the image frame to be rendered, so as to achieve the purpose of post-processing rendering using the depth data, scene data and fog model data to achieve the volume fog effect, thereby achieving the technical effect of reducing the difficulty of volume fog rendering and enhancing virtual reality, and further solving the technical problem that the method for rendering the fog model provided in the related art is difficult to render and has poor effect.

[0141] Through the description of the above implementation modes, it is easy for those skilled in the art to understand that the example implementation modes described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation mode of the present invention can be embodied in the form of a software product, which can be stored in a computer-readable storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation mode of the present invention.

[0142] In an exemplary embodiment of the present invention, a program product capable of implementing the above method of the present embodiment is stored on a computer-readable storage medium. In some possible implementations, various aspects of the present embodiment can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps of various exemplary implementations of the present invention described in the above "Exemplary Method" section of the present embodiment.

[0143] The program product for implementing the above method according to the embodiment of the present invention may adopt a portable compact disk read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the embodiment of the present invention is not limited thereto. In the embodiment of the present invention, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.

[0144] The program product may be in any combination of one or more computer-readable media. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples (non-exhaustive) of computer-readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.

[0145] It should be noted that the program code contained in the computer-readable storage medium can be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.

[0146] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

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

[0148] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0149] Acquire depth data and scene data corresponding to the image frame to be rendered of the virtual scene; generate a target map corresponding to the virtual fog model based on the size information and shape information of the virtual fog model, wherein the target map is used to render the virtual fog model in the virtual scene; perform post-processing rendering using the depth data, scene data and target map to obtain a target rendering result of the virtual fog model in the image frame to be rendered.

[0150] Optionally, based on the size information and shape information of the virtual fog model, generating a target map corresponding to the virtual fog model includes: obtaining a first map, wherein the first map is used to determine initial information of the target map; based on the size information and shape information, rendering the first map to obtain a second map; and generating a target map corresponding to the virtual fog model according to the second map and a preset noise map.

[0151] Optionally, generating a target map corresponding to the virtual fog model according to the second map and the preset noise map includes: determining a first mask of the virtual fog model according to the second map, wherein the first mask is used to determine the area to be rendered corresponding to the virtual fog model; performing smooth sampling on the preset noise map to obtain a second mask of the virtual fog model, wherein the second mask is used to determine the noise information corresponding to the virtual fog model; and superimposing the second map based on the first mask and the second mask to obtain a target map.

[0152] Optionally, post-processing rendering is performed using depth data, scene data and a target map to obtain a target rendering result of a virtual fog model in an image frame to be rendered, including: sampling the target map to obtain a third mask, wherein the third mask is used to render the virtual fog model in an area to be rendered in the image frame to be rendered; determining a fourth mask using the target map and depth data, wherein the fourth mask is used to determine depth information of virtual objects displayed in the image frame to be rendered; sampling the scene data to obtain a map to be rendered corresponding to the image frame to be rendered; and rendering the map to be rendered according to the third mask and the fourth mask to obtain a target rendering result of the virtual fog model in the image frame to be rendered.

[0153] Optionally, the third mask is a regional noise mask, wherein the regional noise mask is used to determine noise information of a to-be-rendered area corresponding to the virtual fog model in the to-be-rendered image frame.

[0154] Optionally, using the target map and depth data, determining the fourth mask includes: performing interpolation calculations based on the target map and fog model intensity parameters to obtain interpolation calculation results, wherein the fog model intensity parameters are used to determine a preset visible distance threshold corresponding to the virtual fog model; sampling the depth data to obtain a depth sampling result; and determining the fourth mask based on the interpolation calculation results and the depth sampling results.

[0155] Optionally, rendering the map to be rendered according to the third mask and the fourth mask to obtain a target rendering result of the virtual fog model in the image frame to be rendered includes: using the fourth mask to interpolate the map to be rendered and the fog model color parameters to obtain candidate rendering results of the virtual fog model in the image frame to be rendered, wherein the fog model color parameters are used to determine the corresponding color information of the virtual fog model in the image frame to be rendered; and determining the target rendering result from the candidate rendering results according to the third mask.

[0156] In the electronic device of this embodiment, a technical solution for rendering a virtual fog model is provided. By acquiring the depth data and scene data corresponding to the image frame to be rendered of the virtual scene, a target map corresponding to the virtual fog model is generated based on the size information and shape information of the virtual fog model, wherein the target map is used to render the virtual fog model in the virtual scene, and the depth data, scene data and target map are used for post-processing rendering to obtain the target rendering result of the virtual fog model in the image frame to be rendered, so as to achieve the purpose of post-processing rendering using the depth data, scene data and fog model data to achieve the volumetric fog effect, thereby achieving the technical effect of reducing the difficulty of volumetric fog rendering and enhancing virtual reality, and further solving the technical problem that the method for rendering the fog model provided in the related art is difficult to render and has poor effect.

[0157] Fig. 9 is a schematic diagram of an electronic device according to an embodiment of the present invention. Fig. 9 As shown, the electronic device 900 is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0158] like Fig. 9 As shown, the electronic device 900 is in the form of a general computing device. The components of the electronic device 900 may include but are not limited to: at least one processor 910, at least one memory 920, a bus 930 connecting different system components (including the memory 920 and the processor 910), and a display 940.

[0159] The memory 920 stores program codes, which can be executed by the processor 910, so that the processor 910 executes the steps according to various exemplary implementations of the present invention described in the method part of the embodiment of the present invention.

[0160] The memory 920 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 9201 and / or a cache memory unit 9202, and may further include a read-only memory unit (ROM) 9203, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.

[0161] In some examples, the memory 920 may also include a program / utility 9204 having a set (at least one) of program modules 9205, such program modules 9205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or a combination thereof may include the implementation of a network environment. The memory 920 may further include a memory remotely disposed relative to the processor 910, and these remote memories may be connected to the electronic device 900 via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0162] Bus 930 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a local bus of processor 910, or a bus using any of a variety of bus architectures.

[0163] The display 940 may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the electronic device 900 .

[0164] Optionally, the electronic device 900 may also communicate with one or more external devices 1400 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), one or more devices that enable a user to interact with the electronic device 900, and / or any device that enables the electronic device 900 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed through an input / output (I / O) interface 950. Furthermore, the electronic device 900 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 960. Fig. 9 As shown, the network adapter 960 communicates with other modules of the electronic device 900 via the bus 930. It should be understood that although Fig. 9 Not shown, other hardware and / or software modules may be used in conjunction with the electronic device 900, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

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

[0166] It can be understood by those skilled in the art that Fig. 9 The structure shown is for illustration only and does not limit the structure of the above electronic device. Fig. 9 More or fewer components as shown, or with Fig. 9 The memory 920 may be used to store computer programs and corresponding data, such as computer programs and corresponding data corresponding to the method for rendering a virtual fog model in an embodiment of the present invention. The processor 910 executes various functional applications and data processing by running the computer programs stored in the memory 920, that is, implementing the method for rendering a virtual fog model.

[0167] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0168] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0169] In the several embodiments provided by the present invention, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0170] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0171] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0172] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of 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 invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.

[0173] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A method for rendering a virtual fog model, characterized in that: include: Obtaining depth data and scene data corresponding to the image frame to be rendered of the virtual scene; Based on the size information and shape information of the virtual fog model, generating a target map corresponding to the virtual fog model, wherein the target map is used to render the virtual fog model in the virtual scene; Post-processing rendering is performed using the depth data, the scene data and the target map to obtain a target rendering result of the virtual fog model in the image frame to be rendered.

2. The method for rendering a virtual fog model according to claim 1, characterized in that: Based on the size information and the shape information of the virtual fog model, generating the target map corresponding to the virtual fog model includes: Acquire a first map, wherein the first map is used to determine initial information of the target map; Rendering the first map based on the size information and the shape information to obtain a second map; The target map corresponding to the virtual fog model is generated according to the second map and the preset noise map.

3. The method for rendering a virtual fog model according to claim 2, characterized in that: Generating the target map corresponding to the virtual fog model according to the second map and the preset noise map includes: Determine a first mask of the virtual fog model according to the second map, wherein the first mask is used to determine a to-be-rendered area corresponding to the virtual fog model; Smoothly sampling the preset noise map to obtain a second mask of the virtual fog model, wherein the second mask is used to determine noise information corresponding to the virtual fog model; Based on the first mask and the second mask, the second map is overlaid to obtain the target map.

4. The method for rendering a virtual fog model according to claim 1, characterized in that: Post-processing and rendering are performed using the depth data, the scene data, and the target map to obtain a target rendering result of the virtual fog model in the image frame to be rendered, including: Sampling the target map to obtain a third mask, wherein the third mask is used to render the virtual fog model in the to-be-rendered area of ​​the to-be-rendered image frame; Determine a fourth mask using the target map and the depth data, wherein the fourth mask is used to determine depth information of a virtual object displayed in the image frame to be rendered; Sampling the scene data to obtain a texture to be rendered corresponding to the image frame to be rendered; The map to be rendered is rendered according to the third mask and the fourth mask to obtain a target rendering result of the virtual fog model in the image frame to be rendered.

5. The method for rendering a virtual fog model according to claim 4, characterized in that: The third mask is a regional noise mask, wherein the regional noise mask is used to determine noise information of a to-be-rendered area corresponding to the virtual fog model in the to-be-rendered image frame.

6. The method for rendering a virtual fog model according to claim 4, characterized in that: Determining the fourth mask using the target map and the depth data includes: Performing interpolation calculation based on the target map and the fog model intensity parameter to obtain an interpolation calculation result, wherein the fog model intensity parameter is used to determine a preset visible distance threshold corresponding to the virtual fog model; Sampling the depth data to obtain a depth sampling result; The fourth mask is determined according to the interpolation calculation result and the depth sampling result.

7. The method for rendering a virtual fog model according to claim 5, characterized in that: Rendering the to-be-rendered map according to the third mask and the fourth mask to obtain the target rendering result of the virtual fog model in the to-be-rendered image frame includes: Using the fourth mask, interpolating the map to be rendered and the fog model color parameters to obtain a candidate rendering result of the virtual fog model in the image frame to be rendered, wherein the fog model color parameters are used to determine the color information corresponding to the virtual fog model in the image frame to be rendered; The target rendering result is determined from the candidate rendering results according to the third mask.

8. A device for rendering a virtual fog model, characterized in that: include: An acquisition module, used to acquire depth data and scene data corresponding to the image frame to be rendered of the virtual scene; A generating module, configured to generate a target map corresponding to the virtual fog model based on size information and shape information of the virtual fog model, wherein the target map is used to render the virtual fog model in the virtual scene; A rendering module is used to perform post-processing rendering using the depth data, the scene data and the target map to obtain a target rendering result of the virtual fog model in the image frame to be rendered.

9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method for rendering a virtual fog model as described in any one of claims 1 to 7 when running.

10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to execute the method for rendering a virtual fog model as described in any one of claims 1 to 7.