Smoke rendering method, device, electronic device and storage medium

By obtaining and applying light and shadow control parameters to render the smoke model, the problem of lack of light and dark changes in volumetric fog in the lighting direction is solved, and the volume and light and shadow expressiveness of the smoke are improved.

CN115082606BActive Publication Date: 2025-09-30NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210573711.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-24
Publication Date
2025-09-30
Estimated Expiration
2042-05-24

AI Technical Summary

Technical Problem

The existing volumetric fog production principle results in a lack of changes in the light and dark relationship of the smoke in the lighting direction, and the sense of volume and light and shadow are not obvious.

Method used

By obtaining a smoke model with a light and shadow control layer, the target light and shadow control parameters are obtained, including the brightness and darkness in each lighting direction, and the smoke model is rendered according to these parameters to generate target smoke that matches the light and shadow control parameters.

Benefits of technology

The richness and diversity of smoke in the lighting direction are improved, and the volume and light and shadow expression of smoke are enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115082606B_ABST
    Figure CN115082606B_ABST
Patent Text Reader

Abstract

The embodiments of the present application disclose a smoke rendering method, device, electronic device, and computer-readable storage medium; the embodiments of the present application can obtain a smoke model to be rendered that carries a target rendering layer, wherein the target rendering layer includes a light and shadow control layer for the smoke model to be rendered; based on the light and shadow control layer of the smoke model to be rendered, target light and shadow control parameters for the smoke model to be rendered are obtained, wherein the target light and shadow control parameters include the degree of brightness in each lighting direction; the smoke model to be rendered is rendered according to the target light and shadow control parameters to obtain target smoke that matches the target light and shadow control parameters. The embodiments of the present application can increase the richness and diversity of smoke in the lighting direction, thereby enhancing the expressiveness of smoke details, volume, and light and shadow.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a smoke rendering method, device, electronic device, and computer-readable storage medium. Background Art

[0002] In virtual scene development, volumetric fog is often used to simulate fog or clouds in real scenes. However, existing volumetric fog production methods rely on particle sheets always facing the camera. This results in uniform lighting and a lack of light and dark variations, leading to a lack of volume and a lack of clear light and shadow effects. Summary of the Invention

[0003] The embodiments of the present application provide a smoke rendering method, device, electronic device and computer-readable storage medium, which can increase the richness and diversity of smoke in the lighting direction, thereby enhancing the expressiveness of the smoke's volume and light and shadow.

[0004] In a first aspect, an embodiment of the present application provides a smoke rendering method, comprising:

[0005] Acquire a smoke model to be rendered that carries a target rendering layer, wherein the target rendering layer includes a light and shadow control layer of the smoke model to be rendered;

[0006] Based on the light and shadow control layer of the smoke model to be rendered, obtaining target light and shadow control parameters of the smoke model to be rendered, wherein the target light and shadow control parameters include brightness and darkness in each lighting direction;

[0007] The smoke model to be rendered is rendered according to the target light and shadow control parameters to obtain target smoke that matches the target light and shadow control parameters.

[0008] In a second aspect, an embodiment of the present application further provides a smoke rendering device, comprising:

[0009] A first acquiring unit is configured to acquire a smoke model to be rendered that carries a target rendering layer, wherein the target rendering layer includes a light and shadow control layer of the smoke model to be rendered;

[0010] A second acquisition unit is configured to acquire target light and shadow control parameters of the smoke model to be rendered based on the light and shadow control layer of the smoke model to be rendered, wherein the target light and shadow control parameters include brightness and darkness in each illumination direction;

[0011] A rendering unit is used to render the smoke model to be rendered according to the target light and shadow control parameters to obtain target smoke that matches the target light and shadow control parameters.

[0012] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a memory storing a plurality of instructions; the processor loads instructions from the memory to execute the steps in any one of the smoke rendering methods provided in the embodiments of the present application.

[0013] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a plurality of instructions, wherein the instructions are suitable for loading by a processor to execute the steps in any one of the smoke rendering methods provided in the embodiment of the present application.

[0014] The embodiment of the present application obtains a smoke model to be rendered that carries a target rendering layer; obtains target light and shadow control parameters of the smoke model to be rendered based on the light and shadow control layer of the smoke model to be rendered; renders the smoke model to be rendered according to the target light and shadow control parameters to obtain target smoke that matches the target light and shadow control parameters; since the target light and shadow control parameters include the brightness and darkness in each lighting direction, they can be used to control the lighting direction and lighting size of the smoke model to be rendered, avoiding the problem of uniform lighting received by the smoke and lack of changes in the light and dark relationship, thereby improving the richness and diversity of the rendered target smoke in the lighting direction, and further enhancing the expressiveness of the smoke's details, sense of volume, and sense of light and shadow. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0016] Figure 1 This is a flow chart of an embodiment of the smoke rendering method provided in the embodiment of the present application;

[0017] Figure 2 This is a flowchart of an embodiment of step 101 provided in the embodiments of the present application;

[0018] Figure 3 3. This is a schematic diagram comparing smoke effects obtained by rendering with and without using target light and shadow control parameters provided in an embodiment of the present application;

[0019] Figure 4 This is another example flow chart of step 101 provided in the embodiments of the present application;

[0020] Figure 5 It is a schematic diagram of the smoke model to be rendered containing multiple frames of smoke;

[0021] Figure 6This is a flowchart of an embodiment of step 103 provided in the embodiments of the present application;

[0022] Figure 7 Schematic diagram of the structure of the smoke rendering device provided in an embodiment of the present application;

[0023] Figure 8 It is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0024] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of this application. At the same time, in the description of the embodiments of the present application, the terms "first", "second", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.

[0025] Embodiments of the present application provide a smoke rendering method, device, electronic device, and computer-readable storage medium.

[0026] Specifically, this embodiment will be described from the perspective of a smoke rendering device. This smoke rendering device can be integrated into an electronic device. That is, the smoke rendering method of the present embodiment can be executed by an electronic device, such as a terminal or a server. The terminal can be a mobile phone, tablet computer, smart Bluetooth device, laptop computer, touch screen, game console, or personal computer (PC); the server can be a single server or a server cluster consisting of multiple servers.

[0027] For example, the electronic device may be a mobile terminal, which may obtain a smoke model to be rendered that carries a target rendering layer through a network, wherein the target rendering layer includes a light and shadow control layer of the smoke model to be rendered; based on the light and shadow control layer of the smoke model to be rendered, obtain target light and shadow control parameters of the smoke model to be rendered, wherein the target light and shadow control parameters include the brightness and darkness in each lighting direction; render the smoke model to be rendered according to the target light and shadow control parameters to obtain target smoke that matches the target light and shadow control parameters.

[0028] In some embodiments, the smoke rendering device can also be integrated into multiple electronic devices. For example, the smoke rendering device can be integrated into multiple servers, and the smoke rendering method of the present application can be implemented by multiple servers. For another example, the smoke rendering device can be integrated into multiple terminals, and the smoke rendering method of the present application can be implemented by multiple terminals.

[0029] In some embodiments, the smoke rendering device can also be integrated into a terminal and server cluster to realize cloud gaming; wherein, the server can render the picture using the smoke rendering method provided by this solution, and send the rendered picture to the terminal through the network to play the rendered picture on the terminal, thereby improving the richness and diversity of the smoke played by the terminal in the lighting direction, and further enhancing the expressiveness of the smoke details, volume and light and shadow.

[0030] In some embodiments, the server can also be implemented in the form of a terminal. For example, a personal computer can be set as a server to integrate the smoke rendering device, and the server configured by the personal computer can implement the smoke rendering method of the present application.

[0031] The following is a detailed description of each embodiment in conjunction with the accompanying drawings. It should be noted that the order in which the following embodiments are described does not limit the preferred order of the embodiments. Although a logical order is shown in the flowcharts, in some cases, the steps shown or described may be performed in an order different from that shown in the drawings.

[0032] like Figure 1 As shown, the specific process of the smoke rendering method can be as follows: Step 101 to Step 103, wherein:

[0033] 101. Obtain a smoke model to be rendered that carries a target rendering layer.

[0034] The smoke model to be rendered is a model of volumetric fog to be rendered.

[0035] The target rendering layer is a layered rendering layer that contains various types of information used to render the smoke model to be rendered (such as basic color, lighting direction, and lighting intensity). The target rendering layer can include the lighting control layer of the smoke model to be rendered (such as the target color channel layer and target velocity channel layer mentioned later), the basic color layer, etc.

[0036] Among them, the light and shadow control layer is a rendering layer used to adjust the brightness and darkness of the smoke model to be rendered in each lighting direction.

[0037] There are many ways to obtain the smoke model to be rendered in step 101, illustratively including:

[0038] (1) The smoke model to be rendered is created in real time using a graphics tool that supports smoke resolution.

[0039] In order to improve the naturalness of the smoke model to be rendered and make it more consistent with the physical properties of smoke, in this embodiment, an image tool that supports smoke calculation is used to create the smoke model to be rendered.

