Real-time rendering method, device, electronic device and storage medium for target object

Through pre-baked parameter group and real-time volume cloud modeling algorithm, the resource consumption and adaptability problems of volume cloud rendering on mobile terminals are solved, and the day and night light and weather changes under low resource consumption are achieved, which improves rendering performance.

CN114445538BActive Publication Date: 2025-08-01NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111663207.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-31
Publication Date
2025-08-01
Estimated Expiration
2041-12-31

AI Technical Summary

Technical Problem

On mobile terminals, real-time volume cloud rendering leads to problems such as loss of texture cache, increased power consumption, and unsustainable frame rates, and cannot ensure the adaptability of the cloud rendering system and the day and night weather system.

Method used

By pre-acquisitioning multiple environmental parameters, determining multiple pre-baking parameter groups, baking multiple texture maps using baking components, combining real-time volume cloud modeling algorithms, real-time rendering of cloud lighting effects in response to current environmental parameters, and avoiding the use of Raymarch technology.

Benefits of technology

Under low system resource consumption, day and night light and shadow follow-up and weather cloud changes are achieved, and the performance is comparable to static cloud texture, avoiding the problems of texture cache loss and power consumption increase.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114445538B_ABST
    Figure CN114445538B_ABST
Patent Text Reader

Abstract

The present application provides a real-time rendering method, device, electronic device and storage medium for a target object. The method includes: determining a plurality of pre-baked parameter groups according to a plurality of pre-acquired environmental parameters; using a baking component to bake the plurality of pre-baked parameter groups to determine a plurality of texture maps; in response to matching a target environmental parameter corresponding to the current scene among the plurality of environmental parameters, determining a lighting result according to the texture map corresponding to the target environmental parameter; and rendering the target object in the current scene in real time according to the lighting result. Furthermore, a three-dimensional cloud lighting effect and a weather transition effect that follow the day and night changes are rendered in real time according to the lighting result, so that day and night light and shadow follow and weather cloud changes can be obtained with extremely low system resources, and the performance is almost equivalent to that of static cloud textures. Since the Raymarch technology is not used, there will be no problem of texture cache loss, nor will there be problems such as increased power consumption, overheating of the body, and unsustainable frame rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular, to a method, apparatus, electronic device, and storage medium for real-time rendering of a target object. Background Art

[0002] In related technologies, virtual scenes include realistic dynamic environmental effects such as day-night cycles and weather changes. Because Raymarch (also known as ray marching) is required, real-time volumetric clouds usually cause high texture cache misses on mobile devices, resulting in increased power consumption, overheating of the device body, unsustainable frame rates, and high costs. Moreover, it is impossible to ensure that the cloud rendering system can adapt to the changes of the day-night weather system to achieve real-time rendering of volumetric clouds. Summary of the Invention

[0003] In view of this, the purpose of this application is to provide a method, apparatus, electronic device, and storage medium for real-time rendering of a target object.

[0004] Based on the above purpose, in the first aspect, this application provides a method for real-time rendering of a target object, including:

[0005] Determining a plurality of pre-baked parameter groups according to a plurality of pre-acquired environmental parameters;

[0006] Using a baking component to bake the plurality of pre-baked parameter groups to determine a plurality of texture maps;

[0007] In response to matching a target environmental parameter corresponding to the current scene among the plurality of environmental parameters, determining a lighting result according to the texture map corresponding to the target environmental parameter;

[0008] Real-time rendering of the target object in the current scene according to the lighting result.

[0009] In a possible implementation,

[0010] The environmental parameters include: time parameters and weather parameters;

[0011] The step of determining a plurality of pre-baked parameter groups according to a plurality of pre-acquired environmental parameters further includes:

[0012] Obtaining a plurality of time parameters and a plurality of weather parameters;

[0013] Mixing each time parameter and each weather parameter respectively to determine a plurality of texture sets;

[0014] Obtaining a lighting equation;

[0015] Determining a pre-baked parameter group corresponding to each texture set according to the lighting equation to obtain a plurality of pre-baked parameter groups.

[0016] In a possible implementation,

[0017] The obtaining of the lighting equation further includes:

[0018] Obtaining the change in light energy;

[0019] Performing integral processing on the change in light energy to determine the light intensity received by the vision camera;

[0020] Determining the first scattering contribution of direct light according to the scattering attenuation amount of light from the light source to the target point, the phase function, the scattering coefficient, and the scattering attenuation amount from the target point to the position of the vision camera;

[0021] Determining the second scattering contribution of ambient light according to the indirect ambient light intensity of the skybox and the scattering attenuation amount from the volume cloud to the target point;

[0022] Determining the lighting equation according to the first scattering contribution and the second scattering contribution.

[0023] In a possible implementation, the pre-baking parameter group includes: a scattering parameter and a penetration rate parameter;

[0024] The determining of the pre-baking parameter group corresponding to each texture set according to the lighting equation to obtain a plurality of pre-baking parameter groups further includes:

[0025] Analyzing each texture set according to the lighting equation to determine the scattering parameter and the penetration rate parameter corresponding to each texture set;

[0026] Determining a plurality of pre-baking parameter groups according to the scattering parameter and the penetration rate parameter corresponding to each texture set.

[0027] In a possible implementation, after using the baking component to bake the plurality of pre-baking parameter groups to determine a plurality of texture maps, it further includes:

[0028] Obtaining the scaling factor of the scattering parameter in each texture map;

[0029] Adjusting the scattering parameter according to the scaling factor to convert each texture map into a true color map.

[0030] In a possible implementation, the texture map includes: a plurality of storage channels;

[0031] After using the baking component to bake the plurality of pre-baking parameter groups to determine a plurality of texture maps, it further includes:

[0032] Group all texture maps according to the weather parameters to determine multiple texture map groups; where, the weather parameters corresponding to each texture map in each texture map group are the same;

[0033] Sort each texture map in each texture map group in chronological order according to the time parameter;

[0034] For each texture map in each texture map group,

[0035] Store the pre-baked parameter group corresponding to the texture map in any one of the storage channels,

[0036] Store the pre-baked parameters corresponding to the texture map in the next time order in any one of the remaining storage channels.

[0037] In a possible implementation, the target environmental parameters include: target weather parameters and target time parameters;

[0038] The determining the lighting result according to the texture map corresponding to the target environmental parameters further includes:

[0039] Determine whether there is a weather parameter corresponding to the target weather parameter among all the weather parameters;

[0040] In response to the existence of a weather parameter corresponding to the target weather parameter, select all the texture maps corresponding to the target weather parameter to determine a first candidate texture map group;

[0041] Determine whether there is a time parameter corresponding to the target time parameter in the first candidate texture map group;

[0042] In response to the existence of a time parameter corresponding to the target time parameter, determine the lighting result according to the texture map corresponding to the target time parameter.

[0043] In a possible implementation, after determining whether there is a weather parameter corresponding to the target weather parameter among all the weather parameters, it further includes:

[0044] In response to the non-existence of a weather parameter corresponding to the target weather parameter, determine two weather parameters to be mixed according to the target weather parameter among all the weather parameters;

