Volumetric fog rendering method, device, equipment and storage medium

By using downsampling resolution and stepped ray offset technology in volumetric fog rendering, combined with the rendering texture mixing of historical frames, the problem of high computational resource consumption in volumetric fog rendering in the existing technology is solved, and the smoothness and accuracy of rendering are improved. .

CN114170359BActive Publication Date: 2024-08-30BEIJING PERFECT WORLD SOFTWARE TECH DEV CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111296242.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-03
Publication Date
2024-08-30
Estimated Expiration
2041-11-03

AI Technical Summary

Technical Problem

The existing volumetric fog rendering method consumes too much computing resources, resulting in low efficiency of the rendering system, especially when rendering detailed volumetric fog.

Method used

The cube model is drawn at a downsampled resolution. Step rays are emitted through the virtual camera and the step starting point is offset for lighting calculations. The rendering texture of historical frames is combined for blending to reduce the rendering overhead of each frame and improve rendering smoothness.

Benefits of technology

While ensuring the pixel accuracy of volumetric fog, by reducing the rendering overhead of each frame, the rendering fluency is improved, and the consumption of computing resources for rendering volumetric fog is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114170359B
    Figure CN114170359B
Patent Text Reader

Abstract

The embodiments of the present application provide a volumetric fog rendering method, apparatus, device and storage medium. Among them, when rendering volumetric fog, the rendering texture of the current frame is drawn with a downsampled resolution, and when performing ray stepping, the stepping starting point of the current frame is offset; after performing illumination calculation using the offset ray stepping point to obtain the volumetric fog rendering texture of the current frame, the volumetric fog rendering texture of the current frame is mixed with the volumetric fog rendering texture of the historical frame to obtain the updated volumetric fog rendering texture of the current frame. Based on this implementation, the rendering overhead of each frame can be reduced by downsampling each frame, and the missing pixels in the current frame can be supplemented by mixing the multi-frame rendering textures of the current frame and the historical frames, thereby reducing the rendering overhead and improving the rendering smoothness while ensuring that the rendered volumetric fog has a high pixel accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a volumetric fog rendering method, device, equipment and storage medium. Background Art

[0002] In virtual scene development, volumetric fog is usually used to simulate fog or clouds in real scenes. However, the existing methods for rendering volumetric fog consume too much computing resources, and a new solution is needed. Summary of the invention

[0003] Multiple aspects of the present application provide a volumetric fog rendering method, apparatus, device and storage medium to reduce the rendering overhead of volumetric fog.

[0004] An embodiment of the present application provides a volumetric fog rendering method, comprising: drawing a cube model in a current frame of the target scene according to the downsampled resolution of the target scene; the cube model is used to represent the object corresponding to the volumetric fog in the target scene; controlling a virtual camera in the target scene to emit a stepping ray to the cube model to obtain a stepping starting point of the stepping ray on the cube model; offsetting the stepping starting point to obtain an updated stepping starting point corresponding to the current frame; controlling the stepping ray to step in the cube along a stepping direction starting from the updated stepping starting point, and calculating the lighting of the volumetric fog to obtain a volumetric fog rendering texture of the current frame; mixing the volumetric fog rendering texture of the current frame with the volumetric fog rendering texture of a historical frame to obtain a mixed volumetric fog rendering texture; rendering the volumetric fog in the current frame according to the mixed volumetric fog rendering texture.

[0005] Further optionally, drawing a cube model in the current frame of the target scene according to the sampled resolution of the target scene includes: determining the image resolution of the target scene; drawing the cube model in the current frame according to a resolution 1 / N times the image resolution; wherein the cube model faces the screen and N is a positive integer greater than 1; and the historical frame includes N-1 frames before the current frame.

[0006] Further optionally, controlling the virtual camera in the target scene to emit a step ray to the cube model to obtain a step starting point of the step ray on the cube model includes: controlling the virtual camera to emit a step ray to the cube model along a line of sight to obtain a first intersection point and a second intersection point between the step ray and the cube model; and selecting a point closer to the virtual camera from the first intersection point and the second intersection point as the step starting point.