[0040] Graphics tools that support smoke computation are those that create smoke models using physical information such as velocity, density, volume, and shape. For example, Houdini is 3D computer graphics software that is an effective tool for creating advanced visual effects and procedural generation.

[0041] Specifically, depending on the different processing requirements of the smoke model to be rendered, there are multiple ways to create the smoke model to be rendered in real time in step 101, illustratively including:

[0042] 1) The smoke model to be rendered is the volumetric fog obtained by performing physical volumetric smoke calculation using a graphics tool that supports smoke calculation. In this case, step 101 may specifically include steps 1011A to 1012A:

[0043] 1011A. Construct preliminary smoke.

[0044] Among them, preliminary smoke refers to the volumetric fog directly obtained after physical volumetric smoke calculation.

[0045] For example, a solver in Houdini can perform physical volumetric smoke solving based on user input of smoke speed, smoke density, smoke volume, smoke shape, etc. to obtain preliminary smoke. The preliminary smoke obtained by the physical volumetric smoke solving is then directly used as the smoke model to be rendered.

[0046] 1012A. Set a rendering layer for the preliminary smoke, and obtain the preliminary smoke with the set rendering layer as a smoke model to be rendered with a target rendering layer.

[0047] The method of setting the rendering layer for preliminary smoke in step 1012A is similar to that in step 1013B. For details, please refer to the relevant instructions of step 1013B. For simplicity, it will not be repeated here.

[0048] 2) The smoke model to be rendered is the volumetric fog obtained by performing physical volumetric smoke calculation using a graphics tool that supports smoke calculation and optimizing the memory usage. Figure 2 As shown, at this time, step 101 may specifically include steps 1011B to 1013B:

[0049] 1011B. Construct preliminary smoke.

[0050] The implementation of step 1011B is similar to that of the above step 1011A. For details, please refer to the relevant instructions of the above step 1011A, which will not be repeated here.

[0051] 1012B. Optimize the memory occupied by the preliminary smoke to obtain optimized smoke.

[0052] The optimizing the memory occupied by the preliminary smoke includes at least one of resampling the velocity of the preliminary smoke and compressing the volume of the preliminary smoke.

[0053] For example, in step 1012B, the memory occupied by the smoke can be optimized from both the velocity channel and the volume of the smoke: on the one hand, the velocity channel of the preliminary smoke can be downsampled to reduce the velocity information required to be carried by the velocity channel of the preliminary smoke, thereby reducing the memory occupied by the preliminary smoke and achieving the purpose of optimizing the memory occupied by the preliminary smoke; on the other hand, the volume of the preliminary smoke can be compressed to reduce the volume information of the preliminary smoke, thereby reducing the memory occupied by the preliminary smoke and achieving the purpose of optimizing the memory occupied by the preliminary smoke; thereby optimizing the memory occupied by the preliminary smoke to obtain optimized smoke.

[0054] By resampling the velocity channel of the preliminary smoke or compressing its volume, the memory usage of the preliminary smoke can be optimized, significantly reducing the memory required for the smoke model to be rendered. For example, in this embodiment, by simultaneously resampling the velocity channel of the preliminary smoke and compressing its volume, the memory usage of the preliminary smoke before optimization is approximately 80Mb, while the memory usage after optimization is approximately 4Mb. This avoids the problem of the smoke model requiring large memory consumption to be rendered, which hinders the iteration and adaptation of the smoke effect.

[0055] 1013B. Setting a rendering layer for the optimized smoke, obtaining the optimized smoke with the set rendering layer as a smoke model to be rendered with a target rendering layer.

[0056] There are various ways to set the rendering layers depending on the specific forms of expression of the target rendering layers. The following uses the example of the target rendering layers being the target color channel layer, target velocity channel layer, and basic color layer of the smoke model to be rendered to illustrate how to set the rendering layers for the optimized smoke in step 1013B.

[0057] ① The target rendering layer is the target color channel layer of the smoke model to be rendered. At this time, step 1013B may specifically include the following steps A1 to A2, wherein:

[0058] The target color channel layer is a color channel-based rendering layer used to adjust the brightness of the rendered smoke model in various lighting directions. Specifically, the control parameters for each color channel in the target color channel layer are used to adjust the brightness of the rendered smoke model in the corresponding lighting direction for each color channel. The detailed implementation of this will be discussed later and will not be repeated here.

[0059] A1. Obtaining the initial color channel layer of the optimized smoke.

[0060] The initial color channel layer includes a color channel for controlling a first color, a color channel for controlling a second color, and a color channel for controlling a third color.

[0061] The initial color channel layer is used to render the smoke color, for example, the optimized smoke RGB layer. In this case, the color channel controlling the first color, the color channel controlling the second color, and the color channel controlling the third color can be the R, G, and B channels of the RGB layer, respectively. The first, second, and third colors are red, green, and blue, respectively.

[0062] A2. Convert the color channel controlling the first color into a color channel controlling the brightness of the light on the smoke in the first direction, convert the color channel controlling the second color into a color channel controlling the brightness of the light on the smoke in the second direction, and convert the color channel controlling the third color into a color channel controlling the brightness of the light on the smoke in the third direction, to obtain optimized smoke with a target color channel layer set as a smoke model to be rendered that carries the target color channel layer.

[0063] For example, if the initial color channel layer is the RGB layer of the optimized smoke, the color channel of the first color (such as the R channel) can be converted into a color channel that controls the brightness of the light on the smoke in the first direction (such as the positive direction of the X axis in the world space), the color channel of the second color (such as the G channel) can be converted into a color channel that controls the brightness of the light on the smoke in the second direction (such as the positive direction of the Y axis in the world space), and the color channel of the third color (such as the B channel) can be converted into a color channel that controls the brightness of the light on the smoke in the third direction (such as the positive direction of the Z axis in the world space), thereby setting a target color channel layer for the optimized smoke and obtaining the optimized smoke with the target color channel layer set as a smoke model to be rendered that carries the target color channel layer.

[0064] By converting the color channel controlling the first color in the initial color channel layer of the optimized smoke into a color channel controlling the brightness of the light of the smoke in the first direction, converting the color channel controlling the second color into a color channel controlling the brightness of the light of the smoke in the second direction, and converting the color channel controlling the third color into a color channel controlling the brightness of the light of the smoke in the third direction, a smoke model to be rendered with a target color channel layer can be produced, so that the brightness of the light of the smoke in various directions can be adjusted based on the target color channel layer of the smoke model to be rendered (as shown in steps 102 to 103), thereby improving the richness of the light in various directions of the rendered target smoke, and to a certain extent improving the details, volume and light and shadow expressiveness of the smoke.

[0065] ② The target rendering layer is the target velocity channel layer of the smoke model to be rendered. At this time, step 1013B may specifically include the following steps B1 to B2, wherein:

[0066] The target velocity channel layer is a rendering layer based on the velocity channel, used to adjust the brightness of the rendered smoke model in various lighting directions. Specifically, the control parameters of each velocity channel in the target velocity channel layer are used to adjust the brightness of the rendered smoke model in the corresponding lighting direction for each velocity channel. The specific implementation will be detailed later and will not be repeated here.

[0067] B1. Obtaining the initial velocity channel layer of the optimized smoke.

[0068] The initial speed channel layer includes a speed channel for controlling the speed of smoke moving in a fourth direction, a speed channel for controlling the speed of smoke moving in a fifth direction, and a speed channel for controlling the speed of smoke moving in a sixth direction.

[0069] The initial velocity channel layer is a rendering layer used to record smoke velocity information, such as the optimized Vel layer of the smoke. At this point, the velocity channel controlling the smoke's speed in the fourth direction, the velocity channel controlling the smoke's speed in the fifth direction, and the velocity channel controlling the smoke's speed in the sixth direction can be the negative X-axis velocity channel, the negative Y-axis velocity channel, and the negative Z-axis velocity channel in the Vel layer, respectively. The fourth, fifth, and sixth directions are the negative X-axis, negative Y-axis, and negative Z-axis directions, respectively.

[0070] B2. Convert the speed channel that controls the speed of smoke moving in the fourth direction into a speed channel that controls the brightness of light in the fourth direction, convert the speed channel that controls the speed of smoke moving in the fifth direction into a speed channel that controls the brightness of light in the fifth direction, and convert the speed channel that controls the speed of smoke moving in the sixth direction into a speed channel that controls the brightness of light in the sixth direction, to obtain optimized smoke with a target speed channel layer set as a smoke model to be rendered that carries the target speed channel layer.

[0071] For example, if the initial velocity channel layer is the Vel layer of the optimized smoke, the velocity channel that controls the speed of the smoke in the fourth direction (such as the negative velocity channel of the X-axis) can be converted into a velocity channel that controls the brightness of the light of the smoke in the fourth direction (such as the negative velocity channel of the X-axis in the world space), the velocity channel that controls the speed of the smoke in the fifth direction (such as the negative velocity channel of the Y-axis) can be converted into a velocity channel that controls the brightness of the light of the smoke in the fifth direction (such as the negative velocity channel of the Y-axis in the world space), and the velocity channel that controls the speed of the smoke in the sixth direction (such as the negative velocity channel of the Z-axis) can be converted into a velocity channel that controls the brightness of the light of the smoke in the sixth direction (such as the negative velocity channel of the Z-axis in the world space), thereby setting a target velocity channel layer for the optimized smoke and obtaining the optimized smoke with the target velocity channel layer set as a smoke model to be rendered that carries the target velocity channel layer.

