Volumetric cloud illumination processing method, device and storage medium

By obtaining the distance field information of the volumetric cloud and using the light step algorithm to calculate the light mask, combining multiple light sources for light synthesis, the problem of large consumption of light calculation performance of the volumetric cloud is solved, and a more realistic lighting effect is achieved.

CN114170369BActive Publication Date: 2025-03-21BEIJING PERFECT WORLD SOFTWARE TECH DEV CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111341310.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-12
Publication Date
2025-03-21
Estimated Expiration
2041-11-12

AI Technical Summary

Technical Problem

The lighting calculation of volumetric clouds generates a lot of performance consumption when rendering virtual scenes, resulting in a degradation of system performance.

Method used

By obtaining the distance field information of the volume cloud, the light ray mask is calculated using the light step algorithm, and combined with real-time direct light, baked direct light and ambient light for light synthesis, the light processing results of the volume cloud are obtained.

Benefits of technology

Reduces lighting calculations to rendering system performance, improves the lighting effect of volume clouds, making it more realistic and detailed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114170369B_ABST
    Figure CN114170369B_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide a method, device and storage medium for lighting processing of a volumetric cloud. When calculating the lighting information of a volumetric cloud, the distance field information of the volumetric cloud to be rendered is obtained, and the distance field information is converted to obtain the concentration information of the volumetric cloud. Based on the concentration information, a ray stepping algorithm can be used to calculate the light mask of the volumetric cloud, and lighting mapping can be performed according to the light mask to obtain real-time direct light of the volumetric cloud. The lighting processing result of the volumetric cloud can be obtained by synthesizing the real-time direct light, the baked direct light and the ambient light. In this embodiment, the number of ray stepping sampling is reduced by the distance field information, the storage space is reduced by the distance concentration conversion, and the performance consumption required for calculating the concentration integral is reduced. At the same time, the lighting of the volumetric cloud using a variety of different photosynthesized volumetric clouds can make the lighting effect of the volumetric cloud more realistic and the details richer.
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 method, device and storage medium for volumetric cloud illumination processing. Background Art

[0002] Volumetric Cloud is also called volumetric cloud or volumetric fog. When rendering virtual scenes (such as game scenes), image engines are usually used to simulate the translucent and irregular performance of real clouds and fog. When rendering volumetric clouds, the lighting calculation of volumetric clouds often consumes a lot of performance. Therefore, a solution is needed. Summary of the invention

[0003] Multiple aspects of the present application provide a volumetric cloud lighting processing method, device and storage medium to reduce the consumption of lighting calculation on rendering system performance during volumetric cloud rendering.

[0004] An embodiment of the present application provides a method for lighting processing of a volumetric cloud, comprising: obtaining distance field information of a volumetric cloud to be rendered; the distance field information comprises a minimum distance from a scene point in a target scene to a surface of the volumetric cloud; obtaining, according to the distance field information, an intersection point between a ray emitted by a virtual camera and the surface of the volumetric cloud using a ray marching algorithm; transforming the distance field information of a point on a line segment formed by the intersection point to obtain concentration information of the volumetric cloud; calculating, according to the concentration information, a ray marching algorithm to calculate a ray mask of the volumetric cloud; performing lighting mapping according to the ray mask to obtain real-time direct light of the volumetric cloud; performing lighting synthesis according to the real-time direct light, baked direct light and ambient light to obtain a lighting processing result of the volumetric cloud.

[0005] Further optionally, the distance field information of the points on the line segment formed by the intersection is transformed to obtain the concentration information of the volume cloud, including: for any scene point on the line segment formed by the intersection, if the minimum distance from the scene point to the surface of the volume cloud is greater than a set distance threshold, the concentration corresponding to the scene point is converted to zero; if the minimum distance from the scene point to the surface of the volume cloud is less than or equal to the set distance threshold, the concentration corresponding to the scene point is determined according to the conversion principle that the distance field is inversely proportional to the concentration.

