WO2021043128A1 - Particle calculation method and apparatus, electronic device, and computer readable storage medium - Google Patents

Particle calculation method and apparatus, electronic device, and computer readable storage medium Download PDF

Info

Publication number
WO2021043128A1
WO2021043128A1 PCT/CN2020/112840 CN2020112840W WO2021043128A1 WO 2021043128 A1 WO2021043128 A1 WO 2021043128A1 CN 2020112840 W CN2020112840 W CN 2020112840W WO 2021043128 A1 WO2021043128 A1 WO 2021043128A1
Authority
WO
WIPO (PCT)
Prior art keywords
attribute
function
particle
initial
time
Prior art date
Application number
PCT/CN2020/112840
Other languages
French (fr)
Chinese (zh)
Inventor
朱旭光
林顺
Original Assignee
厦门雅基软件有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 厦门雅基软件有限公司 filed Critical 厦门雅基软件有限公司
Publication of WO2021043128A1 publication Critical patent/WO2021043128A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T13/00Animation
    • G06T13/203D [Three Dimensional] animation
    • G06T13/603D [Three Dimensional] animation of natural phenomena, e.g. rain, snow, water or plants
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures

Definitions

  • This application relates to the field of particle computing technology. Specifically, this application relates to a particle computing method, device, electronic device, and computer-readable storage medium.
  • the particle system is a graphic generation algorithm that effectively simulates irregular fuzzy objects. It uses a unified pattern to generate natural phenomena with irregular shapes such as clouds, smoke, fire, and water.
  • the scene is defined as being composed of thousands of irregular and randomly distributed particles.
  • the particle system can simulate the motion of uncertain objects, so it has a wide range of applications in the current three-dimensional simulation scenes.
  • the current particle calculation generally uses the graphics processing unit (GPU) to calculate the current state of the particle and then writes it to the floating-point texture, and writes the data in the floating-point texture back to the central processing unit (CPU), but this This calculation method is only applicable to the higher version of the graphics application programming interface (API).
  • the lower version of the graphics API does not support the writing of GPU data back to the CPU. Therefore, it is necessary to provide a particle calculation that can be applied to the lower version of the graphics API. method.
  • the purpose of this application is to at least solve one of the above-mentioned technical defects, especially the technical defect of low particle calculation efficiency.
  • a particle calculation method including:
  • the graphics processor calculates the real-time attribute parameters corresponding to the particle playing time according to the initial attribute parameters, the attribute function, and the particle playing time.
  • sending the initial attribute parameter and the attribute function to the graphics processor includes:
  • converting the velocity function in the attribute function input by the user into a displacement function includes:
  • the initial attribute parameters include an initial position parameter, an initial rotation parameter, an initial size, and an initial color parameter
  • the attribute function sent to the graphics processor includes a displacement function, a rotation function, a size function, and a color function
  • the real-time attribute parameters corresponding to the particle playback time are calculated including:
  • a particle calculation method including:
  • real-time attribute parameters corresponding to the particle playback time are calculated according to the initial attribute parameters, the attribute function, and the particle playback time.
  • the initial attribute parameters include an initial position parameter, an initial rotation parameter, an initial size, and an initial color parameter
  • the attribute function includes a displacement function, a rotation function, a size function, and a color function
  • the real-time attribute parameters corresponding to the particle playback time are calculated including:
  • the displacement function is obtained by converting the velocity function received by the central processing unit with respect to the time integral.
  • a particle calculation method which includes:
  • the central processor receives the initial attribute parameters and attribute functions of the particles input by the user, and the attribute functions correspond to the initial attribute parameters;
  • the central processor sends the initial attribute parameters and attribute functions to the graphics processor
  • the graphics processor calculates the real-time attribute parameters corresponding to the particle playing time according to the initial attribute parameters, the attribute function, and the particle playing time.
  • a particle computing device which includes:
  • the first receiving module is configured to receive the initial attribute parameter and attribute function of the particle input by the user; the attribute function corresponds to the initial attribute parameter; and
  • the first calculation module is configured to send the initial attribute parameters and attribute functions to the graphics processor, so that the graphics processor calculates real-time attributes corresponding to the particle playback time according to the initial attribute parameters, attribute functions, and particle playback time during particle playback parameter.
  • the first calculation module is further configured to, when sending the initial attribute parameters and attribute functions to the graphics processor:
  • the initial attribute parameters, displacement function, and other attribute functions except the velocity function are sent to the graphics processor.
  • the first calculation module is further configured to convert the velocity function in the attribute function input by the user into a displacement function:
  • the initial attribute parameters include an initial position parameter, an initial rotation parameter, an initial size, and an initial color parameter
  • the attribute function sent to the graphics processor includes a displacement function, a rotation function, a size function, and a color function
  • the first calculation module is also configured to enable the graphics processor to calculate the real-time attribute parameters corresponding to the particle playback time according to the initial attribute parameters, the attribute function, and the particle playback time:
  • a particle computing device which includes:
  • the second receiving module is configured to receive the initial attribute parameters and attribute functions of the particles sent by the central processing unit, and the attribute functions correspond to the initial attribute parameters;
  • the second calculation module is configured to calculate the real-time attribute parameter corresponding to the particle playing time according to the initial attribute parameter, the attribute function, and the particle playing time when the particle is playing.
  • the initial attribute parameters include an initial position parameter, an initial rotation parameter, an initial size, and an initial color parameter
  • the attribute function includes a displacement function, a rotation function, a size function, and a color function
  • the second calculation module is also configured to calculate the real-time attribute parameter corresponding to the particle playing time according to the initial attribute parameter, the attribute function, and the particle playing time:
  • the displacement function is obtained based on the integration of the velocity function received by the central processing unit with respect to time.
  • an electronic device including:
  • One or more processors are One or more processors.
  • the memory is configured to store one or more application programs
  • the one or more application programs are configured to execute the particle calculation method shown in the first aspect of the present application when being executed by one or more processors.
  • a computer-readable storage medium is provided, and a computer program is stored on the computer-readable storage medium, wherein the program is configured to be executed by a processor to implement the method shown in the first aspect of the present application The particle calculation method.
  • the initial attribute parameters and attribute functions of the particles input by the user are received through the central processing unit, and the attribute functions correspond to the initial attribute parameters, and then the central processing unit sends the initial attribute parameters and attribute functions to the graphics processing unit.
  • the graphics processor calculates the real-time attribute parameters corresponding to the particle playback time according to the initial attribute parameters, attribute functions, and particle playback time during particle playback.
  • the central processor directly sends the initial attribute parameters and attribute functions to the graphics processor.
  • the graphics processor does not need to write the data back to the central processing unit after the calculation is completed, and it can be applied to the lower version of the graphics API.
  • the central processing unit converts the velocity function in the attribute function input by the user into a displacement function, and then sends the initial attribute parameter, the displacement function and other attribute functions except the velocity function to the graphics processor, and the graphics processor performs calculations.
  • the central processing unit and the graphics processor carry out the division of labor and cooperation, and the graphics processor performs complex calculations, which can further improve the efficiency of particle calculation.
  • FIG. 1 is a schematic flowchart of a particle calculation method according to an embodiment of the present application
  • FIG. 2 is a schematic flowchart of a particle calculation method according to an embodiment of the present application
  • FIG. 3 is a schematic flowchart of a particle calculation method according to an embodiment of the present application.
  • FIG. 4 is a schematic flowchart of a particle calculation method according to an embodiment of the present application.
  • Fig. 5 is a schematic structural diagram of a particle computing device according to an embodiment of the present application.
  • Fig. 6 is a schematic structural diagram of a particle computing device according to an embodiment of the present application.
  • Fig. 7 is a schematic structural diagram of a particle computing device according to an embodiment of the present application.
  • Fig. 8 is a schematic structural diagram of an electronic device for particle computing according to an embodiment of the present application.
  • the central processing unit is one of the main equipment of an electronic computer and the core component of the computer. Its function is mainly to interpret computer instructions and process data in computer software.
  • the CPU is the core component of the computer that is responsible for reading instructions, decoding and executing instructions.
  • the graphics processing unit is the processor of the graphics card, similar to the CPU, except that the GPU is designed to perform complex mathematical and geometric calculations, which are necessary for graphics rendering.
  • the particle computing method, device, electronic device, and computer-readable storage medium provided in this application are intended to solve the above technical problems in the prior art.
  • An embodiment of the present application provides a particle calculation method. As shown in FIG. 1, the method may include the following steps.
  • Step S101 Receive initial attribute parameters and attribute functions of particles input by the user, where the attribute functions correspond to the initial attribute parameters.
  • the initial attribute parameter of the particle can include the initial position parameter, and the corresponding attribute function can be a velocity function or a displacement function; the initial attribute parameter can also include an initial rotation parameter, for example, angular velocity, and the corresponding attribute function can be a rotation function; the initial attribute The parameter may also include the initial size, that is, the initial size of the particle, and the corresponding attribute function may be a size function; the initial attribute parameter may also include an initial color parameter, and the corresponding attribute function may be a color function.
  • users can input initial attribute parameters and corresponding attribute functions into the central processing unit by themselves; they can also pre-store various attribute parameters and various attribute functions in the terminal or server, and users can choose from the pre-stored attribute parameters and attributes. Select the initial attribute parameter and corresponding attribute function for calculation in the function.
  • Step S102 Send the initial attribute parameter and the attribute function to the graphics processor, so that the graphics processor calculates the real-time attribute parameter corresponding to the particle playback time according to the initial attribute parameter, the attribute function, and the particle playback time during particle playback.
  • the playing time of the particle may be the time that the particle has moved after switching from the static state to the moving state.
  • the central processing unit can directly send the initial attribute parameters and attribute functions to the graphics processor, and calculate through the graphics processor during particle playback; the central processing unit can also process the attribute functions first, and then process The latter attribute function is sent to the graphics processor, and the particles are calculated by the graphics processor when the particles are played.
  • the real-time position of the particle is calculated according to the initial position parameter, velocity function, and particle playback time of the particle, or the initial position parameter, displacement function, and particle playback time of the particle; the particle is calculated according to the initial rotation parameter, rotation function, and particle playback time
  • the real-time rotation parameters of the particles; the real-time size parameters of the particles are calculated according to the initial size, the size function and the particle playback time; the real-time color parameters of the particles are calculated according to the initial color parameters, the color function and the particle playback time.
  • the initial attribute parameters and attribute functions of the particles input by the user are received by the central processing unit.
  • the attribute functions correspond to the initial attribute parameters, and then the central processing unit sends the initial attribute parameters and attribute functions to the graphics processor.
  • the graphics processor calculates the real-time attribute parameters corresponding to the particle playback time according to the initial attribute parameters, attribute functions, and particle playback time during particle playback.
  • the central processor directly sends the initial attribute parameters and attribute functions to the graphics processor, and the graphics processor calculates After completion, there is no need to write the data back to the central processor, which can be applied to low-level graphics APIs; and the calculation process does not need to set up other processors, which can save storage space; the graphics processor performs more complex calculations, which can improve the efficiency of particle calculations .
  • the embodiment of the present application provides a possible implementation manner.
  • the sending of the initial attribute parameter and the attribute function to the graphics processor in step S102 may include:
  • the user can directly input the velocity function, that is, the change curve of the particle motion velocity with time, and the central processing unit can convert the velocity function to obtain the displacement function.
  • the velocity function that is, the change curve of the particle motion velocity with time
  • the velocity function input by the user is integrated with respect to time to obtain the displacement function.
  • the central processing unit can recognize whether the attribute function input by the user is a velocity function or a displacement function. If it is recognized as a velocity function, the velocity function is converted; if it is recognized as a displacement function, the displacement function and other attribute functions are directly Send to the graphics processor.
  • the initial attribute parameters may include initial position parameters, initial rotation parameters, initial size, and initial color parameters;
  • the attribute functions sent to the graphics processor may include displacement functions, rotation functions, size functions, and color functions.
  • the calculation of the real-time attribute parameter corresponding to the particle playback time according to the initial attribute parameter, the attribute function, and the particle playback time in step S102 may include:
  • S(t) is the real-time position of the particle
  • S origin is the initial position of the particle
  • v(t) is the velocity function of the particle
  • the initial attribute parameters and attribute functions of the particles input by the user are received by the central processing unit.
  • the attribute functions correspond to the initial attribute parameters, and then the central processing unit sends the initial attribute parameters and attribute functions to the graphics processor.
  • the graphics processor calculates the real-time attribute parameters corresponding to the particle playback time according to the initial attribute parameters, attribute functions, and particle playback time during particle playback.
  • the central processor directly sends the initial attribute parameters and attribute functions to the graphics processor and graphics processor. After the calculation is completed, there is no need to write the data back to the central processing unit, which can be applied to low-level graphics APIs.
  • the central processing unit converts the velocity function in the attribute function input by the user into a displacement function, and then sends the initial attribute parameter, the displacement function, and other attribute functions except the velocity function to the graphics processor, and the graphics processor
  • the central processing unit and the graphics processor perform division of labor and coordination, and the graphics processor performs complex calculations, which can further improve the efficiency of particle calculations.
  • This embodiment also provides a particle calculation method. As shown in FIG. 2, the method may include the following steps.
  • Step S201 Receive the initial attribute parameter and attribute function of the particle sent by the central processing unit, where the attribute function corresponds to the initial attribute parameter.
  • the initial attribute parameter of the particle may include an initial position parameter, and the corresponding attribute function may be a velocity function or a displacement function; the initial attribute parameter may also include an initial rotation parameter, for example, angular velocity, and the corresponding attribute function may be a rotation function;
  • the parameter may also include the initial size, that is, the initial size of the particle, and the corresponding attribute function may be a size function; the initial attribute parameter may also include an initial color parameter, and the corresponding attribute function may be a color function.
  • Step S202 Calculate real-time attribute parameters corresponding to the particle playing time according to the initial attribute parameter, the attribute function, and the particle playing time during particle playing.
  • the playing time of the particle may be the time that the particle has moved after switching from the static state to the moving state.
  • the real-time position of the particle is calculated according to the initial position parameter, velocity function, and particle playback time of the particle, or the initial position parameter, displacement function, and particle playback time of the particle; the particle is calculated according to the initial rotation parameter, rotation function, and particle playback time
  • the real-time rotation parameters of the particles; the real-time size parameters of the particles are calculated according to the initial size, the size function and the particle playback time; the real-time color parameters of the particles are calculated according to the initial color parameters, the color function and the particle playback time.
  • the initial attribute parameters may include initial position parameters, initial rotation parameters, initial size, and initial color parameters;
  • the attribute functions include displacement function, rotation function, size function, and color function; in step S202, according to the initial attribute parameters , Attribute function and particle playback time calculation
  • the real-time attribute parameters corresponding to the particle playback time can include:
  • the displacement function is obtained by transforming the speed function received by the central processing unit with respect to the time integral.
  • the central processing unit can recognize whether the attribute function input by the user is a velocity function or a displacement function. If it is recognized as a velocity function, the velocity function is converted; if it is recognized as a displacement function, the displacement function and other attribute functions are directly Send to the graphics processor.
  • S(t) is the real-time position of the particle
  • S origin is the initial position of the particle
  • v(t) is the velocity function of the particle
  • the initial attribute parameters and attribute functions of the particles input by the user are received by the central processing unit.
  • the attribute functions correspond to the initial attribute parameters, and then the central processing unit sends the initial attribute parameters and attribute functions to the graphics processor.
  • the graphics processor calculates the real-time attribute parameters corresponding to the particle playback time according to the initial attribute parameters, attribute functions, and particle playback time during particle playback.
  • the central processor directly sends the initial attribute parameters and attribute functions to the graphics processor and graphics processor. After the calculation is completed, there is no need to write the data back to the central processing unit, which can be applied to low-level graphics APIs.
  • the central processing unit converts the velocity function in the attribute function input by the user into a displacement function, and then sends the initial attribute parameter, the displacement function, and other attribute functions except the velocity function to the graphics processor, and the graphics processor
  • the central processing unit and the graphics processor perform division of labor and coordination, and the graphics processor performs complex calculations, which can further improve the efficiency of particle calculations.
  • This embodiment also provides a particle calculation method. As shown in FIG. 3, the method may include the following steps.
  • Step S301 the central processor receives the initial attribute parameter and attribute function of the particle input by the user; the attribute function corresponds to the initial attribute parameter.
  • the initial attribute parameter of the particle can include the initial position parameter, and the corresponding attribute function can be a velocity function or a displacement function; the initial attribute parameter can also include an initial rotation parameter, for example, angular velocity, and the corresponding attribute function can be a rotation function; the initial attribute The parameter may also include the initial size, that is, the initial size of the particle, and the corresponding attribute function may be a size function; the initial attribute parameter may also include an initial color parameter, and the corresponding attribute function may be a color function.
  • step S302 the central processor sends the initial attribute parameters and attribute functions to the graphics processor.
  • the central processing unit can directly send the initial attribute parameters and attribute functions to the graphics processor, and the graphics processor performs calculations during particle playback; the central processing unit can also process the attribute functions first, and then process The latter attribute function is sent to the graphics processor, and the particle calculation is performed by the graphics processor during particle playback.
  • the central processing unit can also recognize whether the attribute function input by the user is a velocity function or a displacement function. If it is recognized as a velocity function, the velocity function is converted; if it is recognized as a displacement function, the displacement function and other attribute functions are converted. Send directly to the graphics processor.
  • step S303 the graphics processor calculates the real-time attribute parameter corresponding to the particle playback time according to the initial attribute parameter, the attribute function, and the particle playback time during particle playback.
  • the playing time of the particle may be the time that the particle has moved after switching from the static state to the moving state.
  • the real-time position of the particle is calculated according to the initial position parameter, velocity function, and particle playback time of the particle, or the initial position parameter, displacement function, and particle playback time of the particle; the particle is calculated according to the initial rotation parameter, rotation function, and particle playback time
  • the real-time rotation parameters of the particles; the real-time size parameters of the particles are calculated according to the initial size, the size function and the particle playback time; the real-time color parameters of the particles are calculated according to the initial color parameters, the color function and the particle playback time.
  • the initial attribute parameters and attribute functions of the particles input by the user are received by the central processing unit.
  • the attribute functions correspond to the initial attribute parameters, and then the central processing unit sends the initial attribute parameters and attribute functions to the graphics processor.
  • the graphics processor calculates the real-time attribute parameters corresponding to the particle playback time according to the initial attribute parameters, attribute functions, and particle playback time during particle playback.
  • the central processor directly sends the initial attribute parameters and attribute functions to the graphics processor and graphics processor.
  • the particle calculation method provided in this application may include the following steps:
  • Step S401 the central processor receives the initial attribute parameter and attribute function of the particle input by the user, and the attribute function corresponds to the initial attribute parameter;
  • Step S402 the central processing unit converts the velocity function in the received attribute function into a displacement function
  • Step S403 the central processor sends the initial attribute parameter, the displacement function and other attribute functions except the speed function to the graphics processor;
  • Step S404 the graphics processor calculates the real-time position of the particle according to the initial position parameter and the displacement function
  • Step S405 the graphics processor calculates the real-time rotation parameters of the particles according to the initial rotation parameters and the rotation function
  • Step S406 the graphics processor calculates the real-time size of the particle according to the initial size and the size function.
  • step S407 the graphics processor calculates the real-time color parameters of the particles according to the initial color parameters and the color function.
  • the central processing unit converts the velocity function in the attribute function input by the user into a displacement function, and then sends the initial attribute parameter, the displacement function and other attribute functions except the velocity function to the graphics processor, which will be processed by the graphics
  • the central processing unit and the graphics processor perform the calculation, the central processing unit and the graphics processor perform division of labor, and the graphics processor performs complex calculations, which can further improve the particle calculation efficiency.
  • the particle computing device 50 may include: a first receiving module 501 and a first computing module 502. among them,
  • the first receiving module 501 is configured to receive initial attribute parameters and attribute functions of particles input by a user, and the attribute functions correspond to the initial attribute parameters;
  • the first calculation module 502 is configured to send initial attribute parameters and attribute functions to the graphics processor, so that the graphics processor calculates the real-time corresponding to the particle playback time according to the initial attribute parameters, attribute functions, and particle playback time during particle playback. Property parameters.
  • the aforementioned particle computing device receives the initial attribute parameters and attribute functions of the particles input by the user through the central processing unit.
  • the attribute functions correspond to the initial attribute parameters, and then the central processing unit sends the initial attribute parameters and attribute functions to the graphics processor.
  • the graphics processor calculates the real-time attribute parameters corresponding to the particle playback time according to the initial attribute parameters, attribute functions, and particle playback time during particle playback.
  • the central processor directly sends the initial attribute parameters and attribute functions to the graphics processor and graphics processor. After the calculation is completed, there is no need to write the data back to the central processing unit, which can be applied to low-level graphics APIs, and no other processors need to be set up during the calculation process, which can save storage space; the graphics processor performs more complex calculations, which can improve particles Computational efficiency.
  • the first calculation module 502 is further configured to, when sending the initial attribute parameters and attribute functions to the graphics processor:
  • the first calculation module 502 is further configured to convert the velocity function in the attribute function input by the user into a displacement function:
  • the initial attribute parameter may include an initial position parameter, an initial rotation parameter, an initial size, and an initial color parameter
  • the attribute function sent to the graphics processor includes a displacement function, a rotation function, a size function, and a color function
  • the first calculation module 502 is further configured to enable the graphics processor to calculate the real-time attribute parameter corresponding to the particle playback time according to the initial attribute parameter, the attribute function, and the particle playback time:
  • the particle computing device 60 may include: a second receiving module 601 and a second computing module 602. among them,
  • the second receiving module 601 is configured to receive the initial attribute parameters and attribute functions of the particles sent by the central processing unit, and the attribute functions correspond to the initial attribute parameters;
  • the second calculation module 602 is configured to calculate the real-time attribute parameter corresponding to the particle playing time according to the initial attribute parameter, the attribute function, and the particle playing time when the particle is playing.
  • the initial attribute parameters may include initial position parameters, initial rotation parameters, initial size, and initial color parameters;
  • the attribute functions include displacement function, rotation function, size function, and color function;
  • the second calculation module 602 is also configured to calculate the real-time attribute parameter corresponding to the particle playing time according to the initial attribute parameter, the attribute function, and the particle playing time:
  • the displacement function is obtained by transforming the speed function received by the central processing unit with respect to the time integral.
  • the particle computing device 70 may include: a third receiving module 701, a sending module 702, and a third computing module 703. among them,
  • the third receiving module 701 is configured to enable the central processing unit to receive the initial attribute parameters and attribute functions of the particles input by the user, and the attribute functions correspond to the initial attribute parameters;
  • the sending module 702 is configured to enable the central processing unit to send initial attribute parameters and attribute functions to the graphics processor;
  • the third calculation module 703 is configured to enable the graphics processor to calculate the real-time attribute parameter corresponding to the particle playing time according to the initial attribute parameter, the attribute function, and the particle playing time when the particle is playing.
  • the aforementioned particle computing device receives the initial attribute parameters and attribute functions of the particles input by the user through the central processing unit.
  • the attribute functions correspond to the initial attribute parameters, and then the central processing unit sends the initial attribute parameters and attribute functions to the graphics processor.
  • the graphics processor calculates the real-time attribute parameters corresponding to the particle playback time according to the initial attribute parameters, attribute functions, and particle playback time during particle playback.
  • the central processor directly sends the initial attribute parameters and attribute functions to the graphics processor and graphics processor. After the calculation is completed, there is no need to write the data back to the central processing unit, which can be applied to low-level graphics APIs, and no other processors need to be set up during the calculation process, which can save storage space; the graphics processor performs more complex calculations, which can improve particles Computational efficiency.
  • the particle computing device for the picture in the embodiment of the present disclosure can execute a particle computing method for the picture provided by the embodiment of the present disclosure, and the implementation principle is similar.
  • the modules in the particle computing device for the picture in each embodiment of the present disclosure The actions performed correspond to the steps in the particle calculation method of the picture in each embodiment of the present disclosure.
  • an electronic device is also provided in the embodiment of the present disclosure.
  • the electronic device may include, but is not limited to: a processor and a memory; and a memory for storing a computer. Operation instruction; processor, used to execute the method shown in the embodiment by invoking a computer operation instruction.
  • the electronic device in this application can be adapted to lower version graphics API.
  • an electronic device is provided.
  • the electronic device 4000 shown in FIG. 8 includes a processor 4001 and a memory 4003. Among them, the processor 4001 and the memory 4003 are connected, such as through a bus 4002.
  • the electronic device 4000 may further include a transceiver 4004. It should be noted that in actual applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation to the embodiment of the present application.
  • the processor 4001 may be a central processing unit (CPU), a general-purpose processor, a data signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, transistor logic devices, Hardware components or any combination thereof. It can implement or execute various exemplary logical blocks, modules, and circuits described in conjunction with the disclosure of this application.
  • the processor 4001 may also be a combination for realizing computing functions, for example, including a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and so on.
  • the bus 4002 may include a path for transferring information between the above-mentioned components.
  • the bus 4002 may be a Peripheral Component Interconnection Standard (PCI) bus or an Extended Industry Standard Architecture (EISA) bus or the like.
  • PCI Peripheral Component Interconnection Standard
  • EISA Extended Industry Standard Architecture
  • the bus 4002 can be divided into an address bus, a data bus, a control bus, and so on. For ease of representation, only one thick line is used in FIG. 8, but it does not mean that there is only one bus or one type of bus.
  • the memory 4003 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electronic device.
  • ROM read-only memory
  • RAM random access memory
  • EEPROM Erasable Programmable Read-Only Memory
  • CD-ROM or other optical disc storage optical disc storage (including compact discs, laser discs, optical discs, digital universal discs, Blu-ray discs, etc.), magnetic disk storage media or other Magnetic storage devices, or any other media that can be used to carry or store desired program codes in the form of instructions or data structures and that can be accessed by a computer, but are not limited thereto.
  • the memory 4003 is used to store application program codes for executing the solution of the present application, and is controlled by the processor 4001 to execute.
  • the processor 4001 is configured to execute the application program code stored in the memory 4003 to implement the content shown in the foregoing method embodiment.
  • electronic devices include but are not limited to: mobile phones, notebook computers, digital broadcast receivers, personal digital assistants (PDA), tablet computers (PAD), portable multimedia players (PMP), vehicle terminals (for example, vehicle navigation terminals) And so on mobile terminals and fixed terminals such as digital TVs, desktop computers, etc.
  • PDA personal digital assistants
  • PAD tablet computers
  • PMP portable multimedia players
  • vehicle terminals for example, vehicle navigation terminals
  • FIG. 8 is only an example, and should not bring any limitation to the function and scope of use of the embodiments of the present disclosure.
  • the embodiments of the present application provide a computer-readable storage medium with a computer program stored on the computer-readable storage medium, and when it runs on a computer, the computer can execute the corresponding content in the foregoing method embodiment.
  • the computer-readable storage medium provided in this application can be suitable for lower version graphics APIs.
  • the aforementioned computer-readable medium in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two.
  • the computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or a combination of any of the above. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable removable Programmable read only memory (EPROM or flash memory), optical fiber, portable compact disk read only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program, and the program may be used by or in combination with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in a baseband or as a part of a carrier wave, and a computer-readable program code is carried therein. This propagated data signal can take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • the computer-readable signal medium may also be any computer-readable medium other than the computer-readable storage medium.
  • the computer-readable signal medium may send, propagate or transmit the program for use by or in combination with the instruction execution system, apparatus, or device .
  • the program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to: wire, optical cable, radio frequency (RF), etc., or any suitable combination of the above.
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or it may exist alone without being assembled into the electronic device.
  • the foregoing computer-readable medium carries one or more programs, and when the foregoing one or more programs are executed by the electronic device, the electronic device is caused to execute the method shown in the foregoing embodiment.
  • the computer program code used to perform the operations of the present disclosure may be written in one or more programming languages or a combination thereof.
  • the above-mentioned programming languages include object-oriented programming languages—such as Java, Smalltalk, C++, and also conventional Procedural programming language-such as "C" language or similar programming language.
  • the program code can be executed entirely on the user's computer, partly on the user's computer, executed as an independent software package, partly on the user's computer and partly executed on a remote computer, or entirely executed on the remote computer or server.
  • the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (for example, using an Internet service provider to pass Internet connection).
  • LAN local area network
  • WAN wide area network
  • each block in the flowchart or block diagram may represent a module, program segment, or part of code, and the module, program segment, or part of code contains one or more for realizing the specified logical function Executable instructions.
  • the functions marked in the block may also occur in a different order from the order marked in the drawings. For example, two blocks shown in succession can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved.
  • each block in the block diagram and/or flowchart, and the combination of the blocks in the block diagram and/or flowchart can be implemented by a dedicated hardware-based system that performs the specified functions or operations Or it can be realized by a combination of dedicated hardware and computer instructions.
  • the units involved in the embodiments described in the present disclosure can be implemented in software or hardware. Wherein, the name of the unit does not constitute a limitation on the unit itself under certain circumstances.
  • the first obtaining unit can also be described as "a unit for obtaining at least two Internet Protocol addresses.”

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Graphics (AREA)
  • Image Generation (AREA)