[0072] By converting the speed channel that controls the speed of smoke in the fourth direction in the initial speed channel layer of the optimized smoke into a speed channel that controls the brightness of light in the fourth direction, converting the speed channel that controls the speed of smoke in the fifth direction into a speed channel that controls the brightness of light in the fifth direction, and converting the speed channel that controls the speed of smoke in the sixth direction into a speed channel that controls the brightness of light in the sixth direction, a smoke model to be rendered with a target speed channel layer can be produced, so that the brightness of light in various directions of the smoke can be adjusted based on the target speed channel layer of the smoke model to be rendered subsequently (as shown in steps 102 to 103), thereby improving the richness of light in various directions of the produced target smoke, and to a certain extent improving the expressiveness of the smoke's details, sense of volume, and sense of light and shadow.

[0073] like Figure 3 As shown, Figure 3 : is a schematic diagram comparing the smoke effects obtained by rendering with and without using the target light and shadow control parameters provided in the embodiment of the present application. Figure 3 The diagram on the left shows the smoke rendered without using the target light and shadow control parameters. Figure 3The diagram on the middle right shows the smoke rendered using the target light and shadow control parameters. It can be clearly seen that the smoke rendered using the target light and shadow control parameters has richer lighting in all directions, and the smoke has better details, volume, and light and shadow expression.

[0074] ③ The target rendering layer is the basic color layer of the smoke model to be rendered. In this case, step 1013B may specifically include obtaining the basic color layer (e.g., the diffuse layer) of the optimized smoke, saving the basic color layer for the optimized smoke, and obtaining the optimized smoke with the basic color layer set as the smoke model to be rendered with the basic color layer. The basic color layer (diffuse layer) is used to adjust the basic color information of the smoke.

[0075] 3) The smoke model to be rendered is the volumetric fog obtained by performing physical volumetric smoke calculation using a graphics tool that supports smoke calculation and performing loop transition settings. Figure 4 As shown, at this time, step 101 may specifically include steps 1011C to 1013C:

[0076] 1011C. Construct preliminary smoke.

[0077] The implementation of step 1011C is similar to the implementation of the above step 1011A. For details, please refer to the relevant instructions of the above step 1011A, which will not be repeated here.

[0078] 1012C. Perform cyclic transition setting on the preliminary smoke to obtain cyclically set smoke.

[0079] The cyclic setting of the preliminary smoke includes at least one of cyclic transition setting of the density of the preliminary smoke and cyclic transition setting of the shape of the preliminary smoke.

[0080] The initial smoke is dynamic smoke, that is, the initial smoke includes multiple frames of smoke; for example, the initial smoke is 2-second dynamic smoke, and the 2-second dynamic smoke includes 36 frames of smoke.

[0081] In this embodiment, the purpose of setting the preliminary smoke to be cyclically transitioned is to visually merge and transition the circulating multiple frames of smoke, so that the circulation of the multiple frames of smoke is smoother and the circulation can be seamlessly realized visually.

[0082] Taking the cyclic transition setting of the density of the preliminary smoke as an example, illustratively, the cyclic transition setting of the density of the preliminary smoke can be achieved by interpolation. For example, in Houdini, first, the density of the preliminary smoke is set using the Fit function; then, the density of the initial smoke is set using the Pow function. Among them, the Fit function is an adaptation function, which is used to re-normalize (i.e., adjust) the density range of the preliminary smoke so that the overall density difference of the preliminary smoke is relatively small, so that the cycle of the smoke is softer and smoother. The Pow function is used to adjust the edge of the preliminary smoke to gradually appear during the cycle. By giving the Pow function K frames, the thinner part of the edge of the initial smoke is removed and gradually appears during the cycle, so that the cycle of the smoke is softer and smoother.

[0083] Since the smoke in actual scenes generally has a relatively high density at the center and a relatively low density at the edge, by first setting the density of the initial smoke with the Fit function and then using the Pow function to set the density of the initial smoke, on the one hand, the density difference between the center point density and the edge point density of the initial smoke can be reduced, so that the overall initial smoke density change is smaller; on the other hand, the edge of the initial smoke is gradually changed from nothing to something and from something to nothing, so that the initial smoke cycle is smoother and softer; and then when the smoke frames in the initial smoke circulate (for example, the smoke from the first frame to the lowest 36 frames in a 2-second dynamic smoke circulates), it is softer and smoother, and the seamless circulation of the smoke can be achieved visually; thereby making the target smoke cycle obtained in the subsequent production smoother, and the seamless circulation of the smoke can be achieved visually.

[0084] Taking the cyclic transition setting of the shape of the preliminary smoke as an example, illustratively, the cyclic transition setting of the shape of the preliminary smoke can be achieved by interpolation. For example, in Houdini, first, the shape of the preliminary smoke is set using the Fit function; then, the shape of the initial smoke is set using the Pow function. Among them, the Fit function is an adaptation function, which is used to re-standardize (i.e., adjust) the shape range of the preliminary smoke so that the overall shape difference of the preliminary smoke is relatively small, so that the cycle process of the smoke is softer and smoother. The Pow function is used to adjust the edge of the preliminary smoke to gradually appear during the cycle. By giving the Pow function K frames, the thinner part of the edge of the initial smoke is removed and gradually appears during the cycle, so that the cycle process of the smoke is softer and smoother.

[0085] By first using the Fit function to set the shape of the preliminary smoke and then using the Pow function to set the shape of the initial smoke, on the one hand, the shape difference between the center point shape and the edge point shape of the initial smoke can be reduced, so that the overall initial smoke shape change is smaller; on the other hand, the edge of the initial smoke is gradually changed from nothing to something and from something to nothing, so that the initial smoke cycle is smoother and softer; and then, when the smoke frames in the initial smoke circulate (for example, the smoke from the first frame to the lowest 36 frames in a 2-second dynamic smoke circulates), it is softer and smoother, and the seamless circulation flow of the smoke can be achieved visually; thereby, the target smoke cycle obtained in the subsequent production is smoother, and the seamless circulation flow of the smoke can be achieved visually.

[0086] 1013C. Set a rendering layer for the post-loop setting smoke, and obtain the post-loop setting smoke with the set rendering layer as a smoke model to be rendered that carries a target rendering layer.

[0087] Step 1013C is similar to step 1013B in that the method of setting the rendering layer of the smoke after loop setting is similar to step 1013B. For details, please refer to the relevant instructions of step 1013B. For the sake of simplicity, it will not be repeated here.

[0088] like Figure 5 As shown, Figure 5 This is a schematic diagram of a smoke model to be rendered that includes multiple frames of smoke. Corresponding to the initial smoke model that includes multiple frames of smoke, the smoke model to be rendered prepared in step 1013C also includes multiple frames of smoke. For example, the image size and format of each frame of smoke (e.g., each frame of a 2-second smoke sequence containing 36 frames) can be set in a graphics tool that supports smoke processing (e.g., Houdini). The multiple frames of smoke can then be merged into a single image to form a merged rendering sequence, which is then output as the smoke model to be rendered.

[0089] 4) The smoke model to be rendered is the volumetric fog obtained after performing physical volumetric smoke calculation, memory optimization, and loop transition settings using a graphics tool that supports smoke calculation. In this case, step 101 may specifically include steps 1011D to 1014D:

[0090] 1011D. Construct preliminary smoke.

[0091] The implementation of step 1011D is similar to that of the above step 1011A. For details, please refer to the relevant instructions of the above step 1011A, which will not be repeated here.

[0092] 1012D. Optimize the memory occupied by the preliminary smoke to obtain optimized smoke.

[0093] The optimizing the memory occupied by the preliminary smoke includes at least one of resampling a velocity channel of the preliminary smoke and compressing a volume of the preliminary smoke.

[0094] The implementation of step 1012D is similar to the implementation of the above step 1012B. For details, please refer to the relevant instructions of the above step 1012B, which will not be repeated here.

[0095] 1013D. Perform cyclic transition setting on the optimized smoke to obtain cyclically set smoke.

[0096] The cyclic setting of the preliminary smoke includes at least one of cyclic transition setting of the density of the preliminary smoke and cyclic transition setting of the shape of the preliminary smoke.

[0097] The implementation of step 1013D is similar to the implementation of the above step 1012C. For details, please refer to the relevant instructions of the above step 1012C, which will not be repeated here.

[0098] 1014D. Set a rendering layer for the post-loop setting smoke, and obtain the post-loop setting smoke with the set rendering layer as a smoke model to be rendered that carries a target rendering layer.

