Storm special effect generation method and device in virtual scene, equipment and storage medium
By obtaining and processing relevant parameters and simulation results in a virtual scene, combined with volumetric lighting rendering technology, dynamic and real volumetric storm special effects are generated, solving the problem of lack of volumetric storm special effects and performance overhead in the existing technology.
Patent Information
- Application Number
- CN202311271478.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-26
- Publication Date
- 2025-03-28
AI Technical Summary
When generating storm effects in virtual scenes, the static map lacks a sense of volume, and the particle effect performance is expensive and difficult to connect with other cloud layers, resulting in unnatural seams and color faults.
By obtaining selected positions, texture images, range parameters, exponential distribution functions and three-dimensional noise textures in the virtual scene, sampling them with the fluid simulation results, controlling the storm area to enter the rotation state, and volumetric lighting rendering is performed to generate dynamic storm special effects.
It realizes the generation of storm effects with real volume and dynamic effects in virtual scenes, saving performance overhead caused by particle effects, and storm effects can naturally connect with other clouds in the sky.
Smart Images

Figure CN119701331A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and in particular to a method, device, equipment and storage medium for generating storm special effects in a virtual scene. Background Art
[0002] Weather effects are very common in today's games, but most of the weather effects in games are mainly mild weather, such as sunny days, nights, foggy days, etc. At the same time, some extreme weather effects are gradually appearing to provide gamers with more visually impactful performances. For example, taking storm clouds in extreme weather (i.e., storm effects, hereinafter referred to as storms) as an example, the technical solutions provided by related technologies are usually to place a static storm-shaped texture at the far end of the game scene, create particle effects similar to storm clouds, and then manually place the particle effects at the specified position.
[0003] However, placing a static storm-shaped texture at the far end of the game scene may visually look like a storm cloud effect, but it does not have a real sense of volume. When the game perspective moves and approaches, this solution will be exposed and bring a bad visual experience to the player. At the same time, this solution is a static solution, and the storm does not have the dynamic effects of moving and rotating, resulting in a poor visual experience for the player.
[0004] In addition, although the particle effects similar to storm clouds can have dynamic effects such as movement and rotation to a certain extent and have a certain sense of volume, because the particle effects can only be limited to a certain area and cannot be connected with other clouds in the sky, it is easy to cause unnatural seams or uncoordinated cloud color faults, and there are many restrictions on their use. At the same time, due to its own implementation principle problems, the performance overhead of particle effects is very huge, and it cannot be used in large quantities in general games, which further limits the feasibility of this solution. Summary of the invention
[0005] The embodiments of the present application provide a method, device, electronic device, computer-readable storage medium and computer program product for generating storm special effects in a virtual scene, which can generate dynamic storm special effects in a virtual scene in a resource-intensive manner.
[0006] The technical solution of the embodiment of the present application is implemented as follows:
[0007] The present application embodiment provides a method for generating storm special effects in a virtual scene, including:
[0008] Acquire a selected position in the virtual scene as the position of the storm special effect to be generated in the virtual scene;
[0009] Acquire a texture image and range parameters set for the storm special effect, and determine a storm eye region of the storm special effect and a storm region located outside the storm eye region based on the texture image and the range parameters;
[0010] Acquire an exponential distribution function and a three-dimensional noise texture set for the storm special effect, and determine a change trend of the storm area in a reference direction based on the exponential distribution function and the three-dimensional noise texture;
[0011] Acquire a sampling result obtained by sampling a simulation result, and based on the sampling result, control the storm area to enter a rotating state, wherein the simulation result is obtained by performing fluid simulation on the storm special effect;
[0012] Volumetric lighting rendering is performed on the storm area in the rotation state to generate the storm special effect at the selected position.
[0013] The embodiment of the present application provides a device for generating storm special effects in a virtual scene, comprising:
[0014] An acquisition module, used for acquiring a selected position in a virtual scene as the position of a storm effect to be generated in the virtual scene;
[0015] The acquisition module is further used to acquire the texture image and range parameters set for the storm special effect;
[0016] A determination module, configured to determine a storm eye region of the storm special effect and a storm region located outside the storm eye region based on the texture image and the range parameter;
[0017] The acquisition module is further used to acquire an exponential distribution function and a three-dimensional noise texture set for the storm special effect;
[0018] The determination module is further used to determine a change trend of the storm area in a reference direction based on the exponential distribution function and the three-dimensional noise texture;
[0019] The acquisition module is further used to acquire a sampling result obtained by sampling the simulation result;
[0020] A control module, used for controlling the storm area to enter a rotating state based on the sampling result, wherein the simulation result is obtained by performing fluid simulation on the storm special effect;
[0021] A rendering module is used to perform volumetric lighting rendering on the storm area in the rotating state to generate the storm special effect at the selected position.
[0022] An embodiment of the present application provides an electronic device, including:
[0023] A memory for storing executable instructions;
[0024] The processor is used to implement the method for generating storm special effects in a virtual scene provided in an embodiment of the present application when executing the executable instructions stored in the memory.
[0025] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions for implementing a method for generating storm special effects in a virtual scene provided by an embodiment of the present application when executed by a processor.
[0026] An embodiment of the present application provides a computer program product, including a computer program or computer executable instructions, which are used to implement the method for generating storm special effects in a virtual scene provided by the embodiment of the present application when executed by a processor.
[0027] The embodiments of the present application have the following beneficial effects:
[0028] Through the method of volumetric lighting rendering, combined with the three-dimensional modeling of the storm special effect form (including the eye of the storm area, the definition of the storm area, and the changing trend of the storm area in the reference direction), and the introduction of fluid simulation in the modeling process, a variable-form storm special effect is realized in the virtual scene. In this way, compared with the technical solutions provided by related technologies, the embodiments of the present application can save the huge performance overhead brought by particle special effects, provide game players with a better gaming experience, and also provide game developers and designers with a more complete technical solution. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 1 is a schematic diagram of the architecture of a storm special effect generation system 100 in a virtual scene provided in an embodiment of the present application;
[0030] Figure 2 is a schematic diagram of the structure of an electronic device 500 provided in an embodiment of the present application;
[0031] Figure 3 It is a flowchart of a method for generating storm special effects in a virtual scene provided by an embodiment of the present application;
[0032] Figure 4 It is a flowchart of a method for generating storm special effects in a virtual scene provided by an embodiment of the present application;
[0033] Figure 5 It is a flowchart of a method for generating storm special effects in a virtual scene provided by an embodiment of the present application;
[0034] 6A to 6F It is a schematic diagram of an application scenario of a method for generating storm special effects in a virtual scene provided in an embodiment of the present application;
[0035] Figure 7 It is a schematic diagram of the process of overall rendering of storm clouds and other cloud systems provided by an embodiment of the present application;
[0036] Figure 8 It is a schematic diagram of the principle of customizing the position of storm clouds in a game scene provided by an embodiment of the present application;
[0037] Fig. 9A and Fig. 9B is a schematic diagram of a texture image provided in an embodiment of the present application;
[0038] Fig.10 Schematic diagrams of three different regions of a storm cloud provided in an embodiment of the present application;
[0039] Fig.11 is a schematic diagram of an exponential distribution function provided in an embodiment of the present application;
[0040] Fig.12 is a schematic diagram of a three-dimensional noise texture provided in an embodiment of the present application;
[0041] Fig.13 It is a schematic diagram of the change trend of the storm area in the vertical direction provided by the embodiment of the present application;
[0042] Fig.14 is a schematic diagram of erosion texture provided in an embodiment of the present application;
[0043] Fig.15 is a schematic diagram of simulating fluid calculation results on the ground provided in an embodiment of the present application;
[0044] Fig.16 It is a schematic diagram of the cloud layer starting to rotate dynamically provided by an embodiment of the present application;
[0045] Fig.17 It is a schematic diagram of the principle of the velocity field and diffusion process required for establishing the fluid simulation formula provided in the embodiment of the present application;
[0046] Fig.18 It is a schematic diagram of the principle of allowing a fluid to move in a velocity field provided by an embodiment of the present application;
[0047] Fig.19 is a schematic diagram of a static picture provided in an embodiment of the present application;
[0048] Fig. 20 This is a schematic diagram of a plane rotation effect without vertical changes provided in an embodiment of the present application;
[0049] Fig.21 This is a schematic diagram of the color differences between storm clouds and other cloud systems provided in an embodiment of the present application. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.
[0051] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it can be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0052] It is understandable that in the embodiments of the present application, related data such as user information is involved. When the embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0053] In the following description, the terms "first\second\..." are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\..." can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0054] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0055] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
[0056] 1) In response to: used to indicate the conditions or states on which the executed operations depend. When the dependent conditions or states are met, one or more operations executed may be in real time or have a set delay. Unless otherwise specified, there is no restriction on the order in which the multiple operations executed may be executed.
[0057] 2) Extreme weather: comprehensive weather that exists in nature and has a significant impact on human production and life, such as storms, sandstorms, tornadoes, typhoons, etc.
[0058] 3) Cloud system: refers to a cloud area with a certain shape and lasting for a certain period of time. It also refers to a system composed of various clouds that appear with the same weather system. Different weather systems have different cloud systems.
[0059] 4) Storm cloud modeling: Extreme weather is often accompanied by changes in the shape of clouds in the sky, thus forming storm clouds. In the embodiment of the present application, the shape of storm clouds is mathematically simulated in the game, and the process of establishing a computable storm cloud is called storm cloud modeling.
[0060] 5) Fluid: refers to a substance that can flow. It is a substance that will continuously deform under any small shear force. Fluid is a general term for liquids and gases. It has the characteristics of fluidity, compressibility and viscosity.
[0061] 6) Fluid simulation: The computer is used to simulate materials with fluid physical properties. In order to improve the performance of the simulation process in the game, a certain degree of simplification will be performed to achieve the purpose of showing the fluid in the game.
[0062] 7) Volumetric scattering: When light passes through a substance with a certain volume and low density, a natural phenomenon occurs in which the light is bounced in different directions inside the substance, such as the atmosphere, clouds, thick fog, etc. In the game, this natural phenomenon is called volumetric scattering.
[0063] 8) Cloud gaming: Also known as gaming on demand, it means deploying a game program on a server and running an instance of the game program (referred to as a game instance). The game instance sends the game data output during the running process to the browser page of the user terminal. The page calls the browser's media component to decode the game data and renders the real-time game screen during the game according to the decoding result. When the page detects the user's operation on the game screen, it will report it to the game instance running on the server. When the game data generated by the game instance in response to the operation is received, the decoding and rendering process will be repeated, so that the game screen changes according to the user's operation are presented on the page.
[0064] In other words, cloud gaming is an online gaming technology based on cloud computing technology. Cloud gaming technology enables thin clients with relatively limited graphics processing and data computing capabilities to run high-quality games. In a cloud gaming scenario, the game is not played on the user terminal (such as the player's game terminal), but on the cloud server, which renders the game scene into an audio and video stream and transmits it to the user terminal over the network. In this way, the user terminal does not need to have powerful graphics computing and data processing capabilities, but only needs to have basic streaming media playback capabilities and the ability to obtain player input commands and send them to the cloud server.
[0065] For storm clouds (i.e., storm special effects) that appear in extreme weather in game scenes, the technical solution provided by related technologies is usually to place a static storm-shaped map at the far end of the game scene, create particle special effects that resemble storm clouds, and then manually place the particle special effects at the designated location.
[0066] However, in the process of implementing the embodiments of the present application, the applicant discovered that the technical solutions provided by the related art have the following problems: 1) The static storm map does not have a real sense of volume. When the game perspective moves and approaches, the solution will be exposed and bring a bad visual experience to the player. At the same time, the storm does not have the dynamic effects of movement and rotation, resulting in a poor visual experience for the player; 2) The particle special effects can only be limited to a certain area in the game scene and cannot be connected with other cloud systems in the sky, which easily leads to unnatural seams or uncoordinated cloud color faults. At the same time, the particle special effects have a huge performance overhead due to their own implementation principle problems.
[0067] In view of this, the embodiments of the present application provide a method, device, electronic device, computer-readable storage medium and computer program product for generating storm special effects in a virtual scene, which can generate dynamic storm special effects in a virtual scene in a resource-intensive manner. The electronic device provided by the embodiments of the present application is described below. The electronic device provided by the embodiments of the present application can be implemented as a terminal device, or as a server, or implemented in collaboration with a server and a terminal device. The following is an example of a method for generating storm special effects in a virtual scene provided by an embodiment of the present application being implemented in collaboration with a server and a terminal device.
[0068] For example, see Figure 1 , Figure 1 1 is a schematic diagram of the architecture of a storm special effect generation system 100 in a virtual scene provided in an embodiment of the present application, in order to realize an application supporting the generation of dynamic storm special effects in a virtual scene in a resource-intensive manner, such as Figure 1 As shown, the storm special effects generation system 100 in the virtual scene includes: a server 200, a network 300 and a terminal device 400, wherein the network 300 can be a local area network or a wide area network, or a combination of the two, the terminal device 400 is a terminal device associated with a user (such as a game design developer or a game player), and a client 410 runs on the terminal device 400. The client 410 can be various types of game clients, such as a shooting game client, an open world game client, a real-time strategy game client, etc. The server 200 can be a background server of the client 410, such as a game background server.
[0069] In some embodiments, the server 200 may first obtain a position (e.g., position 1) selected by the game developer and designer in the virtual scene as the position of the storm effect (e.g., storm cloud) to be generated in the virtual scene. Then, the server 200 may obtain a texture image (e.g., including two texture images of different sizes, wherein the large texture image may be used to define the storm area, and the small texture image may be used to define the eye of the storm area) and a range parameter (e.g., a radius coefficient for determining the size of the storm area and the eye of the storm area) set by the game developer and designer for the storm effect, and based on the texture image and the range parameter, determine the eye of the storm effect and the storm area located outside the eye of the storm effect (i.e., determine the shape of the storm effect in the horizontal direction, wherein the horizontal direction refers to the direction parallel to the ground in the virtual scene); then, the server 200 may obtain an exponential distribution function and a three-dimensional noise texture set by the game developer and designer for the storm effect, and based on the obtained exponential distribution function and the three-dimensional noise texture, determine the change trend of the storm effect in a reference direction (e.g., a vertical direction, wherein the vertical direction refers to the direction perpendicular to the ground in the virtual scene) (i.e., determine the shape of the storm effect in the vertical direction). In order to make the storm special effect in a variable form, the server 200 can further obtain the sampling result obtained by sampling the simulation result obtained by fluid simulation for the storm special effect, and based on the sampling result, control the storm area to enter a rotating state (for example, by sampling the simulation result and adding time control to make the shape of the storm area enter a twisted flow form). Finally, the server 200 can perform volumetric lighting rendering on the storm area in a rotating state to generate a dynamic storm special effect at a selected position (i.e., position 1) in the virtual scene. For example, the server 200 can send the rendering result of volumetric lighting rendering for the storm area in a rotating state to the terminal device 400 through the network 300, so that the terminal device 400 calls the human-computer interaction interface of the client 410 for presentation. For example, the virtual scene can be displayed in the human-computer interaction interface of the client 410, and the dynamic storm special effect can be displayed at the selected position (i.e., position 1) in the virtual scene. In this way, through volumetric lighting rendering technology, combined with three-dimensional modeling technology and fluid simulation, a more realistic variable-form storm cloud effect is achieved in the game scene, which brings a more realistic visual experience to game players, and also provides a wider application for game products in weather performance.
[0070] It should be noted that the method for generating storm special effects in a virtual scene provided in the embodiment of the present application can also be implemented by a terminal device alone, for example, Figure 1Taking the terminal device 400 shown in the figure as an example, the steps implemented by the above-mentioned server 200 can also be implemented by the terminal device 400 based on its own computing power. That is to say, the terminal device 400 can realize three-dimensional modeling of storm special effects based on its own computing power, and realize the variable form of storm special effects in combination with fluid simulation, and perform volumetric lighting rendering on the storm area in a rotating state to generate dynamic storm special effects at a selected position in the virtual scene. The embodiments of the present application do not make specific limitations on this.
[0071] In addition, it should be noted that the technical solution provided by the embodiment of the present application can be applied to various types of games, for example, it can be applied to both local game mode and cloud game mode, wherein the local game mode refers to the terminal device and the server cooperating to run the game processing logic, and the operation instructions input by the player in the terminal device are partly processed by the terminal device running the game logic, and the other part is processed by the server running the game logic, and the game logic processing run by the server is often more complex and requires more computing power; the cloud game mode refers to the game logic processing being completely run by the server (such as a cloud server), and the cloud server rendering the game scene data into an audio and video stream, which is then transmitted to the terminal device through the network for display. In other words, the terminal device only needs to have basic streaming media playback capabilities and the ability to obtain the player's operation instructions and send them to the server.
[0072] It can be understood that the technical solutions provided in the embodiments of the present application can be applied not only to game scenarios, but also to other scenarios, such as film and television dramas, virtual social interactions, etc., which require simulation of real weather conditions. In other words, the technical solutions provided in the embodiments of the present application can be applied to any scenario that requires simulation of real weather conditions, and the embodiments of the present application do not specifically limit the types of application scenarios.
[0073] In other embodiments, the embodiments of the present application can also be implemented with the aid of cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or a local area network to achieve data calculation, storage, processing, and sharing.
[0074] Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, and application technology based on the cloud computing business model. It can form a resource pool that can be used on demand and is flexible and convenient. Cloud computing technology will become an important support. The background services of the technical network system require a large amount of computing and storage resources.
[0075] For example, Figure 1The server 200 in the example may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks (CDNs), and big data and artificial intelligence platforms. The terminal device 400 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a vehicle-mounted terminal, a virtual reality device, an augmented reality device, etc., but is not limited thereto. The terminal device 400 and the server 200 may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present application.
[0076] In some embodiments, the terminal device or server can also implement the storm special effects generation method in the virtual scene provided by the embodiment of the present application by running various computer executable instructions or computer programs. For example, computer executable instructions can be microprogram-level commands, machine instructions or software instructions. The computer program can be a native program or software module in the operating system; it can be a local (Native) application (APPlication, APP), that is, a program that needs to be installed in the operating system to run, such as various types of game APPs or game development APPs; it can also be a small program that can be embedded in any APP, that is, a program that can be run only by downloading it to a browser environment. In short, the above-mentioned computer executable instructions can be instructions in any form, and the above-mentioned computer program can be an application, module or plug-in in any form.
[0077] The structure of the electronic device provided in the embodiment of the present application is further described below. Taking the electronic device as a server as an example, see Figure 2 , Figure 2 is a schematic diagram of the structure of an electronic device 500 provided in an embodiment of the present application, Figure 2 The electronic device 500 shown includes: at least one processor 510, a memory 540, and at least one network interface 520. The various components in the electronic device 500 are coupled together via a bus system 530. It is understood that the bus system 530 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 530 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the bus system 530 is not described in detail. Figure 2 Various buses are labeled as bus system 530 .
[0078] The processor 510 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.
[0079] The memory 540 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, etc. The memory 540 may optionally include one or more storage devices that are physically remote from the processor 510.
[0080] The memory 540 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 540 described in the embodiments of the present application is intended to include any suitable type of memory.
[0081] In some embodiments, memory 540 is capable of storing data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.
[0082] Operating system 541, including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0083] A network communication module 542, for reaching other computing devices via one or more (wired or wireless) network interfaces 520, exemplary network interfaces 520 include: Bluetooth, Wireless Compatibility Authentication (WiFi), and Universal Serial Bus (USB);
[0084] In some embodiments, the device provided in the embodiments of the present application can be implemented in software. Figure 2 The storm special effect generating device 543 in the virtual scene stored in the memory 540 is shown, which can be software in the form of programs and plug-ins, including the following software modules: acquisition module 5431, determination module 5432, control module 5433, rendering module 5434, sampling module 5435, erosion module 5436 and filling module 5437. These modules are logical, so they can be arbitrarily combined or further split according to the functions implemented. It should be pointed out that in Figure 2For the sake of convenience, all the above modules are shown at once, but it should not be regarded as that the storm special effect generation device 543 in the virtual scene excludes the implementation that can only include the acquisition module 5431, the determination module 5432, the control module 5433 and the rendering module 5434. The functions of each module will be explained below.
[0085] The method for generating storm special effects in a virtual scene provided by an embodiment of the present application will be specifically described below in combination with the exemplary application and implementation of the server provided by an embodiment of the present application.
[0086] For example, see Figure 3 , Figure 3 is a flow chart of a method for generating storm special effects in a virtual scene provided by an embodiment of the present application, which will be combined with Figure 3 The steps shown are explained.
[0087] In step 101, a selected position in the virtual scene is obtained as the position of the storm special effect to be generated in the virtual scene.
[0088] In some embodiments, the terminal device can respond to the position selection operation triggered by the game developer for the virtual scene, and send the selected position (e.g., position 1) in the virtual scene to the server, so that the server uses the position (i.e., position 1) selected by the game developer in the virtual scene as the position of the storm special effect (e.g., storm cloud) to be generated in the virtual scene. In other words, the technical solution provided in the embodiment of the present application supports game developers and designers to customize the position of storm special effects in the game scene, thereby meeting the personalized needs of different game developers and designers.
[0089] In step 102, a texture image and range parameters set for a storm special effect are obtained, and based on the texture image and the range parameters, a storm eye region of the storm special effect and a storm region located outside the storm eye region are determined.
[0090] In some embodiments, the above-mentioned texture image may include a first texture image (i.e., a small texture image, used to define the size of the eye of the storm area) and a second texture image (i.e., a large texture image, used to define the size of the storm area), wherein the size of the first texture included in the first texture image is smaller than the size of the second texture included in the second texture image. The above-mentioned step 102 can be implemented in the following manner: multiplying the first texture included in the first texture image by the range parameter, and using the first multiplication result as the eye of the storm area of the storm special effect, and multiplying the second texture included in the second texture image by the range parameter, and using the second multiplication result as the storm area located outside the eye of the storm area.
[0091] For example, after determining the position of the storm effect to be generated in the virtual scene, the server can obtain two texture images of different sizes uploaded by the game developer through the terminal device, for example, Fig. 9A The small texture image shown (ie the first texture image) and Fig. 9B The large texture image (i.e., the second texture image) shown, wherein, Fig. 9A The white area (i.e., the first texture) of the small texture image shown is smaller than Fig. 9B The server can then compare the range parameters (such as the radius coefficient, assuming it is 0.8) uploaded by the game developer with the size of the white area (i.e., the second texture) included in the large texture image shown. Fig. 9A The small texture image shown includes white areas and Fig. 9B The white area included in the large texture image shown is multiplied, so that the size of the storm eye area of the storm special effect and the size of the storm area outside the storm eye area can be obtained accordingly. In other words, the game developer can dynamically control the size of the storm special effect through the range parameter, including the size of the storm area and the size of the storm eye area.
[0092] So far, the shape of the storm effect in the horizontal direction (for example, the direction parallel to the ground in the virtual scene) has been determined. The following will continue to explain the process of determining the shape of the storm effect in the vertical direction (for example, the direction perpendicular to the ground in the virtual scene).
[0093] In step 103, an exponential distribution function and a three-dimensional noise texture set for the storm special effect are obtained, and based on the exponential distribution function and the three-dimensional noise texture, a change trend of the storm area in the reference direction is determined.
[0094] Here, the reference direction may refer to a direction perpendicular to the ground in the virtual scene, also called a vertical direction, and the changing trend of the storm area in the reference direction refers to the shape of the storm area in the vertical direction.
[0095] In some embodiments, the above-mentioned determination of the changing trend of the storm area in the reference direction based on the exponential distribution function and the three-dimensional noise texture can be achieved in the following manner: obtaining height parameters set for the storm special effect, wherein the height parameters include the bottom height of the storm special effect (i.e., the distance between the bottom of the storm special effect and the ground in the virtual scene) and the top height (i.e., the distance between the top of the storm special effect and the ground in the virtual scene); normalizing the height parameters, and inputting the normalized height parameters (e.g., the value range of the normalized height parameters is between 0-1) into the exponential distribution function to obtain the function value output by the exponential distribution function; sampling the three-dimensional noise texture, and determining the changing trend of the storm area in the reference direction (e.g., the shape of the storm area in the vertical direction) based on the noise value and function value obtained by the sampling.
[0096] For example, the above-mentioned noise value and function value based on sampling can be implemented in the following way to determine the change trend of the storm area in the reference direction: subtract the function value output by the exponential distribution function from the noise value obtained by sampling, and determine the change trend of the storm area in the reference direction based on the subtraction result, wherein the function value is used to determine the initial shape of the storm area in the reference direction. For example, you can first Fig.11 The exponential distribution function shown determines the initial vertical shape of the storm area, which can then be calculated by Fig.12 The three-dimensional noise texture shown is sampled, and the initial shape of the storm area in the vertical direction is adjusted based on the sampling result, so that the originally tiled initial shape can appear similar to the real cloud in the real world.
[0097] In other embodiments, see Figure 4 , Figure 4 is a flow chart of a method for generating storm special effects in a virtual scene provided by an embodiment of the present application, such as Figure 4 As shown, after executing Figure 3 After step 103 shown, you can also perform Figure 4 Steps 106 and 107 shown in FIG. Figure 4 The steps shown are explained.
[0098] In step 106, an erosion texture set for the storm special effect is obtained.
[0099] Here, the texture size of the erosion texture is smaller than the texture size of the three-dimensional noise texture, that is, the erosion texture is a noise texture with more details than the above-mentioned three-dimensional noise texture. The erosion texture can be used to increase the details of the storm special effect, such as edges.
[0100] In step 107, the erosion texture is sampled, and based on the sampling result, the change trend of the storm area in the reference direction is eroded to obtain the change trend of the storm area in the reference direction after erosion.
[0101] In some embodiments, after determining the changing trend of the storm area in the reference direction, the following method can be used: Fig.14 The erosion texture shown makes the vertical shape of the storm area more abundant. For example, the vertical shape of the storm area can be further adjusted using the sampling results based on the erosion texture, thereby adding more details to the storm area, such as edges.
[0102] In other embodiments, in addition to the storm effect cloud system, the virtual scene may also include other cloud systems located around the storm effect, wherein the degree of erosion for the storm area is different from that for other cloud systems, so that the storm effect can be distinguished from other cloud systems. That is, in the erosion stage, the embodiment of the present application can simultaneously add different erosion controls for the storm area and other cloud systems, so that the entire cloud layer looks more distinguishable and has better visual performance.
[0103] In step 104, a sampling result obtained by sampling the simulation result is obtained, and based on the sampling result, the storm area is controlled to enter a rotating state.
[0104] Here, the simulation results are obtained by fluid simulation for storm special effects.
[0105] In some embodiments, the above-mentioned sampling results obtained by sampling the simulation results can be achieved in the following ways: obtaining the fluid simulation formula set for the storm special effect (such as the Navier-Stokes equations in fluid mechanics), and creating a corresponding velocity field and diffusion process based on the fluid simulation formula; controlling the fluid to move in the velocity field following the diffusion process; rendering the motion state of the fluid at the target time into a pre-set black background image to obtain the simulation result, wherein the target time is any time when the fluid moves in the velocity field; sampling the simulation result multiple times to obtain multiple sampling results corresponding to different times.
[0106] In other embodiments, based on the above example, the above-mentioned control of the storm area into a rotating state based on the sampling results can be achieved in the following manner: in the order of sampling time from early to late, multiple sampling results are used in sequence to adjust the changing trend of the storm area in the reference direction, so that the shape of the storm area enters a rotating state.
[0107] In some embodiments, following the above example, the adjustment degree of the changing trend of the storm area in the reference direction can also be controlled by adding adjustment parameters. The above-mentioned use of multiple sampling results in sequence to adjust the changing trend of the storm area in the reference direction can be achieved in the following way: obtain adjustment parameters set for storm special effects, wherein the adjustment parameters are used to control the adjustment degree when adjusting the changing trend of the storm area in the reference direction; use multiple sampling results and adjustment parameters in sequence to adjust the changing trend of the storm area in the reference direction.
[0108] For example, the embodiment of the present application requires that the storm cloud rotates significantly around the eye of the storm, so the Navier-Stokes equation in fluid mechanics can be used to first establish the following Fig.17 The velocity field and diffusion process shown in the figure can be simplified to reduce the amount of calculation. Then, Fig.18 As shown, by letting Fig.15 The character shown in Figure 1 disturbs the fluid region, causing the fluid to move in the velocity field. The motion state of the fluid at a certain moment can then be rendered in real time on a graph, such as Fig.15 On the black background image shown in . Finally, the image can be saved as an image resource for static sampling. The embodiment of the present application is aimed at the storm area. By sampling this image, the shape of the storm area can be changed into a distorted flow form, and then adjustment parameters are added to control the degree of distortion and flow in the storm area. At the same time, the time change in real-time rendering is added. Because time is constantly increasing, the same position on the storm area will shift with time when sampling this image, so the shape of the entire storm area will be animated. At the same time, the offset of the embodiment of the present application is a rotation offset with the center of the circle as the radius, so that the storm area rotates, that is, the shape of the storm area enters a rotating state.
[0109] In some other embodiments, in addition to the storm effect cloud system, the virtual scene may also include other cloud systems located around the storm effect. Figure 5 , Figure 5 is a flow chart of a method for generating storm special effects in a virtual scene provided by an embodiment of the present application, such as Figure 5 As shown, in the execution Figure 3 Before step 105 shown, you can also perform Figure 5 Steps 108 and 109 shown will be combined Figure 5 The steps shown are explained.
[0110] In step 108, the fill color set for the storm special effect is obtained.
[0111] Here, the fill color is different from the colors of other cloud systems. For example, when the storm effect is a sandstorm, the fill color may be yellow, while the colors of other cloud systems may be white.
[0112] In step 109, the storm area is filled with a filling color, and the position in the storm area close to other cloud systems is adjusted to a transition color.
[0113] Here, the transition color is obtained by interpolating the fill color and the colors of other cloud systems. For example, when the fill color is yellow and the colors of other cloud systems are white, the transition color may be a light yellow obtained by interpolating yellow and white.
[0114] In some embodiments, in order to make the storm special effects present a richer atmosphere, the embodiments of the present application may also add storm area color control to distinguish the color changes and transitions of the storm area and other cloud systems. For example, according to the definition of the storm area and the eye of the storm mentioned above, different colors are superimposed in these areas. For example, when the sampling location is the storm area, it can be filled with a single color. At the same time, between different areas, color transitions can be performed by numerical interpolation, so that clouds of different colors have a gradient effect. Fig.21 It can be seen that the storm area and other cloud systems in the embodiment of the present application have color differences, and the atmosphere is richer.
[0115] In step 105, volumetric lighting rendering is performed on the rotating storm area to generate a storm effect at the selected position.
[0116] In some embodiments, in addition to the storm special effect cloud system, the virtual scene may also include other cloud systems located around the storm special effect. The above-mentioned volumetric lighting rendering of the rotating storm area can be achieved in the following way: using ray stepping to perform volumetric lighting rendering on other cloud systems and the rotating storm area.
[0117] For example, after completing the 3D modeling and visual effects of the storm special effects, the rotating storm area and other cloud systems in the virtual scene can be simultaneously rendered with volumetric lighting based on ray marching, so that the final generated storm special effects can present an effect similar to that of real storm clouds in the real world in the volume scattering of light. Ray marching is a fast rendering method for real-time scenes. Its basic principle is to emit a ray of light from the camera position to each pixel on the screen. The ray of light advances at a certain step length and detects whether the current ray of light is on the surface of the object. The amplitude of the ray of light is adjusted accordingly until it reaches the surface of the object, and then the color value is calculated according to the general ray following method.
[0118] The method for generating storm special effects in a virtual scene provided in the embodiment of the present application uses a volumetric lighting rendering method combined with three-dimensional modeling of the storm special effects form (including the storm eye area, the definition of the storm area, and the changing trend of the storm area in the reference direction), and introduces fluid simulation in the modeling process, thereby realizing a storm special effect with a variable form in the virtual scene. In this way, compared with the technical solutions provided by related technologies, the embodiment of the present application can save the huge performance overhead brought by particle special effects, provide a better gaming experience for game players, and also provide a more complete technical solution for game developers and designers.
[0119] The following is an explanation of an exemplary application of the embodiments of the present application in a practical application scenario.
[0120] Weather effects are very common in today's games, but the weather effects in most games are mainly common mild weather, such as sunny days, cloudy days, nights, foggy days, etc. At the same time, some extreme weather effects are gradually beginning to appear, such as storm clouds in extreme weather (ie storm special effects), which can provide gamers with more visual impact.
[0121] An embodiment of the present application provides a method for generating storm special effects in a virtual scene. Through volume rendering and combined with three-dimensional modeling of storm cloud forms, the problems of visual effects, dynamic movement and rotation, and cloud connection of storm clouds are fully solved. At the same time, it can be completely integrated with other cloud systems in the sky and move, rotate, open and close freely, etc., which also saves the huge performance overhead brought by particle special effects, provides a better experience for game players, and also provides a more complete technical solution for game developers and designers.
[0122] The technical solution provided in the embodiments of the present application can be applied to any type of game products.
[0123] For example, when extreme weather such as storms needs to be added to the game design to provide players with visual impact, the technical solution provided in the embodiment of the present application can be combined to create the following: Fig. 6A Storm performance shown.
[0124] For example, when extreme weather such as sandstorms needs to be added to the game design to provide players with an atmosphere of sandstorms, the technical solution provided in the embodiment of the present application can be combined to create the following: Figure 6B The dust storm shown.
[0125] For example, when the game design needs to express dynamic typhoons, hurricanes and other forms of gameplay, the technical solution provided in the embodiment of the present application can be combined to create realistic typhoon, hurricane, tornado effects for players. For example, Figure 6CThe eye of the typhoon shown is formed and rapidly rotates close to the player's field of vision, giving the player a strong sense of oppression and impact.
[0126] For example, Fig.6D As shown, when the visuals and gameplay designed by the game designers for the players include a typhoon extending toward the ground, the eye of the typhoon can gradually rotate and gather, and dynamically stretch toward the ground.
[0127] For example, Fig. 6E It shows the intermediate state of a tornado extending towards the ground. For example, in the process of showing the dynamic changes of a tornado, the movement speed of the tornado can become faster and faster, and the degree of gathering can also become higher and higher.
[0128] For example, Fig. 6F It shows the final state of the typhoon eye rotating and falling to the ground to form a powerful tornado. In this way, a tense atmosphere can be created for players in the game screen, promoting the improvement of game quality and experience.
[0129] The following is a detailed description of the method for generating storm special effects in a virtual scene provided in an embodiment of the present application.
[0130] The storm cloud in the embodiment of the present application has different forms such as rotation and movement of fluid simulation. At the same time, a significant feature of the storm cloud is that it has the advantage of being completely integrated with other cloud systems in the sky. The above advantage is achieved by using the same volume rendering technology architecture for the storm cloud and other cloud systems. Figure 7 Provide specific instructions.
[0131] In some embodiments, see Figure 7 , Figure 7 is a schematic diagram of the overall rendering process of storm clouds and other cloud systems provided by an embodiment of the present application, such as Figure 7 As shown, the technical solution provided in the embodiment of the present application supports the function of customizing the position of storm clouds in the game scene, for example, Figure 8 As shown, the positions selected by the game developer in the game scene (for example, including position 1, position 2 and position 3) can be used as the positions where storm clouds exist in the game scene. Then, in the process of three-dimensional modeling of the cloud layer, whether it is in the storm cloud position can be used to distinguish whether to enter the technical process of storm cloud rendering or the technical process of other cloud system rendering. If it is outside the storm cloud area, the embodiment of the present application will directly perform volumetric lighting rendering on other cloud systems; if it is in the storm cloud area, it will enter the storm cloud size process, that is, the process of determining the size of the storm cloud.
[0132] In other embodiments, following the above, after determining the location and size of the storm cloud, the eye of the storm area can be modeled. In the embodiment of the present application, two texture images of different sizes can be used, for example, including Fig. 9A The small texture image shown (corresponding to the first texture image, used to define the scope of the storm eye area) and Fig. 9B The large texture image shown (corresponding to the second texture image, used to define the entire storm cloud area) is combined with the range parameter to define the Fig.10 The three different areas of the storm cloud shown are the eye of the storm, the storm area, and the outer area of the storm. The range parameter can be understood as the coefficient of the storm radius, multiplied by Fig. 9A and Fig. 9B The white area in the texture image shown can dynamically control the size of the storm cloud, including the size of the storm eye area and the size of the storm area.
[0133] In some embodiments, following the above, after determining the storm area included in the storm cloud, it is possible to combine Fig.11 The exponential distribution function shown and Fig.12 The three-dimensional noise texture shown is created as Fig.13 The change trend of the storm area in the vertical direction (i.e., z-axis direction) is shown in Figure 1, where the formula of the exponential distribution function is as follows:
[0134] height=(1-e x )*(1-e (1-x) )
[0135] Among them, x represents the normalized height value of the storm cloud, ranging from 0 to 1, e represents a natural constant, and height represents the vertical shape of the storm area. Fig.12 The three-dimensional noise texture shown is a noise texture in a three-dimensional space. By sampling the three-dimensional noise texture, the embodiment of the present application can uniformly define the basic shape of the volume cloud in the three-dimensional space, so that the originally flat cloud can appear in a real shape. For example, the function value of the exponential distribution function can be subtracted from the noise value obtained by sampling the three-dimensional noise texture to obtain the vertical change trend of the storm area.
[0136] Continue to see Figure 7 After determining the vertical trend of the storm area, the erosion phase begins. For example, Fig.14 The texture erosion shown makes the details of the cloud layer more abundant, wherein the erosion texture is actually a more detailed noise texture, and the vertical change trend of the storm area can be further adjusted based on the sampling result of the erosion texture, that is, the erosion texture is mainly used to add more details to the cloud layer, such as the edge, etc. In addition, the embodiment of the present application can also add different erosion controls for the storm area and other cloud systems, so that the entire cloud layer looks more distinguishable and has better visual performance.
[0137] In addition, the embodiment of the present application also requires that the storm area of the storm cloud rotates significantly around the eye of the storm. Therefore, the Navier-Stokes equations in fluid mechanics can be used and the calculation accuracy of the velocity field and the diffusion process can be simplified, such as Fig.15 As shown, the fluid calculation results can be simulated on the ground, and then the simulation results are sampled in the cloud layer, so that the cloud layer morphology changes. At the same time, time control can also be added, such as Fig.16 As shown in FIG. 1 , after adding the time control, the cloud layer starts to rotate dynamically. The above process is described in detail below.
[0138] For example, Fig.17 As shown, we can first establish the velocity field and diffusion process required by the fluid simulation formula, and then, as Fig.18 As shown, by running the characters in the scene in real time (such as Fig.15 The character shown in the figure disturbs the fluid area, thereby causing the fluid to move in the velocity field. The motion state at a certain moment can then be rendered in real time on a graph, for example, Fig.15 The black background image shown in the figure can be saved as an image resource for static sampling or real-time sampling. Fig.19 Next, in the embodiment of the present application, within the storm area, Fig.19 By sampling the static image shown, the shape of the cloud can be changed into a distorted flow form, and the adjustment parameters can be added to control the degree of distortion and flow. In addition, the time change in real-time rendering can be added. Because time is constantly increasing, the same position on the cloud will change when sampling. Fig.19 When the static image shown is offset over time, the shape of the entire storm area will move. In addition, the offset in the embodiment of the present application is a rotation offset with the center of the circle as the radius, so that the cloud layer rotates. For example, Fig. 20 The effect of plane rotation without vertical variation is shown (i.e. the semi-finished effect of storm clouds).
[0139] In order to allow the storm clouds provided by the embodiments of the present application to present a richer atmosphere, the embodiments of the present application may also add storm area color control to distinguish the color changes and transitions between the storm area and other cloud systems. The specific implementation process is as follows: According to the definitions of the storm area and the storm eye area mentioned above, the embodiments of the present application may overlay different colors on these areas. For example, when the sampling location is a storm area, it may be filled with a single color. At the same time, between different areas, color transitions may be performed by numerical interpolation, so that clouds of different colors may have a gradient effect. Fig.21 It can be seen that the storm area and other cloud systems have color differences.
[0140] At this point, the modeling and visual effects of the storm clouds have been basically completed. Finally, the embodiment of the present application can simultaneously perform volumetric lighting rendering based on raymarching on the storm clouds and other cloud systems, so that the clouds can present an effect similar to that in the real world through the volumetric scattering of light.
[0141] In summary, the method for generating storm special effects in a virtual scene provided by the embodiment of the present application has the following beneficial effects: the use of the technical solution provided by the embodiment of the present application can make the clouds in the game have a more complex shape, and at the same time can create a special visual experience of the coming of an unpredictable storm, creating a broader design idea and art design direction for game designers. At the same time, the use of the technical solution provided by the embodiment of the present application can also make the game product more playable, and more innovations can be made in the gameplay design. In addition, in the technical field, the embodiment of the present application solves the problems existing in the related technology that the storm clouds cannot rotate dynamically, cannot move dynamically, cannot perfectly integrate with other cloud systems, and cannot meet the limitations of game performance overhead.
[0142] The following is a description of an exemplary structure of a storm special effect generating device 543 in a virtual scene provided by an embodiment of the present application implemented as a software module. In some embodiments, Figure 2 As shown, the software modules in the storm special effect generating device 543 in the virtual scene stored in the memory 540 may include: an acquisition module 5431 , a determination module 5432 , a control module 5433 and a rendering module 5434 .
[0143] The acquisition module 5431 is used to acquire the selected position in the virtual scene as the position of the storm special effect to be generated in the virtual scene; the acquisition module 5431 is also used to acquire the texture image and range parameters set for the storm special effect; the determination module 5432 is used to determine the storm eye area of the storm special effect and the storm area located outside the storm eye area based on the texture image and range parameters; the acquisition module 5431 is also used to acquire the exponential distribution function and three-dimensional noise texture set for the storm special effect; the determination module 5432 is also used to determine the change trend of the storm area in the reference direction based on the exponential distribution function and the three-dimensional noise texture; the acquisition module 5431 is also used to acquire the sampling results obtained by sampling the simulation results; the control module 5433 is also used to control the storm area to enter a rotating state based on the sampling results, wherein the simulation results are obtained by fluid simulation for the storm special effect; the rendering module 5434 is used to perform volumetric lighting rendering on the storm area in the rotating state to generate the storm special effect at the selected position.
[0144] In some embodiments, the texture image includes a first texture image and a second texture image, wherein the size of the first texture included in the first texture image is smaller than the size of the second texture included in the second texture image; the determination module 5432 is further used to multiply the first texture included in the first texture image by the range parameter, and use the first multiplication result as the eye of the storm area of the storm special effect, and to multiply the second texture included in the second texture image by the range parameter, and use the second multiplication result as the storm area located outside the eye of the storm area.
[0145] In some embodiments, the acquisition module 5431 is also used to obtain height parameters set for storm special effects, wherein the height parameters include the bottom height and the top height of the storm special effects; the determination module 5432 is also used to normalize the height parameters, and input the normalized height parameters into the exponential distribution function to obtain the function value output by the exponential distribution function; the three-dimensional noise texture is sampled, and based on the noise value and function value obtained by the sampling, the changing trend of the storm area in the reference direction is determined.
[0146] In some embodiments, the determination module 5432 is also used to subtract the function value from the sampled noise value, and determine the change trend of the storm area in the reference direction based on the subtraction result, wherein the function value is used to determine the initial shape of the storm area in the reference direction.
[0147] In some embodiments, after the determination module 5432 determines the changing trend of the storm area in the reference direction, the acquisition module 5431 is also used to obtain the erosion texture set for the storm special effect, wherein the texture size of the erosion texture is smaller than the texture size of the three-dimensional noise texture; the storm special effects generating device 543 in the virtual scene also includes a sampling module 5435 and an erosion module 5436, wherein the sampling module 5435 is used to sample the erosion texture; the erosion module 5436 is used to erode the changing trend of the storm area in the reference direction based on the sampling result, and obtain the changing trend of the storm area in the reference direction after erosion.
[0148] In some embodiments, the virtual scene includes a cloud system located around a storm effect, wherein the degree of erosion for the storm area is different from the degree of erosion for the cloud system.
[0149] In some embodiments, the acquisition module 5431 is also used to obtain the fluid simulation formula set for the storm special effect, and create a corresponding velocity field and diffusion process based on the fluid simulation formula; control the fluid to move in the velocity field following the diffusion process; render the motion state of the fluid at the target time into a pre-set black background image to obtain a simulation result, wherein the target time is any time when the fluid moves in the velocity field; sample the simulation results multiple times to obtain multiple sampling results corresponding to different times.
[0150] In some embodiments, the control module 5433 is also used to adjust the change trend of the storm area in the reference direction using multiple sampling results in sequence according to the sampling time from early to late, so that the shape of the storm area enters a rotating state.
[0151] In some embodiments, the acquisition module 5431 is also used to obtain adjustment parameters set for storm special effects, wherein the adjustment parameters are used to control the degree of adjustment when adjusting the changing trend of the storm area in the reference direction; the control module 5433 is also used to use multiple sampling results and adjustment parameters in sequence to adjust the changing trend of the storm area in the reference direction.
[0152] In some embodiments, the virtual scene includes a cloud system located around the storm special effect; before the rendering module 5434 performs volumetric lighting rendering on the storm area in a rotating state, the acquisition module 5431 is also used to obtain the fill color set for the storm special effect, wherein the fill color is different from the color of the cloud system; the storm special effects generating device 543 in the virtual scene also includes a filling module 5437, which is used to fill the storm area with the fill color, and adjust the position close to the cloud system in the storm area to a transition color, wherein the transition color is obtained by interpolating the fill color and the color of the cloud system.
[0153] In some embodiments, the virtual scene includes a cloud system located around the storm special effect; the rendering module 5434 is also used to perform volumetric lighting rendering on the cloud system and the rotating storm area by using ray stepping.
[0154] It should be noted that the description of the device in the embodiment of the present application is similar to the description of the method embodiment described above, and has similar beneficial effects as the method embodiment, so it will not be repeated. Figure 3 , Figure 4 ,or Figure 5 The present invention should be understood by referring to the description of any one of the accompanying drawings.
[0155] The embodiment of the present application provides a computer program product, which includes a computer program or a computer executable instruction, and the computer program or the computer executable instruction is stored in a computer-readable storage medium. The processor of the computer device reads the computer executable instruction from the computer-readable storage medium, and the processor executes the computer executable instruction, so that the computer device executes the storm special effect generation method in the virtual scene described in the embodiment of the present application.
[0156] The present application embodiment provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the processor will execute the method for generating storm special effects in a virtual scene provided by the present application embodiment, for example, Figure 3 , Figure 4 ,or Figure 5 A method for generating storm special effects in a virtual scene is shown.
[0157] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or it may be various devices including one or any combination of the above memories.
[0158] In some embodiments, executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.
[0159] As an example, the executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed at multiple sites and interconnected by a communication network.
[0160] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.
Claims
1. A method for generating storm special effects in a virtual scene, characterized in that: The method comprises: Acquire a selected position in the virtual scene as the position of the storm special effect to be generated in the virtual scene; Acquire a texture image and range parameters set for the storm special effect, and determine a storm eye region of the storm special effect and a storm region located outside the storm eye region based on the texture image and the range parameters; Acquire an exponential distribution function and a three-dimensional noise texture set for the storm special effect, and determine a change trend of the storm area in a reference direction based on the exponential distribution function and the three-dimensional noise texture; Acquire a sampling result obtained by sampling a simulation result, and based on the sampling result, control the storm area to enter a rotating state, wherein the simulation result is obtained by performing fluid simulation on the storm special effect; Volumetric lighting rendering is performed on the storm area in the rotation state to generate the storm special effect at the selected position.
2. The method according to claim 1, characterized in that: The texture image includes a first texture image and a second texture image, wherein a size of a first texture included in the first texture image is smaller than a size of a second texture included in the second texture image; The step of determining the storm eye region of the storm special effect and the storm region outside the storm eye region based on the texture image and the range parameter includes: multiplying the first texture included in the first texture image by the range parameter, and using the obtained first multiplication result as the eye of the storm area of the storm special effect, and The second texture included in the second texture image is multiplied by the range parameter, and a second multiplication result is used as a storm area located outside the storm eye area.
3. The method according to claim 1, characterized in that The step of determining the change trend of the storm area in the reference direction based on the exponential distribution function and the three-dimensional noise texture includes: Acquire a height parameter set for the storm special effect, wherein the height parameter includes a bottom height and a top height of the storm special effect; Normalizing the height parameter, and inputting the normalized height parameter into the exponential distribution function to obtain a function value output by the exponential distribution function; The three-dimensional noise texture is sampled, and based on the noise value obtained by sampling and the function value, a change trend of the storm area in a reference direction is determined.
4. The method according to claim 3, characterized in that The determining, based on the noise value obtained by sampling and the function value, a change trend of the storm area in the reference direction comprises: The function value is subtracted from the sampled noise value, and the change trend of the storm area in the reference direction is determined based on the subtraction result, wherein the function value is used to determine the initial shape of the storm area in the reference direction.
5. The method according to claim 1, characterized in that After determining the change trend of the storm area in the reference direction, the method further includes: Acquire an erosion texture set for the storm special effect, wherein a texture size of the erosion texture is smaller than a texture size of the three-dimensional noise texture; The erosion texture is sampled, and based on the sampling result, the change trend of the storm area in the reference direction is eroded to obtain the change trend of the storm area in the reference direction after erosion.
6. The method according to claim 5, characterized in that The virtual scene includes a cloud system located around the storm special effect, wherein the degree of erosion for the storm area is different from the degree of erosion for the cloud system.
7. The method according to claim 1, characterized in that The obtaining of the sampling result obtained by sampling the simulation result includes: Obtaining a fluid simulation formula for the storm special effect setting, and creating a corresponding velocity field and diffusion process based on the fluid simulation formula; Controlling the fluid to move in the velocity field following the diffusion process; Rendering the motion state of the fluid at a target time into a preset black background image to obtain a simulation result, wherein the target time is any time when the fluid moves in the velocity field; The simulation result is sampled multiple times to obtain multiple sampling results corresponding to different moments.
8. The method according to claim 7, characterized in that The controlling the storm region to enter a rotating state based on the sampling result includes: In the order of sampling time from early to late, the multiple sampling results are used in sequence to adjust the change trend of the storm area in the reference direction, so that the shape of the storm area enters a rotating state.
9. The method according to claim 8, characterized in that The step of sequentially using the multiple sampling results to adjust the change trend of the storm area in the reference direction includes: Acquire adjustment parameters set for the storm special effect, wherein the adjustment parameters are used to control the degree of adjustment when adjusting the change trend of the storm area in the reference direction; The multiple sampling results and the adjustment parameters are used in sequence to adjust the change trend of the storm area in the reference direction.
10. The method according to claim 1, characterized in that The virtual scene includes a cloud system located around the storm special effect; Before performing volumetric lighting rendering on the storm area in the rotation state, the method further includes: Obtaining a fill color set for the storm special effect, wherein the fill color is different from the color of the cloud system; The storm area is filled with the filling color, and the position in the storm area close to the cloud system is adjusted to a transition color, wherein the transition color is obtained by interpolating the filling color and the color of the cloud system.
11. The method according to claim 1, characterized in that: The virtual scene includes a cloud system located around the storm special effect; The performing volumetric lighting rendering on the storm area in the rotating state comprises: The cloud system and the storm area in the rotating state are volumetrically illuminated and rendered by using a ray-stepping method.
12. A device for generating storm special effects in a virtual scene, characterized in that: The device comprises: An acquisition module, used for acquiring a selected position in a virtual scene as the position of a storm effect to be generated in the virtual scene; The acquisition module is further used to acquire the texture image and range parameters set for the storm special effect; A determination module, configured to determine a storm eye region of the storm special effect and a storm region located outside the storm eye region based on the texture image and the range parameter; The acquisition module is further used to acquire an exponential distribution function and a three-dimensional noise texture set for the storm special effect; The determination module is further used to determine a change trend of the storm area in a reference direction based on the exponential distribution function and the three-dimensional noise texture; The acquisition module is further used to acquire a sampling result obtained by sampling the simulation result; A control module, used for controlling the storm area to enter a rotating state based on the sampling result, wherein the simulation result is obtained by performing fluid simulation on the storm special effect; A rendering module is used to perform volumetric lighting rendering on the storm area in the rotating state to generate the storm special effect at the selected position.
13. An electronic device, characterized in that: include: A memory for storing executable instructions; The processor is used to implement the method for generating storm special effects in a virtual scene as described in any one of claims 1 to 11 when executing the executable instructions stored in the memory.
14. A computer-readable storage medium storing computer-executable instructions, characterized in that: When the computer executable instructions are executed by a processor, the method for generating storm special effects in a virtual scene as described in any one of claims 1 to 11 is implemented.
15. A computer program product comprising a computer program or computer executable instructions, characterized in that: When the computer program or computer executable instruction is executed by a processor, the method for generating storm special effects in a virtual scene as described in any one of claims 1 to 11 is implemented.
Citation Information
Cited By
Ocean digital twin engine system
CN120995715A