[0045] Determine a second candidate texture map group and a third candidate texture map group respectively according to all the texture maps corresponding to the two weather parameters to be mixed;

[0046] Determine whether there is a time parameter corresponding to the target time parameter in the second candidate texture map group and the third candidate texture map group;

[0047] In response to the existence of a time parameter corresponding to the target time parameter, mix all the texture maps corresponding to the target time parameter to determine the lighting result.

[0048] In a possible implementation manner, after determining whether there is a time parameter identical to the target time parameter in the first candidate texture map group, the method further includes:

[0049] In response to the non-existence of a time parameter identical to the target time parameter, determine two time parameters corresponding to the time interval including the target time parameter;

[0050] In the first candidate texture map group, select the texture maps corresponding to the two time parameters;

[0051] Determine the lighting result according to the texture maps.

[0052] In a possible implementation manner, after determining whether there is a time parameter identical to the target time parameter in the second candidate texture map group and the third candidate texture map group, the method further includes:

[0053] In response to the non-existence of a time parameter identical to the target time parameter, determine two time parameters corresponding to the time interval including the target time parameter;

[0054] Respectively, in the second candidate texture map group and the third candidate texture map group, select all the texture maps corresponding to the two time parameters;

[0055] Determine the lighting result according to all the texture maps.

[0056] In a second aspect, the present application provides a real-time rendering device for a target object, including:

[0057] A first determination module, configured to determine a plurality of pre-baked parameter groups according to a plurality of pre-acquired environmental parameters;

[0058] A second determination module, configured to bake the plurality of pre-baked parameter groups by using a baking component to determine a plurality of texture maps;

[0059] A third determination module, configured to, in response to matching a target environmental parameter corresponding to the current scene among the plurality of environmental parameters, determine a lighting result according to the texture map corresponding to the target environmental parameter;

[0060] A rendering module, configured to render a target object in a current scene in real time according to the lighting result.

[0061] In a third aspect, the present application provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the real-time rendering method of the target object as described in the first aspect is implemented.

[0062] In a fourth aspect, the present application provides a non-transitory computer-readable storage medium. The non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to cause a computer to execute the real-time rendering method of the target object as described in the first aspect.

[0063] As can be seen from the above, a real-time rendering method, device, electronic device, and storage medium of a target object provided by the present application determine multiple pre-baked parameter groups according to multiple pre-acquired environmental parameters, combine a real-time volumetric cloud modeling algorithm to implement a volumetric cloud baking component, and use the baking component to bake multiple pre-baked parameter groups, thereby determining multiple texture maps for pre-baking cloud lighting data under various weather day and night times; in response to matching a target environmental parameter corresponding to the current scene among multiple environmental parameters, the lighting result can be determined according to the texture map corresponding to the target environmental parameter, and then the three-dimensional cloud lighting effect and weather transition effect following day and night changes can be rendered in real time according to the lighting result, so that under the premise of consuming extremely low system resources, day and night light and shadow following and weather cloud changes can be obtained, and the performance is almost equivalent to that of static cloud textures. Since the Raymarch technology is not used, the problem of texture cache loss will not occur, nor will the problem of increased power consumption and overheating of the body, resulting in unsustainable frame rates. Description of the Drawings

[0064] In order to more clearly illustrate the technical solutions in the present application or related technologies, the following will briefly introduce the drawings required for use in the embodiments or related technology descriptions. Obviously, the drawings in the following description are only the embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0065] Figure 1 Shows an exemplary flowchart of a real-time rendering method of a target object provided by an embodiment of the present application.

[0066] Figure 2 Shows a schematic diagram of light rays passing through a medium in a specific direction from a microscopic perspective according to an embodiment of the present application.

[0067] Figure 3Shows a schematic diagram of light passing through clouds observed by a camera in a specific direction according to an embodiment of the present application.

[0068] Figure 4 Shows a schematic diagram of pixel deviation of a compressed texture map according to an embodiment of the present application.

[0069] Figure 5 Shows a schematic diagram of the scene of volumetric clouds in a virtual scene at 9 o'clock on a cloudy day according to an embodiment of the present application.

[0070] Figure 6 Shows a schematic diagram of the scene of volumetric clouds in a virtual scene at 13 o'clock on a sunny day according to an embodiment of the present application.

[0071] Figure 7 Shows an exemplary structural schematic diagram of a real-time rendering device for a target object provided by an embodiment of the present application.

[0072] Figure 8 Shows an exemplary structural schematic diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0073] To make the objectives, technical solutions, and advantages of the present application clearer and more understandable, the present application will be further described in detail below with reference to specific embodiments and the accompanying drawings.

[0074] It should be noted that unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present application should have the ordinary meanings understood by those of ordinary skill in the art to which the present application belongs. The "first", "second", and similar terms used in the embodiments of the present application do not indicate any order, quantity, or importance, but are only used to distinguish different components. The terms such as "including" or "comprising" mean that the elements or objects appearing before this term cover the elements or objects listed after this term and their equivalents, without excluding other elements or objects. The terms such as "connected" or "coupled" are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The terms such as "upper", "lower", "left", and "right" are only used to represent relative positional relationships, and when the absolute position of the object being described changes, the relative positional relationship may also change accordingly.

[0075] As described in the background art section, in the related art, the virtual scene includes realistic dynamic environmental effects such as day-night cycle and weather changes. Because Raymarch (also known as ray marching) is required, real-time volumetric clouds usually cause a high texture cache loss on mobile devices, which in turn leads to increased power consumption, overheating of the device body, unsustainable frame rate, and high cost. Moreover, it cannot be guaranteed that the cloud rendering system can adapt to the changes of the day-night weather system to achieve real-time rendering of volumetric clouds.

[0076] That is to say, currently, the rendering technology of the target object is a common sky rendering solution on the host side, and its importance for the scene environment experience is self-evident. However, the current mobile device performance is not sufficient to stably support rendering methods such as Raymarch.

[0077] In the related art, taking volumetric clouds as an example, the Raymarch method used essentially means performing numerical integration in the changing cloud density to obtain the T term and the S term. For a specific camera direction, the positions where the light enters and exits the cloud can be determined. N unequal sampling sections are divided in this section. For each section, the noise texture can be sampled at the center and the current density can be calculated in combination with the cloud parameters. Assuming that the density remains unchanged in a small range section, the T term and the S term of this section can be obtained through analytical integration. Further, by stepping from the camera direction, the T term and the S term in each section are accumulated to obtain the final T term and S term, and the final illumination value is obtained.

[0078] The applicant found in the research that the cloud rendering is very important for the overall environment. Considering the development of the GPU computing power of the mobile platform, the applicant studied a volumetric cloud rendering system based on horizon modeling. By using various optimization means, the volumetric clouds can be real-time rendered on mobile devices (such as iPhone X devices) with a time consumption of about 1.5 ms. However, with the diversification of the content in the virtual scene and the promotion of Android platform adaptation, the real-time rendering of volumetric clouds faces more rendering pressure on mobile devices. Therefore, the time budget left for cloud rendering in the entire rendering pipeline needs to be greatly compressed. On this premise, it is also an urgent problem to ensure that the optimized cloud rendering system can adapt to the changes of the day-night weather system.