[0099] Step 1014D is similar to step 1013B in that the method of setting the rendering layer of the smoke after loop setting is similar to step 1013B. For details, please refer to the relevant instructions of step 1013B. For the sake of simplicity, it will not be repeated here.

[0100] Steps 1011D to 1014D illustrate the process of creating a smoke model to be rendered in a graphics tool that supports smoke rendering, using the example of sequentially optimizing smoke memory usage and setting a cyclic transition for the smoke. In practice, step 1012D can be performed first to optimize smoke memory usage, followed by step 1013D to set a cyclic transition for the smoke; alternatively, step 1013D can be performed first to set a cyclic transition for the smoke, followed by step 1012D to optimize smoke memory usage; or, alternatively, step 1012D can be performed in parallel to optimize smoke memory usage and set a cyclic transition for the smoke.

[0101] (2) The smoke model to be rendered is created in real time using a graphics tool that supports rendering functions.

[0102] Among them, the graphics tool that supports the rendering function can be, for example, the game engine UE4.

[0103] Specifically, you can refer to the method in (1) above, first create volumetric fog through a graphics tool that supports rendering functions, and then set a target rendering layer for the volumetric fog (such as a target color channel layer, a target speed channel layer, a basic color layer, etc.), so as to obtain a smoke model to be rendered with a target rendering layer.

[0104] (3) Referring to the method of creating a smoke model to be rendered in real time in (1) or (2) above, the smoke model to be rendered is created in advance using a graphics tool that supports smoke solution and stored in a preset database. In step 101, the smoke model to be rendered is directly read from the preset database.

[0105] 102. Based on the light and shadow control layer of the smoke model to be rendered, obtain target light and shadow control parameters of the smoke model to be rendered.

[0106] The target light and shadow control parameters include the brightness and darkness in each lighting direction.

[0107] The target light and shadow control parameters are parameters used to control the illumination direction and illumination size of the smoke model to be rendered.

[0108] There are many ways to obtain the target light and shadow control parameters of the smoke model to be rendered, for example, recording through the target color channel layer (such as RGB layer) of the smoke model to be rendered, and recording through the target velocity channel layer (such as Vel layer) of the smoke model to be rendered.

[0109] The following examples illustrate how the target light and shadow control parameters are obtained by recording the target color channel layer (such as RGB layer) and the target velocity channel layer (such as Vel layer) of the smoke model to be rendered.

[0110] ① The target light and shadow control parameters are recorded through the target color channel layer of the smoke model to be rendered, that is, the target light and shadow control parameters are the first light and shadow control parameters recorded based on the target color channel layer.

[0111] Among them, the first light and shadow control parameter specifically refers to: the brightness of the light of the smoke in the first direction (such as the positive direction of the X axis in the world space), the brightness of the light in the second direction (such as the positive direction of the Y axis in the world space), and the brightness of the light in the third direction (such as the positive direction of the Z axis in the world space).

[0112] In this case, step 102 may specifically include receiving a control parameter for each color channel input based on the target color channel layer as the first light and shadow control parameter. The control parameter for each color channel in the target color channel layer is used to adjust the brightness of the smoke model to be rendered in the lighting direction corresponding to each color channel.

[0113] For example, if the target color channel layer is the RGB layer of the smoke model to be rendered, the color channel that controls the brightness of the smoke in the first direction, the color channel that controls the brightness of the smoke in the second direction, and the color channel that controls the brightness of the smoke in the third direction are respectively: R channel, G channel, and B channel. In step 102, the default value or user-input value of the R channel can be directly obtained based on the material ball in UE4 as the brightness of the smoke in the first direction; the default value or user-input value of the G channel can be obtained as the brightness of the smoke in the second direction; and the default value or user-input value of the B channel can be obtained as the brightness of the smoke in the third direction, thereby obtaining the first light and shadow control information.

[0114] ② The target light and shadow control parameters are recorded through the target velocity channel layer of the smoke model to be rendered, that is, the target light and shadow control parameters are the second light and shadow control parameters recorded based on the target velocity channel layer.

[0115] Among them, the second light and shadow control parameter specifically refers to: the brightness of the light of the smoke in the fourth direction (such as the negative direction of the X axis in the world space), the brightness of the light in the fifth direction (such as the negative direction of the Y axis in the world space), and the brightness of the light in the sixth direction (such as the negative direction of the Z axis in the world space).

[0116] In this case, step 102 may specifically include receiving a control parameter for each velocity channel input based on the target velocity channel layer as the second light and shadow control parameter. The control parameter for each velocity channel in the target velocity channel layer is used to adjust the brightness of the smoke model to be rendered in the lighting direction corresponding to each velocity channel.

[0117] For example, if the target velocity channel layer is the Vel layer of the smoke model to be rendered, the velocity channel controlling the brightness of the smoke in the fourth direction, the velocity channel controlling the brightness of the smoke in the fifth direction, and the velocity channel controlling the brightness of the smoke in the sixth direction are respectively the negative X-axis velocity channel, the negative Y-axis velocity channel, and the negative Z-axis velocity channel. In step 102, the default value or user-input value of the negative X-axis velocity channel can be directly obtained as the brightness of the smoke in the fourth direction; the default value or user-input value of the negative Y-axis velocity channel can be obtained as the brightness of the smoke in the fifth direction; and the default value or user-input value of the negative Z-axis velocity channel can be obtained as the brightness of the smoke in the sixth direction, thereby obtaining the second light and shadow control information.

[0118] 103. Generate target smoke that matches the target light and shadow control parameters according to the target light and shadow control parameters and the smoke model to be rendered.

[0119] As the target smoke style is different, the information required for rendering the target smoke is also different. In step 103, there are many ways to generate the target smoke, illustratively including:

[0120] (1) Target smoke is rendered based on target light and shadow control parameters.

[0121] Case ①: The target light and shadow control parameters are first light and shadow control parameters recorded based on the target color channel layer. In this case, step 103 may specifically include step 1031A: rendering the smoke model to be rendered according to the first light and shadow control parameters to obtain the target smoke.

[0122] For example, according to the brightness of the light on the smoke in the first direction (such as the positive direction of the X axis in the world space), the brightness of the light in the second direction (such as the positive direction of the Y axis in the world space), and the brightness of the light in the third direction (such as the positive direction of the Z axis in the world space) obtained in step 102, the lighting information of the smoke model to be rendered in the first direction, the second direction, and the third direction are set respectively.

[0123] Case ②: The target light and shadow control parameter is a second light and shadow control parameter recorded based on the target velocity channel layer. In this case, step 103 may specifically include step 1031B: rendering the smoke model to be rendered according to the second light and shadow control parameter to obtain the target smoke.

[0124] For example, according to the brightness of the light on the smoke in the fourth direction (such as the negative direction of the X axis in the world space), the brightness of the light in the fifth direction (such as the negative direction of the Y axis in the world space), and the brightness of the light in the sixth direction (such as the negative direction of the Z axis in the world space) obtained in step 102, the lighting information of the smoke model to be rendered in the fifth direction, the sixth direction, and the seventh direction are set respectively.

[0125] (2) Target smoke depends on target light and shadow control parameters and target smoke type rendering. Figure 6 As shown, at this time, step 103 may specifically include the following steps 1031C to 1032C, wherein:

[0126] 1031C. Based on a preset particle system, obtain a target smoke type of the smoke model to be rendered.

[0127] Among them, the preset particle system is a parameter control system used to create dynamic smoke, for example, the particle system in UE4.

[0128] The target smoke type is the type of smoke to be generated, such as ambient smoke, explosion smoke, etc.

[0129] For example, the target smoke type of the smoke model to be rendered can be set through the particle system in UE4, for example, it can be set to ambient smoke or explosion smoke.

[0130] 1032C. Render the smoke model to be rendered according to the target light and shadow control parameters and the smoke model to be rendered to obtain target smoke that matches the target light and shadow control parameters and the target smoke type.

[0131] For example, first, the smoke model to be rendered can be rendered using the target light and shadow control parameters to obtain intermediate smoke that matches the target light and shadow control parameters; then, the intermediate smoke is rendered based on the target smoke type to obtain smoke that matches the target smoke type, thereby obtaining target smoke that matches both the target light and shadow control parameters and the target smoke type.

[0132] (3) The target smoke depends on the target light and shadow control parameters and the target basic color rendering. At this time, step 103 may specifically include the following steps 1031D to 1032D, wherein:

[0133] 1031D. Based on the basic color layer of the smoke model to be rendered, obtain a target basic color of the smoke model to be rendered.

[0134] Exemplarily, the default value or user input value of the basic color layer of the smoke model to be rendered can be directly obtained based on the material ball in UE4 as the target basic color of the smoke model to be rendered.

[0135] 1032D. Render the smoke model to be rendered according to the target light and shadow control parameters and the smoke model to be rendered to obtain the target smoke that matches the target light and shadow control parameters and the target smoke type.

[0136] For example, first, the smoke model to be rendered can be rendered with the target light and shadow control parameters to obtain intermediate smoke that matches the target light and shadow control parameters; then, the intermediate smoke is rendered based on the target basic color to obtain smoke that matches the target basic color, thereby obtaining target smoke that matches both the target light and shadow control parameters and the target basic color.