[0006] Further optionally, based on the concentration information, a ray stepping algorithm is used to calculate the ray mask of the volume cloud, including: emitting a ray from the position of the virtual camera in the target scene to each of the plurality of pixel points on the screen; controlling each ray to step along the line of sight according to a set stepping distance to reach a plurality of stepping points, and accumulating the concentration values ​​of the plurality of stepping points; wherein the stepping distance of a latter step increases exponentially with respect to the stepping distance of a previous step.

[0007] Further optionally, lighting synthesis is performed according to the real-time direct light, baked direct light and ambient light to obtain a lighting processing result of the volumetric cloud, including: synthesizing according to the real-time direct light and the preset baked direct light to obtain mixed direct light; calculating the total ambient light according to multiple of ambient light occlusion, point light, noise information, transmittance information and color information; mixing the mixed direct light and the total ambient light according to a preset color coefficient to obtain the lighting processing result of the volumetric cloud.

[0008] Further optionally, the real-time direct light and the preset baked direct light are synthesized to obtain mixed direct light, including: multiplying the real-time direct light and the baked direct light to obtain total direct light; calculating the edge transmittance of the volumetric cloud according to the real-time direct light, the baked direct light and light scattering characteristics; and superimposing the edge transmittance with the total direct light to obtain the mixed direct light.

[0009] Further optionally, the total ambient light is calculated based on multiple types of ambient occlusion, point light, noise information, transmittance information and color information, including: calculating the ambient light based on ambient occlusion, opaque color, translucent color and transparency; calculating the lightning light based on the lightning color and the point light; mixing the ambient light with the lightning light to obtain composite ambient light; optimizing the composite ambient light based on real-time noise, transparency noise, the lightning light, the transparency and the real-time direct light to obtain the total ambient light.

[0010] Further optionally, before performing lighting synthesis according to the real-time direct light, baked direct light and ambient light to obtain the lighting processing result of the volumetric cloud, it also includes: acquiring the dynamically configured color information and the preset color coefficient from the art design information of the volumetric cloud.

[0011] 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 volumetric cloud lighting processing method provided in the embodiment of the present application.

[0012] 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.

[0013] The embodiment of the present application also provides a computer program product, including a computer program / instructions. When the computer program is executed by a processor, the processor is caused to implement the steps in the method provided in the embodiment of the present application.

[0014] In the lighting processing method for volumetric clouds provided in an embodiment of the present application, when calculating the lighting information of the volumetric cloud, the distance field information of the volumetric cloud to be rendered is obtained, and the distance field information is converted to obtain the concentration information of the volumetric cloud. Based on the concentration information, a ray stepping algorithm can be used to calculate the light mask of the volumetric cloud, and lighting mapping can be performed according to the light mask to obtain real-time direct light of the volumetric cloud. The lighting processing result of the volumetric cloud can be obtained by synthesizing the real-time direct light, baked direct light and ambient light. In this embodiment, the number of ray stepping sampling is reduced by distance field information, the storage space is reduced by distance concentration conversion, and the performance consumption required for calculating the concentration integral is reduced. At the same time, the lighting of the volumetric cloud using a variety of different photosynthesized volumetric clouds can make the lighting effect of the volumetric cloud more realistic and richer in details. 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 flow chart of a volumetric cloud illumination processing method provided by an exemplary embodiment of the present application;

[0017] Figure 2 A schematic diagram of volumetric cloud obtained based on real-time direct light rendering;

[0018] Figure 3 A schematic diagram of the volumetric cloud rendered based on the total direct light;

[0019] Figure 4 A schematic diagram of a volumetric cloud obtained by edge-transmittance rendering;

[0020] Figure 5 A schematic diagram of a volumetric cloud rendered using mixed direct light after superposition;

[0021] Figure 6 A schematic diagram of a volumetric cloud rendered based on mixed direct light and total ambient light;

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

[0023] 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.

[0024] Volumetric Cloud is also called volumetric cloud or volumetric fog. When rendering virtual scenes (such as game scenes), an image engine is usually used to simulate the translucent and irregular performance of real clouds and fog. Usually, when rendering volumetric clouds, the lighting calculation of volumetric clouds often generates a lot of performance consumption. In response to the above technical problems, a solution is provided in some embodiments of the present application. The technical solutions provided in each embodiment of the present application will be described in detail below in conjunction with the accompanying drawings.