Abstract

Embodiments of the present application provide a particle calculation method and apparatus, an electronic device, and a computer readable storage medium. The method comprises: receiving initial attribute parameters and attribute functions, inputted by a user, of particles, the attribute functions corresponding to the initial attribute parameters; sending the initial attribute parameters and attribute functions to a graphics processing unit; and during particle playback, calculating, by the graphics processing unit according to the initial attribute parameters, the attribute functions, and particle playback time, real-time attribute parameters corresponding to the particle playback time. The particle calculation method disclosed in the embodiments of the present application may be applicable to low-version graphics APIs.

Description

粒子计算方法、装置、电子设备及计算机可读存储介质Particle calculation method, device, electronic equipment and computer readable storage medium
相关申请的交叉引用Cross-references to related applications
本公开要求于2019年9月3日在中国知识产权局提交的标题为“粒子计算方法、装置、电子设备及计算机可读存储介质”中国专利申请No.201910828698.9的优先权,通过引用将该中国专利申请公开的全部内容并入本文。This disclosure claims the priority of Chinese Patent Application No. 201910828698.9 filed with the China Intellectual Property Office on September 3, 2019, entitled "Particle Computing Method, Apparatus, Electronic Equipment, and Computer Readable Storage Medium", and this Chinese patent application is incorporated by reference. The entire disclosure of the patent application is incorporated herein.
技术领域Technical field
本申请涉及粒子计算技术领域,具体而言,本申请涉及一种粒子计算方法、装置、电子设备及计算机可读存储介质。This application relates to the field of particle computing technology. Specifically, this application relates to a particle computing method, device, electronic device, and computer-readable storage medium.
背景技术Background technique
粒子系统是一种有效模拟不规则模糊物体的图形生成算法,它采用统一的模式来生成诸如云、烟、火、水等具有不规则形状的自然现象。在粒子系统中,景象被定义为成千上万个不规则的、随机分布的粒子所组成。粒子系统可以仿真模拟不定性物体的运动,因此在目前的三维仿真场景中有广泛的应用。The particle system is a graphic generation algorithm that effectively simulates irregular fuzzy objects. It uses a unified pattern to generate natural phenomena with irregular shapes such as clouds, smoke, fire, and water. In the particle system, the scene is defined as being composed of thousands of irregular and randomly distributed particles. The particle system can simulate the motion of uncertain objects, so it has a wide range of applications in the current three-dimensional simulation scenes.
但目前的粒子计算一般是在图形处理器(GPU)中计算出粒子当前状态后写入到浮点纹理中,并把浮点纹理中的数据写回到中央处理器(CPU)中,但这种计算方式只适用于高版本的图形应用编程接口(API),低版本的图形API中并不能支持GPU数据写回CPU,因此,有必要提供一种可以适用于低版本的图形API的粒子计算方法。However, the current particle calculation generally uses the graphics processing unit (GPU) to calculate the current state of the particle and then writes it to the floating-point texture, and writes the data in the floating-point texture back to the central processing unit (CPU), but this This calculation method is only applicable to the higher version of the graphics application programming interface (API). The lower version of the graphics API does not support the writing of GPU data back to the CPU. Therefore, it is necessary to provide a particle calculation that can be applied to the lower version of the graphics API. method.
发明内容Summary of the invention
本申请的目的旨在至少能解决上述的技术缺陷之一,特别是粒子计算效率低的技术缺陷。The purpose of this application is to at least solve one of the above-mentioned technical defects, especially the technical defect of low particle calculation efficiency.
根据本公开实施例的第一方面,提供了一种粒子计算方法,该方法包括:According to a first aspect of the embodiments of the present disclosure, there is provided a particle calculation method, the method including:
接收用户输入的粒子的初始属性参数和属性函数,属性函数与初始属性参数相对应;Receive the initial attribute parameters and attribute functions of the particles input by the user, and the attribute functions correspond to the initial attribute parameters;
将初始属性参数和属性函数发送到图形处理器;以及Send initial attribute parameters and attribute functions to the graphics processor; and
在粒子播放时由图形处理器根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对应的实时属性参数。When the particles are playing, the graphics processor calculates the real-time attribute parameters corresponding to the particle playing time according to the initial attribute parameters, the attribute function, and the particle playing time.
在实施例中,将初始属性参数和属性函数发送到图形处理器包括:In the embodiment, sending the initial attribute parameter and the attribute function to the graphics processor includes:
将用户输入的属性函数中的速度函数转化为位移函数;以及Convert the velocity function in the attribute function input by the user into a displacement function; and
将初始属性参数、位移函数和除速度函数以外的其他属性函数发送到图形处理器。Send the initial attribute parameters, displacement function, and other attribute functions except the velocity function to the graphics processor.
在实施例中,将用户输入的属性函数中的速度函数转化为位移函数包括:In an embodiment, converting the velocity function in the attribute function input by the user into a displacement function includes:
将用户输入的速度函数相对于时间进行积分转化得到位移函数。Integrate the velocity function input by the user with respect to time to obtain the displacement function.
在实施例中,初始属性参数包括初始位置参数、初始旋转参数、初始尺寸和初始颜色参数;发送到图形处理器的属性函数包括位移函数、旋转函数、尺寸函数和颜色函数;In an embodiment, the initial attribute parameters include an initial position parameter, an initial rotation parameter, an initial size, and an initial color parameter; the attribute function sent to the graphics processor includes a displacement function, a rotation function, a size function, and a color function;
根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对应的实时属性参数包括:According to the initial attribute parameters, attribute functions, and particle playback time, the real-time attribute parameters corresponding to the particle playback time are calculated including:
根据初始位置参数和位移函数计算粒子的实时位置;Calculate the real-time position of the particle according to the initial position parameter and displacement function;
根据初始旋转参数和旋转函数计算粒子的实时旋转参数;Calculate the real-time rotation parameters of the particles according to the initial rotation parameters and the rotation function;
根据初始尺寸和尺寸函数计算粒子的实时尺寸;以及Calculate the real-time size of the particles based on the initial size and size function; and
根据初始颜色参数和颜色函数计算粒子的实时颜色参数。Calculate the real-time color parameters of the particles according to the initial color parameters and the color function.
根据本公开实施例的第二方面,提供了一种粒子计算方法,该方法包括:According to a second aspect of the embodiments of the present disclosure, there is provided a particle calculation method, the method including:
接收由中央处理器发送的粒子的初始属性参数和属性函数,属性函数与初始属性参数相对应;以及Receive the initial attribute parameters and attribute functions of the particles sent by the central processing unit, the attribute functions corresponding to the initial attribute parameters; and
在粒子播放时根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对应的实时属性参数。During particle playback, real-time attribute parameters corresponding to the particle playback time are calculated according to the initial attribute parameters, the attribute function, and the particle playback time.
在实施例中,初始属性参数包括初始位置参数、初始旋转参数、初始尺寸和初始颜色参数;属性函数包括位移函数、旋转函数、尺寸函数和颜色函数;In an embodiment, the initial attribute parameters include an initial position parameter, an initial rotation parameter, an initial size, and an initial color parameter; the attribute function includes a displacement function, a rotation function, a size function, and a color function;
根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对应的实时属性参数包括:According to the initial attribute parameters, attribute functions, and particle playback time, the real-time attribute parameters corresponding to the particle playback time are calculated including:
根据初始位置参数和位移函数计算粒子的实时位置;Calculate the real-time position of the particle according to the initial position parameter and displacement function;
根据初始旋转参数和旋转函数计算粒子的实时旋转参数;Calculate the real-time rotation parameters of the particles according to the initial rotation parameters and the rotation function;
根据初始尺寸和尺寸函数计算粒子的实时尺寸;以及Calculate the real-time size of the particles based on the initial size and size function; and
根据初始颜色参数和颜色函数计算粒子的实时颜色参数。Calculate the real-time color parameters of the particles according to the initial color parameters and the color function.
在实施例中,位移函数基于中央处理器接收到的速度函数相对于时间积分转化得到。In the embodiment, the displacement function is obtained by converting the velocity function received by the central processing unit with respect to the time integral.
根据本公开实施例的第三方面,提供了一种粒子计算方法,该方法包括:According to a third aspect of the embodiments of the present disclosure, there is provided a particle calculation method, which includes:
由中央处理器接收用户输入的粒子的初始属性参数和属性函数,属性函数与初始属性参数相对应;The central processor receives the initial attribute parameters and attribute functions of the particles input by the user, and the attribute functions correspond to the initial attribute parameters;
由中央处理器将初始属性参数和属性函数发送到图形处理器;The central processor sends the initial attribute parameters and attribute functions to the graphics processor;
在粒子播放时由图形处理器根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对应的实时属性参数。When the particles are playing, the graphics processor calculates the real-time attribute parameters corresponding to the particle playing time according to the initial attribute parameters, the attribute function, and the particle playing time.
根据本公开实施例的第四方面,提供了一种粒子计算装置,该装置包括:According to a fourth aspect of the embodiments of the present disclosure, there is provided a particle computing device, which includes:
第一接收模块,被配置为接收用户输入的粒子的初始属性参数和属性函数;属性函数与初始属性参数相对应;以及The first receiving module is configured to receive the initial attribute parameter and attribute function of the particle input by the user; the attribute function corresponds to the initial attribute parameter; and
第一计算模块,被配置为将初始属性参数和属性函数发送到图形处理器,以在粒子播放时由图形处理器根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对应的实时属性参数。The first calculation module is configured to send the initial attribute parameters and attribute functions to the graphics processor, so that the graphics processor calculates real-time attributes corresponding to the particle playback time according to the initial attribute parameters, attribute functions, and particle playback time during particle playback parameter.
在实施例中,第一计算模块还被配置为在将初始属性参数和属性函数发送到图形处理器时:In an embodiment, the first calculation module is further configured to, when sending the initial attribute parameters and attribute functions to the graphics processor:
将用户输入的属性函数中的速度函数转化为位移函数;以及Convert the velocity function in the attribute function input by the user into a displacement function; and
将初始属性参数、位移函数和除速度函数以外的其他属性函数发送到 图形处理器。The initial attribute parameters, displacement function, and other attribute functions except the velocity function are sent to the graphics processor.
在实施例中,第一计算模块还被配置为在将用户输入的属性函数中的速度函数转化为位移函数时:In an embodiment, the first calculation module is further configured to convert the velocity function in the attribute function input by the user into a displacement function:
将用户输入的速度函数相对于时间进行积分转化得到位移函数。Integrate the velocity function input by the user with respect to time to obtain the displacement function.
在实施例中,初始属性参数包括初始位置参数、初始旋转参数、初始尺寸和初始颜色参数;发送到图形处理器的属性函数包括位移函数、旋转函数、尺寸函数和颜色函数;In an embodiment, the initial attribute parameters include an initial position parameter, an initial rotation parameter, an initial size, and an initial color parameter; the attribute function sent to the graphics processor includes a displacement function, a rotation function, a size function, and a color function;
第一计算模块还被配置为在使图形处理器在根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对应的实时属性参数时:The first calculation module is also configured to enable the graphics processor to calculate the real-time attribute parameters corresponding to the particle playback time according to the initial attribute parameters, the attribute function, and the particle playback time:
通过图形处理器根据初始位置参数和位移函数计算粒子的实时位置;Calculate the real-time position of particles according to the initial position parameters and displacement function through the graphics processor;
根据初始旋转参数和旋转函数计算粒子的实时旋转参数;Calculate the real-time rotation parameters of the particles according to the initial rotation parameters and the rotation function;
根据初始尺寸和尺寸函数计算粒子的实时尺寸;以及Calculate the real-time size of the particles based on the initial size and size function; and
根据初始颜色参数和颜色函数计算粒子的实时颜色参数。Calculate the real-time color parameters of the particles according to the initial color parameters and the color function.
根据本公开实施例的第五方面,提供了一种粒子计算装置,该装置包括:According to a fifth aspect of the embodiments of the present disclosure, there is provided a particle computing device, which includes:
第二接收模块,被配置为接收由中央处理器发送的粒子的初始属性参数和属性函数,属性函数与初始属性参数相对应;以及The second receiving module is configured to receive the initial attribute parameters and attribute functions of the particles sent by the central processing unit, and the attribute functions correspond to the initial attribute parameters; and
第二计算模块,被配置为在粒子播放时根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对应的实时属性参数。The second calculation module is configured to calculate the real-time attribute parameter corresponding to the particle playing time according to the initial attribute parameter, the attribute function, and the particle playing time when the particle is playing.
在实施例中,初始属性参数包括初始位置参数、初始旋转参数、初始尺寸和初始颜色参数;属性函数包括位移函数、旋转函数、尺寸函数和颜色函数;In an embodiment, the initial attribute parameters include an initial position parameter, an initial rotation parameter, an initial size, and an initial color parameter; the attribute function includes a displacement function, a rotation function, a size function, and a color function;
第二计算模块还被配置为在根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对应的实时属性参数时:The second calculation module is also configured to calculate the real-time attribute parameter corresponding to the particle playing time according to the initial attribute parameter, the attribute function, and the particle playing time:
根据初始位置参数和位移函数计算粒子的实时位置;Calculate the real-time position of the particle according to the initial position parameter and displacement function;
根据初始旋转参数和旋转函数计算粒子的实时旋转参数;Calculate the real-time rotation parameters of the particles according to the initial rotation parameters and the rotation function;
根据初始尺寸和尺寸函数计算粒子的实时尺寸;以及Calculate the real-time size of the particles based on the initial size and size function; and
根据初始颜色参数和颜色函数计算粒子的实时颜色参数。Calculate the real-time color parameters of the particles according to the initial color parameters and the color function.
在实施例中,位移函数基于由中央处理器接收到的速度函数相对于时 间积分转化得到。In the embodiment, the displacement function is obtained based on the integration of the velocity function received by the central processing unit with respect to time.
根据本公开实施例的第六方面,提供了一种电子设备,该电子设备包括:According to a sixth aspect of the embodiments of the present disclosure, there is provided an electronic device, the electronic device including:
一个或多个处理器;以及One or more processors; and
存储器,被配置为存储一个或多个应用程序;The memory is configured to store one or more application programs;
其中,该一个或多个应用程序被配置为由一个或多个处理器执行时执行实现本申请第一方面所示的粒子计算方法。Wherein, the one or more application programs are configured to execute the particle calculation method shown in the first aspect of the present application when being executed by one or more processors.
根据本公开实施例的第七方面,提供了一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,其中该程序被配置为由处理器执行时实现本申请第一方面所示的粒子计算方法。According to a seventh aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, and a computer program is stored on the computer-readable storage medium, wherein the program is configured to be executed by a processor to implement the method shown in the first aspect of the present application The particle calculation method.
本申请提供的技术方案至少带来如下有益效果:The technical solution provided by this application brings at least the following beneficial effects:
在本公开实施例的方案中,通过中央处理器接收用户输入的粒子的初始属性参数和属性函数,属性函数与初始属性参数相对应,然后中央处理器将初始属性参数和属性函数发送到图形处理器中,由图形处理器在粒子播放时根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对应的实时属性参数,中央处理器直接将初始属性参数和属性函数发送到图形处理器,图形处理器计算完成后不需要将数据写回中央处理器,可以适用于低版本的图形API。In the solution of the embodiment of the present disclosure, the initial attribute parameters and attribute functions of the particles input by the user are received through the central processing unit, and the attribute functions correspond to the initial attribute parameters, and then the central processing unit sends the initial attribute parameters and attribute functions to the graphics processing unit. In the processor, the graphics processor calculates the real-time attribute parameters corresponding to the particle playback time according to the initial attribute parameters, attribute functions, and particle playback time during particle playback. The central processor directly sends the initial attribute parameters and attribute functions to the graphics processor. The graphics processor does not need to write the data back to the central processing unit after the calculation is completed, and it can be applied to the lower version of the graphics API.
此外,计算过程中无需设置其他处理器,可以节省存储空间;由图形处理器进行较复杂的计算,可以提高粒子计算效率。In addition, there is no need to set up other processors in the calculation process, which can save storage space; more complex calculations are performed by the graphics processor, which can improve the efficiency of particle calculation.
而且,中央处理器将用户输入的属性函数中的速度函数转化为位移函数,再将初始属性参数、位移函数和除速度函数以外的其他属性函数发送到图形处理器,由图形处理器进行计算,中央处理器和图形处理器进行分工协作,由图形处理器进行复杂计算,可以进一步提高粒子计算效率。Moreover, the central processing unit converts the velocity function in the attribute function input by the user into a displacement function, and then sends the initial attribute parameter, the displacement function and other attribute functions except the velocity function to the graphics processor, and the graphics processor performs calculations. The central processing unit and the graphics processor carry out the division of labor and cooperation, and the graphics processor performs complex calculations, which can further improve the efficiency of particle calculation.
本申请附加的方面和优点将在下面的描述中部分给出,这些将从下面的描述中变得明显,或通过本申请的实践了解到。The additional aspects and advantages of the present application will be partly given in the following description, which will become obvious from the following description, or be understood through the practice of the present application.
附图说明Description of the drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对本申请实施 例描述中所需要使用的附图作简单地介绍。In order to more clearly describe the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings that need to be used in the description of the embodiments of the present application.
图1为根据本申请实施例的粒子计算方法的流程示意图;FIG. 1 is a schematic flowchart of a particle calculation method according to an embodiment of the present application;
图2为根据本申请实施例的粒子计算方法的流程示意图;FIG. 2 is a schematic flowchart of a particle calculation method according to an embodiment of the present application;
图3为根据本申请实施例的粒子计算方法的流程示意图;FIG. 3 is a schematic flowchart of a particle calculation method according to an embodiment of the present application;
图4为根据本申请实施例的粒子计算方法的流程示意图;4 is a schematic flowchart of a particle calculation method according to an embodiment of the present application;
图5为根据本申请实施例的粒子计算装置的结构示意图;Fig. 5 is a schematic structural diagram of a particle computing device according to an embodiment of the present application;
图6为根据本申请实施例的粒子计算装置的结构示意图;Fig. 6 is a schematic structural diagram of a particle computing device according to an embodiment of the present application;
图7为根据本申请实施例的粒子计算装置的结构示意图;Fig. 7 is a schematic structural diagram of a particle computing device according to an embodiment of the present application;
图8为根据本申请实施例的粒子计算的电子设备的结构示意图。Fig. 8 is a schematic structural diagram of an electronic device for particle computing according to an embodiment of the present application.
具体实施方式detailed description
下面详细描述本申请的实施例,实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施例是示例性的,仅用于解释本申请,而不能解释为对本发明的限制。The embodiments of the present application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals indicate the same or similar elements or elements with the same or similar functions. The embodiments described below with reference to the drawings are exemplary, and are only used to explain the present application, and cannot be construed as limiting the present invention.
本技术领域技术人员可以理解,除非特意声明,这里使用的单数形式“一”、“一个”、“所述”和“该”也可包括复数形式。应该进一步理解的是,本申请的说明书中使用的措辞“包括”是指存在所述特征、整数、步骤、操作、元件和/或组件,但是并不排除存在或添加一个或多个其他特征、整数、步骤、操作、元件、组件和/或它们的组。应该理解,当我们称元件被“连接”或“耦接”到另一元件时,它可以直接连接或耦接到其他元件,或者也可以存在中间元件。此外,这里使用的“连接”或“耦接”可以包括无线连接或无线耦接。这里使用的措辞“和/或”包括一个或更多个相关联的列出项的全部或任一单元和全部组合。Those skilled in the art can understand that, unless specifically stated, the singular forms "a", "an", "said" and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of this application refers to the presence of the described features, integers, steps, operations, elements and/or components, but does not exclude the presence or addition of one or more other features, Integers, steps, operations, elements, components, and/or groups of them. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element, or intervening elements may also be present. In addition, “connected” or “coupled” used herein may include wireless connection or wireless coupling. The term "and/or" as used herein includes all or any unit and all combinations of one or more of the associated listed items.
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。In order to make the objectives, technical solutions, and advantages of the present application clearer, the implementation manners of the present application will be further described in detail below with reference to the accompanying drawings.
为了更好的说明本公开实施例的方案,下面首先对本公开的实施例涉及的相关技术术语进行介绍和解释:In order to better describe the solutions of the embodiments of the present disclosure, the following first introduces and explains related technical terms involved in the embodiments of the present disclosure:
中央处理器(CPU)是电子计算机的主要设备之一,电脑中的核心配 件。其功能主要是解释计算机指令以及处理计算机软件中的数据。CPU是计算机中负责读取指令,对指令译码并执行指令的核心部件。The central processing unit (CPU) is one of the main equipment of an electronic computer and the core component of the computer. Its function is mainly to interpret computer instructions and process data in computer software. The CPU is the core component of the computer that is responsible for reading instructions, decoding and executing instructions.
图形处理器(GPU)是显卡的处理器,与CPU类似,只不过GPU是专为执行复杂的数学和几何计算而设计的,这些计算是图形渲染所必需的。The graphics processing unit (GPU) is the processor of the graphics card, similar to the CPU, except that the GPU is designed to perform complex mathematical and geometric calculations, which are necessary for graphics rendering.
本申请提供的粒子计算方法、装置、电子设备和计算机可读存储介质,旨在解决现有技术的如上技术问题。The particle computing method, device, electronic device, and computer-readable storage medium provided in this application are intended to solve the above technical problems in the prior art.
下面以具体地实施例对本申请的技术方案以及本申请的技术方案如何解决上述技术问题进行详细说明。下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例中不再赘述。下面将结合附图,对本申请的实施例进行描述。The technical solutions of the present application and how the technical solutions of the present application solve the above technical problems will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
本申请实施例中提供了一种粒子计算方法,如图1所示,该方法可以包括如下步骤。An embodiment of the present application provides a particle calculation method. As shown in FIG. 1, the method may include the following steps.
步骤S101,接收用户输入的粒子的初始属性参数和属性函数,属性函数与初始属性参数相对应。Step S101: Receive initial attribute parameters and attribute functions of particles input by the user, where the attribute functions correspond to the initial attribute parameters.
其中,粒子的初始属性参数可以包括初始位置参数,对应的属性函数可以是速度函数或位移函数;初始属性参数还可以包括初始旋转参数,例如,角速度,对应的属性函数可以是旋转函数;初始属性参数还可以包括初始尺寸,即粒子的初始大小,对应的属性函数可以是尺寸函数;初始属性参数还可以包括初始颜色参数,对应的属性函数可以是颜色函数。Among them, the initial attribute parameter of the particle can include the initial position parameter, and the corresponding attribute function can be a velocity function or a displacement function; the initial attribute parameter can also include an initial rotation parameter, for example, angular velocity, and the corresponding attribute function can be a rotation function; the initial attribute The parameter may also include the initial size, that is, the initial size of the particle, and the corresponding attribute function may be a size function; the initial attribute parameter may also include an initial color parameter, and the corresponding attribute function may be a color function.
在具体实施过程中,用户可以自行输入初始属性参数和对应的属性函数到中央处理器中;也可以在终端或服务器中预存多种属性参数和各属性函数,用户自行从预存的属性参数和属性函数中选取用于计算的初始属性参数和对应的属性函数。In the specific implementation process, users can input initial attribute parameters and corresponding attribute functions into the central processing unit by themselves; they can also pre-store various attribute parameters and various attribute functions in the terminal or server, and users can choose from the pre-stored attribute parameters and attributes. Select the initial attribute parameter and corresponding attribute function for calculation in the function.
步骤S102,将初始属性参数和属性函数发送到图形处理器,以在粒子播放时由图形处理器根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对应的实时属性参数。Step S102: Send the initial attribute parameter and the attribute function to the graphics processor, so that the graphics processor calculates the real-time attribute parameter corresponding to the particle playback time according to the initial attribute parameter, the attribute function, and the particle playback time during particle playback.
其中,粒子播放时即粒子正在运动时,粒子播放时间可以是粒子从静止状态切换到运动状态后,已经运动的时间。Wherein, when the particle is playing, that is, when the particle is moving, the playing time of the particle may be the time that the particle has moved after switching from the static state to the moving state.
在具体实施过程中,中央处理器可以直接将初始属性参数和属性函数 发送到图形处理器,在粒子播放时通过图形处理器进行计算;中央处理器也可以先对属性函数进行处理,然后将处理后的属性函数发送到图形处理器,在粒子播放时通过图形处理器进行粒子计算。In the specific implementation process, the central processing unit can directly send the initial attribute parameters and attribute functions to the graphics processor, and calculate through the graphics processor during particle playback; the central processing unit can also process the attribute functions first, and then process The latter attribute function is sent to the graphics processor, and the particles are calculated by the graphics processor when the particles are played.
具体地,根据粒子的初始位置参数、速度函数和粒子播放时间,或者根据粒子的初始位置参数、位移函数和粒子播放时间计算粒子的实时位置;根据初始旋转参数、旋转函数和粒子播放时间计算粒子的实时旋转参数;根据初始尺寸、尺寸函数和粒子播放时间计算粒子的实时尺寸参数;根据初始颜色参数、颜色函数和粒子播放时间计算粒子的实时颜色参数。Specifically, the real-time position of the particle is calculated according to the initial position parameter, velocity function, and particle playback time of the particle, or the initial position parameter, displacement function, and particle playback time of the particle; the particle is calculated according to the initial rotation parameter, rotation function, and particle playback time The real-time rotation parameters of the particles; the real-time size parameters of the particles are calculated according to the initial size, the size function and the particle playback time; the real-time color parameters of the particles are calculated according to the initial color parameters, the color function and the particle playback time.
上述实施例中,通过中央处理器接收用户输入的粒子的初始属性参数和属性函数,属性函数与初始属性参数相对应,然后中央处理器将初始属性参数和属性函数发送到图形处理器中,由图形处理器在粒子播放时根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对应的实时属性参数,中央处理器直接将初始属性参数和属性函数发送到图形处理器,图形处理器计算完成后不需要将数据写回中央处理器,可以适用于低版本的图形API;且计算过程无需设置其他处理器,可以节省存储空间;由图形处理器进行较复杂的计算,可以提高粒子计算效率。In the above-mentioned embodiment, the initial attribute parameters and attribute functions of the particles input by the user are received by the central processing unit. The attribute functions correspond to the initial attribute parameters, and then the central processing unit sends the initial attribute parameters and attribute functions to the graphics processor. The graphics processor calculates the real-time attribute parameters corresponding to the particle playback time according to the initial attribute parameters, attribute functions, and particle playback time during particle playback. The central processor directly sends the initial attribute parameters and attribute functions to the graphics processor, and the graphics processor calculates After completion, there is no need to write the data back to the central processor, which can be applied to low-level graphics APIs; and the calculation process does not need to set up other processors, which can save storage space; the graphics processor performs more complex calculations, which can improve the efficiency of particle calculations .
本申请实施例中提供了一种可能的实现方式,步骤S102中的将初始属性参数和属性函数发送到图形处理器,可以包括:The embodiment of the present application provides a possible implementation manner. The sending of the initial attribute parameter and the attribute function to the graphics processor in step S102 may include:
(1)将用户输入的属性函数中的速度函数转化为位移函数。(1) Convert the velocity function in the attribute function input by the user into a displacement function.
本步骤中,用户可以直接输入速度函数,即粒子运动速度随时间的变化曲线,中央处理器可以将速度函数进行转化得到位移函数。In this step, the user can directly input the velocity function, that is, the change curve of the particle motion velocity with time, and the central processing unit can convert the velocity function to obtain the displacement function.
在具体实施过程中,将用户输入的速度函数相对于时间进行积分转化得到位移函数。In the specific implementation process, the velocity function input by the user is integrated with respect to time to obtain the displacement function.
(2)将初始属性参数、位移函数和除速度函数以外的其他属性函数发送到图形处理器。(2) Send the initial attribute parameter, displacement function, and other attribute functions except the velocity function to the graphics processor.
具体地,中央处理器可以识别用户输入的属性函数是速度函数还是位移函数,如果识别出是速度函数,则对速度函数进行转化;如果识别出为位移函数,则将位移函数和其他属性函数直接发送到图形处理器。Specifically, the central processing unit can recognize whether the attribute function input by the user is a velocity function or a displacement function. If it is recognized as a velocity function, the velocity function is converted; if it is recognized as a displacement function, the displacement function and other attribute functions are directly Send to the graphics processor.
根据本申请的实施例中,初始属性参数可以包括初始位置参数、初始 旋转参数、初始尺寸和初始颜色参数;发送到图形处理器的属性函数可以包括位移函数、旋转函数、尺寸函数和颜色函数。步骤S102中的根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对应的实时属性参数可以包括:According to the embodiment of the present application, the initial attribute parameters may include initial position parameters, initial rotation parameters, initial size, and initial color parameters; the attribute functions sent to the graphics processor may include displacement functions, rotation functions, size functions, and color functions. The calculation of the real-time attribute parameter corresponding to the particle playback time according to the initial attribute parameter, the attribute function, and the particle playback time in step S102 may include:
(1)根据初始位置参数和位移函数计算粒子的实时位置;(1) Calculate the real-time position of particles according to the initial position parameters and displacement function;
(2)根据初始旋转参数和旋转函数计算粒子的实时旋转参数;(2) Calculate the real-time rotation parameters of the particles according to the initial rotation parameters and the rotation function;
(3)根据初始尺寸和尺寸函数计算粒子的实时尺寸;以及(3) Calculate the real-time size of particles according to the initial size and size function; and
(4)根据初始颜色参数和颜色函数计算粒子的实时颜色参数。(4) Calculate the real-time color parameters of the particles according to the initial color parameters and the color function.
以计算粒子的实时位置为例,可以采用如下公式进行计算:Taking the calculation of the real-time position of particles as an example, the following formula can be used for calculation:
Figure PCTCN2020112840-appb-000001
Figure PCTCN2020112840-appb-000001
式中S(t)为粒子实时位置,S origin为粒子的初始位置,v(t)为粒子的速度函数,
Figure PCTCN2020112840-appb-000002
为粒子的位移函数。
Where S(t) is the real-time position of the particle, S origin is the initial position of the particle, v(t) is the velocity function of the particle,
Figure PCTCN2020112840-appb-000002
Is the displacement function of the particle.
上述的粒子计算方法,通过中央处理器接收用户输入的粒子的初始属性参数和属性函数,属性函数与初始属性参数相对应,然后中央处理器将初始属性参数和属性函数发送到图形处理器中,由图形处理器在粒子播放时根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对应的实时属性参数,中央处理器直接将初始属性参数和属性函数发送到图形处理器,图形处理器计算完成后不需要将数据写回中央处理器,可以适用于低版本的图形API。In the above particle calculation method, the initial attribute parameters and attribute functions of the particles input by the user are received by the central processing unit. The attribute functions correspond to the initial attribute parameters, and then the central processing unit sends the initial attribute parameters and attribute functions to the graphics processor. The graphics processor calculates the real-time attribute parameters corresponding to the particle playback time according to the initial attribute parameters, attribute functions, and particle playback time during particle playback. The central processor directly sends the initial attribute parameters and attribute functions to the graphics processor and graphics processor. After the calculation is completed, there is no need to write the data back to the central processing unit, which can be applied to low-level graphics APIs.
进一步地,计算过程中无需设置其他处理器,可以节省存储空间;由图形处理器进行较复杂的计算,可以提高粒子计算效率。Furthermore, there is no need to set up other processors in the calculation process, which can save storage space; the more complex calculations performed by the graphics processor can improve the efficiency of particle calculation.
进一步地,中央处理器将将用户输入的属性函数中的速度函数转化为位移函数,再将将初始属性参数、位移函数和除速度函数以外的其他属性函数发送到图形处理器,由图形处理器进行计算,中央处理器和图形处理器进行分工协作,由图形处理器进行复杂计算,可以进一步提高粒子计算效率。Further, the central processing unit converts the velocity function in the attribute function input by the user into a displacement function, and then sends the initial attribute parameter, the displacement function, and other attribute functions except the velocity function to the graphics processor, and the graphics processor For calculations, the central processing unit and the graphics processor perform division of labor and coordination, and the graphics processor performs complex calculations, which can further improve the efficiency of particle calculations.
本实施例还提供了一种粒子计算方法,如图2所示,该方法可以包括如下步骤。This embodiment also provides a particle calculation method. As shown in FIG. 2, the method may include the following steps.
步骤S201,接收由中央处理器发送的粒子的初始属性参数和属性函数,属性函数与初始属性参数相对应。Step S201: Receive the initial attribute parameter and attribute function of the particle sent by the central processing unit, where the attribute function corresponds to the initial attribute parameter.
其中,粒子的初始属性参数可以包括初始位置参数,对应的属性函数可以是速度函数或位移函数;初始属性参数还可以包括初始旋转参数,例如,角速度,对应的属性函数可以是旋转函数;初始属性参数还可以包括初始尺寸,即粒子的初始大小,对应的属性函数可以是尺寸函数;初始属性参数还可以包括初始颜色参数,对应的属性函数可以是颜色函数。Among them, the initial attribute parameter of the particle may include an initial position parameter, and the corresponding attribute function may be a velocity function or a displacement function; the initial attribute parameter may also include an initial rotation parameter, for example, angular velocity, and the corresponding attribute function may be a rotation function; The parameter may also include the initial size, that is, the initial size of the particle, and the corresponding attribute function may be a size function; the initial attribute parameter may also include an initial color parameter, and the corresponding attribute function may be a color function.
步骤S202,在粒子播放时根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对应的实时属性参数。Step S202: Calculate real-time attribute parameters corresponding to the particle playing time according to the initial attribute parameter, the attribute function, and the particle playing time during particle playing.
其中,粒子播放时即粒子正在运动时,粒子播放时间可以是粒子从静止状态切换到运动状态后,已经运动的时间。Wherein, when the particle is playing, that is, when the particle is moving, the playing time of the particle may be the time that the particle has moved after switching from the static state to the moving state.
具体地,根据粒子的初始位置参数、速度函数和粒子播放时间,或者根据粒子的初始位置参数、位移函数和粒子播放时间计算粒子的实时位置;根据初始旋转参数、旋转函数和粒子播放时间计算粒子的实时旋转参数;根据初始尺寸、尺寸函数和粒子播放时间计算粒子的实时尺寸参数;根据初始颜色参数、颜色函数和粒子播放时间计算粒子的实时颜色参数。Specifically, the real-time position of the particle is calculated according to the initial position parameter, velocity function, and particle playback time of the particle, or the initial position parameter, displacement function, and particle playback time of the particle; the particle is calculated according to the initial rotation parameter, rotation function, and particle playback time The real-time rotation parameters of the particles; the real-time size parameters of the particles are calculated according to the initial size, the size function and the particle playback time; the real-time color parameters of the particles are calculated according to the initial color parameters, the color function and the particle playback time.
根据本申请的实施例,初始属性参数可以包括初始位置参数、初始旋转参数、初始尺寸和初始颜色参数;属性函数包括位移函数、旋转函数、尺寸函数和颜色函数;步骤S202中的根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对应的实时属性参数,可以包括:According to the embodiment of the present application, the initial attribute parameters may include initial position parameters, initial rotation parameters, initial size, and initial color parameters; the attribute functions include displacement function, rotation function, size function, and color function; in step S202, according to the initial attribute parameters , Attribute function and particle playback time calculation The real-time attribute parameters corresponding to the particle playback time can include:
(1)根据初始位置参数和位移函数计算粒子的实时位置;(1) Calculate the real-time position of particles according to the initial position parameters and displacement function;
(2)根据初始旋转参数和旋转函数计算粒子的实时旋转参数;(2) Calculate the real-time rotation parameters of the particles according to the initial rotation parameters and the rotation function;
(3)根据初始尺寸和尺寸函数计算粒子的实时尺寸;以及(3) Calculate the real-time size of particles according to the initial size and size function; and
(4)根据初始颜色参数和颜色函数计算粒子的实时颜色参数。(4) Calculate the real-time color parameters of the particles according to the initial color parameters and the color function.
根据本申请的实施例,位移函数基于中央处理器接收到的速度函数相对于时间积分转化得到。According to the embodiment of the present application, the displacement function is obtained by transforming the speed function received by the central processing unit with respect to the time integral.
具体地,中央处理器可以识别用户输入的属性函数是速度函数还是位移函数,如果识别出是速度函数,则对速度函数进行转化;如果识别出为位移函数,则将位移函数和其他属性函数直接发送到图形处理器。Specifically, the central processing unit can recognize whether the attribute function input by the user is a velocity function or a displacement function. If it is recognized as a velocity function, the velocity function is converted; if it is recognized as a displacement function, the displacement function and other attribute functions are directly Send to the graphics processor.
以计算粒子的实时位置为例,可以采用如下公式进行计算:Taking the calculation of the real-time position of particles as an example, the following formula can be used for calculation:
Figure PCTCN2020112840-appb-000003
Figure PCTCN2020112840-appb-000003
式中S(t)为粒子实时位置,S origin为粒子的初始位置,v(t)为粒子的速度函数,
Figure PCTCN2020112840-appb-000004
为粒子的位移函数。
Where S(t) is the real-time position of the particle, S origin is the initial position of the particle, v(t) is the velocity function of the particle,
Figure PCTCN2020112840-appb-000004
Is the displacement function of the particle.
上述的粒子计算方法,通过中央处理器接收用户输入的粒子的初始属性参数和属性函数,属性函数与初始属性参数相对应,然后中央处理器将初始属性参数和属性函数发送到图形处理器中,由图形处理器在粒子播放时根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对应的实时属性参数,中央处理器直接将初始属性参数和属性函数发送到图形处理器,图形处理器计算完成后不需要将数据写回中央处理器,可以适用于低版本的图形API。In the above particle calculation method, the initial attribute parameters and attribute functions of the particles input by the user are received by the central processing unit. The attribute functions correspond to the initial attribute parameters, and then the central processing unit sends the initial attribute parameters and attribute functions to the graphics processor. The graphics processor calculates the real-time attribute parameters corresponding to the particle playback time according to the initial attribute parameters, attribute functions, and particle playback time during particle playback. The central processor directly sends the initial attribute parameters and attribute functions to the graphics processor and graphics processor. After the calculation is completed, there is no need to write the data back to the central processing unit, which can be applied to low-level graphics APIs.
进一步地,计算过程中无需设置其他处理器,可以节省存储空间;由图形处理器进行较复杂的计算,可以提高粒子计算效率。Furthermore, there is no need to set up other processors in the calculation process, which can save storage space; the more complex calculations performed by the graphics processor can improve the efficiency of particle calculation.
进一步地,中央处理器将将用户输入的属性函数中的速度函数转化为位移函数,再将将初始属性参数、位移函数和除速度函数以外的其他属性函数发送到图形处理器,由图形处理器进行计算,中央处理器和图形处理器进行分工协作,由图形处理器进行复杂计算,可以进一步提高粒子计算效率。Further, the central processing unit converts the velocity function in the attribute function input by the user into a displacement function, and then sends the initial attribute parameter, the displacement function, and other attribute functions except the velocity function to the graphics processor, and the graphics processor For calculations, the central processing unit and the graphics processor perform division of labor and coordination, and the graphics processor performs complex calculations, which can further improve the efficiency of particle calculations.
本实施例还提供了一种粒子计算方法,如图3所示,该方法可以包括如下步骤。This embodiment also provides a particle calculation method. As shown in FIG. 3, the method may include the following steps.
步骤S301,由中央处理器接收用户输入的粒子的初始属性参数和属性函数;属性函数与初始属性参数相对应。Step S301, the central processor receives the initial attribute parameter and attribute function of the particle input by the user; the attribute function corresponds to the initial attribute parameter.
其中,粒子的初始属性参数可以包括初始位置参数,对应的属性函数可以是速度函数或位移函数;初始属性参数还可以包括初始旋转参数,例如,角速度,对应的属性函数可以是旋转函数;初始属性参数还可以包括初始尺寸,即粒子的初始大小,对应的属性函数可以是尺寸函数;初始属性参数还可以包括初始颜色参数,对应的属性函数可以是颜色函数。Among them, the initial attribute parameter of the particle can include the initial position parameter, and the corresponding attribute function can be a velocity function or a displacement function; the initial attribute parameter can also include an initial rotation parameter, for example, angular velocity, and the corresponding attribute function can be a rotation function; the initial attribute The parameter may also include the initial size, that is, the initial size of the particle, and the corresponding attribute function may be a size function; the initial attribute parameter may also include an initial color parameter, and the corresponding attribute function may be a color function.
步骤S302,由中央处理器将初始属性参数和属性函数发送到图形处 理器。In step S302, the central processor sends the initial attribute parameters and attribute functions to the graphics processor.
在具体实施过程中,中央处理器可以直接将初始属性参数和属性函数发送到图形处理器,通过图形处理器在粒子播放时进行计算;中央处理器也可以先对属性函数进行处理,然后将处理后的属性函数发送到图形处理器,通过图形处理器在粒子播放时进行粒子计算。In the specific implementation process, the central processing unit can directly send the initial attribute parameters and attribute functions to the graphics processor, and the graphics processor performs calculations during particle playback; the central processing unit can also process the attribute functions first, and then process The latter attribute function is sent to the graphics processor, and the particle calculation is performed by the graphics processor during particle playback.
具体地,中央处理器还可以识别用户输入的属性函数是速度函数还是位移函数,如果识别出是速度函数,则对速度函数进行转化;如果识别出为位移函数,则将位移函数和其他属性函数直接发送到图形处理器。Specifically, the central processing unit can also recognize whether the attribute function input by the user is a velocity function or a displacement function. If it is recognized as a velocity function, the velocity function is converted; if it is recognized as a displacement function, the displacement function and other attribute functions are converted. Send directly to the graphics processor.
步骤S303,图形处理器在粒子播放时根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对应的实时属性参数。In step S303, the graphics processor calculates the real-time attribute parameter corresponding to the particle playback time according to the initial attribute parameter, the attribute function, and the particle playback time during particle playback.
其中,粒子播放时即粒子正在运动时,粒子播放时间可以是粒子从静止状态切换到运动状态后,已经运动的时间。Wherein, when the particle is playing, that is, when the particle is moving, the playing time of the particle may be the time that the particle has moved after switching from the static state to the moving state.
具体地,根据粒子的初始位置参数、速度函数和粒子播放时间,或者根据粒子的初始位置参数、位移函数和粒子播放时间计算粒子的实时位置;根据初始旋转参数、旋转函数和粒子播放时间计算粒子的实时旋转参数;根据初始尺寸、尺寸函数和粒子播放时间计算粒子的实时尺寸参数;根据初始颜色参数、颜色函数和粒子播放时间计算粒子的实时颜色参数。Specifically, the real-time position of the particle is calculated according to the initial position parameter, velocity function, and particle playback time of the particle, or the initial position parameter, displacement function, and particle playback time of the particle; the particle is calculated according to the initial rotation parameter, rotation function, and particle playback time The real-time rotation parameters of the particles; the real-time size parameters of the particles are calculated according to the initial size, the size function and the particle playback time; the real-time color parameters of the particles are calculated according to the initial color parameters, the color function and the particle playback time.
上述的粒子计算方法,通过中央处理器接收用户输入的粒子的初始属性参数和属性函数,属性函数与初始属性参数相对应,然后中央处理器将初始属性参数和属性函数发送到图形处理器中,由图形处理器在粒子播放时根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对应的实时属性参数,中央处理器直接将初始属性参数和属性函数发送到图形处理器,图形处理器计算完成后不需要将数据写回中央处理器,可以适用于低版本的图形API,且计算过程中无需设置其他处理器,可以节省存储空间;由图形处理器进行较复杂的计算,可以提高粒子计算效率。In the above particle calculation method, the initial attribute parameters and attribute functions of the particles input by the user are received by the central processing unit. The attribute functions correspond to the initial attribute parameters, and then the central processing unit sends the initial attribute parameters and attribute functions to the graphics processor. The graphics processor calculates the real-time attribute parameters corresponding to the particle playback time according to the initial attribute parameters, attribute functions, and particle playback time during particle playback. The central processor directly sends the initial attribute parameters and attribute functions to the graphics processor and graphics processor. After the calculation is completed, there is no need to write the data back to the central processing unit, which can be applied to low-level graphics APIs, and no other processors need to be set up during the calculation process, which can save storage space; the graphics processor performs more complex calculations, which can improve particles Computational efficiency.
为了更好地理解上述粒子计算方法,如图4所示,以下详细阐述一个本申请的粒子计算的示例:In order to better understand the above particle calculation method, as shown in Figure 4, an example of the particle calculation of this application is described in detail below:
在示例中,本申请提供的粒子计算方法,可以包括如下步骤:In an example, the particle calculation method provided in this application may include the following steps:
步骤S401,由中央处理器接收用户输入的粒子的初始属性参数和属 性函数,属性函数与初始属性参数相对应;Step S401, the central processor receives the initial attribute parameter and attribute function of the particle input by the user, and the attribute function corresponds to the initial attribute parameter;
步骤S402,由中央处理器将接收到的属性函数中的速度函数转化为位移函数;Step S402, the central processing unit converts the velocity function in the received attribute function into a displacement function;
步骤S403,由中央处理器将初始属性参数、位移函数和除速度函数以外的其他属性函数发送到图形处理器;Step S403, the central processor sends the initial attribute parameter, the displacement function and other attribute functions except the speed function to the graphics processor;
步骤S404,由图形处理器根据初始位置参数和位移函数计算粒子的实时位置;Step S404, the graphics processor calculates the real-time position of the particle according to the initial position parameter and the displacement function;
步骤S405,由图形处理器根据初始旋转参数和旋转函数计算粒子的实时旋转参数;Step S405, the graphics processor calculates the real-time rotation parameters of the particles according to the initial rotation parameters and the rotation function;
步骤S406,由图形处理器根据初始尺寸和尺寸函数计算粒子的实时尺寸;以及Step S406, the graphics processor calculates the real-time size of the particle according to the initial size and the size function; and
步骤S407,由图形处理器根据初始颜色参数和颜色函数计算粒子的实时颜色参数。In step S407, the graphics processor calculates the real-time color parameters of the particles according to the initial color parameters and the color function.
上述示例中,中央处理器将将用户输入的属性函数中的速度函数转化为位移函数,再将将初始属性参数、位移函数和除速度函数以外的其他属性函数发送到图形处理器,由图形处理器进行计算,中央处理器和图形处理器进行分工协作,由图形处理器进行复杂计算,可以进一步提高粒子计算效率。In the above example, the central processing unit converts the velocity function in the attribute function input by the user into a displacement function, and then sends the initial attribute parameter, the displacement function and other attribute functions except the velocity function to the graphics processor, which will be processed by the graphics The central processing unit and the graphics processor perform the calculation, the central processing unit and the graphics processor perform division of labor, and the graphics processor performs complex calculations, which can further improve the particle calculation efficiency.
本申请实施例提供了一种粒子计算装置,如图5所示,该粒子计算装置50可以包括:第一接收模块501和第一计算模块502。其中,The embodiment of the present application provides a particle computing device. As shown in FIG. 5, the particle computing device 50 may include: a first receiving module 501 and a first computing module 502. among them,
第一接收模块501,被配置为接收用户输入的粒子的初始属性参数和属性函数,属性函数与初始属性参数相对应;The first receiving module 501 is configured to receive initial attribute parameters and attribute functions of particles input by a user, and the attribute functions correspond to the initial attribute parameters;
第一计算模块502,被配置为将初始属性参数和属性函数发送到图形处理器,以在粒子播放时通过图形处理器根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对应的实时属性参数。The first calculation module 502 is configured to send initial attribute parameters and attribute functions to the graphics processor, so that the graphics processor calculates the real-time corresponding to the particle playback time according to the initial attribute parameters, attribute functions, and particle playback time during particle playback. Property parameters.
上述的粒子计算装置,通过中央处理器接收用户输入的粒子的初始属性参数和属性函数,属性函数与初始属性参数相对应,然后中央处理器将初始属性参数和属性函数发送到图形处理器中,由图形处理器在粒子播放时根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对 应的实时属性参数,中央处理器直接将初始属性参数和属性函数发送到图形处理器,图形处理器计算完成后不需要将数据写回中央处理器,可以适用于低版本的图形API,且计算过程中无需设置其他处理器,可以节省存储空间;由图形处理器进行较复杂的计算,可以提高粒子计算效率。The aforementioned particle computing device receives the initial attribute parameters and attribute functions of the particles input by the user through the central processing unit. The attribute functions correspond to the initial attribute parameters, and then the central processing unit sends the initial attribute parameters and attribute functions to the graphics processor. The graphics processor calculates the real-time attribute parameters corresponding to the particle playback time according to the initial attribute parameters, attribute functions, and particle playback time during particle playback. The central processor directly sends the initial attribute parameters and attribute functions to the graphics processor and graphics processor. After the calculation is completed, there is no need to write the data back to the central processing unit, which can be applied to low-level graphics APIs, and no other processors need to be set up during the calculation process, which can save storage space; the graphics processor performs more complex calculations, which can improve particles Computational efficiency.
根据本申请的实施例,第一计算模块502还被配置为在将初始属性参数和属性函数发送到图形处理器时:According to the embodiment of the present application, the first calculation module 502 is further configured to, when sending the initial attribute parameters and attribute functions to the graphics processor:
将用户输入的属性函数中的速度函数转化为位移函数;以及Convert the velocity function in the attribute function input by the user into a displacement function; and
将初始属性参数、位移函数和除速度函数以外的其他属性函数发送到图形处理器。Send the initial attribute parameters, displacement function, and other attribute functions except the velocity function to the graphics processor.
根据本申请的实施例,第一计算模块502还被配置为在将用户输入的属性函数中的速度函数转化为位移函数时:According to the embodiment of the present application, the first calculation module 502 is further configured to convert the velocity function in the attribute function input by the user into a displacement function:
将用户输入的速度函数相对于时间进行积分转化得到位移函数。Integrate the velocity function input by the user with respect to time to obtain the displacement function.
根据本申请的实施例,初始属性参数可以包括初始位置参数、初始旋转参数、初始尺寸和初始颜色参数;发送到图形处理器的属性函数包括位移函数、旋转函数、尺寸函数和颜色函数;According to the embodiment of the present application, the initial attribute parameter may include an initial position parameter, an initial rotation parameter, an initial size, and an initial color parameter; the attribute function sent to the graphics processor includes a displacement function, a rotation function, a size function, and a color function;
第一计算模块502还被配置为在使图形处理器在根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对应的实时属性参数时:The first calculation module 502 is further configured to enable the graphics processor to calculate the real-time attribute parameter corresponding to the particle playback time according to the initial attribute parameter, the attribute function, and the particle playback time:
使图形处理器根据初始位置参数和位移函数计算粒子的实时位置;Make the graphics processor calculate the real-time position of the particle according to the initial position parameter and the displacement function;
根据初始旋转参数和旋转函数计算粒子的实时旋转参数;Calculate the real-time rotation parameters of the particles according to the initial rotation parameters and the rotation function;
根据初始尺寸和尺寸函数计算粒子的实时尺寸;以及Calculate the real-time size of the particles based on the initial size and size function; and
根据初始颜色参数和颜色函数计算粒子的实时颜色参数。Calculate the real-time color parameters of the particles according to the initial color parameters and the color function.
本申请实施例提供了一种粒子计算装置,如图6所示,该粒子计算装置60可以包括:第二接收模块601和第二计算模块602。其中,The embodiment of the present application provides a particle computing device. As shown in FIG. 6, the particle computing device 60 may include: a second receiving module 601 and a second computing module 602. among them,
第二接收模块601,被配置为接收由中央处理器发送的粒子的初始属性参数和属性函数,属性函数与初始属性参数相对应;以及The second receiving module 601 is configured to receive the initial attribute parameters and attribute functions of the particles sent by the central processing unit, and the attribute functions correspond to the initial attribute parameters; and
第二计算模块602,被配置为在粒子播放时根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对应的实时属性参数。The second calculation module 602 is configured to calculate the real-time attribute parameter corresponding to the particle playing time according to the initial attribute parameter, the attribute function, and the particle playing time when the particle is playing.
根据本申请的实施例,初始属性参数可以包括初始位置参数、初始旋转参数、初始尺寸和初始颜色参数;属性函数包括位移函数、旋转函数、 尺寸函数和颜色函数;According to the embodiment of the present application, the initial attribute parameters may include initial position parameters, initial rotation parameters, initial size, and initial color parameters; the attribute functions include displacement function, rotation function, size function, and color function;
第二计算模块602还被配置为在根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对应的实时属性参数时:The second calculation module 602 is also configured to calculate the real-time attribute parameter corresponding to the particle playing time according to the initial attribute parameter, the attribute function, and the particle playing time:
根据初始位置参数和位移函数计算粒子的实时位置;Calculate the real-time position of the particle according to the initial position parameter and displacement function;
根据初始旋转参数和旋转函数计算粒子的实时旋转参数;Calculate the real-time rotation parameters of the particles according to the initial rotation parameters and the rotation function;
根据初始尺寸和尺寸函数计算粒子的实时尺寸;以及Calculate the real-time size of the particles based on the initial size and size function; and
根据初始颜色参数和颜色函数计算粒子的实时颜色参数。Calculate the real-time color parameters of the particles according to the initial color parameters and the color function.
根据本申请的实施例,位移函数基于中央处理器接收到的速度函数相对于时间积分转化得到。According to the embodiment of the present application, the displacement function is obtained by transforming the speed function received by the central processing unit with respect to the time integral.
本申请实施例提供了一种粒子计算装置,如图7所示,该粒子计算装置70可以包括:第三接收模块701、发送模块702和第三计算模块703。其中,An embodiment of the present application provides a particle computing device. As shown in FIG. 7, the particle computing device 70 may include: a third receiving module 701, a sending module 702, and a third computing module 703. among them,
第三接收模块701,被配置为使中央处理器接收用户输入的粒子的初始属性参数和属性函数,属性函数与初始属性参数相对应;The third receiving module 701 is configured to enable the central processing unit to receive the initial attribute parameters and attribute functions of the particles input by the user, and the attribute functions correspond to the initial attribute parameters;
发送模块702,被配置为使中央处理器将初始属性参数和属性函数发送到图形处理器;以及The sending module 702 is configured to enable the central processing unit to send initial attribute parameters and attribute functions to the graphics processor; and
第三计算模块703,被配置为使图形处理器在粒子播放时根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对应的实时属性参数。The third calculation module 703 is configured to enable the graphics processor to calculate the real-time attribute parameter corresponding to the particle playing time according to the initial attribute parameter, the attribute function, and the particle playing time when the particle is playing.
上述的粒子计算装置,通过中央处理器接收用户输入的粒子的初始属性参数和属性函数,属性函数与初始属性参数相对应,然后中央处理器将初始属性参数和属性函数发送到图形处理器中,由图形处理器在粒子播放时根据初始属性参数、属性函数以及粒子播放时间计算与粒子播放时间对应的实时属性参数,中央处理器直接将初始属性参数和属性函数发送到图形处理器,图形处理器计算完成后不需要将数据写回中央处理器,可以适用于低版本的图形API,且计算过程中无需设置其他处理器,可以节省存储空间;由图形处理器进行较复杂的计算,可以提高粒子计算效率。The aforementioned particle computing device receives the initial attribute parameters and attribute functions of the particles input by the user through the central processing unit. The attribute functions correspond to the initial attribute parameters, and then the central processing unit sends the initial attribute parameters and attribute functions to the graphics processor. The graphics processor calculates the real-time attribute parameters corresponding to the particle playback time according to the initial attribute parameters, attribute functions, and particle playback time during particle playback. The central processor directly sends the initial attribute parameters and attribute functions to the graphics processor and graphics processor. After the calculation is completed, there is no need to write the data back to the central processing unit, which can be applied to low-level graphics APIs, and no other processors need to be set up during the calculation process, which can save storage space; the graphics processor performs more complex calculations, which can improve particles Computational efficiency.
本公开实施例的图片的粒子计算装置可执行本公开的实施例所提供的一种图片的粒子计算方法,其实现原理相类似,本公开各实施例中的图 片的粒子计算装置中的各模块所执行的动作是与本公开各实施例中的图片的粒子计算方法中的步骤相对应的,对于图片的粒子计算装置的各模块的详细功能描述具体可以参见前文中所示的对应的图片的粒子计算方法中的描述,此处不再赘述。The particle computing device for the picture in the embodiment of the present disclosure can execute a particle computing method for the picture provided by the embodiment of the present disclosure, and the implementation principle is similar. The modules in the particle computing device for the picture in each embodiment of the present disclosure The actions performed correspond to the steps in the particle calculation method of the picture in each embodiment of the present disclosure. For the detailed function description of each module of the particle calculation device of the picture, please refer to the corresponding picture shown in the previous section. The description in the particle calculation method will not be repeated here.
基于与本公开的实施例中所示的方法相同的原理,本公开的实施例中还提供了一种电子设备,该电子设备可以包括但不限于:处理器和存储器;存储器,用于存储计算机操作指令;处理器,用于通过调用计算机操作指令执行实施例所示的方法。与现有技术相比,本申请中的电子设备可以适用于低版本图形API。Based on the same principle as the method shown in the embodiment of the present disclosure, an electronic device is also provided in the embodiment of the present disclosure. The electronic device may include, but is not limited to: a processor and a memory; and a memory for storing a computer. Operation instruction; processor, used to execute the method shown in the embodiment by invoking a computer operation instruction. Compared with the prior art, the electronic device in this application can be adapted to lower version graphics API.
在一个可选实施例中提供了一种电子设备,如图8所示,图8所示的电子设备4000包括:处理器4001和存储器4003。其中,处理器4001和存储器4003相连,如通过总线4002相连。可选地,电子设备4000还可以包括收发器4004。需要说明的是,实际应用中收发器4004不限于一个,该电子设备4000的结构并不构成对本申请实施例的限定。In an optional embodiment, an electronic device is provided. As shown in FIG. 8, the electronic device 4000 shown in FIG. 8 includes a processor 4001 and a memory 4003. Among them, the processor 4001 and the memory 4003 are connected, such as through a bus 4002. Optionally, the electronic device 4000 may further include a transceiver 4004. It should be noted that in actual applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation to the embodiment of the present application.
处理器4001可以是中央处理器(CPU),通用处理器,数据信号处理器(DSP),专用集成电路(ASIC),现场可编程门阵列(FPGA)或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。其可以实现或执行结合本申请公开内容所描述的各种示例性的逻辑方框,模块和电路。处理器4001也可以是实现计算功能的组合,例如包含一个或多个微处理器组合,DSP和微处理器的组合等。The processor 4001 may be a central processing unit (CPU), a general-purpose processor, a data signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, transistor logic devices, Hardware components or any combination thereof. It can implement or execute various exemplary logical blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor 4001 may also be a combination for realizing computing functions, for example, including a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and so on.
总线4002可包括一通路,在上述组件之间传送信息。总线4002可以是外设部件互连标准(PCI)总线或扩展工业标准结构(EISA)总线等。总线4002可以分为地址总线、数据总线、控制总线等。为便于表示,图8中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The bus 4002 may include a path for transferring information between the above-mentioned components. The bus 4002 may be a Peripheral Component Interconnection Standard (PCI) bus or an Extended Industry Standard Architecture (EISA) bus or the like. The bus 4002 can be divided into an address bus, a data bus, a control bus, and so on. For ease of representation, only one thick line is used in FIG. 8, but it does not mean that there is only one bus or one type of bus.
存储器4003可以是只读存储器(ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(RAM)或者可存储信息和指令的其他类型的动态存储设备,也可以是电可擦可编程只读存储器(EEPROM)、只读光盘(CD-ROM)或其他光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质 或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。The memory 4003 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electronic device. Erasable Programmable Read-Only Memory (EEPROM), CD-ROM or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital universal discs, Blu-ray discs, etc.), magnetic disk storage media or other Magnetic storage devices, or any other media that can be used to carry or store desired program codes in the form of instructions or data structures and that can be accessed by a computer, but are not limited thereto.
存储器4003用于存储执行本申请方案的应用程序代码,并由处理器4001来控制执行。处理器4001用于执行存储器4003中存储的应用程序代码,以实现前述方法实施例所示的内容。The memory 4003 is used to store application program codes for executing the solution of the present application, and is controlled by the processor 4001 to execute. The processor 4001 is configured to execute the application program code stored in the memory 4003 to implement the content shown in the foregoing method embodiment.
其中,电子设备包括但不限于:移动电话、笔记本电脑、数字广播接收器、个人数字助理(PDA)、平板电脑(PAD)、便携式多媒体播放器(PMP)、车载终端(例如,车载导航终端)等等的移动终端以及诸如数字TV、台式计算机等等的固定终端。图8示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。Among them, electronic devices include but are not limited to: mobile phones, notebook computers, digital broadcast receivers, personal digital assistants (PDA), tablet computers (PAD), portable multimedia players (PMP), vehicle terminals (for example, vehicle navigation terminals) And so on mobile terminals and fixed terminals such as digital TVs, desktop computers, etc. The electronic device shown in FIG. 8 is only an example, and should not bring any limitation to the function and scope of use of the embodiments of the present disclosure.
本申请实施例提供了一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,当其在计算机上运行时,使得计算机可以执行前述方法实施例中相应内容。与现有技术相比,本申请提供的计算机可读存储介质可以适用于低版本图形API。The embodiments of the present application provide a computer-readable storage medium with a computer program stored on the computer-readable storage medium, and when it runs on a computer, the computer can execute the corresponding content in the foregoing method embodiment. Compared with the prior art, the computer-readable storage medium provided in this application can be suitable for lower version graphics APIs.
应该理解的是,虽然附图的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,其可以以其他的顺序执行。而且,附图的流程图中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,其执行顺序也不必然是依次进行,而是可以与其他步骤或者其他步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the various steps in the flowchart of the drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless explicitly stated in this article, the execution of these steps is not strictly limited in order, and they can be executed in other orders. Moreover, at least part of the steps in the flowchart of the drawings may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the order of execution is also It is not necessarily performed sequentially, but may be performed alternately or alternately with at least a part of other steps or sub-steps or stages of other steps.
需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读 存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、射频(RF)等等,或者上述的任意合适的组合。It should be noted that the aforementioned computer-readable medium in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or a combination of any of the above. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable removable Programmable read only memory (EPROM or flash memory), optical fiber, portable compact disk read only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program, and the program may be used by or in combination with an instruction execution system, apparatus, or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as a part of a carrier wave, and a computer-readable program code is carried therein. This propagated data signal can take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. The computer-readable signal medium may also be any computer-readable medium other than the computer-readable storage medium. The computer-readable signal medium may send, propagate or transmit the program for use by or in combination with the instruction execution system, apparatus, or device . The program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to: wire, optical cable, radio frequency (RF), etc., or any suitable combination of the above.
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。The above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or it may exist alone without being assembled into the electronic device.
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备执行上述实施例所示的方法。The foregoing computer-readable medium carries one or more programs, and when the foregoing one or more programs are executed by the electronic device, the electronic device is caused to execute the method shown in the foregoing embodiment.
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。The computer program code used to perform the operations of the present disclosure may be written in one or more programming languages or a combination thereof. The above-mentioned programming languages include object-oriented programming languages—such as Java, Smalltalk, C++, and also conventional Procedural programming language-such as "C" language or similar programming language. The program code can be executed entirely on the user's computer, partly on the user's computer, executed as an independent software package, partly on the user's computer and partly executed on a remote computer, or entirely executed on the remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (for example, using an Internet service provider to pass Internet connection).
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能 的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions, and operations of the system, method, and computer program product according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, program segment, or part of code, and the module, program segment, or part of code contains one or more for realizing the specified logical function Executable instructions. It should also be noted that, in some alternative implementations, the functions marked in the block may also occur in a different order from the order marked in the drawings. For example, two blocks shown in succession can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and/or flowchart, and the combination of the blocks in the block diagram and/or flowchart, can be implemented by a dedicated hardware-based system that performs the specified functions or operations Or it can be realized by a combination of dedicated hardware and computer instructions.
描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,单元的名称在某种情况下并不构成对该单元本身的限定,例如,第一获取单元还可以被描述为“获取至少两个网际协议地址的单元”。The units involved in the embodiments described in the present disclosure can be implemented in software or hardware. Wherein, the name of the unit does not constitute a limitation on the unit itself under certain circumstances. For example, the first obtaining unit can also be described as "a unit for obtaining at least two Internet Protocol addresses."
以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开中所涉及的公开范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述公开构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。The above description is only a preferred embodiment of the present disclosure and an explanation of the applied technical principles. Those skilled in the art should understand that the scope of disclosure involved in this disclosure is not limited to the technical solutions formed by the specific combination of the above technical features, and should also cover the above technical features or technical solutions without departing from the above disclosed concept. Other technical solutions formed by arbitrarily combining the equivalent features. For example, the above-mentioned features and the technical features disclosed in the present disclosure (but not limited to) having similar functions are replaced with each other to form a technical solution.