[0137] The above examples illustrate target smoke rendering methods by using target lighting and shadow control parameters, target lighting and shadow control parameters and target smoke type, and target lighting and shadow control parameters and target basic color. In practice, target smoke can also be rendered by rendering the smoke model to be rendered based on one or more of the target lighting and shadow control parameters, target smoke type, and target basic color.

[0138] Furthermore, in step 103, when rendering the smoke model to be rendered according to the target light and shadow control parameters, the first light and shadow control parameters recorded in the target color channel layer and the second light and shadow control parameters recorded in the target speed channel layer can be combined simultaneously to improve the richness and diversity of the lighting direction of the rendered smoke, thereby enhancing the expressiveness of the smoke's details, volume, and light and shadow.

[0139] From the above content, it can be seen that in the embodiment of the present application, a smoke model to be rendered carrying a target rendering layer is obtained; based on the light and shadow control layer of the smoke model to be rendered, the target light and shadow control parameters of the smoke model to be rendered are obtained; the smoke model to be rendered is rendered according to the target light and shadow control parameters to obtain target smoke that matches the target light and shadow control parameters; since the target light and shadow control parameters include the brightness and darkness in each lighting direction, they can be used to control the lighting direction and lighting size of the smoke model to be rendered, avoiding the problem of uniform lighting received by the smoke and lack of changes in the light and dark relationship, thereby improving the richness and diversity of the rendered target smoke in the lighting direction, and then enhancing the expressiveness of the smoke's details, sense of volume and sense of light and shadow.

[0140] In order to better implement the above method, an embodiment of the present application further provides a smoke rendering device, which can be integrated into an electronic device, such as a computer device, which can be a terminal, server, or other device.

[0141] Among them, the terminal can be a mobile phone, a tablet computer, a smart Bluetooth device, a laptop computer, a personal computer and other devices; the server can be a single server or a server cluster composed of multiple servers.

[0142] For example, in this embodiment, the method of the embodiment of the present application will be described in detail by taking the smoke rendering device specifically integrated into a smartphone as an example.

[0143] For example, Figure 7 As shown, the smoke rendering device may include:

[0144] A first acquiring unit 701 is configured to acquire a smoke model to be rendered that carries a target rendering layer, wherein the target rendering layer includes a light and shadow control layer of the smoke model to be rendered;

[0145] A second acquisition unit 702 is configured to acquire target light and shadow control parameters of the smoke model to be rendered based on the light and shadow control layer of the smoke model to be rendered, wherein the target light and shadow control parameters include brightness and darkness in each lighting direction;

[0146] The rendering unit 703 is configured to render the smoke model to be rendered according to the target light and shadow control parameters to obtain target smoke that matches the target light and shadow control parameters.

[0147] In some embodiments, the light and shadow control layer includes a target color channel layer of the smoke model to be rendered, and the target light and shadow control parameter includes a first light and shadow control parameter recorded based on the target color channel layer; the second acquisition unit 702 is specifically configured to:

[0148] receiving a control parameter of each color channel input based on the target color channel layer as the first light and shadow control parameter, wherein the control parameter of each color channel in the target color channel layer is used to adjust the brightness of the smoke model to be rendered in the lighting direction corresponding to each color channel;

[0149] In some embodiments, the rendering unit 703 is specifically configured to:

[0150] The smoke model to be rendered is rendered according to the first light and shadow control parameters to obtain the target smoke.

[0151] In some embodiments, the light and shadow control layer includes a target velocity channel layer of the smoke model to be rendered, and the target light and shadow control parameter includes a second light and shadow control parameter recorded based on the target velocity channel layer; the second acquisition unit 702 is specifically configured to:

[0152] receiving a control parameter of each speed channel input based on the target speed channel layer as the second light and shadow control parameter, wherein the control parameter of each speed channel in the target speed channel layer is used to adjust the brightness of the smoke model to be rendered in the lighting direction corresponding to each speed channel;

[0153] In some embodiments, the rendering unit 703 is specifically configured to:

[0154] The smoke model to be rendered is rendered according to the second light and shadow control parameters to obtain the target smoke.

[0155] In some embodiments, the first acquiring unit 701 is specifically configured to:

[0156] Constructing preliminary smoke;

[0157] Optimizing the memory occupied by the preliminary smoke to obtain optimized smoke, wherein optimizing the memory occupied by the preliminary smoke comprises at least one of resampling the velocity of the preliminary smoke and compressing the volume of the preliminary smoke;

[0158] A rendering layer is set for the optimized smoke to obtain the optimized smoke with the set rendering layer as a smoke model to be rendered with a target rendering layer.

[0159] In some embodiments, the target rendering layer is the target color channel layer of the smoke model to be rendered, and the first acquiring unit 701 is specifically configured to:

[0160] Acquire an initial color channel layer of the optimized smoke, wherein the initial color channel layer includes a color channel for controlling a first color, a color channel for controlling a second color, and a color channel for controlling a third color;

[0161] The color channel controlling the first color is converted into a color channel controlling the brightness of the light on the smoke in the first direction, the color channel controlling the second color is converted into a color channel controlling the brightness of the light on the smoke in the second direction, and the color channel controlling the third color is converted into a color channel controlling the brightness of the light on the smoke in the third direction, so as to obtain optimized smoke with a target color channel layer set as a smoke model to be rendered that carries the target color channel layer.

[0162] In some embodiments, the target rendering layer is a target velocity channel layer of the smoke model to be rendered, and the first acquiring unit 701 is specifically configured to:

[0163] Obtaining an initial velocity channel layer of the optimized smoke, wherein the initial velocity channel layer includes a velocity channel for controlling the speed of smoke moving in a fourth direction, a velocity channel for controlling the speed of smoke moving in a fifth direction, and a velocity channel for controlling the speed of smoke moving in a sixth direction;

[0164] The speed channel controlling the speed of smoke moving in the fourth direction is converted into a speed channel controlling the brightness of light in the fourth direction, the speed channel controlling the speed of smoke moving in the fifth direction is converted into a speed channel controlling the brightness of light in the fifth direction, and the speed channel controlling the speed of smoke moving in the sixth direction is converted into a speed channel controlling the brightness of light in the sixth direction, so as to obtain optimized smoke with a target speed channel layer set as a smoke model to be rendered carrying the target speed channel layer.

[0165] In some embodiments, the first acquiring unit 701 is specifically configured to:

[0166] Constructing preliminary smoke, wherein the preliminary smoke is dynamic smoke including multiple frames of smoke;

[0167] Performing cyclic transition setting on the preliminary smoke to obtain cyclically set smoke, wherein the cyclic setting on the preliminary smoke includes at least one of performing cyclic transition setting on the density of the preliminary smoke and performing cyclic transition setting on the shape of the preliminary smoke;

[0168] A rendering layer is set for the post-loop setting smoke, and the post-loop setting smoke with the set rendering layer is obtained as a smoke model to be rendered that carries a target rendering layer.

[0169] In some embodiments, the rendering unit 703 is specifically configured to:

[0170] Based on a preset particle system, obtaining a target smoke type of the smoke model to be rendered;

[0171] The smoke model to be rendered is rendered according to the target light and shadow control parameters and the smoke model to be rendered to obtain target smoke that matches the target light and shadow control parameters and the target smoke type.

[0172] In some embodiments, the target rendering layer further includes a basic color layer of a smoke model to be rendered, and the rendering unit 703 is specifically configured to:

[0173] Based on the basic color layer of the smoke model to be rendered, obtaining a target basic color of the smoke model to be rendered;

[0174] The smoke model to be rendered is rendered according to the target light and shadow control parameters and the smoke model to be rendered to obtain the target smoke that matches the target light and shadow control parameters and the target smoke type.

[0175] As can be seen from the above, the smoke rendering device of this embodiment can have a first acquisition unit 701 acquire a smoke model to be rendered that carries a target rendering layer, wherein the target rendering layer includes a light and shadow control layer for the smoke model to be rendered; a second acquisition unit 702 acquires target light and shadow control parameters for the smoke model to be rendered based on the light and shadow control layer for the smoke model to be rendered, wherein the target light and shadow control parameters include the degree of brightness in each lighting direction; and a rendering unit 703 renders the smoke model to be rendered according to the target light and shadow control parameters to obtain target smoke that matches the target light and shadow control parameters. Thus, the smoke rendering device of this embodiment can avoid the problem of uniform illumination received by the smoke and lack of changes in the light and dark relationship, thereby increasing the richness and diversity of the rendered target smoke in the lighting direction, and further enhancing the expressiveness of the smoke's details, sense of volume, and sense of light and shadow.

