Fluid effect rendering method and device
By automatically creating and updating rendering target assets, the problem of low rendering efficiency of fluid effects caused by manual creation of rendering targets in UE4 is solved, and simplified operations and efficient rendering effects are achieved.
Patent Information
- Application Number
- CN202210676298.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-15
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2042-06-15
AI Technical Summary
When using UE4 for game development, the process of manually creating rendering targets (RTs) is cumbersome, resulting in low rendering efficiency of fluid effects. Especially when multiple interactions and fog-effect areas need to be rendered, multiple RTs need to be manually created to further reduce the number of RTs. rendering efficiency.
By calling the target creation function in the target library, the rendering target assets are automatically created, and the asset information is updated based on the user's operation data, the rendering target object is generated, and the target area is added to the target area to achieve the rendering of the fluid effect.
Simplifies user operations, improves the rendering efficiency of fluid effects, avoids the tedious process of manually creating rendering targets, and is suitable for rendering scenes in multiple interactive and foggy areas.
Smart Images

Figure CN115120966B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of game development, and in particular to a method and device for rendering fluid effects. Background Art
[0002] In the process of using UE4 for game development, it is often necessary to use RT (RenderTarget) to save dynamic rendering results. However, RT currently needs to be created manually, and the creation process is cumbersome, resulting in low rendering efficiency of fluid effects. Moreover, when it is necessary to render multiple interactive and fog rendering areas, multiple RTs need to be created manually, further reducing the rendering efficiency of fluid effects.
[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0004] At least some embodiments of the present invention provide a method and apparatus for rendering a fluid effect, so as to at least solve the technical problem in the related art that a rendering target is created manually, resulting in low rendering efficiency of the fluid effect.
[0005] According to one embodiment of the present invention, a method for rendering a fluid effect is provided, the method comprising: in response to a first touch operation performed on a target creation control, calling a target creation function in a target library to create a first rendering target asset; in response to a second touch operation in a target area, updating the first rendering target asset based on operation data corresponding to the second touch operation to obtain a second rendering target asset, wherein the second rendering target asset is used to characterize asset information of the fluid effect; based on the second rendering target asset, generating a rendering target object; and adding the rendering target object to the target area to obtain a rendering result of the fluid effect.
[0006] Optionally, calling a target creation function in a target library to create a first rendering target asset includes: obtaining attribute information corresponding to the first rendering target asset; creating an object pointer, wherein the object pointer is used to create a rendering target object; and creating the first rendering target asset based on the attribute information and the object pointer.
[0007] Optionally, a first rendering target asset is created through an asset management module, and the first rendering target asset is saved in a preset directory.
[0008] Optionally, generating a rendering target object based on the second rendering target asset includes: generating an initial object based on the second rendering target asset; obtaining parameter information corresponding to the rendering target object; and updating the initial object and the second rendering target asset based on the parameter information to obtain the rendering target object.
[0009] Optionally, the parameter information includes one or more of the following information: color value, transparency, resolution, rendering format, and whether to automatically generate execution speed.
[0010] Optionally, a target library is created, wherein the target file of the target library includes target modules and target macros, wherein the target modules and target macros are used to represent the modules and macros of the virtual engine in the editor state; a target creation function is created in the target library, wherein the target creation function includes initial parameter information for rendering the target object.
[0011] Optionally, in response to the target area containing multiple sub-areas, the method further includes: traversing the multiple sub-areas; calling the target creation function to sequentially create multiple sub-objects corresponding to the multiple sub-areas, wherein the rendering target object contains the multiple sub-objects.
[0012] According to one embodiment of the present invention, a fluid effect rendering device is also provided, which includes: an asset creation module, which is used to call a target creation function in a target library in response to a first touch operation performed on a target creation control to create a first rendering target asset; a storage module, which is used to update the first rendering target asset based on operation data corresponding to the second touch operation in response to a second touch operation in a target area to obtain a second rendering target asset, wherein the second rendering target asset is used to characterize asset information of the fluid effect; an object creation module, which is used to generate a rendering target object based on the second rendering target asset; and a rendering module, which is used to add the rendering target object to the target area to obtain a rendering result of the fluid effect.
[0013] According to one embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to control an electronic device to execute any of the above-mentioned methods for rendering fluid effects when running.
[0014] According to one embodiment of the present invention, there is further provided an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute any of the above-mentioned methods for rendering fluid effects.
[0015] In at least some embodiments of the present invention, in response to a first touch operation performed on a target creation control, a target creation function in a target library is called to create a first rendering target asset; in response to a second touch operation in a target area, the first rendering target asset is updated based on the operation data corresponding to the second touch operation to obtain a second rendering target asset, wherein the second rendering target asset is used to characterize asset information of a fluid effect; based on the second rendering target asset, a rendering target object is generated; and the rendering target object is added to the target area to obtain a rendering result of the fluid effect. It is easy to notice that by performing a first touch operation on a target creation control, the target creation function in the target library can be called to automatically create a rendering target without the need for manual creation by the user, thereby achieving the technical effect of simplifying user operations and improving the rendering efficiency of fluid effects, thereby solving the technical problem in the related art of manually creating rendering targets, resulting in low rendering efficiency of fluid effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0017] Figure 1 is a hardware structure block diagram of a mobile terminal according to a method for rendering fluid effects according to an embodiment of the present invention;
[0018] Figure 2 is a flow chart of a method for rendering fluid effects according to one embodiment of the present invention;
[0019] Figure 3 is a schematic diagram of an application scenario of a method for rendering fluid effects according to one embodiment of the present invention;
[0020] Figure 4 is a structural block diagram of a fluid effect rendering device according to one embodiment of the present invention;
[0021] Figure 5 is a schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0022] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0023] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0024] In order to make this solution easier to understand, some special terms are explained below:
[0025] UE4: Unreal Engine 4, a graphics engine used to develop 3D software and games.
[0026] RT: RenderTarget, a storage medium for image and texture information, mostly used for dynamic rendering effect storage.
[0027] Texture2D: Texture target, a storage medium for image and texture information, mostly used for storing static rendering effects.
[0028] SceneCapture2D: It is equivalent to building a camera in front of the screen and saving the contents of the viewport to the storage medium (RenderTarget).
[0029] UV: Texture coordinates, which can be used to locate any pixel on the image.
[0030] Ninja Live: A UE4 plugin that can use 2D patches to simulate 3D dynamic fluid effects.
[0031] Flow Map: A texture used to record 2D vector information.
[0032] Level: Game level, used to design game maps and place various objects, lights, special effects, etc.
[0033] ContentBrowser: Content browser, where UE4 is used to place various asset files, which can be understood as an asset library.
[0034] Blueprint system: UE4's scripting system, whose underlying layer is the C++ code layer of the UE engine.
[0035] UE4C++ layer: The underlying core code layer of the UE4 engine, where you can develop editor, runtime and other logic & plug-ins, and encapsulate the general function library and expose it to the upper-level blueprint system call.
[0036] Blueprint function library: used to expose C++ layer functions to upper-level blueprint system calls.
[0037] RHI: Rendering thread, rendering submission. The thread that calls the graphics card rendering API instructions.
[0038] UObject: Dynamic object information stored in physical memory, which will be automatically deleted when the game memory is released.
[0039] UAsset: Static assets, asset information retained on disk, will not be automatically deleted when the game memory is released.
[0040] BPActor: Object blueprint, representing an object primitive in the game.
[0041] UTextureRenderTarget2D: RT object inherited from UObject, its corresponding UAsset is RenderTarget, not Texture.
[0042] Package: Unreal Engine's asset counting unit, containing UAsset information.
[0043] When using 2D patches to simulate 3D dynamic fluid effects, users usually use the Ninja Live plug-in (a UE4 plug-in that can use 2D patches to simulate 3D dynamic fluid effects). This plug-in uses RT as the storage medium between the interaction and rendering areas, but requires users to manually create RT, and there may be situations where multiple interaction and rendering areas need to be rendered. In this case, users need to manually create multiple RTs and manually place each RT in the interaction and rendering area respectively, and each RT corresponds to an interaction and rendering area, so the two need to be strictly matched, otherwise there may be a situation where there is no corresponding matching setting. For example, when the user is performing interactive operations in the first interaction area, the effect of the second fog effect rendering area changes.
[0044] In order to solve the above problems, the following three methods in related technologies can be referred to:
[0045] The first method is: create a new object blueprint (BPActor) under ContentBrowser, open BPActor, and search for the function method: CreateRenderTarget2D;
[0046] The second method is: use the result obtained by the first method above, input RenderTargetCreateStaticTextureEditorOnly, create a static texture asset through the created UTextureRenderTarget2D object, and the obtained static asset (UAsset) asset type is the target texture (Texture);
[0047] The third method is to provide a method to save RT to assets through the Blueprint function library.
[0048] However, the above methods have the following problems: the first method obtains a UTextureRenderTarget2D object, but the UTextureRenderTarget2D object is a subclass of the UObject (object, and the UObject can only be saved in memory and will be automatically deleted when the game is closed or the engine exits, so it cannot be packaged as an asset into the released game package; the UAsset asset type created by the second method is Texture, which is not the RT required by the user, and UTextureRenderTarget / UTextureRenderTarget2D and UTexture2D are parallel subclasses in the class inheritance relationship, and the corresponding format cannot be forced to convert; a third-party opencv library needs to be introduced for image processing to perform special processing on the transparent channel, which will not only increase the package runtime library capacity, but also slow down the processing progress; the resolution and rendering format of the RT object are fixed and cannot be customized according to user needs; the coding is too cumbersome, and it is not easy to understand reuse and expansion in production. A lot of additional content must be set for use in different projects (such as the import of the opencv library, whether the engine supports this import library, etc.).
[0049] Therefore, in order to solve the above problems, the present invention provides the following implementation scheme: by creating the underlying logic of special assets according to the Unreal Engine, a function implementation method in an editing state is constructed and provided to the upper blueprint script layer, thereby solving an optimization solution for the problem of process-based creation of fluid storage media, and expanding the usability of the solution in various application scenarios.
[0050] According to one embodiment of the present invention, an embodiment of a method for rendering a fluid effect is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0051] The method embodiment can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, the mobile terminal can be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, referred to as MID), a PAD, a game console and other terminal devices. Figure 1 FIG. 1 is a hardware structure block diagram of a mobile terminal of a method for rendering fluid effects according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) processor 102 (processor 102 may include but is not limited to a central processing unit (CPU), a graphics processing unit (GPU), a digital signal processing (DSP) chip, a microprocessor (MCU), a programmable logic device (FPGA), a neural network processor (NPU), a tensor processor (TPU), an artificial intelligence (AI) type processor, etc.) and a memory 104 for storing data. Optionally, the mobile terminal may also include a transmission device 106 for communication functions, an input and output device 108, and a display device 110. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0052] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the rendering method of fluid effects in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, the rendering method of fluid effects described above is realized. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0053] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0054] The inputs in the input / output device 108 may come from a plurality of human interface devices (HIDs), such as keyboards and mice, game controllers, and other dedicated game controllers (such as steering wheels, fishing rods, dance mats, remote controls, etc.). In addition to providing input functions, some human interface devices may also provide output functions, such as force feedback and vibration of game controllers, audio output of controllers, etc.
[0055] The display device 110 may be, for example, a head-up display (HUD), a touch-screen liquid crystal display (LCD), and a touch display (also referred to as a "touch screen" or "touch display screen"). The liquid crystal display may enable a user to interact with a user interface of the mobile terminal. In some embodiments, the mobile terminal has a graphical user interface (GUI), and a user may interact with the GUI by finger contacts and / or gestures on a touch-sensitive surface, wherein the human-computer interaction functions here may optionally include the following interactions: creating web pages, drawing, word processing, making electronic documents, games, video conferencing, instant messaging, sending and receiving emails, call interfaces, playing digital videos, playing digital music, and / or web browsing, etc. The executable instructions for executing the above-mentioned human-computer interaction functions are configured / stored in a computer program product or a readable storage medium executable by one or more processors.
[0056] In a possible implementation, an embodiment of the present invention provides a method for rendering fluid effects, and provides an editor interface of a virtual engine through a terminal device, wherein the terminal device may be the local terminal device mentioned above. Figure 2 1 is a flow chart of a method for rendering fluid effects according to one embodiment of the present invention. The terminal device provides an editor interface of a virtual engine. The content displayed in the editor interface includes a target area and a target creation control. Figure 2 As shown, the method comprises the following steps:
[0057] Step S202: In response to a first touch operation performed on a target creation control, a target creation function in a target library is called to create a first rendering target asset.
[0058] The above-mentioned target creation control can be a button in the editor interface. By clicking the button, the user can generate the first rendering target asset. The first touch operation can be clicking, double-clicking, long pressing, etc. on the target creation control, but is not limited to this. The target library can be a blueprint general function library based on the Unreal Engine set in advance by the user. By creating this target library, the target creation function can be called when the virtual engine is in the editor state, which will not affect the game packaging and logical operations in the running state; the target creation function can be a CreateAndSaveRTToContentBrowser function pre-created in the target library, that is, a function that creates RT and saves it to the game directory; the first rendering target asset can be the RT created by the target creation function, and the resolution, channel color, rendering format and other parameters corresponding to the RT can be customized by the user.
[0059] In an optional embodiment, the user can use the UE4 editor to design the game level. At this time, UE4 is in the editor state, and the UE4 editor interface is displayed on the terminal device. When the user needs to render the fluid effect in the target area, the user can first click the create button (i.e., the target creation control) of the editor interface to call the function (i.e., the target creation function) in the blueprint general function library set by the user in advance. By executing the logic of the target creation function, the RT asset corresponding to the target area (i.e., the first rendering target asset) can be created. The asset is used to store the sliding direction information corresponding to the sliding operation in the target area.
[0060] Optionally, the first rendering target asset can be created by the following steps: obtaining attribute information corresponding to the first rendering target asset; creating an object pointer, wherein the object pointer is used to create a rendering target object; creating the first rendering target asset based on the attribute information and the object pointer through the asset management module, and saving the first rendering target asset in a preset directory.
[0061] The first render target asset mentioned above is a render target (i.e., RT) with default values; the attribute information is the attribute information corresponding to the default values in the render target asset, which may be corresponding parameter settings and default value settings, for example: ResolutionX / ResolutionY can be used to illustrate the width and resolution of RT. In this embodiment, 512 resolution can be taken as an example to illustrate the width and resolution of RT; FLinearColor can represent the default values of RGBA channels, and the specific default values can be set according to user needs. In this embodiment, the default value (0,0,0,1) is taken as an example for explanation. The first three channels correspond to RGB channels, indicating black, and the last value is 1, indicating that this image has a transparent channel A; RenderTargetFormat can represent the image format, and the specific image format The formula can be set according to user needs. In this embodiment, RTF_RGBA16f can be used as an example for explanation. RTF_RGBA16f indicates that the RGBA channel has 16-bit floating point precision. Creating an object pointer can be achieved through UTextureRenderTargetFactoryNew (a construction factory class for creating RT assets). The object pointer can be an "object pointer for creating a factory for UTextureRenderTarget (RT)". By constructing an object pointer, it is convenient for subsequent UTextureRenderTarget objects to be created in a standardized manner. The rendering target object can be an RT object inherited from UObject, and its corresponding UAsset asset type is RenderTarget, not Texture.
[0062] The above-mentioned asset management module can be an Unreal Engine asset management module (ie, FAssetToolsModule), which allows the user to save the created static asset RT in the ContentBrowser; the preset directory can be a content browser (ie, ContentBrowser, where UE4 is used to place various asset files, which can be understood as an asset library).
[0063] In an optional embodiment, first, the attribute information corresponding to the first rendering target asset input by the user can be obtained, for example, the width and resolution of RT, the channel values of the RGBA channels, the image format, etc., and secondly, an object pointer can be created, that is, a "factory for creating UTextureRenderTarget (RT)" Object pointer. The object pointer is created here for the purpose of subsequent standardized creation of UTextureRenderTarget objects; finally, based on the attribute information and the object pointer, the asset management module can create a first rendering target asset, and the first rendering target asset can be a rendering target asset containing default attribute information that the user needs to use. Specifically, first, you can use IAssetTools (a class interface for managing engine assets) and FModuleManager (a class for managing all engine modules, which can be used to find the AssetTools asset management class) instructions to obtain the asset management module (i.e. FAssetToolsModule), and then create a rendering target asset (i.e. static asset) through FAssetToolsModule. Secondly, you can pass the attribute information of the rendering target asset, that is, the name of the created RT static asset, the Package name of the RT static asset, the object class supported by the RT static asset as UTextureRenderTarget2D, the default last parameter of the RT static asset, and other parameter information into the module tool FAssetToolsModule. Then FAssetToolsModule (i.e., the asset management module) can create the first rendering target asset based on the attribute information, and can save the first rendering target asset in the preset directory (i.e., ContentBrowser).
[0064] Optionally, it is also necessary to determine whether the first rendering target asset is successfully generated. If successful, continue with the next step of analysis and then return true; if unsuccessful, return false.
[0065] Step S204: in response to a second touch operation in the target area, updating the first rendering target asset based on operation data corresponding to the second touch operation to obtain a second rendering target asset, wherein the second rendering target asset is used to represent asset information of the fluid effect.
[0066] The above-mentioned target area can be an interactive and rendering area in the editor interface, wherein the interactive area is used to interact with the user and sense the sliding operation performed by the user in the area. The second touch operation can be an operation in which the user uses a mouse, finger, capacitive pen, etc. to slide in the interactive area of the target area, but is not limited to this. It can also be any operation that can make the interactive area feel the user's touch, such as click, long press, etc.; the operation data can include but is not limited to: sliding direction, sliding time, sliding angle, number of clicks, click time, etc.; the rendering area is used to display fluid effects, where the fluid effect can be the flow effect of objects such as fog, smoke and clouds, which can be defined by the user according to needs, and is not specifically limited in the embodiments of the present invention. The second rendering target asset can be an RT asset that stores asset information such as sliding direction, and the rendering and drawing of fluid effects can be driven by this asset.
[0067] In an optional embodiment, when the user uses a mouse, finger, or capacitive pen to slide in the interaction and fog effect rendering area (i.e., the target area), the processor can store information such as the sliding direction in the first rendering target asset. Since the asset information in the first rendering target asset is updated, a new second rendering target asset containing asset information such as the sliding direction can be obtained. It should be noted that the touch operation provided in the embodiment of the present invention is not limited to sliding operation, but can be any operation that can make the interaction area feel the user's touch. In the embodiment of the present invention, the sliding operation is taken as an example for explanation.
[0068] Step S206: Generate a rendering target object based on the second rendering target asset.
[0069] The above-mentioned rendering target object can be a UObject subclass object of UTextureRenderTarget2D. In the embodiment of the present invention, the object is named RTObject. By adjusting the parameters of the object, different fluid effects can be rendered. For example, by adjusting the RGB channel color of the object, the red flame of the flame can be changed to a blue flame, and the fog can be changed from white to black.
[0070] In an optional embodiment, after obtaining the second rendering target asset, the processor can generate a new rendering target object capable of rendering the fluid effect based on the new asset information in the second target asset, wherein the rendering target object can change the display of the fluid effect. Optionally, the specific generation process of the rendering target object is as follows: based on the second rendering target asset, generate an initial object; obtain parameter information corresponding to the rendering target object input by the user, wherein the parameter information includes one or more of the following information: color value, transparency, resolution, rendering format, and whether to automatically generate execution speed; based on the parameter information, update the initial object and the second rendering target asset to obtain the rendering target object.
[0071] The above-mentioned initial object can be an RTObject object; the rendering target object can be an object generated after the user customizes the parameter information of the initial object. For example, the initial object can be a blue flame, and the parameter information can be that the flame is higher and the color is darker. Then, based on the parameter information, the user-defined rendering target object can be a blue flame with a higher flame height and a darker color than the initial object. Among them, the advantage of obtaining the RTObject object is that the user can first create an RT asset, then obtain its corresponding UTextureRenderTarget2D object, and then set the corresponding resolution size, format and other contents in subsequent steps, and then resubmit it to the RHI to update the rendering.
[0072] In an optional embodiment, when the user slides the mouse in the interaction and fog effect rendering area (i.e., the target area), the processor can store information such as the sliding direction in the first rendering target asset. Since the asset information in the first rendering target asset is updated, a new second rendering target asset containing asset information such as the sliding direction can be obtained. After obtaining the second rendering target asset, an initial object (i.e., RTObject) can be generated based on the attribute information in the second rendering target asset. Secondly, parameter information corresponding to the rendering target object input by the user can be obtained, such as RGBA channel color, transparency, resolution, rendering format, and whether to automatically generate execution speed (mips) and other information. Finally, the initial object and the second rendering target asset are updated based on the parameter information to obtain the rendering target object, and the rendering target object can be saved in the ContentBrowser.
[0073] Step S208: adding the rendering target object to the target area to obtain a rendering result of the fluid effect.
[0074] In an optional embodiment, by adding the newly generated rendering target object to the target area, the fluid effect in the target area can be rendered, so that the required rendering effect of the fluid effect can be obtained.
[0075] In at least some embodiments of the present invention, in response to a first touch operation performed on a target creation control, a target creation function in a target library is called to create a first rendering target asset; in response to a second touch operation in a target area, the first rendering target asset is updated based on the operation data corresponding to the second touch operation to obtain a second rendering target asset, wherein the second rendering target asset is used to characterize asset information of a fluid effect; based on the second rendering target asset, a rendering target object is generated; and the rendering target object is added to the target area to obtain a rendering result of the fluid effect. It is easy to notice that by performing a first touch operation on a target creation control, the target creation function in the target library can be called to automatically create a rendering target without the need for manual creation by the user, thereby achieving the technical effect of simplifying user operations and improving the rendering efficiency of fluid effects, thereby solving the technical problem in the related art of manually creating rendering targets, resulting in low rendering efficiency of fluid effects.
[0076] Optionally, before executing the above steps, the method also includes: creating a target library, wherein the target file of the target library includes a target module and a target macro, and the target module and the target macro are used to represent the modules and macros of the virtual engine in the editor state; creating a target creation function in the target library, wherein the target creation function includes initial parameter information for rendering the target object, and adding the target macro can ensure that the function only runs in the editing state and will not affect the runtime logic. If it is runtime logic, #else is executed and this function returns false.
[0077] The above-mentioned target library can be a blueprint general function library, the target file can be a .build.cs file, the target module can be an edit state module, and the target macro can be an #if With_Editor macro. The functions of the target file, target module and target macro are to expose all function methods of the blueprint general function library to the upper blueprint, so that all function methods can be called in the editor state, otherwise the blueprint system cannot find the function methods provided in the blueprint general function library; the above-mentioned target creation function can be the CreateAndSaveRTToContentBrowser function, and the target creation function contains the initial parameter information of the rendering target object required by the user, such as color value, transparency, resolution, rendering format and whether to automatically generate execution speed (mips) and other one or more information.
[0078] In an optional embodiment, first, a target library can be created according to conventional steps, and an editing module and an #if With_Editor macro can be added to the .build.cs file; secondly, a target creation function CreateAndSaveRTToContentBrowser can be created in the target library, and parameter settings and default value settings can be provided, wherein the parameters include one or more of the following information: RGBA channel color, transparency, resolution, rendering format, and whether to automatically generate execution speed (mips) and other information. By creating a target function and including initial parameter information of the rendering target object in the target function, the user can customize the resolution and format of the input RT; at the same time, the problem of incorrect transparent channel can be solved.
[0079] Optionally, in response to the target area containing multiple sub-areas, the method further includes: traversing the multiple sub-areas; calling the target creation function to sequentially create multiple sub-objects corresponding to the multiple sub-areas, wherein the rendering target object contains the multiple sub-objects.
[0080] In an optional embodiment, in a scene where multiple interaction and rendering areas are placed in the same game level, the target area can be divided into multiple sub-areas (i.e., multiple interaction and rendering areas). If each sub-area needs to render a fluid effect, and the fluid effects in different sub-areas are different. In order to achieve the purpose of process-based creation of RT, the user can click on the target creation control. At this time, the processor first traverses the multiple sub-areas, then calls the target creation function to sequentially create multiple sub-rendering target objects (i.e., multiple sub-objects) corresponding to the multiple sub-areas, and finally adds the multiple sub-rendering target objects to the corresponding multiple sub-areas in turn.
[0081] It should be noted that, in the embodiment of the present invention, the created rendering target object can be transmitted to achieve the purpose of secondary modification.
[0082] In addition, the solution provided in the above embodiment can be a general solution, which can be applied not only to fluid effect rendering scenes, but also to all scenes that require process-based creation of RT (storage medium), and there is no need to modify the code for a second time, and it can be directly loaded and used.
[0083] Figure 3 is a schematic diagram of an application scenario of a method for rendering fluid effects according to one embodiment of the present invention. Figure 3 A preferred embodiment of the present invention is described in detail. The method is constructed in the C++ layer and provides a function implementation method in the editing state, which is provided to the upper layer blueprint system for calling. Figure 3The editor interface shown in the figure shows multiple interactive areas and fog rendering areas in the rendering result display window of the interface. When the user needs to generate RT, he can click the Create button to generate RT. The background processor will process the number of interactive areas and fog rendering areas in the window and generate RT assets according to the user settings. The RT assets are displayed in the window in the lower left corner. RT exists in the interactive area and fog rendering (after process creation). The RT assets are visible under ContentBrowser.
[0084] The present invention creates fluid storage media in a procedural manner based on the UE4 editing state. In terms of use, it provides a very simple configuration method and can customize different storage medium information according to user needs. In terms of expansion and reuse, it is easy to reuse, extremely easy to expand, and decoupled without using an external graphics processing library.
[0085] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0086] In this embodiment, a rendering device for fluid effects is also provided, which is used to implement the above embodiments and preferred implementation modes, and will not be repeated hereafter. As used below, the terms "unit" and "module" may be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0087] Figure 4 is a structural block diagram of a fluid effect rendering device according to one embodiment of the present invention, wherein an editor interface of a virtual engine is provided through a terminal device, and the contents displayed in the editor interface include a target area and a target creation control, such as Figure 4As shown, the device includes: an asset creation module 40, which is used to call a target creation function in a target library in response to a first touch operation performed on a target creation control to create a first rendering target asset; a storage module 42, which is used to update the first rendering target asset based on operation data corresponding to the second touch operation in response to a second touch operation in a target area to obtain a second rendering target asset, wherein the second rendering target asset is used to characterize asset information of a fluid effect; an object creation module 44, which is used to generate a rendering target object based on the second rendering target asset; and a rendering module 46, which is used to add the rendering target object to the target area to obtain a rendering result of the fluid effect.
[0088] Optionally, the asset creation module includes: a first acquisition unit, used to acquire attribute information corresponding to the first rendering target asset; a first creation unit, used to create an object pointer, wherein the object pointer is used to create a rendering target object; and a second creation unit, used to create the first rendering target asset based on the attribute information and the object pointer.
[0089] Optionally, the second creation unit is further configured to create a first rendering target asset through an asset management module, and save the first rendering target asset in a preset directory.
[0090] Optionally, the object creation module includes: a generation unit, used to generate an initial object based on a second rendering target asset; a second acquisition unit, used to acquire parameter information corresponding to the rendering target object; and an update unit, used to update the initial object and the second rendering target asset based on the parameter information to obtain the rendering target object.
[0091] Optionally, the device also includes: a library creation module, used to create a target library, wherein the target file of the target library includes a target module and a target macro, wherein the target module and the target macro are used to represent the modules and macros of the virtual engine in the editor state; a function creation module, used to create a target creation function in the target library, wherein the target creation function includes initial parameter information for rendering the target object.
[0092] Optionally, the device also includes: a traversal module, used to traverse the multiple sub-areas in response to the target area containing multiple sub-areas; a calling module, used to call the target creation function to sequentially create multiple sub-objects corresponding to the multiple sub-areas, wherein the rendering target object contains multiple sub-objects.
[0093] It should be noted that the above-mentioned units and modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to this: the above-mentioned units and modules are all located in the same processor; or, the above-mentioned units and modules are located in different processors in any combination.
[0094] According to one embodiment of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to control an electronic device to execute any of the above-mentioned methods for rendering fluid effects when running.
[0095] Optionally, in this embodiment, the non-volatile storage medium may be configured to store a computer program for performing the following steps:
[0096] S1, in response to a first touch operation performed on a target creation control, calling a target creation function in a target library to create a first rendering target asset;
[0097] S2, in response to a second touch operation in the target area, updating the first rendering target asset based on operation data corresponding to the second touch operation to obtain a second rendering target asset, wherein the second rendering target asset is used to represent asset information of a fluid effect;
[0098] S3, generating a rendering target object based on the second rendering target asset;
[0099] S4, adding the rendering target object to the target area to obtain a rendering result of the fluid effect.
[0100] Optionally, the above-mentioned non-volatile storage medium is also configured to store a computer program for performing the following steps: obtaining attribute information corresponding to the first rendering target asset; creating an object pointer, wherein the object pointer is used to create a rendering target object; and creating a first rendering target asset based on the attribute information and the object pointer.
[0101] Optionally, the non-volatile storage medium is further configured to store a computer program for executing the following steps: creating a first rendering target asset through an asset management module, and saving the first rendering target asset in a preset directory.
[0102] Optionally, the above-mentioned non-volatile storage medium is also configured to store a computer program for performing the following steps: generating an initial object based on the second rendering target asset; obtaining parameter information corresponding to the rendering target object; and updating the initial object and the second rendering target asset based on the parameter information to obtain the rendering target object.
[0103] Optionally, the non-volatile storage medium is further configured to store: one or more parameter information such as color value, transparency, resolution, rendering format, and whether to automatically generate execution speed.
[0104] Optionally, the above-mentioned non-volatile storage medium is also configured to store a computer program for performing the following steps: creating a target library, wherein the target file of the target library includes target modules and target macros, and the target modules and target macros are used to represent the modules and macros of the virtual engine in the editor state; creating a target creation function in the target library, wherein the target creation function includes initial parameter information for rendering the target object.
[0105] Optionally, the above-mentioned non-volatile storage medium is also configured to store a computer program for performing the following steps: in response to the target area containing multiple sub-areas, traversing the multiple sub-areas; calling the target creation function to sequentially create multiple sub-objects corresponding to the multiple sub-areas, wherein the rendering target object contains multiple sub-objects.
[0106] Optionally, in this embodiment, the above-mentioned computer-readable storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.
[0107] Optionally, in this embodiment, the computer-readable storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.
[0108] Through the description of the above implementation modes, it is easy for those skilled in the art to understand that the example implementation modes described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation mode of the present invention can be embodied in the form of a software product, which can be stored in a computer-readable storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation mode of the present invention.
[0109] In the exemplary embodiment of the present application, a program product capable of implementing the above method of the present embodiment is stored on a computer-readable storage medium. In some possible implementations, various aspects of the embodiments of the present invention may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps of various exemplary implementations of the present invention described in the above "Exemplary Method" section of the present embodiment.
[0110] The program product for implementing the above method according to the embodiment of the present invention may adopt a portable compact disk read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the embodiment of the present invention is not limited thereto. In the embodiment of the present invention, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.
[0111] The program product may be in any combination of one or more computer-readable media. 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 any combination thereof. More specific examples (non-exhaustive) of computer-readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0112] It should be noted that the program code contained in the computer-readable storage medium can be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.
[0113] According to one embodiment of the present invention, there is further provided an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute any of the above-mentioned methods for rendering fluid effects.
[0114] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0115] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0116] S1, in response to a first touch operation performed on a target creation control, calling a target creation function in a target library to create a first rendering target asset;
[0117] S2, in response to a second touch operation in the target area, updating the first rendering target asset based on operation data corresponding to the second touch operation to obtain a second rendering target asset, wherein the second rendering target asset is used to represent asset information of a fluid effect;
[0118] S3, generating a rendering target object based on the second rendering target asset;
[0119] S4, adding the rendering target object to the target area to obtain a rendering result of the fluid effect.
[0120] Optionally, the processor is further configured to perform the following steps through a computer program: obtaining attribute information corresponding to the first rendering target asset; creating an object pointer, wherein the object pointer is used to create a rendering target object; and creating the first rendering target asset based on the attribute information and the object pointer.
[0121] Optionally, the processor is further configured to perform the following steps through a computer program: create a first rendering target asset through an asset management module, and save the first rendering target asset in a preset directory.
[0122] Optionally, the processor is further configured to perform the following steps through a computer program: generate an initial object based on the second rendering target asset; obtain parameter information corresponding to the rendering target object; and update the initial object and the second rendering target asset based on the parameter information to obtain the rendering target object.
[0123] Optionally, the processor is further configured to perform the following steps through a computer program: creating a target library, wherein the target file of the target library includes target modules and target macros, and the target modules and target macros are used to represent the modules and macros of the virtual engine in the editor state; creating a target creation function in the target library, wherein the target creation function includes initial parameter information for rendering the target object.
[0124] Optionally, the processor is further configured to perform the following steps through a computer program: in response to the target area containing multiple sub-areas, traversing the multiple sub-areas; calling a target creation function to sequentially create multiple sub-objects corresponding to the multiple sub-areas, wherein the rendering target object contains multiple sub-objects.
[0125] Figure 5 is a schematic diagram of an electronic device according to an embodiment of the present invention. Figure 5 As shown, the electronic device 500 is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0126] like Figure 5 As shown, the electronic device 500 is in the form of a general computing device. The components of the electronic device 500 may include but are not limited to: at least one processor 510, at least one memory 520, a bus 530 connecting different system components (including the memory 520 and the processor 510), and a display 540.
[0127] The memory 520 stores program codes, which can be executed by the processor 510, so that the processor 510 executes the steps according to various exemplary embodiments of the present invention described in the method part of the embodiment of the present application.
[0128] The memory 520 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 5201 and / or a cache memory unit 5202, and may further include a read-only memory unit (ROM) 5203, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.
[0129] In some examples, the memory 520 may also include a program / utility 5204 having a set (at least one) of program modules 5205, such program modules 5205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or a combination thereof may include the implementation of a network environment. The memory 520 may further include a memory remotely disposed relative to the processor 510, and these remote memories may be connected to the electronic device 500 via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0130] Bus 530 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a local bus of processor 510, or a bus using any of a variety of bus architectures.
[0131] The display 540 may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the electronic device 500 .
[0132] Optionally, the electronic device 500 may also communicate with one or more external devices 600 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), one or more devices that enable a user to interact with the electronic device 500, and / or any device that enables the electronic device 500 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed through an input / output (I / O) interface 550. Furthermore, the electronic device 500 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 560. Figure 5 As shown, the network adapter 560 communicates with other modules of the electronic device 500 via the bus 530. It should be understood that although Figure 5Not shown, other hardware and / or software modules may be used in conjunction with the electronic device 500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0133] The electronic device 500 may further include: a keyboard, a cursor control device (such as a mouse), an input / output interface (I / O interface), a network interface, a power supply and / or a camera.
[0134] It can be understood by those skilled in the art that Figure 5 The structure shown is for illustration only and does not limit the structure of the above electronic device. Figure 5 More or fewer components as shown, or with Figure 1 The memory 520 may be used to store computer programs and corresponding data, such as the computer programs and corresponding data corresponding to the fluid effect rendering method in the embodiment of the present invention. The processor 510 executes various functional applications and data processing by running the computer programs stored in the memory 520, that is, implementing the fluid effect rendering method described above.
[0135] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0136] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0137] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0138] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0139] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0140] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for rendering fluid effects, characterized in that: An editor interface of a virtual engine is provided through a terminal device, wherein the contents displayed on the editor interface include a target area and a target creation control, and the method includes: In response to a first touch operation performed on the target creation control, calling a target creation function in a target library, creating a first rendering target asset through an asset management module, and saving the first rendering target asset in a preset directory; In response to a second touch operation in the target area, updating the first rendering target asset based on operation data corresponding to the second touch operation to obtain a second rendering target asset, wherein the second rendering target asset is used to represent asset information of the fluid effect; generating a render target object based on the second render target asset; Adding the rendering target object to the target area to obtain a rendering result of the fluid effect; Wherein, the method further comprises: Creating the target library, wherein the target file of the target library includes target modules and target macros, and the target modules and target macros are used to represent the modules and macros of the virtual engine in the editor state; The target creation function is created in the target library, wherein the target creation function contains initial parameter information of the rendering target object.
2. The method according to claim 1, characterized in that: Calling the target creation function in the target library to create the first rendering target asset includes: Obtaining attribute information corresponding to the first render target asset; Creating an object pointer, wherein the object pointer is used to create the rendering target object; Based on the attribute information and the object pointer, the first render target asset is created.
3. The method according to claim 1, characterized in that Generating a render target object based on the second render target asset includes: generating an initial object based on the second render target asset; Obtain parameter information corresponding to the rendering target object; The initial object and the second rendering target asset are updated based on the parameter information to obtain the rendering target object.
4. The method according to claim 3, characterized in that: The parameter information includes one or more of the following information: color value, transparency, resolution, rendering format, and whether to automatically generate execution speed.
5. The method according to claim 1, characterized in that In response to the target area including a plurality of sub-areas, the method further includes: Traversing the multiple sub-areas; The target creation function is called to sequentially create a plurality of sub-objects corresponding to the plurality of sub-areas, wherein the rendering target object includes the plurality of sub-objects.
6. A fluid effect rendering device, characterized in that: An editor interface of a virtual engine is provided through a terminal device, wherein the contents displayed on the editor interface include a target area and a target creation control, and the apparatus comprises: an asset creation module, configured to, in response to a first touch operation performed on the target creation control, call a target creation function in a target library, create a first rendering target asset through an asset management module, and save the first rendering target asset in a preset directory; a storage module, configured to respond to a second touch operation in the target area and update the first rendering target asset based on operation data corresponding to the second touch operation to obtain a second rendering target asset, wherein the second rendering target asset is used to represent asset information of the fluid effect; an object creation module, configured to generate a rendering target object based on the second rendering target asset; A rendering module, used for adding the rendering target object to the target area to obtain a rendering result of the fluid effect; Wherein, the device further comprises: A library creation module, used for creating the target library, wherein the target file of the target library includes target modules and target macros, and the target modules and target macros are used for representing the modules and macros of the virtual engine in the editor state; A function creation module is used to create the target creation function in the target library, wherein the target creation function contains initial parameter information of the rendering target object.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program is configured to control an electronic device to execute the method for rendering fluid effects as claimed in any one of claims 1 to 5 when the computer program is run.
8. An electronic device comprising a memory and a processor, characterized in that: The memory stores a computer program, and the processor is configured to run the computer program to execute the method for rendering fluid effects as claimed in any one of claims 1 to 5.