[0079] For this reason, a real-time rendering method, apparatus, electronic device, and storage medium for a target object provided by this application determine multiple pre-baked parameter groups according to multiple pre-acquired environmental parameters, implement a volumetric cloud baking component in combination with a real-time volumetric cloud modeling algorithm, and use the baking component to bake the multiple pre-baked parameter groups, thereby determining multiple texture maps for pre-baking cloud illumination data under various weather and day-night times; in response to matching a target environmental parameter corresponding to the current scene among the multiple environmental parameters, the illumination result can be determined according to the texture map corresponding to the target environmental parameter, and then the three-dimensional cloud illumination effect and weather transition effect can be rendered in real time according to the illumination result following the day-night change, so that under the premise of consuming extremely little system resources, day-night light and shadow following and weather cloud changes can be obtained, and the performance is almost equivalent to that of static cloud textures. Since the Raymarch technology is not used, the problem of texture cache loss will not occur, nor will the problem of increased power consumption and overheating of the body, resulting in unsustainable frame rates.

[0080] The following specifically describes the real-time rendering method for a target object provided by the embodiments of this application through specific embodiments.

[0081] Figure 1 FIG. shows an exemplary flowchart of a real-time rendering method for a target object provided by an embodiment of this application.

[0082] Reference Figure 1 An embodiment of the real-time rendering method for a target object provided by this application specifically includes the following steps:

[0083] S102: Determine multiple pre-baked parameter groups according to multiple pre-acquired environmental parameters.

[0084] S104: Bake the multiple pre-baked parameter groups using a baking component to determine multiple texture maps.

[0085] S106: In response to matching a target environmental parameter corresponding to the current scene among the multiple environmental parameters, determine an illumination result according to the texture map corresponding to the target environmental parameter.

[0086] S108: Render the target object in the current scene in real time according to the illumination result.

[0087] In the following embodiments of this application, for the convenience of explanation, the target object is taken as an example of volumetric cloud for illustration. It should be noted that the target object includes but is not limited to volumetric cloud and volumetric fog, etc.

[0088] Figure 2 FIG. shows a schematic diagram of light rays passing through a medium in a specific direction from a microscopic perspective according to an embodiment of this application.

[0089] In some embodiments, since the cloud is a propagation medium, the interaction between light and the medium can be first divided into three types, namely absorption, luminescence, and scattering. Referring to Figure 2 , it can be seen that from a microscopic perspective, when light in a specific direction passes through a small distance, the change in light energy can be obtained.

[0090] Before step S102, the lighting equation can be obtained based on the volume cloud lighting theory, and thus the pre-baked parameter set can be determined according to the equation. Specifically, referring to Figure 2 , the change in light energy can be obtained, and the expression can be

[0091]

[0092] where α represents the absorption coefficient, σ represents the scattering coefficient, represents the light energy before passing through this section of the medium dx, represents the scattering contribution of the direct light part in the ω direction, represents the scattering contribution of the light around this section of the medium dx in the ω direction, that is, the phase function, which is the integral of light energy on the spherical surface.

[0093] Figure 3 shows a schematic diagram of observing light passing through a cloud layer from a camera in a specific direction according to an embodiment of the present application.

[0094] Referring to Figure 3 , it studies the situation where the light after scattering is captured by the visual camera through a specific viewing angle, that is, any optical fiber path in the direction ba will scatter at a certain point x between ba and then enter the visual camera. a refers to the position of the visual camera, b refers to the position of the surface of the physical object, and x refers to the position where any light scatters.

[0095] By further integrating the change in light energy, the light intensity received by the visual camera can be determined, and the expression is

[0096]

[0097] where, represents the light intensity received by the camera in a specific direction, a represents the position of the visual camera, ω represents the light direction, L b represents the light intensity reflected or emitted by the surface of the object at point b, τ(b, a) represents the integral of the sum of absorption and scattering, that is, the optical thickness, e -τ(x,a) represents the transmittance T(b, a). The variables a, b, and x can be understood as absolute spatial positions in the integral expression, or as one-dimensional coordinates with the light direction as the axis.

[0098] Furthermore, it can be further disassembled to obtain

[0099]

[0100] Where t1 and t2 are only formal variables in the integral expression and have no specific meaning. What this formula expresses is the ratio of the energy after attenuation to the energy before attenuation when light travels through the distance from t1 to t2 on the suspect.

[0101] It can also be obtained that

[0102]

[0103] Where ω represents the direction and is a multi-dimensional variable. Therefore, the writing in the integral expression is different from that of ordinary one-dimensional variables. dΩ’ represents the integral over the entire spherical direction in the ω direction, that is, what the formula expresses is the total scattering generated by light in all directions at x. represents the light intensity received from the direction ω’ at the position point that is in the ω direction relative to the camera and at a distance of x. represents the scattering coefficient at the position point x, that is, the proportion of light rays that undergo scattering. represents what proportion of the light rays scattered from the direction ω’ will propagate along the ω direction and be captured by the vision camera.

[0104] Furthermore, for the phase function, it can be used to calculate the single-scattering contribution of direct light, that is, the first scattering contribution, which is expressed as

[0105]

[0106] Where g represents the anisotropy coefficient. The larger g is, the greater the difference in the scattering distribution in different directions. θ represents the angle between the ω direction and the ω’ direction.

[0107] It should be noted that in real-time volume cloud computing, in order to simplify the operation, only the energy propagation process of single scattering is calculated. The scattering contribution of direct light needs to consider the scattering attenuation amount from sunlight to the target point x, the phase function, the scattering coefficient, and the scattering attenuation amount from the target point x to the position a of the vision camera. At the same time, the contribution of skylight to the cloud layer can also be considered. For the sake of simplifying the calculation, SH o (that is, the skybox baking coefficient, the zero-order of SH) can be used as the average value of the contributions in different directions, that is, the scattering contribution of ambient light, which can also be called the second scattering contribution. Here, the phase function part of the skylight can be not considered. Secondly, a constant coefficient k can be used to approximate the calculation of the scattering attenuation amount when skylight enters the cloud layer to the target point x.

[0108] Furthermore, It can be further expressed as

[0109]

[0110] Secondly, for the cloud medium, it can be ideally assumed that the absorption coefficient and the scattering coefficient are linearly related to the medium density ρ(t), and it can be deduced that

[0111]

[0112] and

[0113]

[0114] Furthermore, the scattering contribution of SH can be simplified:

[0115]

[0116] where ρ(t) represents the density distribution function of the medium, and the independent variable t is the spatial coordinate point. Since it is assumed that the scattering coefficient and the absorption coefficient are linearly related to the medium density ρ(t), σ(x) = μ σ ρ(x) and a(x) = μ α ρ(x) can be set, where μ α and μ σ are constant coefficients.

[0117] Furthermore, the method of substitution for definite integrals can be used. Let t = τ(x, a),

[0118]

[0119] So far, the variables in the scattering contribution of SH o are only related to the transmittance. Next, the scattering contribution of the direct light can be split and simplified. Let the integral part be equal to S(a, b), where S(a, b) is called the scattering parameter. Thus, the lighting equation can be determined according to the scattering contribution of the direct light and the scattering contribution of the ambient light, expressed as