[0007] Further optionally, the step starting point is offset to obtain an updated step starting point corresponding to the current frame, including: offsetting the step starting point by a specified distance along the stepping direction of the stepping ray to obtain the updated step starting point; wherein the specified distance is calculated based on at least one of the step length, blue noise, and frame jitter offset.

[0008] Further optionally, the specified distance=the step length*blue noise*frame jitter offset.

[0009] Further optionally, the stepping ray is controlled to step in the cube along the stepping direction starting from the updated stepping starting point, and the lighting of the volumetric fog is calculated, including: controlling the stepping ray to step to the stepping point in the cube model according to the set step length; according to the coordinates of the stepping point, reading the fog density and shadow value of the stepping point from the preset fog density map and shadow map respectively; and calculating the lighting of the stepping point according to the fog density and shadow value of the stepping point.

[0010] Further optionally, the volumetric fog rendering texture of the current frame is mixed with the volumetric fog rendering texture of the historical frame to obtain a mixed volumetric fog rendering texture, including: performing bilateral blur calculation on the volumetric fog rendering texture of the current frame to obtain the blurred volumetric fog rendering texture of the current frame; and mixing the blurred volumetric fog rendering texture of the current frame with the volumetric fog rendering texture of the historical frame according to respective weighted weights of the current frame and the historical frame to obtain the mixed volumetric fog rendering texture.

[0011] Further optionally, before mixing the blurred volume fog rendering texture of the current frame with the volume fog rendering texture of the historical frame according to the respective weighted weights of the current frame and the historical frame, it also includes: calculating the depth value of the historical frame according to the texture mapping coordinates of the screen pixels of the current frame, the depth value of the current frame, and the clipping coordinate transformation matrix between the current frame and the historical frame; determining the weighted weight of the historical frame according to the depth value of the historical frame.

[0012] An embodiment of the present application also provides an electronic device, comprising: a memory and a processor; the memory is used to store one or more computer instructions; the processor is used to execute the one or more computer instructions to: execute the steps in the method provided in the embodiment of the present application.

[0013] The embodiment of the present application also provides a computer-readable storage medium storing a computer program, which can implement the steps in the method provided in the embodiment of the present application when the computer program is executed.

[0014] In the volumetric fog rendering method provided in the embodiment of the present application, when rendering volumetric fog, the rendering texture of the current frame is drawn with a downsampled resolution, and when performing ray stepping, the stepping starting point of the current frame is offset; after performing illumination calculation using the offset ray stepping point to obtain the volumetric fog rendering texture of the current frame, the volumetric fog rendering texture of the current frame is mixed with the volumetric fog rendering texture of the historical frame to obtain the updated volumetric fog rendering texture of the current frame. Based on this implementation, the rendering overhead of each frame can be reduced by downsampling each frame, and the missing pixels in the current frame can be supplemented by mixing the multi-frame rendering textures of the current frame and the historical frames, thereby reducing the rendering overhead and improving the rendering smoothness while ensuring that the rendered volumetric fog has a high pixel accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0016] Figure 1 A schematic diagram of a flow chart of a volumetric fog rendering method provided by an exemplary embodiment of the present application;

[0017] Figure 2 A schematic diagram of a ray-stepping algorithm provided for an exemplary embodiment of the present application;

[0018] Figure 3 A schematic diagram of the structure of an electronic device provided as an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0019] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only 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 this field without making creative work are within the scope of protection of the present application.

[0020] In virtual scene development, volumetric fog is usually used to simulate fog or clouds in real scenes. However, the existing methods of rendering volumetric fog consume too much computing resources. When it is necessary to render volumetric fog with rich details, it will greatly reduce the operating efficiency of the rendering system.

[0021] In view of the above technical problems, a solution is provided in some embodiments of the present application. The technical solutions provided by the embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0022] Figure 1 A flow chart of a volumetric fog rendering method provided by an exemplary embodiment of the present application is shown in FIG. Figure 1 As shown, the method includes:

[0023] Step 101: Draw a cube model in a current frame of the target scene according to the downsampled resolution of the target scene; the cube model is used to represent the object corresponding to the volumetric fog in the target scene.

[0024] Step 102: Control the virtual camera in the target scene to emit a stepping ray to the cube model to obtain a stepping starting point of the stepping ray on the cube model.

[0025] Step 103: offset the stepping start point to obtain an updated stepping start point corresponding to the current frame.

[0026] Step 104: Control the stepping ray to step in the cube along the stepping direction starting from the updated stepping starting point, and calculate the lighting of the volumetric fog to obtain the volumetric fog rendering texture of the current frame.

[0027] Step 105: Mix the volumetric fog rendering texture of the current frame with the volumetric fog rendering texture of the historical frame to obtain a mixed volumetric fog rendering texture.

[0028] Step 106: Render the volumetric fog in the current frame according to the mixed volumetric fog rendering texture.

[0029] This embodiment can be executed by a terminal device, and a rendering engine can be run on the terminal device to render the target scene obtained by modeling. The target scene can be a game scene, a VR (Virtual Reality) scene, etc., which is not limited in this embodiment.

[0030] Typically, the image corresponding to the target scene is displayed in full resolution. The full resolution means that the resolution of the image is consistent with the number of pixels actually displayed on the display, that is, each pixel on the image is fully displayed. In this embodiment, in order to reduce the overhead of the volumetric fog rendering operation, the volumetric fog can be rendered according to the downsampled resolution of the target scene. The downsampled resolution can be one-half, one-quarter or one-eighth of the resolution (i.e., full resolution) of the image corresponding to the target scene, and this embodiment does not limit this.

[0031] After determining the resolution after downsampling, the rendering engine can customize a MeshPass to draw the render texture (RT) map corresponding to the volume fog. Among them, Mesh refers to the mesh of the model, that is, the mesh obtained by modeling the object, and Pass can be regarded as a drawing process. MeshPass refers to the process of customizing the drawing network. In this embodiment, the rendering engine can draw the RT map of the volume fog based on the downsampled resolution through a customized MeshPass.

[0032] When drawing the RT map of volumetric fog, a downsampled resolution can be used to draw a cube model in the current frame of the target scene. The cube model is used to represent the object corresponding to the volumetric fog in the target scene. The current frame refers to a frame of image to be rendered at the current moment. After drawing the cube model, the virtual camera in the target scene can be controlled to emit a stepping ray to the cube model to obtain the stepping starting point of the stepping ray on the cube model. The stepping starting point is one of the intersections of the stepping ray and the cube model, and is the starting point for calculating the illumination of the volumetric fog using the ray marching algorithm (Raymarching).

[0033] In some optional embodiments, when the virtual camera is controlled to emit a step ray toward the cube model along the line of sight, a first intersection point and a second intersection point between the step ray and the cube model can be obtained; a point closer to the virtual camera can be selected from the first intersection point and the second intersection point as the step starting point.

[0034] Next, the step start point can be offset to obtain the updated step start point corresponding to the current frame, and the step ray can be controlled to step in the cube along the step direction starting from the updated step start point. In the stepping process, each time a step point is stepped, the illumination of the volume fog corresponding to the step point can be calculated, thereby obtaining the volume fog rendering texture of the current frame.

[0035] In some optional embodiments, when the stepping starting point is offset to obtain an updated stepping starting point corresponding to the current frame, the stepping starting point can be offset by a specified distance along the stepping direction of the stepping ray to obtain an updated stepping starting point; wherein the specified distance is calculated based on at least one of the stepping step length, blue noise, and frame jitter offset.

[0036] Optionally, the specified distance=step length*blue noise*frame jitter offset. The frame jitter offset is related to the number of frames, and the frame jitter offsets of different frames may be different.