Claims (12)

  1. 一种粒子计算方法,包括:A particle calculation method, including:
    接收用户输入的粒子的初始属性参数和属性函数,所述属性函数与所述初始属性参数相对应;Receiving initial attribute parameters and attribute functions of particles input by a user, where the attribute functions correspond to the initial attribute parameters;
    将所述初始属性参数和所述属性函数发送到图形处理器;以及Sending the initial attribute parameter and the attribute function to the graphics processor; and
    在粒子播放时,由所述图形处理器根据所述初始属性参数、所述属性函数以及粒子播放时间计算与所述粒子播放时间对应的实时属性参数。During particle playback, the graphics processor calculates real-time attribute parameters corresponding to the particle playback time according to the initial attribute parameter, the attribute function, and the particle playback time.
  2. 根据权利要求1所述的粒子计算方法,其中,所述将所述初始属性参数和所述属性函数发送到图形处理器包括:The particle calculation method according to claim 1, wherein said sending said initial attribute parameter and said attribute function to a graphics processor comprises:
    将用户输入的所述属性函数中的速度函数转化为位移函数;以及Converting the velocity function in the attribute function input by the user into a displacement function; and
    将所述初始属性参数、所述位移函数和除所述速度函数以外的其他属性函数发送到图形处理器。The initial attribute parameter, the displacement function, and other attribute functions other than the velocity function are sent to the graphics processor.
  3. 根据权利要求2所述的粒子计算方法,其中,所述将用户输入的所述属性函数中的速度函数转化为位移函数包括:The particle calculation method according to claim 2, wherein said converting the velocity function in the attribute function input by the user into a displacement function comprises:
    将用户输入的所述速度函数相对于时间进行积分转化得到所述位移函数。The speed function input by the user is integrated with respect to time to obtain the displacement function.
  4. 根据权利要求2所述的粒子计算方法,其中,所述初始属性参数包括初始位置参数、初始旋转参数、初始尺寸和初始颜色参数;发送到图形处理器的所述属性函数包括所述位移函数、旋转函数、尺寸函数和颜色函数;The particle calculation method according to claim 2, wherein the initial attribute parameters include initial position parameters, initial rotation parameters, initial dimensions, and initial color parameters; the attribute function sent to the graphics processor includes the displacement function, Rotation function, size function and color function;
    所述根据所述初始属性参数、所述属性函数以及粒子播放时间计算与所述粒子播放时间对应的实时属性参数包括:The calculating the real-time attribute parameter corresponding to the particle playing time according to the initial attribute parameter, the attribute function, and the particle playing time includes:
    根据所述初始位置参数和所述位移函数计算粒子的实时位置;Calculating the real-time position of the particle according to the initial position parameter and the displacement function;
    根据所述初始旋转参数和所述旋转函数计算粒子的实时旋转参数;Calculating the real-time rotation parameter of the particle according to the initial rotation parameter and the rotation function;
    根据所述初始尺寸和所述尺寸函数计算粒子的实时尺寸;以及Calculating the real-time size of the particles according to the initial size and the size function; and
    根据所述初始颜色参数和所述颜色函数计算粒子的实时颜色参数。The real-time color parameters of the particles are calculated according to the initial color parameters and the color function.
  5. 一种粒子计算方法,包括:A particle calculation method, including:
    接收中央处理器发送的粒子的初始属性参数和属性函数,所述属性函 数与所述初始属性参数相对应;以及Receiving initial attribute parameters and attribute functions of the particles sent by the central processing unit, where the attribute functions correspond to the initial attribute parameters; and
    在粒子播放时根据所述初始属性参数、所述属性函数以及粒子播放时间计算与所述粒子播放时间对应的实时属性参数。During particle playback, real-time attribute parameters corresponding to the particle playback time are calculated according to the initial attribute parameter, the attribute function, and the particle playback time.
  6. 根据权利要求5所述的粒子计算方法,其中,所述初始属性参数包括初始位置参数、初始旋转参数、初始尺寸和初始颜色参数;所述属性函数包括位移函数、旋转函数、尺寸函数和颜色函数;The particle calculation method according to claim 5, wherein the initial attribute parameters include initial position parameters, initial rotation parameters, initial size, and initial color parameters; and the attribute functions include displacement function, rotation function, size function, and color function ;
    所述根据所述初始属性参数、所述属性函数以及粒子播放时间计算与所述粒子播放时间对应的实时属性参数包括:The calculating the real-time attribute parameter corresponding to the particle playing time according to the initial attribute parameter, the attribute function, and the particle playing time includes:
    根据所述初始位置参数和所述位移函数计算粒子的实时位置;Calculating the real-time position of the particle according to the initial position parameter and the displacement function;
    根据所述初始旋转参数和所述旋转函数计算粒子的实时旋转参数;Calculating the real-time rotation parameter of the particle according to the initial rotation parameter and the rotation function;
    根据所述初始尺寸和所述尺寸函数计算粒子的实时尺寸;以及Calculating the real-time size of the particles according to the initial size and the size function; and
    根据所述初始颜色参数和所述颜色函数计算粒子的实时颜色参数。The real-time color parameters of the particles are calculated according to the initial color parameters and the color function.
  7. 根据权利要求6所述的粒子计算方法,其中,所述位移函数基于所述中央处理器接收到的速度函数相对于时间积分转化得到。8. The particle calculation method according to claim 6, wherein the displacement function is obtained by converting the velocity function received by the central processing unit with respect to time integral.
  8. 一种粒子计算方法,包括:A particle calculation method, including:
    由中央处理器接收用户输入的粒子的初始属性参数和属性函数,所述属性函数与所述初始属性参数相对应;The central processor receives the initial attribute parameters and attribute functions of the particles input by the user, and the attribute functions correspond to the initial attribute parameters;
    由所述中央处理器将所述初始属性参数和所述属性函数发送到图形处理器;以及Sending the initial attribute parameter and the attribute function to the graphics processor by the central processing unit; and
    在粒子播放时,由所述图形处理器根据所述初始属性参数、所述属性函数以及粒子播放时间计算与所述粒子播放时间对应的实时属性参数。During particle playback, the graphics processor calculates real-time attribute parameters corresponding to the particle playback time according to the initial attribute parameter, the attribute function, and the particle playback time.
  9. 一种粒子计算装置,包括:A particle computing device, including:
    第一接收模块,被配置为接收用户输入的粒子的初始属性参数和属性函数,所述属性函数与所述初始属性参数相对应;以及The first receiving module is configured to receive the initial attribute parameters and attribute functions of the particles input by the user, the attribute functions corresponding to the initial attribute parameters; and
    第一计算模块,被配置为将所述初始属性参数和所述属性函数发送到图形处理器,以在粒子播放时由所述图形处理器根据所述初始属性参数、所述属性函数以及粒子播放时间计算与所述粒子播放时间对应的实时属性参数。The first calculation module is configured to send the initial attribute parameter and the attribute function to the graphics processor, so that when the particle is played, the graphics processor will play according to the initial attribute parameter, the attribute function, and the particle playback. Time calculation of real-time attribute parameters corresponding to the particle playing time.
  10. 一种粒子计算装置,包括:A particle computing device, including:
    第二接收模块,被配置为接收由中央处理器发送的粒子的初始属性参数和属性函数,所述属性函数与所述初始属性参数相对应;以及The second receiving module is configured to receive the initial attribute parameter and attribute function of the particle sent by the central processing unit, the attribute function corresponding to the initial attribute parameter; and
    第二计算模块,被配置为在粒子播放时根据所述初始属性参数、所述属性函数以及粒子播放时间计算与所述粒子播放时间对应的实时属性参数。The second calculation module is configured to calculate a real-time attribute parameter corresponding to the particle playing time according to the initial attribute parameter, the attribute function, and the particle playing time during particle playing.
  11. 一种电子设备,包括:An electronic device including:
    一个或多个处理器;One or more processors;
    存储器,所述存储器被配置为存储一个或多个应用程序;A memory, the memory is configured to store one or more application programs;
    其中所述一个或多个应用程序被配置为由所述一个或多个处理器执行时执行根据权利要求1-8中的任一项所述的粒子计算方法。The one or more application programs are configured to execute the particle calculation method according to any one of claims 1-8 when being executed by the one or more processors.
  12. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其中,该程序被配置为由处理器执行时实现权利要求1-8中的任一项所述的粒子计算方法。A computer-readable storage medium storing a computer program, wherein the program is configured to implement the particle calculation method according to any one of claims 1-8 when executed by a processor.