[0025] Figure 1 A flow chart of a method for volumetric cloud illumination processing provided by an exemplary embodiment of the present application is shown in FIG. Figure 1 As shown, the method includes:

[0026] Step 101: Obtain distance field information of a volume cloud to be rendered; the distance field information includes a minimum distance from a scene point in a target scene to a surface of the volume cloud.

[0027] Step 102: According to the distance field information, a ray marching algorithm is used to obtain the intersection point between the ray emitted by the virtual camera and the surface of the volume cloud.

[0028] Step 103: transform the distance field information of the points on the line segment formed by the intersection points to obtain the concentration information of the volume cloud.

[0029] Step 104: Calculate the light mask of the volume cloud using a light marching algorithm according to the concentration information.

[0030] Step 105: Perform illumination mapping according to the light mask to obtain real-time direct light of the volumetric cloud.

[0031] Step 106: Perform lighting synthesis according to the real-time direct light, the baked direct light and the ambient light to obtain a lighting processing result for the volumetric cloud.

[0032] This embodiment can be implemented by an electronic device, which can be a terminal device such as a smart phone, a tablet computer, a computer, or a server device, and this embodiment does not limit it. Among them, a rendering engine that can perform rendering operations of a virtual scene can be run on the electronic device.

[0033] The target scene may include any virtual 3D (3-dimensional) scene obtained by scene modeling, may be a game scene (such as a large map scene), or may be an animation scene, etc., which is not limited in this embodiment. The target scene includes a volume cloud.

[0034] Among them, the distance field (Signed Distance Field) is a function that calculates the distance. The position of a point is input, and based on the distance field function, the minimum distance from the point to the surface of any object in the scene can be output. When the point is inside the object, the value output by the distance field is negative; when the point is outside the object, the value output by the distance field is positive; when the point is on the surface of the object, the value output by the distance field is 0.

[0035] In this embodiment, the distance field information of the point in the target scene is calculated based on the relative position relationship between the point in the target scene and the volume cloud. The distance field information includes the minimum distance from any point in the target scene to the surface of the volume cloud in the target scene. That is, the distance field information of the target scene includes the distance field information of all points in the target scene.

[0036] According to the distance field information, the ray marching algorithm can be used to obtain the intersection of the ray emitted by the virtual camera and the surface of the volume cloud. According to the definition of the distance field, the intersection of the ray emitted by the virtual camera and the surface of the volume cloud is the point where the distance field is zero. Therefore, based on the distance field, the intersection of the ray and the volume cloud can be quickly found from the target scene.

[0037] In this embodiment, after obtaining the distance field information of the volume cloud, the distance field information can be transformed to obtain the concentration information of the volume cloud. In order to reduce the amount of calculation, the distance field information of the points on the line segment formed by the intersection of the ray of the virtual camera and the surface of the volume cloud can be transformed to obtain the concentration information of the volume cloud. Among them, the concentration information of the volume cloud is used to describe the penetration ability of light irradiated on the volume cloud during the rendering process. The greater the concentration of the volume cloud, the stronger the light blocking ability; the smaller the concentration of the volume cloud, the weaker the light blocking ability. Generally, the closer the point is to the volume cloud, the greater its corresponding concentration. Based on this principle, the distance field information of the target scene can be transformed to obtain the concentration information of the volume cloud.

[0038] In some embodiments, in order to further save the amount of calculation for subsequent concentration integration, when converting the distance field information, the concentration of points farther from the surface of the volume cloud can be converted to zero, and the concentration of points closer to the surface of the volume cloud, points on the surface of the volume cloud, and points inside the surface of the volume cloud can be converted to non-zero values ​​related to the distance field.