[0037] In some optional embodiments, the stepping ray is controlled to step in the cube along the stepping direction starting from the updated stepping starting point, and when calculating the illumination of the volume fog, the stepping ray can be controlled to step to the stepping point in the cube model according to the set step length, such as Figure 2 As shown. After reaching each step point, the fog density and shadow value of the step point can be read from the preset fog density map and shadow map (shadowmap) according to the coordinates of the step point, and the lighting of the step point can be calculated according to the fog density and shadow value of the step point. After calculating the lighting of each step point, the lighting of multiple step points in the line of sight direction can be accumulated to obtain the lighting of the pixel point corresponding to the line of sight direction on the screen.

[0038] After obtaining the lighting calculation result of the volumetric fog corresponding to the current frame, the volumetric fog rendering texture of the current frame can be mixed with the volumetric fog rendering texture of the historical frame to obtain a mixed volumetric fog rendering texture, and the volumetric fog in the current frame can be rendered according to the mixed volumetric fog rendering texture. Among them, the historical frame refers to the several frames before the current frame. In this embodiment, after drawing the rendering texture map with a downsampled resolution, the rendering overhead of each frame is reduced, but the resolution of each frame is lost to a certain extent. When the current frame is ray stepped, the stepping starting point of the current frame is offset, and the volumetric fog rendering texture of the current frame and the volumetric fog rendering texture of the historical frame are mixed, which can make up for the loss of resolution of the current frame to a certain extent, thereby reducing the rendering overhead while maintaining a high pixel accuracy.

[0039] In some optional embodiments, when the volumetric fog rendering texture of the current frame is mixed with the volumetric fog rendering texture of the historical frame to obtain the mixed volumetric fog rendering texture, a bilateral filter calculation may be performed on the volumetric fog rendering texture of the current frame to obtain the blurred volumetric fog rendering texture of the current frame; next, the blurred volumetric fog rendering texture of the current frame may be mixed with the volumetric fog rendering texture of the historical frame according to respective weighted weights of the current frame and the historical frame to obtain the mixed volumetric fog rendering texture.

[0040] Among them, the weighted weights of each historical frame can be set according to empirical values, for example, can be set to 0.7, 0.8. Alternatively, the weighted weights of each historical frame can also be determined according to the depth value of the historical frame. Before the blurred volume fog rendering texture of the current frame is mixed with the volume fog rendering texture of the historical frame, the depth value of the historical frame can be calculated according to the texture map coordinates of the screen pixels of the current frame, the depth value of the current frame, and the clipping coordinate conversion matrix between the current frame and the historical frame, and the weighted weight of the historical frame can be determined according to the depth value of the historical frame.

[0041] After obtaining the mixed volumetric fog rendering texture of the current frame, the volumetric fog in the current frame can be rendered.

[0042] In this embodiment, when rendering volumetric fog, the rendering texture of the current frame is drawn with a downsampled resolution, and when performing ray stepping, the stepping starting point of the current frame is offset; after performing illumination calculation using the offset ray stepping point to obtain the volumetric fog rendering texture of the current frame, the volumetric fog rendering texture of the current frame is mixed with the volumetric fog rendering texture of the historical frame to obtain the updated volumetric fog rendering texture of the current frame. Based on this implementation, the rendering overhead of each frame can be reduced by downsampling each frame, and the missing pixels in the current frame can be supplemented by mixing the current frame with the historical frame through multiple frames of rendering textures, thereby reducing the rendering overhead and improving the rendering smoothness while ensuring that the rendered volumetric fog has a high pixel accuracy.

[0043] In some optional embodiments, when drawing the cube model in the current frame of the target scene according to the sampled resolution of the target scene, the image resolution of the target scene can be determined, and the cube model can be drawn in the current frame according to a resolution of 1 / N times the image resolution; wherein the cube model faces the screen and N is a positive integer greater than 1.

[0044] Optionally, N may be 4 or 16, etc., which is not limited in this embodiment. Taking N=4 as an example, when ray marching is performed at half resolution, the width and height of the current frame are reduced by 1 / 2, and the resolution of the rendered texture drawn after downsampling is 1 / 4 of the full resolution.