[0120]

[0121] After further simplification, it can be obtained that for a specific camera angle, based on the known T term (i.e., the scattering parameter) and the S term (i.e., the transmittance parameter), the cloud lighting data can be simply calculated.

[0122] In some embodiments, since it is necessary to calculate in a specific camera direction during the rendering of the volumetric cloud, the pre-baked data of the entire cloud needs to cover the entire upper hemisphere, and it is necessary to ensure that the clarity in each direction is almost the same after mapping. Therefore, the mutual conversion of ViewDir and UV can be implemented in the Shader component.

[0123] Figure 4 A schematic diagram of the spherical mapping code according to an embodiment of the present application is shown.

[0124] Reference Figure 4 , further, according to Figure 4 the code in it, the camera direction can be defined by dividing it into two angles, namely the horizontal angle and the zenith angle. For any point in the two-dimensional plane, the horizontal angle can be defined by the angle between the central connection line and the x-axis, and the radian size of the zenith angle can be represented by the distance from the point to the center, so as to realize the conversion from two-dimensional to three-dimensional ray direction.

[0125] For step S102, the environmental parameters may include time parameters and weather parameters. For example, in the weather system and day-night system data in the virtual scene, M time parameters and N weather parameters are obtained, where the time parameters control the influence of the directional light on the light path propagation path, and the weather parameters mainly affect the modeling coverage rate of the volumetric cloud. After obtaining multiple time parameters and multiple weather parameters, each time parameter and each weather parameter are respectively mixed. For example, M×N different texture sets can be obtained. Analyze each texture set using the light equation obtained in the above steps, so as to determine the scattering parameter and penetration rate parameter corresponding to each texture set. The scattering parameter and penetration rate parameter of each texture set can determine the pre-baked parameter of each texture set, so as to determine the pre-baked parameters of all texture sets.

[0126] Regarding step S104, the ComputeShader can be used to implement the cloud texture baking process of pixel parallel computing on the GPU. Based on the baked material, a ComputePass is constructed and submitted to the hardware for calculation. After synchronization, the texture data is read back to the CPU using the driver API, and finally saved as a file in the dds format, so as to use the baking component to bake the pre-baked parameter group of all texture sets and determine the texture map in the two dimensions of time parameters and weather parameters. For example, if 5 weather parameters and 10 time parameters are obtained, 50 texture maps can be obtained finally.

[0127] In some embodiments, since floating-point texture maps consume more bandwidth, the present application avoids using HDR texture maps (High Dynamic Range, also known as high-dynamic-range texture maps). To avoid the problem of insufficient precision caused by the scattering parameters in the pre-baked parameter group being floating-point data, after using the baking component to bake the pre-baked parameter group to determine the texture map, a scaling factor for the scattering parameters can be set for each texture map. When actually baking, HDR texture maps are used to read back and statistically analyze the overall accuracy of all pixels of the scattering parameters of the image under R8, and then the scaling factor of the scattering parameters is automatically adjusted. Finally, each texture map is converted into a 16-bit true-color texture map (i.e., an R8G8 texture map). In the R8G8 texture map, each storage channel uses a precision of 0-256 to represent a value of 0-1, that is, the numerical precision is guaranteed to be 1 / 256. If the data to be baked is distributed in a relatively small range, there will be obvious precision problems. Therefore, it is necessary to statistically analyze the distribution range of the data and use a coefficient to fully map the data between 0 and 1, thereby reducing the visual problems caused by precision. Specifically, the scaling factor can be pre-multiplied during baking and pre-divided during rendering, which can solve most of the precision problems.

[0128] To further reduce bandwidth consumption, in some embodiments, the texture map includes multiple storage channels, generally four storage channels. There are changes in two dimensions of time parameters and weather parameters in the baking system. This means that when the volumetric clouds in the actually rendered scene are between two pre-acquired weather parameters, that is, in a transitional weather, and the time of the current scene is between two pre-acquired time parameters, four texture maps need to be sampled and blended to obtain the effect of the volumetric clouds in the current scene. For example, when the weather is in a transitional weather between sunny and rainy, and the pre-acquired time parameters are only 9 o'clock and 10 o'clock, and the time of the current scene is 9:30, then the first texture map with a weather parameter of sunny and a time parameter of 9 o'clock needs to be obtained; the second texture map with a weather parameter of sunny and a time parameter of 10 o'clock; the third texture map with a weather parameter of rainy and a time parameter of 9 o'clock; and the fourth texture map with a weather parameter of rainy and a time parameter of 10 o'clock. By sampling and blending these four texture maps, the effect of the volumetric clouds in the transitional weather between sunny and rainy at 9:30 in the current scene can be obtained.

[0129] To reduce bandwidth consumption, all texture maps can be grouped according to weather parameters to determine multiple texture map groups. Each texture map in each texture map group corresponds to the same weather parameter. That is to say, classification is carried out according to weather parameters. For example, all texture maps with the weather parameter of sunny are grouped together, and all texture maps with the weather parameter of rainy are grouped together, and so on. Then, each texture map in each texture map group is sorted in sequence according to the time parameter. That is to say, taking the sunny texture map group as an example, it is sorted in the order of 0-24 o'clock. The texture map with the time parameter of 0 o'clock is the first texture map, the texture map with the time parameter of 1 o'clock is the second texture map... The texture map with the time parameter of 24 o'clock is the twenty-fifth texture map.

[0130] For each texture map in each texture map group, store the scattering parameter corresponding to the texture map in any one of the 4 storage channels, and store the transmittance parameter in any one of the remaining 3 storage channels. Next, store the scattering parameter and transmittance parameter corresponding to the texture map in the next time order in the remaining two storage channels respectively. For example, two storage channels in the sunny texture map at 0 o'clock store its own scattering parameter and transmittance parameter respectively, and the remaining two storage channels store the scattering parameter and transmittance parameter in the sunny texture map at 1 o'clock respectively. In this way, at this time, after merging the time parameters of the two texture maps, the merged texture map is a 32-bit true color map, and the pre-baked parameter groups of the two texture maps can be obtained in one texture map, thereby saving bandwidth consumption.

[0131] Figure 4 Shows a pixel deviation schematic diagram of the compressed texture map according to an embodiment of the present application.

[0132] Reference Figure 4 , for the mobile terminal, the astc compression method can be selected. Considering that there is no correlation between the texture channels, the mask map compression mode in astc is used, that is, the compression method with equal weights for all storage channels. After testing, finally, the astcenc 4x4-mask configuration can be used to produce cloud textures with better quality, and the pixel size of the compressed texture is only 8bpp.

[0133] For step S106, the target environmental parameters in the current scene can be obtained, and it is determined whether an environmental parameter corresponding to the target environmental parameter can be matched among the multiple environmental parameters determined in the previous steps. For example, an environmental parameter identical to the target environmental parameter is found among the multiple environmental parameters. If so, the lighting result is determined according to the texture map corresponding to the environmental parameter.