[0176] Accordingly, the embodiment of the present application also provides an electronic device, which may be a terminal, such as a smart phone, a tablet computer, a laptop computer, a touch screen, a game console, a personal computer (PC), a personal digital assistant (PDA), or other terminal devices. Figure 8 As shown, Figure 8Schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device 800 includes a processor 801 having one or more processing cores, a memory 802 having one or more computer-readable storage media, and a computer program stored in the memory 802 and executable on the processor. The processor 801 is electrically connected to the memory 802. It will be understood by those skilled in the art that the electronic device structure shown in the figure does not constitute a limitation of the electronic device, and may include more or fewer components than shown, or combine certain components, or arrange the components differently.

[0177] The processor 801 is the control center of the electronic device 800. It uses various interfaces and lines to connect various parts of the entire electronic device 800. By running or loading software programs and / or modules stored in the memory 802 and calling data stored in the memory 802, it executes various functions of the electronic device 800 and processes data, thereby monitoring the electronic device 800 as a whole.

[0178] In the embodiment of the present application, the processor 801 in the electronic device 800 loads instructions corresponding to one or more application processes into the memory 802 according to the following steps, and the processor 801 runs the application stored in the memory 802 to implement various functions:

[0179] Acquire a smoke model to be rendered that carries a target rendering layer, wherein the target rendering layer includes a light and shadow control layer of the smoke model to be rendered;

[0180] Based on the light and shadow control layer of the smoke model to be rendered, obtaining target light and shadow control parameters of the smoke model to be rendered, wherein the target light and shadow control parameters include brightness and darkness in each lighting direction;

[0181] The smoke model to be rendered is rendered according to the target light and shadow control parameters to obtain target smoke that matches the target light and shadow control parameters.

[0182] In some embodiments, the light and shadow control layer includes a target color channel layer of the smoke model to be rendered, and the target light and shadow control parameter includes a first light and shadow control parameter recorded based on the target color channel layer;

[0183] The step of obtaining target light and shadow control parameters of the smoke model to be rendered based on the light and shadow control layer of the smoke model to be rendered includes:

[0184] receiving a control parameter of each color channel input based on the target color channel layer as the first light and shadow control parameter, wherein the control parameter of each color channel in the target color channel layer is used to adjust the brightness of the smoke model to be rendered in the lighting direction corresponding to each color channel;

[0185] The step of rendering the smoke model to be rendered according to the target light and shadow control parameters to obtain target smoke that matches the target light and shadow control parameters includes:

[0186] The smoke model to be rendered is rendered according to the first light and shadow control parameters to obtain the target smoke.

[0187] In some embodiments, the light and shadow control layer includes a target velocity channel layer of the smoke model to be rendered, and the target light and shadow control parameter includes a second light and shadow control parameter recorded based on the target velocity channel layer;

[0188] The step of obtaining target light and shadow control parameters of the smoke model to be rendered based on the light and shadow control layer of the smoke model to be rendered includes:

[0189] receiving a control parameter of each speed channel input based on the target speed channel layer as the second light and shadow control parameter, wherein the control parameter of each speed channel in the target speed channel layer is used to adjust the brightness of the smoke model to be rendered in the lighting direction corresponding to each speed channel;

[0190] The step of rendering the smoke model to be rendered according to the target light and shadow control parameters to obtain target smoke that matches the target light and shadow control parameters includes:

[0191] The smoke model to be rendered is rendered according to the second light and shadow control parameters to obtain the target smoke.

[0192] In some embodiments, obtaining a smoke model to be rendered that carries a target rendering layer includes:

[0193] Constructing preliminary smoke;

[0194] Optimizing the memory occupied by the preliminary smoke to obtain optimized smoke, wherein optimizing the memory occupied by the preliminary smoke comprises at least one of resampling the velocity of the preliminary smoke and compressing the volume of the preliminary smoke;

[0195] A rendering layer is set for the optimized smoke to obtain the optimized smoke with the set rendering layer as a smoke model to be rendered with a target rendering layer.

[0196] In some embodiments, the target rendering layer is the target color channel layer of the smoke model to be rendered, and setting a rendering layer for the optimized smoke to obtain the optimized smoke with the set rendering layer as the smoke model to be rendered with the target rendering layer includes:

[0197] Acquire an initial color channel layer of the optimized smoke, wherein the initial color channel layer includes a color channel for controlling a first color, a color channel for controlling a second color, and a color channel for controlling a third color;

[0198] The color channel controlling the first color is converted into a color channel controlling the brightness of the light on the smoke in the first direction, the color channel controlling the second color is converted into a color channel controlling the brightness of the light on the smoke in the second direction, and the color channel controlling the third color is converted into a color channel controlling the brightness of the light on the smoke in the third direction, so as to obtain optimized smoke with a target color channel layer set as a smoke model to be rendered that carries the target color channel layer.

[0199] In some embodiments, the target rendering layer is a target velocity channel layer of the smoke model to be rendered, and setting a rendering layer for the optimized smoke to obtain the optimized smoke having the set rendering layer as the smoke model to be rendered with the target rendering layer includes:

[0200] Obtaining an initial velocity channel layer of the optimized smoke, wherein the initial velocity channel layer includes a velocity channel for controlling the speed of smoke moving in a fourth direction, a velocity channel for controlling the speed of smoke moving in a fifth direction, and a velocity channel for controlling the speed of smoke moving in a sixth direction;

[0201] The speed channel controlling the speed of smoke moving in the fourth direction is converted into a speed channel controlling the brightness of light in the fourth direction, the speed channel controlling the speed of smoke moving in the fifth direction is converted into a speed channel controlling the brightness of light in the fifth direction, and the speed channel controlling the speed of smoke moving in the sixth direction is converted into a speed channel controlling the brightness of light in the sixth direction, so as to obtain optimized smoke with a target speed channel layer set as a smoke model to be rendered carrying the target speed channel layer.

[0202] In some embodiments, obtaining a smoke model to be rendered that carries a target rendering layer includes:

[0203] Constructing preliminary smoke, wherein the preliminary smoke is dynamic smoke including multiple frames of smoke;

[0204] Performing cyclic transition setting on the preliminary smoke to obtain cyclically set smoke, wherein the cyclic setting on the preliminary smoke includes at least one of performing cyclic transition setting on the density of the preliminary smoke and performing cyclic transition setting on the shape of the preliminary smoke;

[0205] A rendering layer is set for the post-loop setting smoke, and the post-loop setting smoke with the set rendering layer is obtained as a smoke model to be rendered that carries a target rendering layer.

[0206] In some embodiments, rendering the smoke model to be rendered according to the target light and shadow control parameters to obtain target smoke that matches the target light and shadow control parameters includes:

[0207] Based on a preset particle system, obtaining a target smoke type of the smoke model to be rendered;

[0208] The smoke model to be rendered is rendered according to the target light and shadow control parameters and the smoke model to be rendered to obtain target smoke that matches the target light and shadow control parameters and the target smoke type.

[0209] In some embodiments, the target rendering layer further includes a basic color layer of a smoke model to be rendered, and rendering the smoke model to be rendered according to the target light and shadow control parameters to obtain target smoke matching the target light and shadow control parameters includes:

[0210] Based on the basic color layer of the smoke model to be rendered, obtaining a target basic color of the smoke model to be rendered;

[0211] The smoke model to be rendered is rendered according to the target light and shadow control parameters and the smoke model to be rendered to obtain the target smoke that matches the target light and shadow control parameters and the target smoke type.

[0212] The specific implementation of the above operations can be found in the previous embodiments and will not be repeated here.

[0213] Optional, such as Figure 8 As shown, the electronic device 800 further includes: a touch screen 803, a radio frequency circuit 804, an audio circuit 805, an input unit 806, and a power supply 807. Among them, the processor 801 is electrically connected to the touch screen 803, the radio frequency circuit 804, the audio circuit 805, the input unit 806, and the power supply 807 respectively. Those skilled in the art will understand that Figure 8 The electronic device structure shown in the figure does not constitute a limitation to the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0214] The touch display screen 803 can be used for displaying a graphical user interface and receiving an operation instruction generated by the user acting on the graphical user interface. The touch display screen 803 can include a display panel and a touch panel. Among them, the display panel can be used for displaying information input by the user or information provided to the user and various graphical user interfaces of the electronic device, and these graphical user interfaces can be composed of graphics, text, icons, videos and any combination thereof. Optionally, the display panel can be configured in the form of a liquid crystal display (LCD), an organic light emitting diode (OLED, Organic Light-Emitting Diode) or the like. The touch panel can be used for collecting the user's touch operation on or near it (such as the user uses any suitable object or accessory such as a finger, a stylus on the touch panel or near the touch panel) and generates corresponding operation instructions, and the operation instructions execute corresponding programs. Optionally, the touch panel may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch direction, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 801, and can receive the command sent by the processor 801 and execute it. The touch panel can cover the display panel. When the touch panel detects a touch operation on or near it, it is transmitted to the processor 801 to determine the type of touch event, and then the processor 801 provides a corresponding visual output on the display panel according to the type of touch event. In an embodiment of the present application, the touch panel and the display panel can be integrated into the touch display screen 803 to realize the input and output functions. However, in some embodiments, the touch panel and the touch panel can be used as two independent components to realize the input and output functions. That is, the touch display screen 803 can also be used as part of the input unit 806 to realize the input function.