PCT/CN2020/112840 2019-09-03 2020-09-01 Particle calculation method and apparatus, electronic device, and computer readable storage medium WO2021043128A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910828698.9 2019-09-03
CN201910828698.9A CN111815749A (en) 2019-09-03 2019-09-03 Particle calculation method, particle calculation device, electronic equipment and computer-readable storage medium

Publications (1)

Publication Number Publication Date
WO2021043128A1 true WO2021043128A1 (en) 2021-03-11

Family

ID=72844528

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/112840 WO2021043128A1 (en) 2019-09-03 2020-09-01 Particle calculation method and apparatus, electronic device, and computer readable storage medium

Country Status (2)

Country Link
CN (1) CN111815749A (en)
WO (1) WO2021043128A1 (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102722859A (en) * 2012-05-31 2012-10-10 北京像素软件科技股份有限公司 Method for rendering computer simulation scene
CN104867186A (en) * 2015-04-29 2015-08-26 中国海洋大学 GPU-based interactive ocean three-dimensional flow field dynamic visual algorithm
US20170091983A1 (en) * 2015-09-30 2017-03-30 Visual Music Systems, Inc. Four-dimensional path-adaptive anchoring for immersive virtual visualization systems
CN107392935A (en) * 2017-07-06 2017-11-24 苏州蜗牛数字科技股份有限公司 A kind of particle computational methods and particIe system based on integral formula
CN107392835A (en) * 2016-05-16 2017-11-24 腾讯科技(深圳)有限公司 A kind of processing method and processing device of particIe system
CN111540035A (en) * 2020-05-07 2020-08-14 支付宝(杭州)信息技术有限公司 Particle rendering method, device and equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105718998A (en) * 2016-01-21 2016-06-29 上海斐讯数据通信技术有限公司 Particle swarm optimization method based on mobile terminal GPU operation and system thereof

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102722859A (en) * 2012-05-31 2012-10-10 北京像素软件科技股份有限公司 Method for rendering computer simulation scene
CN104867186A (en) * 2015-04-29 2015-08-26 中国海洋大学 GPU-based interactive ocean three-dimensional flow field dynamic visual algorithm
US20170091983A1 (en) * 2015-09-30 2017-03-30 Visual Music Systems, Inc. Four-dimensional path-adaptive anchoring for immersive virtual visualization systems
CN107392835A (en) * 2016-05-16 2017-11-24 腾讯科技(深圳)有限公司 A kind of processing method and processing device of particIe system
CN107392935A (en) * 2017-07-06 2017-11-24 苏州蜗牛数字科技股份有限公司 A kind of particle computational methods and particIe system based on integral formula
CN111540035A (en) * 2020-05-07 2020-08-14 支付宝(杭州)信息技术有限公司 Particle rendering method, device and equipment

Also Published As

Publication number Publication date
CN111815749A (en) 2020-10-23

Similar Documents

Publication Publication Date Title
WO2022127278A1 (en) Method and apparatus for rendering virtual scene
WO2020186935A1 (en) Virtual object displaying method and device, electronic apparatus, and computer-readable storage medium
WO2020228406A1 (en) Image stylization generation method and apparatus, and electronic device
WO2022166927A1 (en) Cursor display method and apparatus based on remote desktop, medium, and electronic device
WO2021008627A1 (en) Game character rendering method and apparatus, electronic device, and computer-readable medium
WO2020248900A1 (en) Panoramic video processing method and apparatus, and storage medium
WO2022242379A1 (en) Stroke-based rendering method and device, storage medium and terminal
JP2017526045A (en) An efficient hardware mechanism to ensure shared resource data coherency across draw calls
WO2023103999A1 (en) 3d target point rendering method and apparatus, and device and storage medium
CN111798545A (en) Method and device for playing skeleton animation, electronic equipment and readable storage medium
WO2023029893A1 (en) Texture mapping method and apparatus, device and storage medium
WO2023202358A1 (en) Virtual object motion control method and device
WO2023193639A1 (en) Image rendering method and apparatus, readable medium and electronic device
WO2023172195A2 (en) Line special effect processing method and apparatus, electronic device, storage medium, and product
CN111652675A (en) Display method and device and electronic equipment
CN111355978A (en) Video file processing method and device, mobile terminal and storage medium
WO2020207083A1 (en) Information sharing method and apparatus, and electronic device and computer-readable storage medium
WO2021043128A1 (en) Particle calculation method and apparatus, electronic device, and computer readable storage medium
WO2023197911A1 (en) Three-dimensional virtual object generation method and apparatus, and device, medium and program product
WO2023169287A1 (en) Beauty makeup special effect generation method and apparatus, device, storage medium, and program product
WO2023174087A1 (en) Method and apparatus for generating special effect video, and device and storage medium
CN111355997B (en) Video file generation method and device, mobile terminal and storage medium
CN111862342A (en) Texture processing method and device for augmented reality, electronic equipment and storage medium
WO2023138467A1 (en) Virtual object generation method and apparatus, device, and storage medium
CN110069195B (en) Image dragging deformation method and device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20861782

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20861782

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 14.06.2023)

122 Ep: pct application non-entry in european phase

Ref document number: 20861782

Country of ref document: EP

Kind code of ref document: A1