[0134] In some embodiments, the target environmental parameters may include target weather parameters and target time parameters. If each texture map still stores only the scattering parameters and transmittance parameters corresponding to this texture map, it is possible to determine whether there is a weather parameter in all weather parameters that is the same as the target weather parameter. If so, directly select all texture maps corresponding to this weather parameter to determine a candidate texture map group. Then, determine whether there is a time parameter in the candidate texture map group that is the same as the target time parameter. If so, directly determine the lighting result according to the texture map corresponding to this time parameter. For example, if the target weather parameter is sunny and the target time parameter is 8 o'clock, find all texture maps with the weather parameter of sunny, and look for the texture map with the time parameter of 8 o'clock among these texture maps. After finding it, the texture map for sunny at 8 o'clock is determined, and the lighting result is directly determined according to this texture map.

[0135] Figure 5 FIG. shows a schematic diagram of the volume cloud in the virtual scene at 9 o'clock on a cloudy day according to an embodiment of the present application.

[0136] In some embodiments, refer to Figure 5 , if each texture map stores not only the scattering parameters and transmittance parameters corresponding to this texture map, but also the scattering parameters and transmittance parameters corresponding to the texture map at the next moment with the same weather parameter. Similarly, it is possible to determine whether there is a weather parameter in all weather parameters that is the same as the target weather parameter. If so, directly select all texture maps corresponding to this weather parameter to determine a candidate texture map group. Then, determine whether there is a time parameter in the candidate texture map group that is the same as the target time parameter. If so, directly determine the lighting result according to the texture map corresponding to this time parameter. For example, if the target weather parameter is cloudy and the target time parameter is 9 o'clock, find all texture maps with the weather parameter of cloudy, and look for the texture map with the time parameter of 9 o'clock among these texture maps. After finding it, the texture map for cloudy at 9 o'clock is determined, and the lighting result is directly determined according to this texture map. Among them, the lighting result is determined by substituting the pre-baked parameter group of the finally determined texture map into the lighting equation, and then according to step S108, the volume cloud in the current scene is rendered in real time according to the lighting result.

[0137] Figure 6 FIG. shows a schematic diagram of the volume cloud in the virtual scene at 13 o'clock on a sunny day according to an embodiment of the present application.

[0138] Refer to Figure 6 , if the target time parameter is 13 o'clock in the afternoon at this time, it can be seen that the volume cloud also changes according to the change of the time parameter under the same weather parameter.

[0139] In some embodiments, if, when each texture map still stores only the scattering parameter and penetration rate parameter corresponding to this texture map, no weather parameter identical to the target weather parameter is found, that is, the target weather parameter is a transitional weather, then two weather parameters to be mixed are determined from all the weather parameters according to the target weather parameter, and two candidate texture map groups A and B are respectively determined from all the texture maps corresponding to the two weather parameters to be mixed. It is determined whether there is a time parameter identical to the target parameter in the candidate texture map groups A and B. If so, the texture maps corresponding to this time parameter in the candidate texture map groups A and B are directly obtained, and these two texture maps are mixed to determine the lighting result. For example, if the target weather parameter is a transitional weather between sunny and rainy, and the target time parameter is 8 o'clock, then the texture maps with weather parameters of sunny and rainy are respectively found, then the texture map at 8 o'clock is searched for in the sunny texture map, and the texture map at 8 o'clock is searched for in the rainy texture map, and the sunny 8 o'clock texture map and the rainy 8 o'clock texture map are mixed to determine the lighting result. Among them, the lighting result is determined by substituting the pre-baked parameter group of the finally determined texture map into the lighting equation, and then according to step S108, the volume clouds in the current scene are rendered in real time according to the lighting result.

[0140] It should be noted that when at least two texture maps need to be mixed, different weight values can be assigned to each texture map. For example, when the cloud density in the transitional weather is close to the cloud density in sunny weather, then when mixing the sunny 8 o'clock texture map and the rainy 8 o'clock texture map, the weight of the sunny 8 o'clock texture map will be greater than that of the rainy 8 o'clock texture map, so that after mixing the two texture maps, the mixing result is closer to the transitional weather with cloud density close to sunny weather.

[0141] In some embodiments, if each texture map stores not only the scattering parameter and penetration rate parameter corresponding to this texture map, but also the scattering parameter and penetration rate parameter corresponding to the texture map at the next moment with the same weather parameter. Similarly, in the case where no weather parameter identical to the target weather parameter is found, that is, when the target weather parameter is a transitional weather, two weather parameters to be mixed are determined from all weather parameters according to the target weather parameter, and then two candidate texture map groups A and B are respectively determined from all the texture maps corresponding to the two weather parameters to be mixed. It is determined whether there is a time parameter identical to the target parameter in the candidate texture map groups A and B. If so, the texture maps corresponding to this time parameter in the candidate texture map groups A and B are directly obtained, and these two texture maps are mixed to determine the lighting result. For example, if the target weather parameter is a transitional weather between sunny and rainy, and the target time parameter is 8 o'clock, then the texture maps with weather parameters of sunny and rainy are respectively found, then the texture map at 8 o'clock is searched for in the sunny texture map, and the texture map at 8 o'clock is searched for in the rainy texture map, and the sunny 8 o'clock texture map and the rainy 8 o'clock texture map are mixed to determine the lighting result. Among them, the lighting result is determined by substituting the pre-baked parameter group of the finally determined texture map into the lighting equation, and then according to step S <108>, the volume cloud in the current scene is rendered in real time according to the lighting result.

[0142] In some embodiments, if each texture map still only stores the scattering parameter and penetration rate parameter corresponding to this texture map, after a weather parameter identical to the target weather parameter is found and there is no time parameter identical to the target time parameter, two time parameters closest to the target time parameter need to be found, the texture maps corresponding to these two time parameters are obtained, and these two texture maps are mixed to determine the lighting result. For example, if the target weather parameter is sunny, after all the texture maps with the weather parameter of sunny are found, and the target time parameter is 8:30, then two texture maps with time parameters of 8 o'clock and 9 o'clock need to be found in the sunny texture map, and the sunny 8 o'clock texture map and the sunny 9 o'clock texture map are mixed to determine the lighting result. Among them, the lighting result is determined by substituting the pre-baked parameter group of the finally determined texture map into the lighting equation, and then according to step S <108>, the volume cloud in the current scene is rendered in real time according to the lighting result.

[0143] It can be understood that when at least two texture maps need to be mixed, different weight values can be assigned to each texture map. For example, when the target time parameter is 8:30, the sunny 8 o'clock texture map and the sunny 9 o'clock texture map Figure 2 are mixed with each accounting for 50% of the weight. If the target time parameter is 8:10, the weight of the sunny 8 o'clock texture map should be 5 / 6, and the weight of the sunny 9 o'clock texture map should be 1 / 6, and then the two are mixed.