[0215] The radio frequency circuit 804 may be used to transmit and receive radio frequency signals, so as to establish wireless communication with a network device or other electronic devices through wireless communication, and to transmit and receive signals with the network device or other electronic devices.

[0216] The audio circuit 805 can be used to provide an audio interface between the user and the electronic device through a speaker and microphone. The audio circuit 805 can convert the received audio data into an electrical signal and transmit it to the speaker, which then converts it into a sound signal for output. On the other hand, the microphone converts the collected sound signal into an electrical signal, which is received by the audio circuit 805 and converted into audio data. The audio data is then output to the processor 801 for processing, and then sent to another electronic device through the radio frequency circuit 804, or the audio data is output to the memory 802 for further processing. The audio circuit 805 may also include an earphone jack to provide communication between external headphones and the electronic device.

[0217] The input unit 806 may be configured to receive input digital, character information, or user feature information (such as fingerprint, iris, or facial information), and to generate keyboard, mouse, joystick, optical, or trackball signal input related to user settings and function control.

[0218] Power supply 807 is used to supply power to various components of electronic device 800. Optionally, power supply 807 can be logically connected to processor 801 via a power management system, thereby enabling the power management system to manage charging, discharging, and power consumption. Power supply 807 can also include one or more DC or AC power supplies, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and other arbitrary components.

[0219] although Figure 8 Not shown in the figure, the electronic device 800 may further include a camera, a sensor, a wireless fidelity module, a Bluetooth module, etc., which will not be described in detail here.

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

[0221] As can be seen from the above, the electronic device provided in this embodiment can obtain a smoke model to be rendered that carries a target rendering layer; based on the light and shadow control layer of the smoke model to be rendered, obtain target light and shadow control parameters for the smoke model to be rendered; and render the smoke model to be rendered according to the target light and shadow control parameters to obtain target smoke that matches the target light and shadow control parameters. Because the target light and shadow control parameters include the degree of brightness and darkness in each lighting direction, they can be used to control the lighting direction and lighting size of the smoke model to be rendered. Therefore, the electronic device provided in this embodiment can avoid the problem of uniform lighting received by the smoke and lack of changes in the light and dark relationship, thereby increasing the richness and diversity of the rendered target smoke in the lighting direction, and further enhancing the expressiveness of the smoke's details, sense of volume, and sense of light and shadow.

[0222] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be accomplished by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0223] To this end, an embodiment of the present application provides a computer-readable storage medium storing a plurality of computer programs, which can be loaded by a processor to execute the steps of any of the smoke rendering methods provided in the embodiments of the present application. For example, the computer program can execute the following steps:

[0224] Acquire a smoke model to be rendered that carries a target rendering layer, wherein the target rendering layer includes a light and shadow control layer of the smoke model to be rendered;

[0225] Based on the light and shadow control layer of the smoke model to be rendered, obtaining target light and shadow control parameters of the smoke model to be rendered, wherein the target light and shadow control parameters include brightness and darkness in each lighting direction;

[0226] The smoke model to be rendered is rendered according to the target light and shadow control parameters to obtain target smoke that matches the target light and shadow control parameters.

[0227] In some embodiments, the light and shadow control layer includes a target color channel layer of the smoke model to be rendered, and the target light and shadow control parameter includes a first light and shadow control parameter recorded based on the target color channel layer;

[0228] The step of obtaining target light and shadow control parameters of the smoke model to be rendered based on the light and shadow control layer of the smoke model to be rendered includes:

[0229] receiving a control parameter of each color channel input based on the target color channel layer as the first light and shadow control parameter, wherein the control parameter of each color channel in the target color channel layer is used to adjust the brightness of the smoke model to be rendered in the lighting direction corresponding to each color channel;

[0230] The step of rendering the smoke model to be rendered according to the target light and shadow control parameters to obtain target smoke that matches the target light and shadow control parameters includes:

[0231] The smoke model to be rendered is rendered according to the first light and shadow control parameters to obtain the target smoke.

[0232] In some embodiments, the light and shadow control layer includes a target velocity channel layer of the smoke model to be rendered, and the target light and shadow control parameter includes a second light and shadow control parameter recorded based on the target velocity channel layer;

[0233] The step of obtaining target light and shadow control parameters of the smoke model to be rendered based on the light and shadow control layer of the smoke model to be rendered includes:

[0234] receiving a control parameter of each speed channel input based on the target speed channel layer as the second light and shadow control parameter, wherein the control parameter of each speed channel in the target speed channel layer is used to adjust the brightness of the smoke model to be rendered in the lighting direction corresponding to each speed channel;

[0235] The step of rendering the smoke model to be rendered according to the target light and shadow control parameters to obtain target smoke that matches the target light and shadow control parameters includes:

[0236] The smoke model to be rendered is rendered according to the second light and shadow control parameters to obtain the target smoke.

[0237] In some embodiments, obtaining a smoke model to be rendered that carries a target rendering layer includes:

[0238] Constructing preliminary smoke;

[0239] Optimizing the memory occupied by the preliminary smoke to obtain optimized smoke, wherein optimizing the memory occupied by the preliminary smoke comprises at least one of resampling the velocity of the preliminary smoke and compressing the volume of the preliminary smoke;

[0240] A rendering layer is set for the optimized smoke to obtain the optimized smoke with the set rendering layer as a smoke model to be rendered with a target rendering layer.

[0241] In some embodiments, the target rendering layer is the target color channel layer of the smoke model to be rendered, and setting a rendering layer for the optimized smoke to obtain the optimized smoke with the set rendering layer as the smoke model to be rendered with the target rendering layer includes:

[0242] Acquire an initial color channel layer of the optimized smoke, wherein the initial color channel layer includes a color channel for controlling a first color, a color channel for controlling a second color, and a color channel for controlling a third color;

[0243] The color channel controlling the first color is converted into a color channel controlling the brightness of the light on the smoke in the first direction, the color channel controlling the second color is converted into a color channel controlling the brightness of the light on the smoke in the second direction, and the color channel controlling the third color is converted into a color channel controlling the brightness of the light on the smoke in the third direction, so as to obtain optimized smoke with a target color channel layer set as a smoke model to be rendered that carries the target color channel layer.

[0244] In some embodiments, the target rendering layer is a target velocity channel layer of the smoke model to be rendered, and setting a rendering layer for the optimized smoke to obtain the optimized smoke having the set rendering layer as the smoke model to be rendered with the target rendering layer includes:

[0245] Obtaining an initial velocity channel layer of the optimized smoke, wherein the initial velocity channel layer includes a velocity channel for controlling the speed of smoke moving in a fourth direction, a velocity channel for controlling the speed of smoke moving in a fifth direction, and a velocity channel for controlling the speed of smoke moving in a sixth direction;

[0246] The speed channel controlling the speed of smoke moving in the fourth direction is converted into a speed channel controlling the brightness of light in the fourth direction, the speed channel controlling the speed of smoke moving in the fifth direction is converted into a speed channel controlling the brightness of light in the fifth direction, and the speed channel controlling the speed of smoke moving in the sixth direction is converted into a speed channel controlling the brightness of light in the sixth direction, so as to obtain optimized smoke with a target speed channel layer set as a smoke model to be rendered carrying the target speed channel layer.

[0247] In some embodiments, obtaining a smoke model to be rendered that carries a target rendering layer includes:

[0248] Constructing preliminary smoke, wherein the preliminary smoke is dynamic smoke including multiple frames of smoke;

[0249] Performing cyclic transition setting on the preliminary smoke to obtain cyclically set smoke, wherein the cyclic setting on the preliminary smoke includes at least one of performing cyclic transition setting on the density of the preliminary smoke and performing cyclic transition setting on the shape of the preliminary smoke;

[0250] A rendering layer is set for the post-loop setting smoke, and the post-loop setting smoke with the set rendering layer is obtained as a smoke model to be rendered that carries a target rendering layer.

[0251] In some embodiments, rendering the smoke model to be rendered according to the target light and shadow control parameters to obtain target smoke that matches the target light and shadow control parameters includes:

[0252] Based on a preset particle system, obtaining a target smoke type of the smoke model to be rendered;

[0253] The smoke model to be rendered is rendered according to the target light and shadow control parameters and the smoke model to be rendered to obtain target smoke that matches the target light and shadow control parameters and the target smoke type.

[0254] In some embodiments, the target rendering layer further includes a basic color layer of a smoke model to be rendered, and rendering the smoke model to be rendered according to the target light and shadow control parameters to obtain target smoke matching the target light and shadow control parameters includes:

[0255] Based on the basic color layer of the smoke model to be rendered, obtaining a target basic color of the smoke model to be rendered;

[0256] The smoke model to be rendered is rendered according to the target light and shadow control parameters and the smoke model to be rendered to obtain the target smoke that matches the target light and shadow control parameters and the target smoke type.