[0039] Optionally, taking any scene point on the line segment formed by the intersection as an example, the distance field information is converted to obtain the concentration information of the volume cloud. If the minimum distance from the scene point to the volume cloud surface is greater than the set distance threshold, the concentration corresponding to the scene point is converted to zero; if the minimum distance from the scene point to the volume cloud surface is less than or equal to the set distance threshold, the concentration corresponding to the scene point is determined according to the conversion principle that the distance field is inversely proportional to the concentration. Among them, the set distance threshold is a positive value and can be set according to actual needs. That is, for points in the target scene whose distance field is greater than a certain positive value, their concentration can be set to zero, and for points whose distance field is less than or equal to the positive value, the smaller the corresponding distance value, the higher the concentration. The distance field of the points inside the volume cloud is usually a negative value, and the corresponding concentration is greater than the concentration of the points outside the volume cloud.

[0040] Based on the concentration information, a ray marching algorithm can be used to calculate the light mask of the volume cloud. The ray marching process can be regarded as a process of performing concentration integration toward the light source. The larger the concentration integral, the more the light is shielded.

[0041] After obtaining the light mask, the light mapping is performed according to the light mask to obtain the real-time direct light of the volumetric cloud. Generally, the light decreases exponentially with the concentration. Based on this principle, the light mask corresponding to the concentration can be mapped to the light to obtain the real-time direct light.

[0042] To further improve the lighting effect, after obtaining the real-time direct light, the lighting synthesis can be performed according to the real-time direct light, the baked direct light and the ambient light, so as to optimize the lighting of the volumetric cloud. The specific implementation of the lighting synthesis will be described in the subsequent embodiments and will not be repeated here.

[0043] In this embodiment, when calculating the lighting information of the volume cloud, the distance field information of the volume cloud to be rendered is obtained, and the distance field information is converted to obtain the concentration information of the volume cloud. Based on the concentration information, a ray stepping algorithm can be used to calculate the light mask of the volume cloud, and lighting mapping can be performed according to the light mask to obtain real-time direct light of the volume cloud. The lighting processing result of the volume cloud can be obtained by synthesizing the real-time direct light, baked direct light and ambient light. In this embodiment, the number of ray stepping sampling is reduced by using the distance field information, the storage space is reduced by the distance concentration conversion, and the performance consumption required for calculating the concentration integral is reduced. At the same time, the lighting of the volume cloud using a variety of different photosynthesized volume clouds can make the lighting effect of the volume cloud more realistic and richer in details.

[0044] In some exemplary embodiments, when a ray marching algorithm is used to calculate the ray mask of the volume cloud according to the concentration information, a ray may be emitted from the position of the virtual camera in the target scene to each of the multiple pixel points on the screen; the ray is used to simulate the light corresponding to the pixel point. When executing the Raymarching algorithm, the multiple rays corresponding to the multiple pixel points may be controlled to march along the line of sight according to the distance field information of the point in the target scene until they pass through the volume cloud. The distance of each step may be the same or different. Each ray may be controlled to march along the line of sight according to the set stepping distance, reach multiple stepping points, and accumulate the concentration values ​​of the multiple stepping points.

[0045] In this embodiment, in order to better fit the effect of light attenuation with distance, the step distance can be set to increase exponentially, that is, the step distance of the next step increases exponentially relative to the step distance of the previous step.

[0046] In some embodiments, the number of steps, that is, the number of concentration samplings, can be set, and the amplitude of the step distance exponential growth can be calculated based on the number of steps. When the number of steps is large, a larger step distance growth amplitude can be set, and when the number of steps is small, a smaller step distance growth amplitude can be set. Among them, the relationship between the number of steps and the step distance growth amplitude can be determined by setting a step distance growth coefficient. When the number of steps is large, a smaller step distance growth coefficient can be set, so that the step distance increases slightly. When the number of steps is small, a larger step distance growth coefficient can be set, so that the step distance increases significantly. In order to reduce the amount of calculation, the number of steps can be set to 5 times, 6 times, etc., which is not limited in this embodiment.