[0144] In some embodiments, if each texture map stores not only the scattering parameters and penetration rate parameters corresponding to this texture map, but also the scattering parameters and penetration rate parameters corresponding to the texture map at the next moment with the same weather parameters. After finding the weather parameters that are the same as the target weather parameters, if there are no time parameters that are the same as the target time parameters, two time parameters corresponding to the time interval containing the target time parameter can be determined. Among the candidate texture map groups corresponding to the weather parameters that are the same as the target weather parameters, select the texture maps corresponding to these two time parameters, and determine the lighting result according to the texture maps. For example, if the target weather parameter is sunny, after finding all the texture maps with the weather parameter of sunny, and the target time parameter is 8:30, then it is necessary to find the texture map storing the pre-baked parameter group at 8 o'clock on a sunny day and the texture map storing the pre-baked parameter group at 9 o'clock on a sunny day. Just according to this texture map, the lighting result can be determined. Among them, the lighting result is determined by substituting the pre-baked parameter group of the finally determined texture map into the lighting equation, and then according to step S108, the volume cloud in the current scene is rendered in real time according to the lighting result.

[0145] In some embodiments, if each texture map still only stores the scattering parameters and penetration rate parameters corresponding to this texture map, and neither the weather parameters that are the same as the target weather parameters nor the time parameters that are the same as the target time parameters are found, it is necessary to find all the texture maps corresponding to two weather parameters that can be mixed to obtain the target weather parameter, and find all the texture maps corresponding to two time parameters that can be mixed to obtain the target time parameter among these texture maps, and then mix these texture maps to determine the lighting result. For example, if the target weather parameter is a transitional weather between sunny and rainy, and the target time parameter is 8:30, then it is necessary to find the texture map at 8 o'clock on a sunny day, the texture map at 9 o'clock on a sunny day, the texture map at 8 o'clock on a rainy day, and the texture map at 9 o'clock on a rainy day, and mix the four texture maps according to the set weights to determine the lighting result. Among them, the lighting result is determined by substituting the pre-baked parameter group of the finally determined texture map into the lighting equation, and then according to step S108, the volume cloud in the current scene is rendered in real time according to the lighting result.

[0146] In some embodiments, if each texture map stores not only the scattering parameters and penetration rate parameters corresponding to this texture map, but also the scattering parameters and penetration rate parameters corresponding to the texture map at the next moment with the same weather parameters. In the case where there are no weather parameters identical to the target weather parameters, two weather parameters to be mixed are determined from all the weather parameters according to the target weather parameters, and two candidate texture map groups A and B are respectively determined from all the texture maps corresponding to the two weather parameters to be mixed. And in the case where there are no time parameters identical to the target time parameter in the candidate texture map groups A and B, two time parameters corresponding to the time interval including the target time parameter can be determined, and then all the texture maps corresponding to the two time parameters are respectively selected from the two candidate texture map groups A and B, and the lighting result is determined according to all the texture maps. For example, if the target weather parameter is a transitional weather between sunny and rainy, and the target time parameter is 8:30, then first find two weather parameters that can be mixed to obtain the transitional weather, which are sunny and rainy respectively. Then, all the sunny texture maps at all times are determined as the candidate texture map group A, and all the rainy texture maps at all times are determined as the candidate texture map group B. Further, two texture maps that store the pre-baked parameter group at 8 o'clock on sunny days and the pre-baked parameter group at 9 o'clock on sunny days are found respectively in the candidate texture map groups A and B, and the two texture maps are mixed according to different set weights to determine the lighting result. Among them, the lighting result is determined by substituting the pre-baked parameter group of the finally determined texture map into the lighting equation. Then, according to step S108, the volume clouds in the current scene are rendered in real time according to the lighting result.

[0147] It should be noted that for step S108, in real-time rendering, the phase value calculated using the current sun direction can be applied to the scattering of all clouds. Compared with calculating and participating in mixing using the phase function during baking, it can avoid the visual problem of aliasing in the mixing of the highlight parts of the clouds. Among them, the direction of the sun is different when baking the lighting data for different time periods. The included angle in the phase function is the included angle between the sunlight and the viewing direction. Therefore, the direct result of the phase function is that the scattering highlight of the clouds is obvious when looking at the sun. So there will be two problems of highlight aliasing in the mixing of the highlight parts. Therefore, in the lighting equation obtained in this application, this part of the calculation is moved to the real-time part, so that the cloud highlights always follow the sun direction. What is meant by applying to all layers is that regardless of the phase function at different time periods, the phase function is uniformly calculated using the real-time sun direction.

[0148] As can be seen from the above, a real-time rendering method, apparatus, electronic device, and storage medium for a target object provided by the present application determine multiple pre-baked parameter groups according to multiple pre-acquired environmental parameters, implement a volumetric cloud baking component in combination with a real-time volumetric cloud modeling algorithm, and bake the multiple pre-baked parameter groups by using the baking component, so as to determine multiple texture maps for pre-baking cloud illumination data under various weather day and night times; in response to matching a target environmental parameter corresponding to the current scene among the multiple environmental parameters, the illumination result can be determined according to the texture map corresponding to the target environmental parameter, and then a three-dimensional cloud illumination effect and a weather transition effect following day and night changes can be rendered in real time according to the illumination result, so that under the premise of consuming extremely little system resources, day and night light and shadow following and weather cloud changes can be obtained, and the performance is almost equivalent to that of static cloud textures. Since the Raymarch technology is not used, the problem of texture cache loss will not be caused, nor will the problem of increased power consumption and overheating of the body, resulting in an unsustainable frame rate.

[0149] It should be noted that the method of the embodiments of the present application can be executed by a single device, such as a computer or a server. The method of this embodiment can also be applied to a distributed scenario and completed by multiple devices cooperating with each other. In such a distributed scenario, one of the multiple devices can only execute one or more steps of the method of the embodiments of the present application, and these multiple devices will interact with each other to complete the described method.

[0150] It should be noted that some embodiments of the present application have been described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the above embodiments and still achieve the desired results. Additionally, the processes depicted in the figures do not necessarily require the particular order or sequential order shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0151] Figure 7 Shows an exemplary structural schematic diagram of a real-time rendering apparatus for a target object provided by an embodiment of the present application.

[0152] Based on the same inventive concept, corresponding to the method of any of the above embodiments, the present application further provides a real-time rendering apparatus for a target object.

[0153] Refer to Figure 7 , the real-time rendering apparatus for the target object includes: a first determination module, a second determination module, a third determination module, and a rendering module; wherein,

[0154] The first determination module is configured to determine multiple pre-baked parameter groups according to multiple pre-acquired environmental parameters;

[0155] A second determination module, configured to bake the multiple pre-baking parameter groups by using a baking component to determine multiple texture maps;

[0156] A third determination module, configured to, in response to matching a target environmental parameter corresponding to the current scene among the multiple environmental parameters, determine a lighting result according to the texture map corresponding to the target environmental parameter;

[0157] A rendering module, configured to render a target object in the current scene in real time according to the lighting result.

[0158] In a possible implementation manner, the environmental parameters include: a time parameter and a weather parameter;

[0159] The first determination module is further configured to:

[0160] Obtain multiple time parameters and multiple weather parameters;

[0161] Mix each time parameter and each weather parameter respectively to determine multiple texture sets;

[0162] Obtain a lighting equation;

[0163] Determine a pre-baking parameter group corresponding to each texture set according to the lighting equation to obtain multiple pre-baking parameter groups.