[0045] To compensate for the loss of image precision caused by resolution reduction, the rendering texture of the current frame can be mixed with the rendering texture corresponding to the N-1 frame before the current frame to obtain the rendering texture of the current frame. That is, from the time dimension, the rendering overhead is dispersed into N frames to reduce the rendering overhead; from the spatial dimension, the stepping starting point of each frame is offset, and the rendering textures of N frames are mixed to compensate for the missing pixels, thereby achieving a balance between rendering effect and rendering overhead.

[0046] In addition, for each pixel on the screen, the number of steps corresponding to each pixel can be greatly improved based on the frame offset and superposition method. That is, the basic small number of step sampling times corresponding to each pixel is expanded N times in the spatial dimension and time dimension.

[0047] Among them, in the spatial dimension, the number of step samplings for each pixel on the screen is obtained by adding up the number of step samplings of each of the N frames with spatial offset. Therefore, in the spatial dimension, the number of step samplings is equivalent to being expanded N times. In the temporal dimension, the number of step samplings for each pixel on the screen is obtained by adding up the number of samplings corresponding to the historical N-1 frames with different time sequences and the number of step samplings corresponding to the current frame. Therefore, in the spatial dimension, the number of step samplings is equivalent to being expanded N times. Thus, the lack of sampling rate is compensated and rendering efficiency is improved.

[0048] It should be noted that the execution subject of each step of the method provided in the above embodiment can be the same device, or the method can be executed by different devices. For example, the execution subject of steps 101 to 103 can be device A; for another example, the execution subject of steps 101 and 102 can be device A, and the execution subject of step 103 can be device B; and so on.

[0049] In addition, in some of the processes described in the above embodiments and the accompanying drawings, multiple operations appearing in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this document or may be executed in parallel, and the serial numbers of the operations, such as 101, 102, etc., are only used to distinguish between different operations, and the serial numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel.

[0050] It should be noted that the descriptions such as “first” and “second” in this article are used to distinguish different messages, devices, modules, etc., and do not represent the order of precedence, nor do they limit “first” and “second” to different types.

[0051] Figure 3 FIG. 1 is a schematic diagram of the structure of an electronic device provided by an exemplary embodiment of the present application, and the electronic device can be used to execute the volumetric fog rendering method described in the above embodiments. Figure 3 As shown, the electronic device includes: a memory 301 , a processor 302 and a communication component 303 .

[0052] The memory 301 is used to store computer programs and can be configured to store various other data to support operations on the electronic device. Examples of such data include instructions for any application or method operating on the electronic device, contact data, phone book data, messages, pictures, videos, etc.

[0053] Among them, the memory 301 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.

[0054] The processor 302 is coupled to the memory 301 and is used to execute the computer program in the memory 301, so as to: draw a cube model in the current frame of the target scene according to the downsampled resolution of the target scene; the cube model is used to represent the object corresponding to the volumetric fog in the target scene; control the virtual camera in the target scene to emit a stepping ray to the cube model to obtain a stepping starting point of the stepping ray on the cube model; offset the stepping starting point to obtain an updated stepping starting point corresponding to the current frame; control the stepping ray to step in the cube along a stepping direction starting from the updated stepping starting point, and calculate the lighting of the volumetric fog to obtain a volumetric fog rendering texture of the current frame; mix the volumetric fog rendering texture of the current frame with the volumetric fog rendering texture of the historical frame to obtain a mixed volumetric fog rendering texture; render the volumetric fog in the current frame according to the mixed volumetric fog rendering texture.

[0055] Further optionally, when the processor 302 draws the cube model in the current frame of the target scene according to the sampled resolution of the target scene, it is specifically used to: determine the image resolution of the target scene; draw the cube model in the current frame according to a resolution of 1 / N times the image resolution; wherein the cube model faces the screen and N is a positive integer greater than 1; and the historical frame includes N-1 frames before the current frame.

[0056] Further optionally, when the processor 302 controls the virtual camera in the target scene to emit a step ray to the cube model to obtain a step starting point of the step ray on the cube model, it is specifically used to: control the virtual camera to emit a step ray to the cube model along the line of sight direction to obtain a first intersection point and a second intersection point between the step ray and the cube model; and select a point closer to the virtual camera from the first intersection point and the second intersection point as the step starting point.