[0047] After performing concentration sampling based on the Raymarching algorithm and accumulating the concentration values ​​of multiple stepping points, the light mask (CloudShaded) of the volumetric cloud can be obtained. According to the principle that illumination decreases exponentially with concentration, the light mask is illuminated and mapped to obtain the real-time direct light (CloudDiffuse) of the volumetric cloud. For example, CloudDiffuse = exp2[(x)*sqrt(CloudShaded)], where the value of x can be determined according to the exponential growth requirement of the step size. In some embodiments, x can be set to a negative value to simulate the effect of light decreasing exponentially with concentration. For example, x = -2.75 or x = -3, etc. can be set. This embodiment is not limited. By rendering the volumetric cloud based on real-time direct light, the following can be obtained: Figure 2 The effect shown.

[0048] The lighting of volumetric clouds can mainly include real-time light and baked light. Among them, baked light is used to store the final results of a large number of detailed lighting simulations, and real-time light calculates the lighting changes caused by noise erosion and other spatial disturbances. Combining real-time light with baked light can improve the rendering effect of volumetric clouds without causing excessive consumption of rendering system performance.

[0049] In addition to the above classification methods, the volumetric cloud lighting can also be divided into direct light and ambient light. Ambient light can include ambient occlusion (AO) and light transmission caused by multiple scattering in the cloud. Direct light includes the bright / dark parts brought by sunlight. Therefore, multiple lighting can be synthesized to obtain a more realistic volumetric cloud lighting effect.

[0050] In some exemplary embodiments, the operation of performing lighting synthesis according to real-time direct light, baked direct light, and ambient light to obtain the lighting processing result of the volumetric cloud can be implemented based on the following steps:

[0051] Step S1, synthesize the real-time direct light (CloudDiffuse) and the preset baked direct light (bakeDirectLight) to obtain mixed direct light directLight.

[0052] Optionally, mixed direct light may include direct light and edge light. When calculating direct light, real-time direct light and baked direct light may be multiplied together to obtain total direct light. That is, total direct light = real-time direct light * baked direct light. Figure 3 Schematic diagram of the volumetric cloud rendered based on the total direct light.

[0053] Optionally, the edge transmittance edgeBacks of the volume cloud can also be calculated based on the real-time direct light, the baked direct light and the light scattering characteristics. That is, edgeBacks=F(real-time direct light, baked direct light). Wherein, F() represents a calculation function that matches the light scattering characteristics.

[0054] In some embodiments, the process of calculating edge transmittance edgeBacks based on F() can be recorded with reference to the following formula:

[0055] directTemp=lerp(0.2, 0.005, bakeDirectLight*CloudDiffuse);

[0056] temp=directTemp / [directTemp-(vdotl-1.0)];

[0057] temp / =[directTemp*log((2*directTemp)+1)];

[0058] temp2=(5*temp)*CloudDiffuse;

[0059] edgeBacks=[0.5+0.5*bakeDirectLight].

[0060] In the above formula, lerp() is an interpolation function, and vdotl can be a constant set according to empirical values. The constants used in the above formula are also only used for exemplary description. In different embodiments, the above constants can be replaced with other possible values ​​according to requirements, and this embodiment does not limit them.

[0061] Based on the above formula, the edge transmittance can be calculated according to the direction of light and the direction of sight. This results in the light scattering forward in the cloud medium, visually forming the effect of a transparent silver edge at the edge of the volumetric cloud when it is backlit, such as Figure 4 shown.

[0062] After calculating the edge transmittance, superimpose the edge transmittance with the total direct light to obtain the mixed direct light directLight. When superimposing the edge transmittance with the total direct light, the edge transmittance effect and the total direct light can be directly added, and the baked direct light can be used for darkening, and finally multiplied by the color of the sunlight to obtain the mixed direct light.

[0063] Optionally, directLight = (_LightColor*bakeDirectLight)*((CloudDiffuse*noiseTrans))+edgeBacks, where noiseTrans represents transparency noise, and LightColor represents the color of sunlight. Figure 5 Schematic diagram of volumetric cloud rendered by superimposed mixed direct light. Figure 5 As shown, when the volumetric cloud is backlit, the edges have good light transmittance and higher authenticity.