[0257] As can be seen from the above, the computer-readable storage medium provided in this embodiment can be used to obtain a smoke model to be rendered that carries a target rendering layer; obtain target light and shadow control parameters for the smoke model to be rendered based on the light and shadow control layer of the smoke model to be rendered; and render the smoke model to be rendered according to the target light and shadow control parameters to obtain target smoke that matches the target light and shadow control parameters. Because the target light and shadow control parameters include the degree of brightness and darkness in each lighting direction, they can be used to control the lighting direction and brightness of the smoke model to be rendered. Therefore, the computer-readable storage medium provided in this embodiment can avoid the problem of uniform lighting received by the smoke and lack of changes in the light and dark relationship, thereby increasing the richness and diversity of the rendered target smoke in terms of lighting direction, and further enhancing the expressiveness of the smoke's details, sense of volume, and sense of light and shadow.

[0258] The specific implementation of the above operations can be found in the previous embodiments and will not be repeated here.

[0259] The computer-readable storage medium may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0260] Since the computer program stored in the computer-readable storage medium can execute the steps of any of the smoke rendering methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any of the smoke rendering methods provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0261] The above is a detailed introduction to a smoke rendering method, device, electronic device and computer-readable storage medium provided in the embodiments of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core ideas. At the same time, for those skilled in the art, based on the ideas of the present application, there may be changes in the specific implementation methods and application scopes. In summary, the contents of this specification should not be understood as limiting the present application.

Claims

1. A smoke rendering method, characterized in that: include: Acquire a smoke model to be rendered that carries a target rendering layer, wherein the target rendering layer includes a light and shadow control layer of the smoke model to be rendered; Based on the light and shadow control layer of the smoke model to be rendered, obtaining target light and shadow control parameters of the smoke model to be rendered, wherein the target light and shadow control parameters include brightness and darkness in each lighting direction; Rendering the smoke model to be rendered according to the target light and shadow control parameters to obtain target smoke that matches the target light and shadow control parameters; The light and shadow control layer includes a target velocity channel layer of the smoke model to be rendered, and the target light and shadow control parameter includes a second light and shadow control parameter recorded based on the target velocity channel layer; The step of obtaining target light and shadow control parameters of the smoke model to be rendered based on the light and shadow control layer of the smoke model to be rendered includes: receiving a control parameter of each speed channel input based on the target speed channel layer as the second light and shadow control parameter, wherein the control parameter of each speed channel in the target speed channel layer is used to adjust the brightness of the smoke model to be rendered in the lighting direction corresponding to each speed channel; The step of rendering the smoke model to be rendered according to the target light and shadow control parameters to obtain target smoke that matches the target light and shadow control parameters includes: The smoke model to be rendered is rendered according to the second light and shadow control parameters to obtain the target smoke.

2. The smoke rendering method according to claim 1, wherein: The light and shadow control layer includes a target color channel layer of the smoke model to be rendered, and the target light and shadow control parameter includes a first light and shadow control parameter recorded based on the target color channel layer; The step of obtaining target light and shadow control parameters of the smoke model to be rendered based on the light and shadow control layer of the smoke model to be rendered includes: receiving a control parameter of each color channel input based on the target color channel layer as the first light and shadow control parameter, wherein the control parameter of each color channel in the target color channel layer is used to adjust the brightness of the smoke model to be rendered in the lighting direction corresponding to each color channel; The step of rendering the smoke model to be rendered according to the target light and shadow control parameters to obtain target smoke that matches the target light and shadow control parameters includes: The smoke model to be rendered is rendered according to the first light and shadow control parameters to obtain the target smoke.

3. The smoke rendering method according to claim 1, wherein: The step of obtaining a smoke model to be rendered that carries a target rendering layer includes: Constructing preliminary smoke; Optimizing the memory occupied by the preliminary smoke to obtain optimized smoke, wherein optimizing the memory occupied by the preliminary smoke comprises at least one of resampling the velocity of the preliminary smoke and compressing the volume of the preliminary smoke; A rendering layer is set for the optimized smoke to obtain the optimized smoke with the set rendering layer as a smoke model to be rendered with a target rendering layer.

4. The smoke rendering method according to claim 3, wherein: The target rendering layer is the target color channel layer of the smoke model to be rendered, and the rendering layer is set for the optimized smoke. The optimized smoke having the set rendering layer is obtained as the smoke model to be rendered with the target rendering layer, including: Acquire an initial color channel layer of the optimized smoke, wherein the initial color channel layer includes a color channel for controlling a first color, a color channel for controlling a second color, and a color channel for controlling a third color; The color channel controlling the first color is converted into a color channel controlling the brightness of the light on the smoke in the first direction, the color channel controlling the second color is converted into a color channel controlling the brightness of the light on the smoke in the second direction, and the color channel controlling the third color is converted into a color channel controlling the brightness of the light on the smoke in the third direction, so as to obtain optimized smoke with a target color channel layer set as a smoke model to be rendered that carries the target color channel layer.

5. The smoke rendering method according to claim 3, wherein: The target rendering layer is the target velocity channel layer of the smoke model to be rendered, and the rendering layer is set for the optimized smoke. The optimized smoke having the set rendering layer is obtained as the smoke model to be rendered with the target rendering layer, including: Obtaining an initial velocity channel layer of the optimized smoke, wherein the initial velocity channel layer includes a velocity channel for controlling the speed of smoke moving in a fourth direction, a velocity channel for controlling the speed of smoke moving in a fifth direction, and a velocity channel for controlling the speed of smoke moving in a sixth direction; The speed channel controlling the speed of smoke moving in the fourth direction is converted into a speed channel controlling the brightness of light in the fourth direction, the speed channel controlling the speed of smoke moving in the fifth direction is converted into a speed channel controlling the brightness of light in the fifth direction, and the speed channel controlling the speed of smoke moving in the sixth direction is converted into a speed channel controlling the brightness of light in the sixth direction, so as to obtain optimized smoke with a target speed channel layer set as a smoke model to be rendered carrying the target speed channel layer.

6. The smoke rendering method according to claim 1, wherein: The step of obtaining a smoke model to be rendered that carries a target rendering layer includes: Constructing preliminary smoke, wherein the preliminary smoke is dynamic smoke including multiple frames of smoke; Performing cyclic transition setting on the preliminary smoke to obtain cyclically set smoke, wherein the cyclic setting on the preliminary smoke includes at least one of performing cyclic transition setting on the density of the preliminary smoke and performing cyclic transition setting on the shape of the preliminary smoke; A rendering layer is set for the post-loop setting smoke, and the post-loop setting smoke with the set rendering layer is obtained as a smoke model to be rendered that carries a target rendering layer.

7. The smoke rendering method according to any one of claims 1 to 6, characterized in that: The step of rendering the smoke model to be rendered according to the target light and shadow control parameters to obtain target smoke that matches the target light and shadow control parameters includes: Based on a preset particle system, obtaining a target smoke type of the smoke model to be rendered; The smoke model to be rendered is rendered according to the target light and shadow control parameters and the smoke model to be rendered to obtain target smoke that matches the target light and shadow control parameters and the target smoke type.

8. The smoke rendering method according to any one of claims 1 to 6, characterized in that: The target rendering layer further includes a basic color layer of a smoke model to be rendered, and the smoke model to be rendered is rendered according to the target light and shadow control parameters to obtain target smoke that matches the target light and shadow control parameters, including: Based on the basic color layer of the smoke model to be rendered, obtaining a target basic color of the smoke model to be rendered; The smoke model to be rendered is rendered according to the target light and shadow control parameters and the smoke model to be rendered to obtain the target smoke that matches the target light and shadow control parameters and the target smoke type.

9. A smoke rendering device, characterized in that: include: A first acquiring unit is configured to acquire a smoke model to be rendered that carries a target rendering layer, wherein the target rendering layer includes a light and shadow control layer of the smoke model to be rendered; A second acquisition unit is configured to acquire target light and shadow control parameters of the smoke model to be rendered based on the light and shadow control layer of the smoke model to be rendered, wherein the target light and shadow control parameters include brightness and darkness in each illumination direction; a rendering unit, configured to render the smoke model to be rendered according to the target light and shadow control parameters, to obtain target smoke that matches the target light and shadow control parameters; The light and shadow control layer includes a target velocity channel layer of the smoke model to be rendered, and the target light and shadow control parameter includes a second light and shadow control parameter recorded based on the target velocity channel layer; The step of obtaining target light and shadow control parameters of the smoke model to be rendered based on the light and shadow control layer of the smoke model to be rendered includes: receiving a control parameter of each speed channel input based on the target speed channel layer as the second light and shadow control parameter, wherein the control parameter of each speed channel in the target speed channel layer is used to adjust the brightness of the smoke model to be rendered in the lighting direction corresponding to each speed channel; The step of rendering the smoke model to be rendered according to the target light and shadow control parameters to obtain target smoke that matches the target light and shadow control parameters includes: The smoke model to be rendered is rendered according to the second light and shadow control parameters to obtain the target smoke.

10. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a plurality of instructions; the processor loads instructions from the memory to execute the steps in the smoke rendering method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the smoke rendering method according to any one of claims 1 to 8.