[0164] In a possible implementation manner, the device further includes: a lighting equation determination module;

[0165] The lighting equation determination module is further configured to:

[0166] Obtain a change amount of light energy;

[0167] Perform an integration process on the change amount of light energy to determine the light intensity received by a vision camera;

[0168] Determine a first scattering contribution of direct light according to a scattering attenuation amount from sunlight to a target point, a phase function, a scattering coefficient, and a scattering attenuation amount from the target point to the position of the vision camera;

[0169] Determine a second scattering contribution of ambient light according to an indirect ambient light intensity of a skybox and a scattering attenuation amount from the volume cloud to the target point;

[0170] Determine a lighting equation according to the first scattering contribution and the second scattering contribution.

[0171] In a possible implementation manner, the pre-baking parameter group includes: a scattering parameter and a penetration rate parameter;

[0172] The device further includes: a fourth determination module;

[0173] The fourth determination module is further configured to:

[0174] Analyze each of the texture sets according to the illumination equation to determine the scattering parameter and the penetration rate parameter corresponding to each of the texture sets;

[0175] Determine a plurality of pre-baked parameter groups according to the scattering parameter and the penetration rate parameter corresponding to each texture set.

[0176] In a possible implementation manner, the device further includes: a conversion module;

[0177] The conversion module is further configured to:

[0178] Obtain a scaling factor of the scattering parameter in each texture map;

[0179] Adjust the scattering parameter according to the scaling factor to convert each texture map into a true color map.

[0180] In a possible implementation manner, the texture map includes: a plurality of storage channels;

[0181] The device further includes: an optimization module;

[0182] The optimization module is further configured to:

[0183] Group all texture maps according to the weather parameter to determine a plurality of texture map groups; wherein, the weather parameter corresponding to each texture map in each texture map group is the same;

[0184] Sort each texture map in each texture map group in chronological order according to the time parameter;

[0185] For each texture map in each texture map group,

[0186] Store the pre-baked parameter group corresponding to the texture map in any one of the storage channels,

[0187] Store the pre-baked parameter corresponding to the texture map in the next time order in any one of the remaining storage channels.

[0188] In a possible implementation manner, the target environmental parameter includes: a target weather parameter and a target time parameter;

[0189] The third determination module is further configured to:

[0190] Determine whether there is a weather parameter corresponding to the target weather parameter among all the weather parameters;

[0191] In response to the existence of a weather parameter corresponding to the target weather parameter, select all the texture maps corresponding to the weather parameter to determine a first candidate texture map group;

[0192] Determine whether there is a time parameter corresponding to the target time parameter in the first candidate texture map group;

[0193] In response to the existence of a time parameter corresponding to the target time parameter, determine the lighting result according to the texture map corresponding to the time parameter.

[0194] In a possible implementation, the third determination module is further configured to:

[0195] In response to the non-existence of a weather parameter corresponding to the target weather parameter, determine two weather parameters to be mixed among all the weather parameters according to the target weather parameter;

[0196] Determine a second candidate texture map group and a third candidate texture map group respectively according to all the texture maps corresponding to the two weather parameters to be mixed;

[0197] Determine whether there is a time parameter corresponding to the target time parameter in the second candidate texture map group and the third candidate texture map group;

[0198] In response to the existence of a time parameter corresponding to the target time parameter, mix all the texture maps corresponding to the time parameter to determine the lighting result.

[0199] In a possible implementation, the third determination module is further configured to:

[0200] In response to the non-existence of a time parameter corresponding to the target time parameter, determine two time parameters corresponding to the time interval including the target time parameter;

[0201] In the first candidate texture map group, select the texture maps corresponding to the two time parameters;

[0202] Determine the lighting result according to the texture maps.

[0203] In a possible implementation, the third determination module is further configured to:

[0204] In response to the non-existence of a time parameter corresponding to the target time parameter, determine two time parameters corresponding to the time interval including the target time parameter;

[0205] Select all texture maps corresponding to the two time parameters from the second candidate texture map group and the third candidate texture map group, respectively;

[0206] Determine the lighting result according to all the texture maps.

[0207] For the convenience of description, when describing the above device, various modules are described separately according to their functions. Of course, when implementing the present application, the functions of each module can be implemented in the same or multiple software and / or hardware.

[0208] The device of the above embodiment is used to implement the real-time rendering method of the corresponding target object in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be elaborated here.

[0209] Figure 8 The exemplary structural schematic diagram of an electronic device provided by the embodiment of the present application is shown.

[0210] Based on the same inventive concept, corresponding to the method of any of the above embodiments, the present application further provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, it implements the real-time rendering method of the target object described in any of the above embodiments. Figure 8 The more specific hardware structural schematic diagram of the electronic device provided by this embodiment is shown. The device may include: a processor 810, a memory 820, an input / output interface 830, a communication interface 840, and a bus 850. Among them, the processor 810, the memory 820, the input / output interface 830, and the communication interface 840 are communicatively connected to each other inside the device through the bus 850.

[0211] The processor 810 may be implemented in a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, etc., and is used to execute relevant programs to implement the technical solutions provided by the embodiments of this specification.

[0212] The memory 820 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage devices, dynamic storage devices, etc. The memory 820 can store an operating system and other application programs. When implementing the technical solutions provided in the embodiments of this specification through software or firmware, the relevant program codes are stored in the memory 820 and called and executed by the processor 810.

[0213] The input / output interface 830 is used to connect to the input / output module to achieve information input and output. The input / output module can be configured as a component in the device (not shown in the figure) or externally connected to the device to provide corresponding functions. The input devices can include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output devices can include a display, a speaker, a vibrator, an indicator light, etc.

[0214] The communication interface 840 is used to connect to a communication module (not shown in the figure) to achieve communication and interaction between this device and other devices. The communication module can communicate through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0215] The bus 850 includes a path for transmitting information between various components of the device (such as the processor 810, the memory 820, the input / output interface 830, and the communication interface 840).

[0216] It should be noted that although the above device only shows the processor 810, the memory 820, the input / output interface 830, the communication interface 840, and the bus 850, in the specific implementation process, this device may also include other components necessary for normal operation. In addition, those skilled in the art can understand that the above device may also only include the components necessary to implement the solutions of the embodiments of this specification and do not have to include all the components shown in the figure.

[0217] The electronic device in the above embodiments is used to implement the real-time rendering method of the corresponding target object in any of the foregoing embodiments and has the beneficial effects of the corresponding method embodiments, which will not be elaborated here.

[0218] Based on the same inventive concept, corresponding to the method in any of the above embodiments, the present application also provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the real-time rendering method of the target object as described in any one of the above embodiments.

[0219] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. The 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 technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible by a computing device.

[0220] The computer instructions stored in the storage medium of the above embodiment are used to cause the computer to execute the real-time rendering method of the target object described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be elaborated here.

[0221] Those of ordinary skill in the art should understand that the discussion of any of the above embodiments is only exemplary and is not intended to imply that the scope of the present application (including the claims) is limited to these examples; under the concept of the present application, the technical features in the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations in different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of brevity.