[0064] Step S2: Calculate the total ambient light according to multiple information of ambient light occlusion, point light, noise information, light transmittance information and color information.

[0065] The noise information may include real-time noise and transparency noise. The noise information may be stored in a 3D noise map. The color information may include the color of sunlight, the color of lightning, the color of clouds, the color of point light, etc. The above color information may be flexibly configured by the art production personnel.

[0066] Optionally, when obtaining the total ambient light, the ambient light evnColor is calculated according to the ambient light occlusion (AO), opaque color (_OpaqueColor), translucent color (_TranslucentColor) and transparency (_Translucency); the lightning light (LightningColor) is calculated according to the lightning color (_LightningColor) and pointlight (pointlight). The ambient light is mixed with the lightning light to obtain the synthetic ambient light; according to the real-time noise (directWithNoise), transparency noise (noiseTrans), lightning light (LightningColor), transparency (Translucency) and real-time direct light (CloudDiffus), the synthetic ambient light is optimized to obtain the total ambient light finalEnv.

[0067] In some embodiments, the above process can be calculated using the following formula:

[0068] evnColor=AO*lerp(_OpaqueColor, _TranslucentColor, _Translucency);

[0069] LighteningColor=_LighteningColor*pointlight;

[0070] evnColor += LightningColor;

[0071] finalEnv=(evnColor*directWithNoise)*((1+((1.5*0.25)*noiseTrans))+(LightningColor*(0.5*Translucency)*CloudDiffuse). In the above formula, the constant values ​​involved in the calculation are empirical values, which can be personalized according to actual needs, and are not limited in this embodiment. In each embodiment of the present application, the "_" before the variable is used to indicate that the variable involved in the calculation is a local variable or a private variable.

[0072] Step S2: Mix the mixed direct light and the total ambient light according to a preset color coefficient to obtain a lighting processing result of the volumetric cloud.

[0073] Optionally, the total ambient light and mixed direct light can be added together and the whole can be multiplied by the color coefficient to obtain the final lighting of the volumetric cloud. Figure 6 The volumetric cloud rendered from the final lighting of the composition is shown. Figure 6 As shown, through this embodiment, a volumetric cloud with natural lighting and a large number of concave and convex details near the cloud can be rendered.

[0074] It is worth noting that, in this embodiment, before performing lighting synthesis based on real-time direct light, baked direct light and ambient light, dynamically configured color information and preset color coefficients can be further obtained from the art design information of the volume cloud.

[0075] Therefore, in the art production process, the color of ambient light, the color of light transmission after multiple scattering in the cloud, the color of direct light, the color of switchable lightning light, and the color of the cloud as a whole can be dynamically configured. At the same time, the weights of direct light, ambient light, real-time light, and baked light can also be flexibly adjusted, which greatly improves the freedom of art production for volumetric cloud artists.

[0076] 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.

[0077] 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.

[0078] 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.

[0079] Figure 7 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 cloud illumination processing method described in the above embodiments. Figure 7 As shown, the electronic device includes: a memory 701 and a processor 702.

[0080] The memory 701 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, first resources, etc.

[0081] Among them, the memory 701 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.

[0082] The processor 702 is coupled to the memory 701 and is used to execute the computer program in the memory 701, so as to: obtain distance field information of a volume cloud to be rendered; the distance field information includes the minimum distance from a scene point in a target scene to the surface of the volume cloud; according to the distance field information, a ray marching algorithm is used to obtain the intersection of a ray emitted by a virtual camera and the surface of the volume cloud; the distance field information of a point on a line segment formed by the intersection is converted to obtain concentration information of the volume cloud; according to the concentration information, a ray marching algorithm is used to calculate a ray mask of the volume cloud; according to the ray mask, illumination mapping is performed to obtain real-time direct light of the volume cloud; according to the real-time direct light, the baked direct light and the ambient light, illumination synthesis is performed to obtain an illumination processing result of the volume cloud.

[0083] Further optionally, when the processor 702 converts the distance field information of the points on the line segment formed by the intersection to obtain the concentration information of the volume cloud, it is specifically used to: for any scene point on the line segment formed by the intersection, if the minimum distance from the scene point to the surface of the volume cloud is greater than a set distance threshold, convert the concentration corresponding to the scene point to zero; if the minimum distance from the scene point to the surface of the volume cloud is less than or equal to the set distance threshold, determine the concentration corresponding to the scene point according to the conversion principle that the distance field is inversely proportional to the concentration.

[0084] Further optionally, when the processor 702 calculates the ray mask of the volume cloud based on the concentration information using a ray stepping algorithm, it is specifically used to: emit a ray from the position of the virtual camera in the target scene to multiple pixel points on the screen respectively; control each ray to step along the line of sight according to a set stepping distance to reach multiple stepping points, and accumulate the concentration values ​​of the multiple stepping points; wherein the stepping distance of the latter step increases exponentially with respect to the stepping distance of the previous step.

[0085] Further optionally, when the processor 702 performs lighting synthesis according to the real-time direct light, baked direct light and ambient light to obtain the lighting processing result of the volumetric cloud, it is specifically used to: synthesize according to the real-time direct light and the preset baked direct light to obtain mixed direct light; calculate the total ambient light according to multiple types of ambient light occlusion, point light, noise information, transmittance information and color information; mix the mixed direct light and the total ambient light according to a preset color coefficient to obtain the lighting processing result of the volumetric cloud.

[0086] Further optionally, when the processor 702 synthesizes the real-time direct light and the preset baked direct light to obtain the mixed direct light, it is specifically used to: multiply the real-time direct light and the baked direct light to obtain the total direct light; calculate the edge transmittance of the volumetric cloud according to the real-time direct light, the baked direct light and the light scattering characteristics; and superimpose the edge transmittance with the total direct light to obtain the mixed direct light.

[0087] Further optionally, when the processor 702 calculates the total ambient light based on multiple types of ambient light occlusion, point light, noise information, transmittance information and color information, it is specifically used to: calculate the ambient light based on ambient light occlusion, opaque color, translucent color and transparency; calculate the lightning light based on the lightning color and the point light; mix the ambient light with the lightning light to obtain synthetic ambient light; optimize the synthetic ambient light based on real-time noise, transparency noise, the lightning light, the transparency and the real-time direct light to obtain the total ambient light.

[0088] Further optionally, before performing lighting synthesis according to the real-time direct light, baked direct light and ambient light, the processor 702 is also used to: obtain the dynamically configured color information and the preset color coefficient from the art design information of the volume cloud.

[0089] Further, if Figure 7 As shown, the electronic device also includes: a display component 703, a communication component 704, a power component 705, an audio component 706 and other components. Figure 7 Only some components are shown schematically, which does not mean that the electronic device only includes Figure 7 Components shown.

[0090] Among them, the display component 703 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.

[0091] Among them, the communication component 704 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.

[0092] The power supply component 705 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.

[0093] Among them, the audio component 706 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.

[0094] In this embodiment, when calculating the lighting information of the volume cloud, the distance field information of the volume cloud to be rendered is obtained, and the distance field information is converted to obtain the concentration information of the volume cloud. Based on the concentration information, a ray stepping algorithm can be used to calculate the light mask of the volume cloud, and lighting mapping can be performed according to the light mask to obtain real-time direct light of the volume cloud. The lighting processing result of the volume cloud can be obtained by synthesizing the real-time direct light, baked direct light and ambient light. In this embodiment, the number of ray stepping sampling is reduced by using the distance field information, the storage space is reduced by the distance concentration conversion, and the performance consumption required for calculating the concentration integral is reduced. At the same time, the lighting of the volume cloud using a variety of different photosynthesized volume clouds can make the lighting effect of the volume cloud more realistic and richer in details.

[0095] 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.

[0096] Accordingly, an embodiment of the present application also provides a computer program product, including a computer program / instructions. When the computer program is executed by a processor, the processor is caused to implement each step in the above method embodiment that can be executed by an electronic device.

[0097] 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.

[0098] 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.

[0099] 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.

[0100] 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 in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

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

[0102] 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.

[0103] 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.

[0104] 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.

[0105] 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 method for volumetric cloud illumination processing, characterized in that: include: Get the distance field information of the volume cloud to be rendered; The distance field information includes a minimum distance from a scene point in the target scene to a surface of the volume cloud; According to the distance field information, a ray marching algorithm is used to obtain an intersection point between a ray emitted by a virtual camera and a surface of the volume cloud; Transforming the distance field information of the points on the line segment formed by the intersection points to obtain the concentration information of the volume cloud; Calculating a ray mask of the volume cloud using a ray marching algorithm according to the concentration information; Performing light mapping according to the light mask to obtain real-time direct light of the volumetric cloud; Lighting synthesis is performed according to the real-time direct light, the baked direct light and the ambient light to obtain a lighting processing result of the volumetric cloud.

2. The method according to claim 1, characterized in that The distance field information of the points on the line segment formed by the intersection is transformed to obtain the concentration information of the volume cloud, including: For any scene point on the line segment formed by the intersection points, if the minimum distance from the scene point to the volume cloud surface is greater than a set distance threshold, converting the concentration corresponding to the scene point to zero; If the minimum distance from the scene point to the volume cloud surface is less than or equal to the set distance threshold, the concentration corresponding to the scene point is determined according to the conversion principle that the distance field is inversely proportional to the concentration.

3. The method according to claim 1, characterized in that: According to the concentration information, a ray marching algorithm is used to calculate a ray mask of the volume cloud, including: Sending a ray from the position of the virtual camera in the target scene to each of the plurality of pixel points on the screen; Each ray is controlled to step along the line of sight according to the set stepping distance, reach multiple stepping points, and accumulate the concentration values ​​of the multiple stepping points; wherein the stepping distance of the latter step increases exponentially with respect to the stepping distance of the previous step.

4. The method according to claim 1, characterized in that: Performing illumination synthesis according to the real-time direct light, the baked direct light, and the ambient light to obtain an illumination processing result of the volumetric cloud, including: Combining the real-time direct light and the preset baked direct light to obtain mixed direct light; Calculate the total ambient light according to multiple of the ambient light occlusion, point light, noise information, light transmittance information and color information; The mixed direct light and the total ambient light are mixed according to a preset color coefficient to obtain a lighting processing result of the volumetric cloud.

5. The method according to claim 4, characterized in that The real-time direct light and the preset baked direct light are synthesized to obtain mixed direct light, including: Multiplying the real-time direct light and the baked direct light to obtain total direct light; Calculating edge transmittance of the volumetric cloud according to the real-time direct light, the baked direct light and light scattering characteristics; The edge transmitted light is superimposed on the total direct light to obtain the mixed direct light.

6. The method according to claim 4, characterized in that Calculate total ambient light based on ambient occlusion, point light, noise information, light transmittance information, and color information, including: Calculate ambient light based on ambient occlusion, opaque color, translucent color, and transparency; Calculate lightning light according to the lightning color and the point light; Mixing the ambient light with the lightning light to obtain synthetic ambient light; The synthesized ambient light is optimized according to the real-time noise, the transparency noise, the lightning light, the transparency and the real-time direct light to obtain the total ambient light.

7. The method according to any one of claims 4 to 6, characterized in that: Before performing lighting synthesis according to the real-time direct light, baked direct light and ambient light, it also includes: The dynamically configured color information and the preset color coefficient are obtained from the art design information of the volume cloud.

8. An electronic device, characterized in that: include: Memory and processor; The memory is used to store one or more computer instructions; The processor is configured to execute the one or more computer instructions to: perform the steps in the method according to any one of claims 1-7.

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

10. A computer program product comprising a computer program / instructions, characterized in that When the computer program is executed by a processor, the processor is caused to implement the steps in the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Three-dimensional volume cloud rendering method and system based on three-dimensional noise map

    CN111951362A

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

    CN111968215A