Physical special effects rendering method and apparatus, computer device, and computer program
By integrating a particle simulation tool for real-time physical simulation within the particle emission plug-in, the method addresses inefficiencies in conventional rendering methods, enabling more realistic and interactive animations.
Patent Information
- Application Number
- JP2023555759
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Priority Date
- 2021-10-25
- Filing Date
- 2022-09-14
- Publication Date
- 2024-11-13
- Estimated Expiration
- 2042-09-14
AI Technical Summary
Conventional particle emission plug-ins lack the capability for real-time physical simulation of particle movement, relying on offline simulation results for rendering physical special effects, leading to inefficiencies.
Integrate a particle simulation tool into the particle emission plug-in to perform real-time physical simulation by obtaining physical special effects data from the previous frame, instantiating a scene management class, calculating motion state information in the current frame, and updating data to render accurate physical effects.
Enhances the efficiency and accuracy of physical special effects rendering by performing real-time simulations, improving the realism and interactivity of animations.
Smart Images

Figure 0007582589000002 
Figure 0007582589000003 
Figure 0007582589000004
Abstract
Description
[Technical field]
[0001] This application claims priority to a Chinese patent application filed on October 25, 2021, bearing application number 202111237498X and entitled "Physical special effects rendering method and apparatus, computer equipment, and storage medium," the entire contents of which are incorporated herein by reference.
[0002] The present application relates to the field of computer technology, and in particular to a method and apparatus for rendering physical special effects, a computer device, a storage medium, and a computer program product. [Background technology]
[0003] With the development of computer technology, particle emission plug-ins are widely used in the development of games, animations, etc. Particle emission plug-ins can emit particles in three-dimensional space and obtain physical special effects by rendering the generated particles.
[0004] In the prior art, the particle emission plug-in cannot perform physical simulation for particle movement, and needs to externally obtain the simulation results obtained by offline physical simulation to realize the rendering of physical special effects, resulting in low efficiency in rendering physical special effects. Summary of the Invention [Problem to be solved by the invention]
[0005] Various embodiments of the present application provide a method and apparatus for rendering physical special effects, a computer device, a storage medium, and a computer program product. [Means for solving the problem]
[0006] A physical special effect rendering method implemented by a computer device includes the steps of: obtaining physical special effect data in a frame immediately before a physical special effect particle emitted by a particle emission plug-in; obtaining a first target instance obtained by instantiating a scene management class, where the scene management class inherits from a target base class provided by the particle emission plug-in; calling a scene management interface of a particle simulation tool integrated in the particle emission plug-in via the first target instance, and calculating, in a scene manager of the particle simulation tool, motion state information in a current frame of the physical special effect particle based on the physical special effect data in the immediately before frame; and updating the physical special effect data in the immediately before frame based on the motion state information in the current frame, to render and obtain the physical special effect in the current frame.
[0007] The rendering device for physical special effects includes: a data acquisition module for acquiring physical special effect data in a frame immediately before a physical special effect particle emitted by a particle emission plug-in; an instance acquisition module for acquiring a first target instance obtained by instantiating a scene management class, where the scene management class inherits from a target base class provided by the particle emission plug-in; a data calculation module for calling a scene management interface of a particle simulation tool integrated in the particle emission plug-in via the first target instance, and calculating, in a scene manager of the particle simulation tool, motion state information in a current frame of the physical special effect particle based on the physical special effect data in the immediately before frame; and a data update module for updating the physical special effect data in the immediately before frame based on the motion state information in the current frame, and rendering and acquiring the physical special effect in the current frame.
[0008] The computing device includes a memory having computer-readable instructions stored thereon and a processor, the computer-readable instructions, when executed by the processor, causing the processor to perform steps of the method for rendering physical special effects described above.
[0009] One or more non-volatile readable storage media have computer readable instructions stored thereon that, when executed by one or more processors, cause the processors to perform the steps of the method for rendering physical special effects described above.
[0010] The computer program product includes computer readable instructions which, when executed by a processor, effectuate the steps of the method for rendering physical special effects.
[0011] The details of one or more embodiments of the application are set forth in the drawings and description below. Other features, objects, and advantages of the application will become apparent from the description, drawings, and claims. [Brief description of the drawings]
[0012] In order to more clearly describe the embodiments of the present application or the technical means in the prior art, the drawings that need to be used in the description of the embodiments or the prior art are briefly described below. It is obvious that the drawings in the following description are only the embodiments of the present application, and those skilled in the art can obtain other drawings based on the disclosed drawings without creative labor.
[0013] [Figure 1] FIG. 2 is a diagram illustrating an application environment of a physical special effects rendering method in one embodiment. [Diagram 2] 1 is a flowchart of a method for rendering physical special effects in one embodiment. [Diagram 3] FIG. 13 is a schematic diagram of a setting interface for setting attribute parameters of a first attribute in an embodiment. [Figure 4] FIG. 13 is a schematic diagram of a setting interface for setting attribute parameters of a second attribute in an embodiment. [Diagram 5] FIG. 13 is a schematic diagram of a setting interface for setting attribute parameters of a third attribute in an embodiment. [Figure 6] FIG. 2 is a schematic diagram of a preset model in one embodiment. [Figure 7] FIG. 2 is a schematic diagram of particles obtained by sampling in one embodiment. [Figure 8] FIG. 2 is a schematic diagram of calculating motion state information in one embodiment. [Figure 9] FIG. 13 is a relationship diagram of classes provided by the particle emission plugin in one embodiment. [Figure 10] FIG. 13 is a schematic diagram showing modules displayed in a settings interface in one embodiment. [Figure 11] FIG. 13 is a diagram illustrating the effect of particle rotation in one embodiment. [Figure 12] 1 is a flow chart of a simulation process invocation in one embodiment. [Figure 13] FIG. 1 is a block diagram of a physical special effects rendering device according to one embodiment. [Figure 14] FIG. 2 is a diagram illustrating an internal configuration of a computer device according to an embodiment. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0014] Hereinafter, the technical means in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application, and obviously, the described embodiments are only some embodiments of the present application, not all of them, and all other embodiments that a person skilled in the art can obtain based on the embodiments of the present application without creative labor all belong to the protection scope of the present application.
[0015] The physical special effect rendering method according to the present application can be applied to an application environment as shown in Fig. 1. The computer device 102 may be a terminal or a server. The terminal may be, but is not limited to, various personal computers, notebook computers, smartphones, tablets, and portable wearable devices. The server may be an independent server or a server cluster composed of multiple servers. A particle emission plug-in is installed in the computer device 102, and the computer device obtains physical special effect data in a frame immediately before the physical special effect particle emitted by the particle emission plug-in, and further obtains a first target instance obtained by instantiating a scene management class inheriting from a target base class provided by the particle emission plug-in. Then, through the first target instance, the computer device calls a scene management interface of a particle simulation tool integrated in the particle emission plug-in, and calculates motion state information in a current frame of the physical special effect particle based on the physical special effect data in the immediately before frame in the scene manager of the particle simulation tool, and updates the physical special effect data in the immediately before frame based on the motion state information in the current frame. Based on the updated physical special effect data, the computer device 102 can render and obtain the physical special effect in the current frame, and can display the rendered physical special effect on the interface of the computer device.
[0016] In one embodiment, as shown in FIG. 2, a method for rendering physical special effects is provided, and the method is described by taking the application of the method to the computer device in FIG. 1 as an example, and includes the following steps 202, 204, 206, and 208.
[0017] In step 202, physical effect data in the frame immediately preceding the physical effect particle emitted by the particle emission plug-in is obtained.
[0018] A particle emission plug-in refers to a plug-in that can emit physical special effect particles. The particle emission plug-in may be, for example, a Niagara plug-in in the game engine Unreal Engine (UE), and the plug-in simultaneously integrates a particle simulation tool that can simulate physical special effects. The physical special effects may be effects that express physical processes in animation, such as the blowing of wind, the swaying of leaves, and the scattering of debris caused by the explosion of an object, which are felt in daily life. Animations include, but are not limited to, game animations and movie animations. The use of physical special effects brings a more realistic game feel, makes the animation look more realistic and more impactful, and gives the feeling of being in the place. The physical special effect particles refer to substances that cannot be divided further in the simulation of physical special effects, and may be, for example, snow particles, sand particles, oil particles, water particles, etc., and more broadly, hair, cloth, etc., and are also collectively referred to as particles. The physical special effect data refers to particle-related data generated in the process of performing a physical special effect simulation, and the physical special effect data includes at least attribute information and motion state information of the physical special effect particles, and the attribute information of the physical special effect particles may include basic information such as the mass, particle number, and life cycle of the physical special effect particles, and the motion state information may refer to state information when the physical special effect particles move, and may include information such as the speed, deformation gradient, shaping state, and position information of the physical special effect particles.
[0019] In one embodiment, the physical special effect data further includes a force value of the physical special effect particle, the force value representing the magnitude of the force received by the physical special effect particle, and the force received by the physical special effect particle may refer to all acting forces that the physical special effect particle may be subjected to, for example, acting forces, frictional forces, gravity, etc. that the physical special effect particle receives from other physical special effect particles.
[0020] Specifically, the computing device can read from the video memory allocated to the particle emission plug-in the physical special effect data in the frame immediately preceding the physical special effect particles emitted by the particle emission plug-in.
[0021] In addition, the physical special effect particles emitted by the particle emission plug-in have a life cycle, and in different animation frames, the particles disappear as the particle's life cycle ends. Therefore, when the computer device obtains physical special effect data, the computer device obtains physical special effect data corresponding to the currently living particles.
[0022] In addition, if the immediately preceding frame is the first frame, the physical special effect data in the immediately preceding frame may be obtained by initializing it to a numerical value set by the user, and if the immediately preceding frame is an intermediate frame, the physical special effect data in the immediately preceding frame is obtained by updating the physical special effect data in the immediately preceding frame.
[0023] In step 204, a first target instance is obtained by instantiating a scene management class, which inherits from the target base class provided by the particle emission plug-in.
[0024] The target base class is a base class that defines a data interface in a base class collection provided by the particle emission plug-in, and the target base class is an abstract data interface class, and the data interface class includes an abstract method for calling a particle simulation tool. The target base class can derive a plurality of subclasses as a parent class, and when each subclass realizes the data interface defined by the target base class, it rewrites the abstract method in the data interface to call a specific data interface of the particle simulation tool. The scene management class inherits from the target base class, that is, the scene management class is a subclass derived from the target base class, and the scene management class realizes the data interface defined by the target base class to call the scene management interface of the particle simulation tool. The particle simulation tool is a program module that can realize particle simulation, and the particle simulation tool can calculate the motion state information of particles in the simulation process. The first target instance is obtained by instantiating the scene management class, and it can realize calling the scene management interface of the particle simulation tool by the method of the scene management class.
[0025] In one embodiment, the particle simulation tool may be, for example, a physion tool, and the algorithm used in Physion is MPM (Material Point Method), which can simulate various physical materials such as snow, smoke, water, oil, muscle, hair, etc. based on a unified algorithm framework. At the same time, Physion realizes all MPM on the CUDA (Compute Unified Device Architecture) line, and performs parallel calculations on the GPU (graphics processing unit), greatly improving calculation efficiency.
[0026] Specifically, the computer device can obtain a first target instance in the particle emission plug-in, and the first target instance is generated by instantiating a scene management class in the creation process of the physical special effect. By instantiating the scene management class in the particle emission plug-in, a scene management interface of a particle simulation tool can be called in the execution process of the particle emission plug-in to realize the simulation calculation of the physical special effect particle.
[0027] In one embodiment, the first target instance is generated by the steps of first determining a base class for calling a data interface provided by the particle simulation tool from a set of base classes provided by the particle emission plug-in to obtain a target base class, then creating a scene management class that inherits from the target base class, and finally instantiating the scene management class to obtain the first target instance.
[0028] In step 206, a scene management interface of a particle simulation tool integrated in the particle emission plug-in is called via the first target instance, and the scene manager of the particle simulation tool calculates the motion state information of the physical special effect particle in the current frame based on the physical special effect data in the previous frame.
[0029] The particle simulation tool is integrated into the particle emission plug-in, which means that the dll (Dynamic Link Library) file and lib (library, static link library) file obtained by compiling the basic library corresponding to the particle simulation tool, as well as all header files, are integrated into the particle emission plug-in. This allows the particle emission plug-in to directly call the functions of the particle simulation tool. The scene management interface is a data interface corresponding to the scene manager of the particle simulation tool, and the scene manager can be called through the scene management interface. The scene manager is used to manage the scene of physical special effects in the particle simulation tool and realize simulation calculations for the physical special effect particles in the scene.
[0030] Specifically, after obtaining the first target instance, the computing device can call the scene management interface of the particle simulation tool integrated in the particle emission plug-in through the first target instance, so as to calculate the motion state information of the physical special effect particle in the current frame in the scene manager of the particle simulation tool, and can perform calculations based on the physical special effect data in the previous frame in the calculation process.
[0031] In one embodiment, the step of the computer device calculating the motion state information of the physical special effect particle in the current frame based on the physical special effect data in the previous frame in the scene manager of the particle simulation tool can be specifically calculated using the material point method (MPM). The material point method is a new calculation method that combines the Euler method and the Lagrangian method, and avoids the difficult problem of needing to solve the convection term in the Euler method, and solves the problems of grid distortion and negative volume faced when analyzing large deformation in the Lagrangian method. In the material point method, the particle exists in a set of background grids as a simulation object, and at the start of the simulation of each frame, the current motion state information of the particle is mapped to the background grid, and calculation is performed by the grid node in the background grid, and after the calculation is completed, all the information is transmitted to the particle, and then the current motion state information of the particle is updated.
[0032] In one embodiment, when the computer device calculates the motion state information of the physical special effect particle in the current frame based on the physical special effect data in the immediately preceding frame, the calculation for the current frame is divided into a plurality of time steps, and in the first time step, the motion state information of the physical special effect particle in the current time step is calculated based on the physical special effect data in the immediately preceding frame, and in each subsequent time step until the calculation of the final time step is completed, the motion state information of the physical special effect particle in the current time step is calculated based on the motion state information of the physical special effect particle in the previous time step, and the motion state information of the physical special effect particle in the final time step is the motion state information of the physical special effect particle in the current frame. The time step is the minimum time unit when calculating the motion state information of the physical special effect particle in the current frame, and the time difference between the end time of the current time step and the end time of the immediately preceding time step is the step size of the current time step, and the step size of the time step may be preset as necessary. For example, the time interval between the previous frame and the current frame is t1, and t1 can be equally divided into 30 time steps, with the step size of each time step being t1 / 30.
[0033] In step 208, the physical special effect data in the previous frame is updated based on the motion state information in the current frame, and the physical special effect in the current frame is rendered and obtained.
[0034] The physical special effect data in the previous frame includes motion state information of the physical special effect particles in the previous frame. The physical special effect in the current frame is the physical special effect formed by the physical special effect particles in the current frame through simulation.
[0035] Specifically, the computer device can replace the motion state information of the physical special effect data in the previous frame with the motion state information in the current frame to update the physical special effect data in the previous frame, obtain the updated physical special effect data, and render and obtain the physical special effect in the current frame based on the updated physical special effect data. The computer device can further display the physical special effect rendered in the current frame and complete a simulation for the physical special effect.
[0036] In one embodiment, updating the physical special effect data further includes updating the life status of physical special effect particles in the physical special effect data, erasing dead particles, updating the force reception status of living particles, etc.
[0037] In one embodiment, in the rendering process, the computer device can render the physical special effect particles with texture-mapped quadrilateral sprites, and in the case of low resolution or limited processing power, the particles may be rendered as one pixel, and in the case of offline rendering, they can be rendered as one sphere, and a very good liquid surface can be obtained from the isosurface calculated by the particle sphere. The particles can also be rendered in a three-dimensional grid. In a specific application, when the particle emission plug-in is a Niagara plug-in, four particle renderers can be provided, which respectively use sprite, mesh, ribbon, and light to render the particles.
[0038] In the above-mentioned physical special effect rendering method, a first target instance is obtained by instantiating a scene management class by obtaining physical special effect data in a frame immediately before the physical special effect particle emitted by the particle emission plug-in, the scene management class is inherited from a target base class provided by the particle emission plug-in, and a scene management interface of a particle simulation tool integrated in the particle emission plug-in is called through the first target instance, and in the scene manager of the particle simulation tool, motion state information in a current frame of the physical special effect particle is calculated based on the physical special effect data in the immediately before frame, and the physical special effect data in the immediately before frame is updated based on the motion state information in the current frame to render and obtain the physical special effect in the current frame; in this way, in order to integrate the particle simulation tool in the particle emission plug-in, a scene management interface of the particle simulation tool is called through the first target instance obtained by instantiating the scene management class, and motion state information is calculated in the scene manager of the particle simulation tool to render and obtain the physical special effect, thereby avoiding obtaining simulation results from outside and improving efficiency in rendering the physical special effect.
[0039] In addition, particle simulation tools are integrated into the particle emission plug-in, allowing real-time particle physics simulation in animation frames and interaction with objects in the scene, improving the accuracy of physical special effects simulation and making the rendered physical special effects more accurate and realistic.
[0040] In one embodiment, the first target instance is generated by the steps of: determining a base class for calling a data interface provided by the particle simulation tool from a set of base classes provided by the particle emission plug-in to obtain a target base class; creating a scene management class that inherits from the target base class so that a scene management interface of the particle simulation tool can be called; and instantiating the scene management class to obtain the first target instance.
[0041] The base class collection includes at least one base class, and a base class refers to a class from which a subclass can be derived. A base class for calling a data interface provided by a particle simulation tool refers to a base class from which a subclass can be derived that calls a data interface provided by a particle simulation tool as a parent class. When a data interface provided by a particle simulation tool is called, each function in the particle simulation tool can be accessed, and the particle simulation tool can provide multiple data interfaces, and when different data interfaces are called, different functions in the particle simulation tool can be accessed, for example, a scene manager in the particle simulation tool can be accessed by calling a scene management interface provided by the particle simulation tool.
[0042] In a specific embodiment, when the particle emission plug-in is a Niagara plug-in and the particle simulation tool is Physion, the target base class may be, for example, NiagaraDataInterface. The member functions included in the target base class are shown in Table 1. In the target base class, a member function "IsPhysionDataInterface()" can be defined to realize the increase of interfaces related to Physion, PostInitProperties() is for initializing variables, GetFunctions is for registering customization functions in NiagaraDataInterface, GetVMExternalFunctio is for returning a representative of the registered functions, and CanExecuteOnTarget is for setting the particle simulation to be executed on the GPU. [Table 1]
[0043] Specifically, before the animation execution process begins, the computer device determines a base class for calling the data interface provided by the particle simulation tool from the base class set provided by the particle emission plug-in, obtains a target base class, creates a subclass that inherits from the target base class, adds a call to the scene management interface of the particle simulation tool to the subclass, and rewrites the abstract method in the target base class to obtain a scene management class, and finally, instantiates the scene management class in the particle emission plug-in to obtain a first target instance in the particle emission plug-in, so that in the process of the particle emission plug-in rendering physical special effects, the first target instance can be obtained and called the scene management interface of the particle simulation tool to realize the calculation of particle motion state information.
[0044] In the above embodiment, a base class is provided that can call the data interface provided by the particle emission plug-in, so that the particle emission plug-in can extend the base class to obtain a scene management class, and the scene management class is further instantiated in the particle emission plug-in to realize the calling of the scene manager, so that the particle simulation tool can be well integrated into the particle emission plug-in.
[0045] In one embodiment, the step of instantiating the scene management class to obtain the first target instance includes the steps of creating an object corresponding to the scene management class to obtain a scene management object, packaging the scene management object to obtain the first target object, and setting the first target object as a first attribute of the particle emission plug-in to obtain the first target instance.
[0046] An object is abstracted from a class, and an object can manipulate the basic attributes and methods of a class to solve the corresponding problem. Packaging is to hide the attributes and implementation details of an object, and provide only a common access method to the outside. Packaging can isolate changes, make it easier to use, improve reusability, and improve safety. The principle of packaging is to hide all contents that do not need to be provided to the outside, hide all attributes, and provide a common method to access them.
[0047] Specifically, the computer device can create an object corresponding to the scene management class by a new operator to obtain a scene management object, then package the code of the scene management object in a predetermined packaging manner to obtain a first target object, and finally set the first target object as a first attribute of the particle emission plug-in, thereby realizing the instantiation of the scene management class into the particle emission plug-in. In one embodiment, the predetermined packaging manner can be, for example, making the attribute private, setting public get and set methods, setting functions with and without parameters, and finally rewriting the tostring method. The new operator is an operator for creating an object, and its grammatical structure is new constructor(), where constructor refers to a class corresponding to the object to be created. For example, the object corresponding to the scene management class to be created can be new NiagaraDataInterfaceScenario().
[0048] In one embodiment, when the particle emission plug-in is a Niagara plug-in, the Niagara plug-in includes a system manager and an emitter manager, and the computing device can set a scene management class as a system attribute of Niagara.
[0049] In the above embodiment, the first target instance is obtained to package the created scene management object and set it as an attribute of the particle emission plug-in. The setting interface can call the scene management function of the particle simulation tool to generate animation, thereby improving the safety and availability of the first target instance.
[0050] In an embodiment, after the step of setting the first target object as a first attribute of the particle emission plug-in to obtain a first target instance, the method further includes the steps of obtaining a first attribute value obtained by setting attribute parameters of the first attribute through a setting interface of the particle emission plug-in, setting the first attribute value as a variable value corresponding to the first target instance, and setting parameters of a scene manager corresponding to a scene management interface according to the variable value corresponding to the first target instance, and obtaining the scene manager for performing scene management in the particle simulation tool after setting.
[0051] The setting interface of the particle emission plug-in refers to an interface provided by the particle emission plug-in that can set attribute parameters of each attribute of the particle emission plug-in, and each packaged function in the particle simulation tool can be called through the interface. The variable value corresponding to the first target instance refers to the specific numerical value of the member variable in the first target instance. The attribute parameter of the first attribute is a parameter value related to the scene, and may be, for example, scene stability, frame rate, etc.
[0052] Specifically, when setting attribute parameters of a first attribute through a setting interface of a particle emission plug-in, the computer device can obtain attribute values of each attribute parameter set through the setting interface, provide values to corresponding member variables in a first target instance according to the first attribute values to obtain variable values corresponding to the first target instance, and transmit the variable values corresponding to the first target instance to a scene management interface to set a scene manager corresponding to the scene management interface, and obtain a set scene manager. The scene manager is for managing scenes in a particle simulation tool, and includes calculating physical special effect data in a scene according to the set attribute values. That is, calculating motion state information in a current frame based on physical special effect data of a physical special effect particle in a previous frame.
[0053] Take for example, as shown in Fig. 3, in one embodiment, a setting interface for setting a first attribute is provided by the particle emission plug-in. As shown in Fig. 3, the first attribute corresponds to a scene manager, and various attribute parameters of the first attribute can be set in the setting interface of the particle emission plug-in, such as the frame rate, inversion rate, stability, etc. in Fig. 3.
[0054] In the above embodiment, the attribute parameters of the first attribute can be set through the setting interface of the particle emission plug-in to obtain the first attribute value obtained. Therefore, by performing a simple setting operation in the setting interface, the parameters of the scene manager corresponding to the scene management interface can be set, and the scene manager for scene management in the particle simulation tool after setting can be obtained. The operation is simple and convenient, and there is no need to understand the underlying setting process, which improves the setting efficiency.
[0055] In one embodiment, the step of updating the physical special effect data in the previous frame based on the motion state information in the current frame to render and obtain the physical special effect in the current frame includes the steps of obtaining a second target instance obtained by instantiating a geometry management class, where the geometry management class inherits from a target base class provided by the particle emission plug-in; and calling a geometry management interface of the particle simulation tool through the second target instance, writing the motion state information in the current frame to a target video memory by a geometry manager in the particle simulation tool, and updating the physical special effect data in the previous frame in the target video memory based on the motion state information in the current frame to render and obtain the physical special effect in the current frame.
[0056] The geometry management class is a subclass that inherits from the target base class, and the geometry management class calls the geometry management interface of the particle simulation tool by implementing the data interface defined by the target base class. The geometry management interface refers to a data interface provided by the geometry manager of the particle simulation tool, and the geometry manager can be called through the geometry management interface. The geometry manager manages the attributes of objects in physical special effects in the particle simulation tool, including physical attributes such as the material, density, and brittleness of the object, and physical special effect data of the particles that constitute the object. The second target instance is obtained by instantiating the geometry management class, and therefore the geometry management interface of the geometry manager can be called through the second target instance by implementing the method of the geometry management class. The target video memory refers to a data buffer area allocated to the rendering data of the particle emission plug-in.
[0057] Specifically, the motion state information in the current frame is calculated and obtained in the particle simulation tool, the obtained motion state information is stored in a data buffer area different from the target video memory, and the geometry manager can manage the physical special effect data of the particles, so that the motion state information can be written to the target video memory by the geometry manager. Specifically, when the computer device updates the physical special effect data in the previous frame based on the motion state information in the current frame to render and obtain the physical special effect in the current frame, the computer device instantiates a geometry management class to obtain a second target instance, and calls a geometry management interface of the particle simulation tool through the second target instance to write the motion state information in the current frame to the target video memory by the geometry manager corresponding to the geometry management interface, the target video memory stores the physical special effect data in the previous frame, and after the motion state information in the current frame is written to the target video memory by the geometry manager, the physical special effect data corresponding to the previous frame in the target video memory can be updated to obtain the updated physical special effect data, and the updated physical special effect data can be used to render and obtain the physical special effect in the current frame.
[0058] In the above embodiment, the geometry management interface of the particle simulation tool is called through the second target instance, and the motion state information of the current frame is written to the target video memory by the geometry manager in the particle simulation tool, so as to quickly obtain the desired rendering data from the particle simulation tool and improve the rendering efficiency.
[0059] In one embodiment, the second target instance is generated by the steps of creating a geometry management class that inherits from the target base class so that a geometry management interface of the particle simulation tool is invoked; creating an object corresponding to the geometry management class to obtain a geometry management object; packaging the geometry management object to obtain a second target object; and setting the second target object as a second attribute of the particle emission plug-in to obtain the second target instance.
[0060] Specifically, before the animation execution process begins, the computer device determines a base class for calling the data interface provided by the particle simulation tool from the base class set provided by the particle emission plug-in to obtain a target base class, then creates a subclass that inherits from the target base class, adds a call to the geometry management interface of the particle simulation tool to the subclass, and rewrites the abstract method in the target base class to obtain a geometry management class, and finally instantiates the geometry management class in the particle emission plug-in to obtain a second target instance in the particle emission plug-in, so that in the process of rendering physical special effects by the particle emission plug-in, the second target instance can be obtained and the geometry management interface of the particle simulation tool can be called to realize the management of object attributes in physical special effects.
[0061] In the process of instantiation, the computer device creates an object corresponding to the geometry management class by a new operator to obtain a geometry management object, then packages the code of the geometry management object in a predetermined packaging manner to obtain a second target object, and finally sets the second target object as a second attribute of the particle emission plug-in, thereby realizing the instantiation of the geometry management class into the particle emission plug-in.
[0062] In one embodiment, when the particle emission plug-in is a Niagara plug-in, the Niagara plug-in includes a system manager and an emitter manager, and the computing device can set a geometry management class as an emitter attribute of Niagara.
[0063] In the above embodiment, the particle emission plug-in provides a base class that can call the data interface provided by the particle simulation tool, and can extend the base class to obtain a geometry management class, and then instantiates the geometry management class in the particle emission plug-in to realize the calling of the geometry manager, so that the particle simulation tool can be well integrated into the particle emission plug-in; and the created geometry management object is packaged and set as an attribute of the particle emission plug-in to obtain a second target instance, so that a technical artist can create animations by directly calling the geometry management function of the particle simulation tool through the setting interface without the need for programmer cooperation, and improves the safety and availability of the second target instance.
[0064] In an embodiment, after the step of setting the second target object as a second attribute of the particle emission plug-in to obtain a second target instance, the method further includes the steps of: obtaining a second attribute value obtained by setting attribute parameters of the second attribute through a setting interface of the particle emission plug-in; setting the second attribute value as a variable value corresponding to the second target instance; and setting a geometry manager corresponding to a geometry management interface by the variable value corresponding to the second target instance to obtain the geometry manager for performing geometry management in the particle simulation tool after setting.
[0065] The particle emission plug-in setting interface refers to an interface provided by the particle emission plug-in that can set attribute parameters of each attribute of the particle emission plug-in, and each function of the particle simulation tool can be packaged and called through the interface. The variable value corresponding to the second target instance refers to the specific numerical value of the member variable in the second target instance. The attribute parameter of the second attribute is a parameter value related to the attribute of an object in a physical special effect, and may be, for example, the material, density, etc. of the object.
[0066] Specifically, when setting attribute parameters of a second attribute through a setting interface of a particle emission plug-in, the computing device can obtain attribute values of each attribute parameter set through the setting interface, assign values to corresponding member variables in the second target instance according to the second attribute values to obtain variable values corresponding to the second target instance, and transmit the variable values corresponding to the second target instance to a geometry management interface to set a geometry manager corresponding to the geometry management interface to obtain a set geometry manager, where the geometry manager is for managing attributes of objects in physical special effects in a particle simulation tool.
[0067] Take an example, as shown in Fig. 4, in one embodiment, a setting interface for setting a second attribute by a particle emission plug-in. As shown in Fig. 4, the second attribute corresponds to a geometry manager, and various attribute parameters of the second attribute can be set in the setting interface of the particle emission plug-in, such as density, material, material model, hardness, etc. in Fig. 4.
[0068] In the above embodiment, the attribute parameters of the second attribute can be set through the setting interface of the particle emission plug-in to obtain the second attribute value obtained. Therefore, by performing a simple setting operation in the setting interface, the parameters of the geometry manager corresponding to the geometry management interface can be set, and the geometry manager for performing geometry management in the particle simulation tool after the setting can be obtained. The operation is simple and convenient, and there is no need to understand the underlining setting process, which improves the setting efficiency.
[0069] In one embodiment, the method further includes a step of obtaining a third target instance obtained by instantiating a boundary condition management class, where the boundary condition management class inherits from a target base class provided by the particle emission plug-in; and a step of calling a boundary condition management interface of the particle simulation tool via the third target instance to obtain the target boundary condition in a boundary condition manager of the particle simulation tool, wherein the step of calculating, in a scene manager of the particle simulation tool, motion state information in a current frame of the physical special effect particle based on the physical special effect data in a previous frame includes a step of calculating, in the scene manager of the particle simulation tool, motion state information in a current frame of the physical special effect particle based on the physical special effect data in a previous frame and the target boundary condition.
[0070] The boundary condition management class is a subclass that inherits from the target base class, and the boundary condition management class calls the boundary condition management interface of the particle simulation tool by implementing the data interface defined by the target base class. The boundary condition management interface refers to an interface provided by the boundary condition manager of the particle simulation tool, and the boundary condition manager can be called through the boundary condition management interface. The boundary condition manager is for managing the boundary conditions in the scene in the particle simulation tool. The boundary conditions are Signed Distance Fields (SDF), which are objects that can participate in the simulation and collide with particles in the particle simulation tool. The boundary conditions include three types: ground, static body, and skeletal animation, where the ground and static body are static, and the skeletal animation is dynamic. Compared with particles, the difference is that the position change of the SDF is not dynamically calculated, but is fixed in advance (static) or driven by the FBX model (dynamic). The target boundary condition is the boundary condition that corresponds to a predetermined boundary condition parameter. The third target instance is obtained by instantiating the boundary condition management class, and thus, through the third target instance, the method of the boundary condition management class can be realized to invoke the boundary condition management interface, thereby realizing the management of boundary conditions.
[0071] Specifically, in a physical special effect that needs to simulate a collision effect, a parameter corresponding to a target boundary condition can be set in advance, so that during animation execution, the computer device can obtain a third target instance obtained by instantiating the boundary condition management class, and call the boundary condition management interface of the particle simulation tool through the third target instance to obtain the target boundary condition in the boundary condition manager based on the parameter corresponding to the target boundary condition. Since the target boundary condition is obtained, when calculating the motion state information of the physical special effect particle in the current frame, the target boundary condition can be registered in the scene manager, and the scene manager calculates the motion state information of the physical special effect particle in the current frame based on the physical special effect data in the previous frame and the target boundary condition. For example, assuming that the target boundary condition is the ground, the source parameter of the boundary condition can be specified to be "plane actor" during setting, so that the "plane actor" in the scene can be set as the ground in the boundary condition manager.
[0072] In the above embodiment, the boundary condition management interface of the particle simulation tool is called through the third target instance to obtain the target boundary condition in the boundary condition manager, so that the calculation of the collision process can be simulated in the scene manager, and the physical special effects obtained by the simulation can be diversified.
[0073] In one embodiment, the third target instance is generated by the steps of: creating a boundary condition management class that inherits from a target base class, such that a boundary condition management interface of the particle simulation tool is invoked; creating a target derived class that inherits from the boundary condition management class and corresponds to a type setting parameter; and instantiating the target derived class to obtain the third target instance, where the type setting parameter is a parameter obtained by setting the type of the boundary condition manager obtained via the setting interface of the particle emission plug-in.
[0074] In the embodiment of the present application, when a data interface provided by the particle simulation tool is called, each function in the particle simulation tool can be accessed, and the particle simulation tool can provide multiple data interfaces, and when different data interfaces are called, different functions in the particle simulation tool can be accessed. For example, when it is necessary to access a boundary condition manager in the particle simulation tool, this can be realized by calling a boundary condition management interface provided by the particle simulation tool. The boundary condition manager is for managing boundary conditions, including generating boundary conditions corresponding to setting parameters.
[0075] The type setting data is data that represents the type of boundary condition manager. Different boundary conditions correspond to different boundary condition managers, for example, the ground boundary condition is managed by the ground boundary condition manager. If multiple different types of boundary condition managers are required, multiple type setting parameters can be set to obtain different target derived classes for different type setting parameters. Take the particle emission plug-in as an example, Niagara. In the Niagara System, Sdf can only be used as an external input, so if a user wants to add Sdf as a collision body, the user needs to add the corresponding type of NiagaraDataInterfaceSdf to User Exposed, and can set three different types of type setting parameters, for example, ground boundary condition (GroudSdf), skeletal animation boundary condition (SkeletalMeshSdf), and static body boundary condition (StaticMeshSdf).
[0076] Specifically, before the animation execution process starts, the computer device determines a base class for calling the data interface provided by the particle simulation tool from the base class set provided by the particle emission plug-in to obtain a target base class, and then creates a subclass inheriting from the target base class, and adds a call to the boundary condition management interface of the particle simulation tool to the subclass to rewrite the abstract method in the target base class to obtain a boundary condition management class. Since the boundary condition managers have different types, it is necessary to create a target derived class corresponding to the type setting parameters based on the boundary condition management class, and finally instantiate the target derived class in the particle emission plug-in to obtain a third target instance in the particle emission plug-in. In this way, in the process of rendering physical special effects through the particle emission plug-in, the third target instance can be obtained and the boundary condition management interface corresponding to the third target instance type in the particle simulation tool can be called to realize the calculation of the motion state information during the collision of particles.
[0077] In the above embodiment, the particle emission plug-in provides a base class that can call the data interface provided by the particle simulation tool, and can extend the base class to obtain a boundary condition management class; and based on the boundary condition management class, different derived classes can be derived and instantiated in the particle emission plug-in to realize the calling of different types of boundary condition managers, so that the particle simulation tool can be well integrated into the particle emission plug-in.
[0078] In one embodiment, the step of instantiating the target derived class to obtain a third target instance includes the steps of creating an object corresponding to the target derived class to obtain a target boundary condition management object, packaging the target boundary condition management object to obtain a third target object, and setting the third target object as a third attribute of the particle emission plug-in to obtain the third target instance.
[0079] Specifically, in the process of instantiation, the computer device creates an object corresponding to the target derived class by a new operator to obtain a target boundary condition management object, then packages the code of the target boundary condition management object in a predetermined packaging manner to obtain a third target object, and finally sets the third target object as a third attribute of the particle emission plug-in, thereby realizing the instantiation of the target derived class into the particle emission plug-in.
[0080] In one embodiment, when the particle emission plug-in is a Niagara plug-in, the Niagara plug-in includes a system manager and an emitter manager, and the computing device can set the target derived class as a system attribute of Niagara.
[0081] In the above embodiment, the created target boundary condition management object is packaged and set as an attribute of the particle emission plug-in to obtain the third target instance, so that the technical artist can directly call the boundary condition management function of the particle simulation tool through the setting interface without the need for the cooperation of a programmer, thereby improving the safety and availability of the third target instance.
[0082] In an embodiment, after the step of setting the third target object as a third attribute of the particle emission plug-in to obtain a third target instance, the method further includes the steps of: obtaining a third attribute value obtained by setting attribute parameters of the third attribute through a setting interface of the particle emission plug-in; setting the third attribute value as a variable value corresponding to the third target instance; and setting parameters of a boundary condition manager corresponding to the boundary condition management interface according to the variable value corresponding to the third target instance, and obtaining the set boundary condition manager for performing boundary condition management in the particle simulation tool.
[0083] The attribute parameters of the third attribute refer to parameters related to boundary conditions in physical special effects, and are used to specify objects that correspond to the boundary conditions.
[0084] Specifically, when setting attribute parameters of a third attribute through a setting interface of a particle emission plug-in, the computer device can obtain attribute values of each attribute parameter set through the setting interface, assign values to corresponding member variables in a third target instance according to the third attribute values to obtain variable values corresponding to the third target instance, and transmit the variable values corresponding to the third target instance to a boundary condition management interface corresponding to the third target instance to set a boundary condition manager corresponding to the boundary condition management interface, and obtain a set boundary condition manager, which is for managing a corresponding type of boundary condition in a particle simulation tool.
[0085] When multiple types of scene managers are set in advance, multiple target derived classes are obtained by creating a target derived class that inherits from the boundary condition management class for each scene manager.
[0086] For each target derived class, a corresponding object is created to obtain a corresponding target boundary condition management object, and each target boundary condition management object is all packaged to obtain multiple third target objects, and each third target object is set as a third attribute of the particle emission plug-in to obtain multiple third target instances. In order to facilitate the setting and improve the setting efficiency, when the third attribute value obtained by setting the attribute parameters of each third attribute through the setting interface of the particle emission plug-in is obtained, it can be obtained through the same setting interface. For example, as shown in FIG. 5, in one embodiment, the setting interface for setting the third attribute by the particle emission plug-in. As shown in FIG. 5, the same interface includes parameter setting items for the ground, skeletal animation, and static body, and the attribute values for three different types of boundary conditions of the ground, skeletal animation, and static body can be obtained simultaneously through the interface.
[0087] In the above embodiment, the attribute parameters of the third attribute can be set through the setting interface of the particle emission plug-in to obtain the third attribute value obtained. Therefore, by performing a simple setting operation in the setting interface, the parameters of the geometry manager corresponding to the geometry management interface can be set. The operation is simple and convenient, and there is no need to understand the underlying setting process, which improves the setting efficiency.
[0088] In one embodiment, the step of calculating, in a scene manager of the particle simulation tool, motion state information of the physical special effect particle in a current frame based on the physical special effect data in a previous frame includes a step of calculating, in the scene manager of the particle simulation tool, motion state information of the physical special effect particle in a current frame based on the physical special effect data in a previous frame, and writing the motion state information to a first video memory; the step of updating the physical special effect data in the previous frame based on the motion state information in the current frame and rendering and obtaining the physical special effect in the current frame includes a step of reading the motion state information in the current frame from the first video memory and copying the motion state information in the current frame; and a step of writing the copied motion state information to a second video memory and updating the physical special effect data in the previous frame in the second video memory based on the motion state information in the current frame, wherein the first video memory is a data buffer area allocated to the particle simulation tool in a target video memory of the particle emission plug-in, and the second video memory is a data buffer area in the target video memory different from the first video memory, for storing particle emission data and particle rendering data.
[0089] In this embodiment, the particle emission plug-in is a Niagara plug-in, and the particle simulation tool integrated in the plug-in is Physion. In Niagara's GPU Sim mode, Niagara uses a high-level shading language (abbreviated as HLSL) to operate a GPU buffer (a data buffer area corresponding to a GPU), and Physion uses Cuda (Compute Unified Device Architecture) to operate the GPU buffer. However, since HLSL and CUDA cannot call each other, in the embodiment of the present application, an interoperability method between CUDA and Compute Shader is used to realize indirect interaction.
[0090] Specifically, a first video memory may be allocated to physion, and the first video memory may operate using CUDA, and a second video memory may be allocated to Niagara, and the second video memory may operate using Compute Shader, and data in the first video memory and the second video memory may realize GPU to GPU data transmission in a copy manner. The first video memory mainly stores particle emission data and particle rendering data, where the particle emission data refers to particle attribute data stored when a particle emitter of Niagara emits particles, and the particle rendering data refers to particle physical special effect data stored when Niagara performs a rendering step.
[0091] Since the motion state information in the current frame is calculated by the scene manager of the particle simulation tool, the calculated motion state information is written to a first video memory allocated to Physion, and rendering of physical special effects is performed in Niagara, the computer device can read the motion state information in the current frame from the first video memory, copy the motion state information in the current frame, and write the copied motion state information to a second video memory, and update the physical special effect data in the previous frame in the second video memory based on the motion state information in the current frame.
[0092] In the above embodiment, by allocating different video memories and realizing interoperability between different programming languages by using a data copying method, Physion can be conveniently and quickly integrated into Niagara without the need for large-scale code modifications, thereby improving development efficiency.
[0093] In one embodiment, the method further includes the steps of emitting a predetermined number of initial particles at a position of the preset model and writing attribute information of the initial particles to a second video memory; reading the attribute information of the initial particles from the second video memory and copying the attribute information of the initial particles; writing the copied attribute information of the initial particles to a first video memory, and sampling on and inside the preset model by a particle simulation tool based on the attribute information of the initial particles in the first video memory to obtain physical special effect particles used in physical special effect simulation.
[0094] The preset model controls the generation position of the particles, and may be a model of a geometry of regular or irregular shape, for example, a ring, a sphere, a cone, etc. The preset model may be a mesh such as a Static Mesh or a Skeletal Mesh, and as shown in Figure 6, a schematic diagram of a preset model in one embodiment is shown, and 602 in Figure 6 is a preset model.
[0095] In addition, in the prior art, when Niagara generates particles in a mesh, it can only sample on the surface of the mesh. For example, the particles obtained by sampling based on the surface of the static mesh shown in 602 in FIG. 6 are shown in FIG. 7(a), and it can be seen that the sampled particles are only on the surface of the head, and there are no sampled particles inside. This generation method does not necessarily meet the needs of use, and in actual use, it may be necessary to generate particles inside the mesh. For example, if it is necessary to simulate the effect of snowball shattering and require different physical parameters of different parts of the snowball, it is necessary to divide one sphere into multiple meshes, and then sample each mesh as one sampling body, and divide one sphere into multiple Emitters, and then set different physical parameters for each Emitter. Based on this, in the embodiment of the present application, the particle sampling function in Physion can be accessed to perform particle sampling on both the surface and the inside of the mesh. For example, the particles obtained by sampling based on the surface and the inside of the static mesh shown in 602 in FIG. 6 are shown in FIG. 7(b).
[0096] In this embodiment, a predetermined number of initial particles are emitted at the position of the preset model by the Niagara plug-in, and the attribute information of the initial particles is written to the second video memory allocated to Niagara. Since the particles need to be sampled by Physion, the attribute information of the initial particles needs to be read from the second video memory, the attribute information of the initial particles needs to be copied, and the copied attribute information of the initial particles needs to be written to the first video memory allocated to Physion, so that the physical special effect particles are obtained by sampling on the surface and inside of the preset model to simulate physical special effects.
[0097] In the above embodiment, the attribute information of the initial particles is read from the second video memory, the attribute information of the initial particles is copied, and the copied attribute information of the initial particles is written to the first video memory. The particle simulation tool samples the surface and interior of the preset model based on the attribute information of the initial particles in the first video memory, so that the physical special effect particles obtained by sampling can better meet the simulation needs of special effects.
[0098] In one embodiment, in a scene manager of a particle simulation tool, the step of calculating motion state information of physical special effect particles in a current frame based on physical special effect data in a previous frame includes the steps of: mapping, in a scene manager of the particle simulation tool, the physical special effect data in the previous frame onto a predetermined background grid, where the background grid includes a plurality of grid nodes; calculating, in the background grid, motion state information of grid nodes corresponding to each physical special effect particle in the current frame based on the physical special effect data; and mapping the motion state information of each grid node to a corresponding physical special effect particle to obtain motion state information of each physical special effect particle in the current frame.
[0099] The background grid refers to a simulation space for placing physical special effect particles in the calculation process, and the background grid includes at least a plurality of grid nodes, where a plurality refers to at least two. In one embodiment, the background grid can be divided into at least one grid block, where each grid block includes at least one grid for placing physical special effect particles, and each grid corresponds to at least one grid node. In order to reduce memory usage, the grid blocks can be sparsely stored in one data structure, i.e., only the grid blocks on which the physical special effect particles fall are assigned corresponding memory.
[0100] Specifically, the computer device can interpolate the physical special effect data in a frame immediately before the physical special effect particle to a predetermined background grid by a shape function, and for a certain physical special effect particle, the grid node interpolated by the physical special effect data of the physical special effect particle is the corresponding grid node in the background grid of the physical special effect particle, and the computer device further calculates the motion state information of the grid node in the background grid based on these interpolation information, and then maps the calculated motion state information back to the physical special effect particle corresponding to the grid node by a shape function to obtain the motion state information of each physical special effect particle in the current frame. Interpolation may refer to interpolating a continuous function based on discrete data, so that the continuous curve passes through all the predetermined discrete data points. Interpolation is an important method of discrete function approximation, which can be used to estimate the approximate value at other points of the function according to the situation of the value taken at a finite number of points of the function.
[0101] As shown in Fig. 8, in a specific embodiment, the flow chart of calculating the motion state information by the background grid is shown in Fig. 8. As shown in Fig. 8, specifically, the method includes the following steps 1 to 10.
[0102] Step 1 involves interpolating the mass and velocity of physical effect particles onto a background grid.
[0103] Step 2 calculates the volume of the physical special effects particles.
[0104] In step 3, the force values of the grid nodes are calculated based on the calculated volumes.
[0105] In step 4, information such as the velocity and displacement of the grid nodes is calculated based on the calculated force values.
[0106] In step 5, collision detection with boundary conditions is performed for the grid nodes.
[0107] In step 6, after collision detection, information such as the velocity and displacement of the grid nodes is implicitly calculated.
[0108] In step 7, the calculated information is mapped to the corresponding physical special effect particles to update the deformation gradients of the physical special effect particles.
[0109] Step 8 updates the velocity of the physical effect particles based on the deformation gradient.
[0110] In step 9, collision detection with the boundary conditions is performed on the particles.
[0111] In step 10, the motion state information of the physical special effect particles, such as their velocities and positions, is updated based on the new particle velocities.
[0112] As can be seen from the flow in Figure 8, when performing a simulation, each physical special effect particle needs to store its own attribute values such as its mass, position, velocity, deformation gradient, elastic-plastic physical parameters, etc., and the grid node needs to calculate the force receiving situation, acceleration situation, velocity increment, and processing for boundary conditions (i.e., collision bodies), etc.
[0113] In specific implementation, in order to ensure the accuracy of the calculation, the current frame is divided into multiple time steps, and the motion state information is calculated once at each time step. After the cumulative time of the multiple time steps becomes the time of the current frame, each new attribute value of the physical special effect particle can be output as the result of the current frame.
[0114] In the above embodiment, the particle motion state information is calculated by mapping the physical special effect data to the background grid, and the background grid is greatly reduced relative to the number of particles, thus saving overhead in the calculation process.
[0115] The present application further provides an application scenario in which the rendering method of physical special effects is applied to realize the rendering of physical special effects in games by the rendering method of physical special effects. Specifically, in the application scenario, the particle emission plug-in is Niagara, and the particle emission plug-in is integrated with the particle simulation tool Physion. Niagara is the main next-generation particle system in UE. With Niagara, TA (Technical Artist) can create additional functions by himself without the cooperation of programmers. Niagara has the characteristics of being easy to use and understand, and Niagara allows artists to fully control, program, and customize effects, provide better debugging, display and performance tools, and support data from other parts of UE or outside, without interfering with user operations.
[0116] The particle emission plug-in according to an embodiment of the present application provides various classes that inherit from the data interface class (NiagaraDataInterface), and can access these classes in Niagara. By instantiating them in the Niagara System and Niagara Emitter, it is possible to call Physion in the Niagara execution process, and further realize the function of dynamic calculation for particles. As shown in FIG. 9, this is a class relationship diagram of the particle emission plug-in. The class relationship diagram includes the following main classes: a data interface class (NiagaraDataInterface) is a target base class, from which three subclasses are derived: a scene management class (NiagaraDataInterfaceScenario), a geometry management class (NiagaraDataInterfaceGeometry), and a boundary condition management class (NiagaraDataInterfaceSdf). From the boundary condition management class (NiagaraDataInterface Sdf), three subclasses are derived: a first derived class (NiagaraDataInterfaceStaticMeshSdf) corresponding to a static body, a second derived class (NiagaraDataInterfaceSkeletalMeshSdf) corresponding to a skeletal animation, and a third derived class (NiagaraDataInterfaceGroundSdf) corresponding to the ground. Each of these subclasses will be described below.
[0117] 1, NiagaraDataInterfaceScenario
[0118] In the particle emission plug-in according to the embodiment of the present application, the class NiagaraDataInterfaceScenario corresponds to Scenario in Physion, i.e., the scene manager of the current simulation. In Niagara, one Niagara System corresponds to one NiagaraDataInterfaceScenario, i.e., NiagaraDataInterfaceScenario is the only attribute of one Niagara System, and all particles in one Niagara System can collide and interact with each other (even if they belong to different Emitters), while particles in different Niagara Systems are isolated from each other and cannot affect each other.
[0119] 2, NiagaraDataInterfaceGeometry
[0120] In the particle emission plug-in according to an embodiment of the present application, the class NiagaraDataInterfaceGeometry corresponds to the geometry manager Geometry in Physion, and in Niagara, one Niagara Emitter corresponds to one NiagaraDataInterfaceGeometry, i.e., NiagaraDataInterfaceGeometry is the only attribute of one Niagara Emitter, particles of the same Emitter are initialized using the same set of parameters, and one System may include multiple Emitters, i.e., multiple Geometry, and at the start of a simulation, in the Scenario initialization stage, data for each Emitter is obtained, and initialization of the System's Scenario is completed.
[0121] 3. NiagaraDataInterfaceSdf
[0122] In the particle emission plug-in according to the embodiment of the present application, NiagaraDataInterfaceSdf derives subclasses for different purposes as a base class for boundary conditions, and includes the following subclasses 1) to 3).
[0123] 1)NiagaraDataInterfaceStaticMeshSdf
[0124] This subclass can take an Actor that contains a Static Mesh Component in the scene as input, and Physion samples the Static Mesh to obtain SDF format data that can participate in collision calculations, inputting this data into the Scenario as a static boundary condition for the simulation.
[0125] 2)NiagaraDataInterfaceSkeletalMeshSdf
[0126] This subclass takes an Actor containing a Skeletal Mesh Component in the scene as input, and Physion samples the Skeletal Mesh in the current frame state in each frame to obtain SDF format data that can participate in collision calculations, which is input into Scenario. Compared to Static Mesh SDF, Skeletal Mesh SDF needs to be updated each frame and is used as a boundary condition for the motion state in the case of a simulation.
[0127] 3)NiagaraDataInterfaceGroundSdf
[0128] The boundary condition obtained by this subclass is typically specified as a Plane Actor in the scene, an infinitely extending plane that particles cannot pass through and can typically be used as the ground.
[0129] In addition, Sdf can only be used as an external input in simulations, and the only way to do this is to mount an Actor in the scene to a Niagara Component in the scene and compile particles in the Niagara System; it is not possible to introduce Sdf to collide with particles.
[0130] Furthermore, in this application scenario, each function in Physion is packaged, the corresponding addable attribute is added to the setting interface of Niagara, and the module script already created is called in the corresponding Niagara, thereby realizing the integration of Physion into Niagara. As shown in Figure 10, it is a schematic diagram of Niagara displaying each module in the setting interface, and the setting interface mainly includes two modules, NiagaraSystem and NiagaraEmitter, NiagaraSystem functions as a manager of the current system, NiagaraEmitter functions as an emitter in the current system, the NiagaraSystem module mainly includes two modules, system spawn and system update, and the NiagaraEmitter module mainly includes four modules, emitter spawn, emitter update, particle spawn and particle update, and different modules perform steps of different stages, and these modules are described below respectively.
[0131] 1. Regarding system spawn, the module in question includes the following modules 1) to 3).
[0132] 1) Scene Manager Settings (Set PhysionScenario)
[0133] In this module, the system attribute PhysionScenario, that is, an instance with NiagaraDataInterfaceScenario as the System attribute, can be set, and in this module, the attribute parameters of PhysionScenario can be set. For details, see FIG. 3.
[0134] 2) Scene Manager Reset (NM Reset Scenario)
[0135] This module functions to clear the data from the previous simulation and reset Physion to its initial state in preparation for the next simulation each time a Niagara cycle begins.
[0136] 3) Ground initialization (NM Init Ground Sdf), Skeletal animation initialization (NM Init Skeletal Mesh Sdf), and Static body initialization (NM Init Static Mesh Sdf)
[0137] These three modules initialize different types of boundary conditions, please refer to the above embodiment for details.
[0138] In addition, since Sdf can only be used as an external input in the Niagara System, if a user wants to add an Sdf as a collision object, the user needs to add the corresponding type of NiagaraDataInterfaceSdf to User Exposed. After adding NiagaraDataInterfaceSdf to User Exposed, the user can specify the corresponding parameters in the attributes in the scene. For example, a Static Mesh in the scene is referenced as an object that collides with and interacts with particles. As shown in Figure 5, PhysionGroundSdf in Figure 5 specifies the plane in the scene as the ground, and PhysionSkeletalMeshSdf specifies the reptile in the scene as the object with skeletal animation specified.
[0139] In short, in the System Spawn stage, the main role is to reset each parameter in the Scenario and then initialize Sdf, but other contents are not initialized in the System Spawn stage. This is because the initialization of other parts needs to depend on particle information, and particles have not yet been generated in the System Spawn stage. Since particles are generated in the Particle Spawn stage, only Sdf that does not depend on particles can be initialized in the System Spawn stage, and the initialization of other parts needs to be completed later.
[0140] 2. Regarding System Update, the module mainly includes the following modules 1) to 3).
[0141] 1) Scene Manager Initialization (NM Init Scenario)
[0142] It includes calling the initialization function of the scene manager, using the data initialized by the geometry manager and boundary condition manager, sending all data to the GPU side, and completing other lower-level data preparation tasks.
[0143] 2) Skeletal animation update (NM Update Skeletal Mesh Sdf)
[0144] Since the skeletal mesh moves constantly during animation playback and the SDF information of the skeletal mesh needs to be updated in each frame, this module needs to be called in the System Update phase to update the skeletal mesh SDF in the scene, and according to the number of skeletal mesh SDFs participating in the calculation in the scene, the corresponding number of NM Update Skeletal Mesh SDFs needs to be added, and each one is specified as the corresponding skeletal mesh.
[0145] 3) Physion update (NM Update Physion)
[0146] This module drives Scenario to calculate the physical state of particles in the current frame, updates information such as the positions of all particles, and needs to be called every frame. It updates the force values and life cycles of each physical special effect particle in the physion data buffer area, and drives the particles to simulate the motion state of the next frame.
[0147] 3. Regarding the Emitter Spawn, the module includes the following modules 1) to 2).
[0148] 1) Geometry Manager Settings (Set PhysionGeometry)
[0149] In this module, the emitter attribute PhysionGeometry, i.e., an instance with NiagaraDataInterfaceGeometry as the Emitter attribute, can be set, and in this module, the attribute parameters of PhysionGeometry can be set. Specifically, see FIG. 4.
[0150] 2) Geometry Manager Reset (NM Reset Geometry)
[0151] This module functions to clear the data in Geometry from the previous simulation and reset Geometry to its initial state in preparation for the next simulation at the start of each Niagara cycle.
[0152] 4. Regarding Emitter Update, the module mainly includes the following modules 1) to 3).
[0153] 1) Emitter State and Particle Spawn Number Settings (Spawn Burst Instantaneous)
[0154] These two modules are native to Niagara, with Emitter State allowing you to specify some emitter attribute parameters, and Spawn Burst Instantaneous specifying the number of particles to be generated at a given time.
[0155] 2) Geometry manager initialization (NM Init Geometry)
[0156] This module functions to initialize Geometry. Its main process is to obtain particle attributes such as position, mass, number, and life cycle according to the layout status of particle attributes through the data buffer area that stores Niagara particle data, copy these attributes, and transmit them to the scene manager via GPU to GPU data transmission to prepare the data for subsequent initialization operations of Scenario.
[0157] 3) Geometry Manager Update (NM Update Geometry)
[0158] This module mainly updates the relevant information of the corresponding physical special effect particles in the current geometry manager in each frame, and includes the following: 1) reading the force value of the physical special effect particles in the Niagara data buffer area; 2) writing the particle position, speed and other information of the current frame after the calculation in Physion is completed to the Niagara data buffer area to prepare the data for rendering; and 3) updating the life status of each particle and counting the extinct particles in real time.
[0159] 5. Regarding Particle Spawn, the module includes the following modules 1) to 2).
[0160] 1) Initialize Particle
[0161] This module is a native Niagara module and allows you to set several attributes of each particle, such as lifecycle, color, mass, rendering radius, etc.
[0162] This module is a native module of Niagara, but it can also play a role in indirectly controlling Physion simulation. Take mass as an example, after setting the particles according to Niagara's mass, when Physion is initialized, copy the data of each particle's mass stored in the Niagara data buffer area, and initialize the mass of each particle in Physion through GPU to GPU operation, thus achieving the purpose of setting the particle's mass in Physion.
[0163] 2) Location control
[0164] The particles are controlled to be generated within a preset model. The preset model may be a model of a regular or irregular shaped geometry, e.g., a torus, a sphere, a cone, etc. The preset model may be a mesh, e.g., a Static Mesh or a Skeletal Mesh.
[0165] 6. Regarding particle update, the module mainly includes the following modules 1) to 4).
[0166] 1) Particle State Settings
[0167] This module is a native Niagara module and mainly sets the state of particles, for example, setting the life cycle of a particle and setting it so that the particle disappears at the end of its life cycle.
[0168] 2) Gravity Force
[0169] This module is a native module of Niagara, which adds a gravity effect to each particle, and there are other control force modules as well, which can realize various particle movement effects by adding multiple different control forces. As shown in Figure 11, the rotation effect of particles can be realized by adding gravity, line attraction force, curl noise, and vortex force.
[0170] In the particle emission plug-in of the embodiment of the present application, by reusing the module script of Niagara's native control force module, external forces are applied to particles to control the particle movement, which is better integrated with Niagara, meets the usage habits of technical artists, and facilitates the reuse of some effects.
[0171] 3) Force calculation (NM Physion Solve Forces and Velocity)
[0172] Since Niagara's GPU Buffer contents can only be obtained from the Buffer that stores particle attribute values at runtime, the NM Physion Solve Forces and Velocity module saves the calculated resultant force value in the particle attribute so that it can be read in the case of a Physion simulation.
[0173] 4) Particle deletion (NM Set Deleted Particle Index)
[0174] When executed, it obtains the survival status of each particle in the current Emitter in real time, obtains the survival information of each particle for each frame, and writes the information to a single data buffer area corresponding to the Geometry Manager. This allows the Physion side to obtain the actual survival status of particles for each frame and synchronize information on particles that have already disappeared.
[0175] FIG. 12 is a flowchart of the invocation of the particle emission plug-in during motion in one embodiment. As shown in FIG. 12, for the particle emission plug-in integrated with Physion, Niagara needs to execute some additional steps in addition to executing the native script (i.e., the script originally in Niagara) at each stage. The following describes the additional steps executed during execution and the important steps in the native script with reference to the drawings.
[0176] 1. First frame
[0177] 1. Executes the spawn stage logic of the system and all emitters.
[0178] 1.1. System spawning phase
[0179] 1) Initialize each emitter, allocate video memory, and set up the scene manager, i.e. set all input parameters for the Scenario.
[0180] 2) Scene manager reset: Resets all contents in the scene manager, deletes the previous simulation results, and prepares for a new simulation.
[0181] 3) Regarding boundary condition initialization, all boundary conditions in the current system are initialized.
[0182] 1.2. Emitter spawning stage
[0183] 1) Regarding the geometry manager configuration, set all the input parameters of the geometry manager.
[0184] 2) Geometry Manager Reset: Resets all contents in the Geometry Manager, deletes previous results, and prepares for a new simulation.
[0185] 2. Particle generation
[0186] 2.1. Regarding emitter updates, execute the native script, i.e., determine the number of particles to be generated based on Niagara's native module Spawn Burst Instantaneous.
[0187] 2.2. For particle spawning, execute the native script, i.e., generate particles based on the particle generation number specified in the emitter update stage, and specify each attribute value of the newly generated particle, including position, speed, etc., and write the particle attribute data to the allocated video memory.
[0188] 2. Second frame
[0189] For emitter update, since particles have already been generated in the first frame, in this stage, the geometry manager reads the attribute data in the video memory corresponding to the emitter, performs one GPU to GPU copy on the data that stores the relevant attributes of each particle, and copies it to the video memory corresponding to the geometry manager, thereby initializing the geometry manager.
[0190] 3. Frame 3
[0191] 1. Regarding system update, since the video memory in the geometry manager has already been initialized in the second frame, in the third frame, the scene manager reads all the data in the geometry manager, initializes the scene manager, starts the simulation, and calculates the new positions, velocities and other data of the particles.
[0192] 2. Regarding emitter update, the geometry manager reads the calculated data stored in the video memory corresponding to the scene manager, obtains the particle position, velocity and other data, performs one GPU-to-GPU copy, and copies the new position, velocity and other data to the video memory corresponding to Niagara to complete the particle update.
[0193] 3. Regarding emitter update, the geometry manager can read the particle force value in the video memory corresponding to Niagara, and write it to the video memory corresponding to the geometry manager through one GPU-to-GPU copy.
[0194] 4. Regarding system updates, the scene manager reads the input value and updates Physion.
[0195] 4. Fourth Frame
[0196] For system updates, the next frame is simulated and new positions, velocities, etc. of particles are calculated.
[0197] For the emitter update, repeat the operation of the third frame, perform one GPU to GPU copy, and copy the new position, velocity, and other data to the video memory corresponding to Niagara to complete the particle update.
[0198] 5. Repeat the 4th frame step until the last frame of the physical effect.
[0199] Although each step in the above flowchart is shown in the order indicated by the arrow, it should be understood that these steps are not necessarily performed in the order indicated by the arrow. Except as expressly stated in this specification, the execution of these steps is not strictly sequential, and these steps may be performed in other orders. Furthermore, at least some of the steps in these flowcharts may include multiple steps or multiple stages, and these steps or stages are not necessarily performed and completed at the same time, but may be performed at different times, and the order of execution of these steps or stages is not necessarily sequential, but may be performed in order or alternately with respect to other steps or at least some of the steps or stages in other steps.
[0200] In one embodiment, as shown in FIG. 13, a physical special effects rendering device 1300 is provided, which is a part of a computing device using software modules or hardware modules or a combination of both, and which specifically includes: A data acquisition module 1302 for acquiring physical special effect data in a frame immediately before the physical special effect particles emitted by the particle emission plug-in; an instance obtainment module 1304 for obtaining a first target instance obtained by instantiating a scene management class, the scene management class inheriting from a target base class provided by the particle emission plug-in; a data calculation module 1306 for calling a scene management interface of a particle simulation tool integrated in the particle emission plug-in through a first target instance, and calculating, in a scene manager of the particle simulation tool, motion state information of the physical special effect particle in a current frame according to the physical special effect data in a previous frame; and a data updating module 1308 for updating the physical special effect data in the previous frame based on the motion state information in the current frame, and rendering and obtaining the physical special effect in the current frame.
[0201] In the above-mentioned physical special effect rendering device, a first target instance is obtained by instantiating a scene management class inherited from a target base class provided by the particle emission plug-in to obtain physical special effect data in a frame immediately preceding the frame of a physical special effect particle emitted by a particle emission plug-in, and a scene management interface of a particle simulation tool integrated in the particle emission plug-in is called through the first target instance to calculate motion state information of the physical special effect particle in a current frame in the scene manager of the particle simulation tool based on the physical special effect data in the immediately preceding frame, and the physical special effect data in the immediately preceding frame is updated based on the motion state information in the current frame to render and obtain the physical special effect in the current frame; in this way, in order to integrate the particle simulation tool in the particle emission plug-in, a scene management interface of the particle simulation tool is called through the first target instance obtained by instantiating the scene management class to calculate and obtain the motion state information in the scene manager of the particle simulation tool, thereby rendering and obtaining the physical special effect, thereby avoiding obtaining simulation results from outside and improving efficiency in rendering the physical special effect.
[0202] In one embodiment, the apparatus further includes a first target instance generation module that determines a base class for calling a data interface provided by the particle simulation tool from a set of base classes provided by the particle emission plug-in to obtain a target base class, creates a scene management class inheriting from the target base class so that a scene management interface of the particle simulation tool can be called, and instantiates the scene management class to obtain a first target instance.
[0203] In one embodiment, the first target instance generation module further creates an object corresponding to a scene management class to obtain a scene management object, packages the scene management object to obtain a first target object, and sets the first target object as a first attribute of the particle emission plug-in to obtain the first target instance.
[0204] In one embodiment, the above-mentioned apparatus further includes a scene manager setting module: obtains a first attribute value obtained by setting attribute parameters of a first attribute through a setting interface of a particle emission plug-in, and sets the first attribute value as a variable value corresponding to a first target instance, and sets parameters of a scene manager corresponding to a scene management interface according to the variable value corresponding to the first target instance, so as to obtain the scene manager for performing scene management in the particle simulation tool after setting.
[0205] In one embodiment, the data update module further obtains a second target instance obtained by instantiating a geometry management class inheriting from the target base class provided by the particle emission plug-in, and calls a geometry management interface of the particle simulation tool through the second target instance to write the motion state information of the current frame to the target video memory by the geometry manager in the particle simulation tool, and updates the physical special effect data of the previous frame in the target video memory based on the motion state information of the current frame, so as to render and obtain the physical special effect of the current frame.
[0206] In one embodiment, the apparatus further includes a second target instance generation module: creating a geometry management class inheriting from the target base class so that a geometry management interface of the particle simulation tool is invoked; creating an object corresponding to the geometry management class to obtain a geometry management object; packaging the geometry management object to obtain a second target object; and setting the second target object as a second attribute of the particle emission plug-in to obtain a second target instance.
[0207] In one embodiment, the above apparatus further includes a geometry manager setting module: obtains a second attribute value obtained by setting attribute parameters of the second attribute through a setting interface of the particle emission plug-in, and sets the second attribute value as a variable value corresponding to a second target instance, and sets a geometry manager corresponding to the geometry management interface according to the variable value corresponding to the second target instance, so as to obtain the set geometry manager for performing geometry management in the particle simulation tool.
[0208] In one embodiment, the apparatus further includes a boundary condition generation module that obtains a third target instance obtained by instantiating a boundary condition management class inheriting from a target base class provided by the particle emission plug-in, and calls a boundary condition management interface of the particle simulation tool via the third target instance to obtain a target boundary condition in a boundary condition manager of the particle simulation tool; and a data calculation module that calculates motion state information of the physical special effect particles in a current frame based on the physical special effect data and the target boundary condition in a previous frame in a scene manager of the particle simulation tool.
[0209] In one embodiment, the apparatus further includes a third target instance generation module: creating a boundary condition management class that inherits from the target base class so that a boundary condition management interface of the particle simulation tool is invoked; creating a target derived class that inherits from the boundary condition management class and corresponds to the type setting parameter; and instantiating the target derived class to obtain a third target instance, where the type setting parameter is a parameter obtained by setting the type of the boundary condition manager obtained via the setting interface of the particle emission plug-in.
[0210] In one embodiment, the third target instance generation module further creates an object corresponding to the target derived class to obtain a target boundary condition management object, packages the target boundary condition management object to obtain a third target object, and sets the third target object as a third attribute of the particle emission plug-in to obtain a third target instance.
[0211] In an embodiment, the above-mentioned apparatus further includes a boundary condition manager setting module, which obtains a third attribute value obtained by setting attribute parameters of a third attribute through a setting interface of the particle emission plug-in, and sets the third attribute value as a variable value corresponding to a third target instance, and sets parameters of a boundary condition manager corresponding to the boundary condition management interface according to the variable value corresponding to the third target instance, to obtain the set boundary condition manager for performing boundary condition management in the particle simulation tool.
[0212] In one embodiment, the data calculation module further calculates motion state information of the physical special effect particle in a current frame in a scene manager of the particle simulation tool based on the physical special effect data in a previous frame, and writes the motion state information to a first video memory; the data update module further reads the motion state information in the current frame from the first video memory, copies the motion state information in the current frame, and writes the copied motion state information to a second video memory, and updates the physical special effect data in the previous frame in the second video memory based on the motion state information in the current frame; the first video memory is a data buffer area allocated to the particle simulation tool in a target video memory of the particle emission plug-in, and the second video memory is a data buffer area in the target video memory different from the first video memory, for storing particle emission data and particle rendering data.
[0213] In one embodiment, the apparatus further includes a sampling module that emits a predetermined number of initial particles at positions of the preset model, writes attribute information of the initial particles to a second video memory, reads the attribute information of the initial particles from the second video memory, copies the attribute information of the initial particles, and writes the copied attribute information of the initial particles to the first video memory, and samples on the surface and inside of the preset model by a particle simulation tool based on the attribute information of the initial particles in the first video memory to obtain physical special effect particles used in physical special effect simulation.
[0214] In one embodiment, the data updating module further maps the physical special effect data in the previous frame to a predetermined background grid in a scene manager of the particle simulation tool, the background grid including a plurality of grid nodes, and in the background grid, calculates motion state information of grid nodes corresponding to each physical special effect particle in the current frame based on the physical special effect data, and maps the motion state information of each grid node to a corresponding physical special effect particle to obtain the motion state information of each physical special effect particle in the current frame.
[0215] For specific limitations on the physical special effect rendering device, reference may be made to the limitations on the physical special effect rendering method, and the description will be omitted here. Each module in the physical special effect rendering device may be realized in whole or in part by software, hardware, or a combination thereof. Each module may be incorporated as hardware into a processor in a computer device, or may be provided independently of a processor in a computer device, or may be stored as software in a memory in a computer device, so that the processor calls and executes operations corresponding to each module.
[0216] In one embodiment, a computer device is provided, which may be a terminal, and its internal configuration diagram may be configured as shown in FIG. 14. The computer device includes a processor, a memory, a communication interface, a display, and an input device connected via a system bus. The processor of the computer device provides calculation and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and computer-readable instructions. The internal memory provides an environment for the execution of the operating system and the computer-readable instructions in the non-volatile storage medium. The communication interface of the computer device communicates with an external terminal in a wired or wireless manner, and the wireless manner may be realized by WIFI, a carrier network, NFC (near field communication) or other technologies. When the computer-readable instructions are executed by the processor, a physical special effect rendering method is realized. The display of the computing device may be a liquid crystal display or an electronic ink display, and the input device of the computing device may be a touch layer covered by the display, or may be a button, a trackball or a touchpad mounted on the housing of the computing device, or may even be an external keyboard, touchpad or mouse, etc.
[0217] Those skilled in the art will understand that the configuration shown in FIG. 14 is merely a block diagram of some configurations related to the technical means of the present application, and does not limit the computer device to which the technical means of the present application is applied, and that a specific computer device may include more or fewer components than those shown in the figure, may be a combination of several components, or may have a different component layout.
[0218] In one embodiment, there is further provided a computing device including a memory and a processor, the memory storing computer readable instructions, the processor executing the computer readable instructions performing the steps of each of the method embodiments above.
[0219] In one embodiment, a computer readable storage medium is provided having computer readable instructions stored thereon which, when executed by a processor, perform the steps of each of the method embodiments described above.
[0220] In one embodiment, a computer program product or computer readable instructions is provided, the computer program product or computer readable instructions including computer instructions stored in a computer readable storage medium, a processor of a computing device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to cause the computing device to perform the steps of each of the method embodiments described above.
[0221] Those skilled in the art can understand that all or part of the flow of the method of the above embodiments can be realized by instructing relevant hardware by computer-readable instructions, and the computer-readable instructions may be stored in a non-volatile computer-readable storage medium, and the computer-readable instructions may include the flow of each of the above method embodiments when executed. Any reference to memory, storage, database, or other medium provided in this application and used in each embodiment may include at least one of non-volatile and volatile memory. Non-volatile memory may include Read-Only Memory (ROM), magnetic tape, flexible disk, flash memory, optical memory, etc. Volatile memory may include Random Access Memory (RAM) or external cache memory. By way of example and not limitation, RAM can be in various forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).
[0222] As described above, the technical features of the embodiments can be combined in any combination, and for the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combinations of these technical features, all of them should be considered within the scope of this specification.
[0223] The above embodiments only describe some embodiments of the present application, and although the description is specific and detailed, it should not be construed as limiting the scope of the patent of the present application. It should be noted that those skilled in the art can make some modifications or improvements without departing from the concept of the present application, and both of these modifications or improvements belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application should be based on the scope of the attached claims.
Claims
1. 1. A method for rendering physical special effects implemented by a computing device, comprising: obtaining physical effect data for a frame immediately preceding a physical effect particle emitted by a particle emission plug-in; obtaining a first target instance obtained by instantiating a scene management class, the scene management class inheriting from a target base class provided by the particle emission plug-in; calling a scene management interface of a particle simulation tool integrated in the particle emission plug-in through the first target instance, and calculating, in a scene manager of the particle simulation tool, motion state information of the physical special effect particle in a current frame according to the physical special effect data in the previous frame; updating physical special effect data in the previous frame based on motion state information in the current frame to render and obtain physical special effects in the current frame.
2. The first target instance is determining a base class for calling a data interface provided by the particle simulation tool from a set of base classes provided by the particle emission plug-in to obtain the target base class; creating a scene management class that inherits from the target base class such that a scene management interface of the particle simulation tool can be invoked; and instantiating the scene management class to obtain the first target instance.
3. The step of instantiating the scene management class to obtain the first target instance includes: creating an object corresponding to the scene management class to obtain a scene management object; packaging the scene management object to obtain a first target object; and setting the first target object as a first attribute of the particle emission plug-in to obtain the first target instance.
4. After the step of setting the first target object as a first attribute of the particle emission plug-in to obtain the first target instance, the method further comprises: obtaining a first attribute value obtained by setting attribute parameters of the first attribute through a setting interface of the particle emission plug-in; setting the first attribute value as a variable value corresponding to the first target instance; 4. The method of claim 3, further comprising: setting parameters of a scene manager corresponding to the scene management interface according to variable values corresponding to the first target instance, and obtaining the set scene manager for performing scene management in the particle simulation tool.
5. The step of updating the physical special effect data in the previous frame based on the motion state information in the current frame to render and obtain the physical special effect in the current frame includes: obtaining a second target instance obtained by instantiating a geometry management class, the geometry management class inheriting from a target base class provided by the particle emission plug-in; 2. The method of claim 1, further comprising: calling a geometry management interface of the particle simulation tool via the second target instance, causing a geometry manager in the particle simulation tool to write motion state information in the current frame to a target video memory; and updating physical special effect data in the previous frame in the target video memory based on the motion state information in the current frame, to render and obtain physical special effects in the current frame.
6. The second target instance is creating a geometry management class that inherits from the target base class such that a geometry management interface of the particle simulation tool can be invoked; creating an object corresponding to the geometry management class to obtain a geometry management object; packaging the geometry management object to obtain a second target object; and setting the second target object as a second attribute of the particle emission plug-in to obtain the second target instance.
7. After the step of setting the second target object as a second attribute of the particle emission plug-in to obtain the second target instance, the method further comprises: obtaining a second attribute value obtained by setting attribute parameters of the second attribute through a setting interface of the particle emission plug-in; setting the second attribute value as a variable value corresponding to the second target instance; 7. The method of claim 6, further comprising: setting a geometry manager corresponding to the geometry management interface with variable values corresponding to the second target instance to obtain the set geometry manager for performing geometry management in the particle simulation tool.
8. The method comprises: obtaining a third target instance obtained by instantiating a boundary condition management class, the boundary condition management class inheriting from a target base class provided by the particle emission plug-in; and invoking a boundary condition management interface of the particle simulation tool via the third target instance to obtain a target boundary condition in a boundary condition manager of the particle simulation tool. The step of calculating, in a scene manager of the particle simulation tool, motion state information in a current frame of the physical special effect particle based on the physical special effect data in the previous frame, includes: The method of claim 1 , further comprising: calculating, in a scene manager of the particle simulation tool, motion state information in a current frame of the physical special effect particles based on the physical special effect data in the previous frame and the target boundary conditions.
9. The third target instance is creating a boundary condition management class that inherits from the target base class so that a boundary condition management interface of the particle simulation tool can be invoked; creating a target derived class that inherits from the boundary condition management class and corresponds to a type setting parameter, and instantiating the target derived class to obtain the third target instance; The method of claim 8 , wherein the type setting parameters are parameters obtained by setting a type of the boundary condition manager obtained via a setting interface of the particle emission plugin.
10. The method of claim 9 , wherein the type setting parameters include at least one of a ground boundary condition, a skeletal animation boundary condition, or a stationary body boundary condition.
11. The step of instantiating the target derived class to obtain the third target instance includes: creating an object corresponding to the target derived class to obtain a target boundary condition management object; packaging the target boundary condition management object to obtain a third target object; and setting the third target object as a third attribute of the particle emission plug-in to obtain the third target instance.
12. After the step of setting the third target object as a third attribute of the particle emission plug-in to obtain the third target instance, the method further comprises: obtaining a third attribute value obtained by setting an attribute parameter of the third attribute through a setting interface of the particle emission plug-in; setting the third attribute value as a variable value corresponding to the third target instance; 12. The method of claim 11, further comprising: setting parameters of a boundary condition manager corresponding to the boundary condition management interface according to variable values corresponding to the third target instance to obtain a set boundary condition manager for performing boundary condition management in the particle simulation tool.
13. The step of calculating, in a scene manager of the particle simulation tool, motion state information in a current frame of the physical special effect particle based on the physical special effect data in the previous frame, includes: In a scene manager of the particle simulation tool, calculating motion state information of the physical special effect particles in a current frame based on the physical special effect data in the previous frame, and writing the motion state information into a first video memory; The step of updating the physical special effect data in the previous frame based on the motion state information in the current frame to render and obtain the physical special effect in the current frame includes: reading motion state information for the current frame from the first video memory and copying the motion state information for the current frame; writing the copied motion state information to a second video memory, and updating, in the second video memory, physical special effect data in the immediately preceding frame based on the motion state information in the current frame; 2. The method of claim 1 , wherein the first video memory is a data buffer area in a target video memory of the particle emission plug-in allocated to the particle simulation tool, and the second video memory is a data buffer area in the target video memory different from the first video memory, for storing particle emission data and particle rendering data.
14. The method comprises: A step of emitting a predetermined number of initial particles at the position of the preset model and writing attribute information of the initial particles into a second video memory; reading attribute information of the initial particles from the second video memory and copying the attribute information of the initial particles; 2. The method of claim 1, further comprising the steps of: writing the copied attribute information of the initial particles to a first video memory allocated to the particle simulation tool; and sampling, by the particle simulation tool, on a surface and inside of the preset model based on the attribute information of the initial particles in the first video memory to obtain physical special effect particles used in a physical special effect simulation.
15. The step of calculating, in a scene manager of the particle simulation tool, motion state information in a current frame of the physical special effect particle based on the physical special effect data in the previous frame, includes: mapping the physical special effect data of the previous frame onto a predefined background grid in a scene manager of the particle simulation tool, the background grid including a plurality of grid nodes; Calculating, in the background grid, motion state information of grid nodes corresponding to each physical special effect particle in a current frame according to the physical special effect data; and mapping the motion state information of each of the grid nodes to a corresponding physical special effect particle to obtain motion state information of each of the physical special effect particles in a current frame.
16. The step of calculating motion state information of the physical special effect particle in a current frame based on the physical special effect data in the previous frame includes: Dividing the current frame into a number of time steps; determining a current time step from the plurality of time steps in chronological order, and for each current time step, calculating motion state information of a physical special effect particle in the current time step based on physical special effect data of the physical special effect particle in a time step immediately before the current time step; The method according to any one of claims 1 to 14, further comprising: determining motion state information of the physical special effect particle in the last time step as motion state information of the physical special effect particle in the current frame.
17. a data acquisition module for acquiring physical effect data in a frame immediately before the physical effect particles emitted by the particle emission plug-in; an instance acquisition module for acquiring a first target instance obtained by instantiating a scene management class, the scene management class inheriting from a target base class provided by the particle emission plug-in; a data calculation module that calls a scene management interface of a particle simulation tool integrated in the particle emission plug-in through the first target instance, and calculates, in a scene manager of the particle simulation tool, motion state information of the physical special effect particle in a current frame according to the physical special effect data in the previous frame; and a data updating module that updates the physical special effect data in the immediately preceding frame based on the motion state information in the current frame, and renders and obtains the physical special effect in the current frame.
18. 1. A computing device including a memory having computer readable instructions stored thereon and one or more processors, A computing apparatus, wherein the computer readable instructions, when executed by the processor, cause the one or more processors to implement the method of any one of claims 1 to 14.
19. A computer program arranged to cause a computer to carry out the method according to any one of claims 1 to 14.
Citation Information
Patent Citations
Information storage medium, game system, and image generating method
JP2009285477A
Computer graphics shader system and method
JP2009500730A
Display control program, display control device, and display control method
JP2020086674A
Method and device for presenting operating states
US20170046866A1