[0057] Further optionally, when the processor 302 offsets the stepping starting point to obtain the updated stepping starting point corresponding to the current frame, it is specifically used to: offset the stepping starting point by a specified distance along the stepping direction of the stepping ray to obtain the updated stepping starting point; wherein the specified distance is calculated based on at least one of the stepping step length, blue noise, and frame jitter offset.

[0058] Further optionally, the specified distance=the step length*blue noise*frame jitter offset.

[0059] Further optionally, when the processor 302 controls the stepping ray to step in the cube along the stepping direction starting from the updated stepping starting point and calculates the lighting of the volumetric fog, it is specifically used to: control the stepping ray to step to the stepping point in the cube model according to the set step length; read the fog density and shadow value of the stepping point from the preset fog density map and shadow map according to the coordinates of the stepping point; calculate the lighting of the stepping point according to the fog density and shadow value of the stepping point.

[0060] Further optionally, when the processor 302 mixes the volumetric fog rendering texture of the current frame with the volumetric fog rendering texture of the historical frame to obtain the mixed volumetric fog rendering texture, it is specifically used to: perform bilateral blur calculation on the volumetric fog rendering texture of the current frame to obtain the blurred volumetric fog rendering texture of the current frame; and mix the blurred volumetric fog rendering texture of the current frame with the volumetric fog rendering texture of the historical frame according to respective weighted weights of the current frame and the historical frame to obtain the mixed volumetric fog rendering texture.

[0061] Further optionally, before mixing the blurred volume fog rendering texture of the current frame with the volume fog rendering texture of the historical frame according to the respective weighted weights of the current frame and the historical frame, the processor 302 is also used to: calculate the depth value of the historical frame according to the texture mapping coordinates of the screen pixels of the current frame, the depth value of the current frame, and the clipping coordinate transformation matrix between the current frame and the historical frame; determine the weighted weight of the historical frame according to the depth value of the historical frame.

[0062] Further, if Figure 3 As shown, the electronic device also includes: a display component 303, a communication component 304, a power component 305, an audio component 306 and other components. Figure 3 Only some components are shown schematically, which does not mean that the electronic device only includes Figure 3 Components shown.

[0063] Among them, the display component 303 includes a screen, and the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.

[0064] Among them, the communication component 304 is configured to facilitate wired or wireless communication between the device where the communication component is located and other devices. The device where the communication component is located can access a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G or 5G, or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component can be implemented based on near field communication (NFC) technology, radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0065] The power supply component 305 provides power to various components of the device where the power supply component is located. The power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device where the power supply component is located.

[0066] Among them, the audio component 306 can be configured to output and / or input audio signals. For example, the audio component includes a microphone (MIC), and when the device where the audio component is located is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in a memory or sent via a communication component. In some embodiments, the audio component also includes a speaker for outputting an audio signal.

[0067] In this embodiment, when rendering volumetric fog, the rendering texture of the current frame is drawn with a downsampled resolution, and when performing ray stepping, the stepping starting point of the current frame is offset; after performing illumination calculation using the offset ray stepping point to obtain the volumetric fog rendering texture of the current frame, the volumetric fog rendering texture of the current frame is mixed with the volumetric fog rendering texture of the historical frame to obtain the updated volumetric fog rendering texture of the current frame. Based on this implementation, the rendering overhead of each frame can be reduced by downsampling each frame, and the missing pixels in the current frame can be supplemented by mixing the current frame with the historical frame through multiple frames of rendering textures, thereby reducing the rendering overhead and improving the rendering smoothness while ensuring that the rendered volumetric fog has a high pixel accuracy.

[0068] Accordingly, an embodiment of the present application further provides a computer-readable storage medium storing a computer program, which, when executed, can implement each step that can be executed by an electronic device in the above method embodiment.

[0069] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0070] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0071] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0072] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0073] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0074] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0075] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0076] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0077] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims

1. A volumetric fog rendering method, characterized in that: include: Drawing a cube model in a current frame of the target scene according to a downsampled resolution of the target scene; The cube model is used to represent the object corresponding to the volumetric fog in the target scene; Controlling a virtual camera in the target scene to emit a stepping ray to the cube model, and obtaining a stepping starting point of the stepping ray on the cube model; offsetting the stepping starting point to obtain an updated stepping starting point corresponding to the current frame; Controlling the stepping ray to step in the cube along the stepping direction starting from the updated stepping starting point, and calculating the illumination of the volumetric fog to obtain the volumetric fog rendering texture of the current frame; Mixing the volumetric fog rendering texture of the current frame with the volumetric fog rendering texture of the historical frame to obtain a mixed volumetric fog rendering texture; The volumetric fog in the current frame is rendered according to the mixed volumetric fog rendering texture.

2. The method according to claim 1, characterized in that: Drawing a cube model in a current frame of the target scene according to the sampled resolution of the target scene includes: Determining an image resolution of the target scene; A cube model is drawn in the current frame at a resolution of 1 / N times the image resolution; wherein the cube model faces the screen, and N is a positive integer greater than 1; and the historical frame includes N-1 frames before the current frame.

3. The method according to claim 1, characterized in that Controlling a virtual camera in the target scene to emit a stepping ray to the cube model to obtain a stepping starting point of the stepping ray on the cube model includes: Controlling the virtual camera to emit a step ray toward the cube model along a line of sight, and obtaining a first intersection point and a second intersection point between the step ray and the cube model; From the first intersection point and the second intersection point, a point closer to the virtual camera is selected as the stepping starting point.

4. The method according to claim 1, characterized in that: The stepping starting point is offset to obtain an updated stepping starting point corresponding to the current frame, including: The stepping starting point is offset by a specified distance along the stepping direction of the stepping ray to obtain the updated stepping starting point; wherein the specified distance is calculated based on at least one of the stepping step length, blue noise and frame jitter offset.

5. The method according to claim 4, characterized in that The specified distance = the step length * blue noise * frame jitter offset.

6. The method according to claim 1, characterized in that Controlling the stepping ray to step in the cube along the stepping direction starting from the updated stepping starting point, and calculating the illumination of the volumetric fog, including: Controlling the stepping ray to step to a stepping point in the cube model according to a set step length; According to the coordinates of the step point, the fog density and the shadow value of the step point are read from the preset fog density map and the shadow map respectively; The illumination of the step point is calculated according to the fog density and the shadow value of the step point.

7. The method according to claim 1, characterized in that Mixing the volumetric fog rendering texture of the current frame with the volumetric fog rendering texture of the historical frame to obtain a mixed volumetric fog rendering texture, including: Performing bilateral blur calculation on the volumetric fog rendering texture of the current frame to obtain a blurred volumetric fog rendering texture of the current frame; According to respective weighted weights of the current frame and the historical frame, the blurred volumetric fog rendering texture of the current frame is mixed with the volumetric fog rendering texture of the historical frame to obtain the mixed volumetric fog rendering texture.

8. The method according to claim 7, characterized in that Before mixing the blurred volume fog rendering texture of the current frame with the volume fog rendering texture of the historical frame according to the respective weighted weights of the current frame and the historical frame, the method further includes: Calculating the depth value of the historical frame according to the texture map coordinates of the screen pixels of the current frame, the depth value of the current frame, and the clipping coordinate conversion matrix between the current frame and the historical frame; The weight of the historical frame is determined according to the depth value of the historical frame.

9. An electronic device, characterized in that: include: Memory, CPU, and GPU; The memory is used to store one or more computer instructions; The central processing unit is used to execute the one or more computer instructions to: call the graphics processor to execute the steps in any one of the methods of claims 1-8.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed, the steps in the method according to any one of claims 1 to 8 can be implemented.

Citation Information

Patent Citations

  • Volume light rendering method and device, electronic equipment and storage medium

    CN111968215A

  • Dynamic resolution rendering method and device, electronic equipment and readable storage medium

    CN113469883A