[0222] In addition, for the sake of simplicity of description and discussion, and in order not to make the embodiments of the present application difficult to understand, the well-known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided drawings. In addition, the device may be shown in block diagram form to avoid making the embodiments of the present application difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform on which the embodiments of the present application are to be implemented (i.e., these details should be fully within the understanding of those skilled in the art). In the case where specific details (such as circuits) are set forth to describe the exemplary embodiments of the present application, it will be apparent to those skilled in the art that the embodiments of the present application can be implemented without these specific details or with variations of these specific details. Therefore, these descriptions should be considered illustrative rather than restrictive.

[0223] Although the present application has been described in connection with specific embodiments thereof, many alternatives, modifications, and variations of these embodiments will be apparent to those of ordinary skill in the art in light of the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may be used with the embodiments discussed.

[0224] Embodiments of the present application are intended to cover all such alternatives, modifications, and variations that fall within the broad scope of the appended claims. Accordingly, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the embodiments of the present application shall be included within the protection scope of the present application.

Claims

1. A real-time rendering method for a target object, characterized in that, Including: Determine multiple pre-baking parameter groups according to multiple pre-acquired environmental parameters; wherein, the multiple pre-baking parameter groups are determined by the acquired lighting equation; the lighting equation further includes: obtaining the change amount of light energy; performing integral processing on the change amount of light energy to determine the light intensity received by the vision camera; determining the first scattering contribution of direct light according to the scattering attenuation amount of light from the light source to the target point, the phase function, the scattering coefficient, and the scattering attenuation amount from the target point to the position of the vision camera; determining the second scattering contribution of ambient light according to the indirect ambient light intensity of the skybox and the scattering attenuation amount from the volume cloud to the target point; determining the lighting equation according to the first scattering contribution and the second scattering contribution; Use a baking component to bake the multiple pre-baking parameter groups to determine multiple texture maps; In response to matching the target environmental parameter corresponding to the current scene among the multiple environmental parameters, determine the lighting result according to the texture map corresponding to the target environmental parameter; Render the target object in the current scene in real time according to the lighting result.

2. The method according to claim 1, wherein The environmental parameters include: time parameters and weather parameters; The determining multiple pre-baking parameter groups according to multiple pre-acquired environmental parameters further includes: Obtain multiple time parameters and multiple weather parameters; Mix each time parameter and each weather parameter respectively to determine multiple texture sets; Determine the pre-baking parameter group corresponding to each texture set according to the lighting equation to obtain multiple pre-baking parameter groups.

3. The method according to claim 2, wherein The pre-baking parameter group includes: scattering parameters and penetration rate parameters; The determining the pre-baking parameter group corresponding to each texture set according to the lighting equation to obtain multiple pre-baking parameter groups further includes: Analyze each texture set according to the lighting equation to determine the scattering parameters and the penetration rate parameters corresponding to each texture set; Determine multiple pre-baking parameter groups according to the scattering parameters and the penetration rate parameters corresponding to each texture set.

4. The method according to claim 3, wherein After using the baking component to bake the multiple pre-baking parameter groups to determine multiple texture maps, it further includes: Obtain the scaling factor of the scattering parameter in each texture map; Adjust the scattering parameter according to the scaling factor to convert each texture map into a true color map.

5. The method according to claim 1, wherein The environmental parameters include: time parameters and weather parameters; the texture map includes: multiple storage channels; After using the baking component to bake the multiple pre-baking parameter groups to determine multiple texture maps, it further includes: Group all texture maps according to the weather parameters to determine multiple texture map groups; wherein, the weather parameters corresponding to each texture map in each texture map group are the same; Sort each texture map in each texture map group in chronological order according to the time parameter; For each texture map in each texture map group, Store the pre-baking parameter group corresponding to the texture map in any one of the storage channels, Store the pre-baking parameters corresponding to the texture map in the next time order in any one of the remaining storage channels.

6. The method according to claim 5, wherein The target environmental parameters include: target weather parameters and target time parameters; Determining the lighting result according to the texture map corresponding to the target environmental parameters further includes: Determining whether there is a weather parameter corresponding to the target weather parameter among all the weather parameters; In response to the existence of a weather parameter corresponding to the target weather parameter, selecting all the texture maps corresponding to the target weather parameter to determine a first candidate texture map group; Determining whether there is a time parameter corresponding to the target time parameter in the first candidate texture map group; In response to the existence of a time parameter corresponding to the target time parameter, determining the lighting result according to the texture map corresponding to the target time parameter.

7. The method according to claim 6, characterized in that After determining whether there is a weather parameter corresponding to the target weather parameter among all the weather parameters, it further includes: In response to the non-existence of a weather parameter corresponding to the target weather parameter, determining two weather parameters to be mixed according to the target weather parameter among all the weather parameters; Respectively determining a second candidate texture map group and a third candidate texture map group according to all the texture maps corresponding to the two weather parameters to be mixed; Determining whether there is a time parameter corresponding to the target time parameter in the second candidate texture map group and the third candidate texture map group; In response to the existence of a time parameter corresponding to the target time parameter, mixing all the texture maps corresponding to the target time parameter to determine the lighting result.

8. The method according to claim 6, wherein After determining whether there is a time parameter the same as the target time parameter in the first candidate texture map group, it further includes: In response to the non-existence of a time parameter the same as the target time parameter, determining two time parameters corresponding to the time interval including the target time parameter; In the first candidate texture map group, selecting the texture maps corresponding to the two time parameters; Determining the lighting result according to the texture maps.

9. The method according to claim 7, wherein After determining whether there is a time parameter the same as the target time parameter in the second candidate texture map group and the third candidate texture map group, it further includes: In response to the non-existence of a time parameter the same as the target time parameter, determining two time parameters corresponding to the time interval including the target time parameter; Respectively selecting all the texture maps corresponding to the two time parameters in the second candidate texture map group and the third candidate texture map group; Determining the lighting result according to all the texture maps.

10. A real-time rendering device for a target object, characterized in that, Includes: A first determination module, configured to determine a plurality of pre-baking parameter groups according to a plurality of pre-acquired environmental parameters; wherein, the plurality of pre-baking parameter groups are determined by an acquired light equation; the light equation further includes: acquiring a change amount of light energy; performing an integration process on the change amount of light energy to determine the light intensity received by a vision camera; determining a first scattering contribution of direct light according to a scattering attenuation amount from a light ray to a target point, a phase function, a scattering coefficient, and a scattering attenuation amount from the target point to the position of the vision camera; determining a second scattering contribution of ambient light according to an indirect ambient light intensity of a skybox and a scattering attenuation amount from a volume cloud to the target point; determining the light equation according to the first scattering contribution and the second scattering contribution; A second determination module, configured to bake the plurality of pre-baking parameter groups by using a baking component to determine a plurality of texture maps; A third determination module, configured to, in response to matching a target environmental parameter corresponding to a current scene among the plurality of environmental parameters, determine a lighting result according to the texture map corresponding to the target environmental parameter; A rendering module, configured to render a target object in the current scene in real time according to the lighting result.

11. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the program, the method according to any one of claims 1 to 9 is implemented.

12. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to implement the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Method and system for switching baking data in real time based on illumination environment

    CN113694516A