Special effect generation method, apparatus, device, and computer-readable storage medium
Patent Information
- Application Number
- CN202210508080.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-10
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2042-05-10
AI Technical Summary
[0003]通常,开发人员在特效制作界面选择各种资源,基于选择的所有资源生成一种特效,然而,开发人员制作的特效可能是其他场景中的一些已经制作好的特效的组合,若采用上述技术手段,导致制作特效的时间较长,降低特效的生成效率
[0034]本公开提供的技术方案中,通过获取至少两个目标预制体文件,其中,每个目标预制体文件对应一个特效,每个目标预制体文件中包括:目标文件夹,目标文件夹中包括所对应的特效的资源文件,不同目标预制体文件中的目标文件夹的命名不同;基于至少两个目标预制体文件生成组合特效,能够基于多个目标预制体文件,生成多个特效的组合特效,如此,无需在针对组合特效添加各个资源,能够简化组合特效的制作流程,缩短特效的制作时间,从而能够提升组合特效的生成效率。另外,不同目标预制体文件中的目标文件夹的命名不同,基于目标文件夹可以识别出不同的特效对应的相同资源文件,如此,在不同特效对应相同的资源文件时,仍然可以得到多个特效各自的资源文件,避免出现未识别出资源文件的情况,确保组合特效的顺利生成。
Smart Images

Figure CN117076396B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image processing technology, and in particular to a method, apparatus, device and computer-readable storage medium for generating special effects. Background Technology
[0002] With the development of image processing technology, more and more multimedia applications offer image effects functions. Users can select the image to which they want to add effects and import it into the multimedia application. The application then selects the desired effects and adds them to the image. Alternatively, users can first select the desired effects, then use their camera to capture a picture; the captured image will then have the effects added.
[0003] Typically, developers select various resources in the special effects creation interface and generate a special effect based on all the selected resources. However, the special effects created by developers may be a combination of some pre-made special effects in other scenes. If the above-mentioned techniques are used, the special effects production time will be long, reducing the efficiency of special effects generation. Summary of the Invention
[0004] This disclosure provides a method, apparatus, device, and computer-readable storage medium for generating special effects, which can shorten the production time of combined special effects and improve the efficiency of generating combined special effects.
[0005] Firstly, this disclosure provides a method for generating special effects, including:
[0006] Obtain at least two target prefab files, wherein each target prefab file corresponds to one effect, and each target prefab file includes a target folder containing the resource files of the corresponding effect. The target folders in different target prefab files are named differently.
[0007] Generate combined effects based on the at least two target prefab files.
[0008] Optionally, before obtaining at least two target prefab files, the process further includes:
[0009] Obtain the resource file for a special effect;
[0010] Create a target folder, copy the resource files into the target folder, and the target folder corresponds to the special effect;
[0011] The target prefab file is generated based on the target folder.
[0012] Optionally, before obtaining at least two target prefab files, the process further includes:
[0013] The following operations are performed by running the preset script:
[0014] Obtain resource files for special effects corresponding to at least two original prefab files, wherein the original prefab files include the resource files for the corresponding special effects;
[0015] For each effect, a target folder is created, and the resource files are copied to the target folder, which corresponds to the effect; the target prefab file is generated based on the target folder.
[0016] Optionally, before generating the combined effect based on the at least two target prefab files, the method further includes:
[0017] Create a target prefab folder and a resource folder in the project directory;
[0018] The creation of the target folder includes:
[0019] Create the target folder in the resource folder;
[0020] The step of generating the target prefab file based on the target folder includes:
[0021] The target prefab file is generated based on the target folder, and the target prefab file is stored in the prefab folder;
[0022] The acquisition of at least two target prefab files includes:
[0023] Obtain the special effects compressed package, which includes: the prefab folder and the resource folder, wherein the prefab folder includes: the target prefab file.
[0024] Optionally, the method further includes:
[0025] Based on the resource folder and the target folder, modify the resource path in the script file corresponding to the special effect.
[0026] Optionally, the resource file includes at least one of the following:
[0027] Material files; model files; texture files; texture files.
[0028] Optionally, the resource file may also include a control script, which is used to display the resource file of the special effect in an interface manner.
[0029] Secondly, this disclosure provides a special effects generation apparatus, comprising:
[0030] The acquisition module is used to acquire at least two target prefab files, wherein each target prefab file corresponds to one special effect, and each target prefab file includes a target folder, which contains the resource files of the corresponding special effect. The target folders in different target prefab files have different names.
[0031] A generation module is used to generate combined effects based on the at least two target prefab files.
[0032] Thirdly, this disclosure provides an electronic device, including: a processor, the processor being configured to execute a computer program stored in a memory, the computer program being executed by the processor to implement the steps of the method described in any of the first aspects.
[0033] Fourthly, this disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in any of the first aspects.
[0034] The technical solution provided in this disclosure obtains at least two target prefab files, each target prefab file corresponding to one special effect. Each target prefab file includes a target folder containing the resource files for the corresponding special effect. The target folders in different target prefab files have different names. A combined special effect is generated based on at least two target prefab files. This allows for the generation of combined special effects from multiple target prefab files, eliminating the need to add individual resources for each combined effect, simplifying the production process, shortening the production time, and thus improving the efficiency of combined special effect generation. Furthermore, the different names of the target folders in different target prefab files allow for the identification of the same resource files corresponding to different special effects. Therefore, even when different special effects correspond to the same resource files, the individual resource files for each special effect can still be obtained, avoiding situations where resource files are not identified and ensuring the successful generation of combined special effects. Attached Figure Description
[0035] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0036] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0037] Figure 1A An illustration of a special effect provided in this disclosure;
[0038] Figure 1B An illustration of another special effect provided in this disclosure;
[0039] Figure 1C This is an illustration of yet another special effect provided in this disclosure;
[0040] Figure 2 This is an illustration of yet another special effect provided in this disclosure;
[0041] Figure 3 This is a flowchart illustrating an embodiment of a special effects generation method provided in this disclosure;
[0042] Figure 4 A flowchart illustrating another embodiment of the special effects generation method provided in this disclosure;
[0043] Figure 5A A schematic diagram of a target folder provided in this disclosure;
[0044] Figure 5B A schematic diagram of another target folder provided in this disclosure;
[0045] Figure 6A A schematic diagram of yet another target folder provided in this disclosure;
[0046] Figure 6B A schematic diagram of yet another target folder provided in this disclosure;
[0047] Figure 7 This is a schematic diagram of a target prefabricated body file provided in this disclosure;
[0048] Figure 8 This is a schematic diagram of a target prefabricated body file provided in this disclosure;
[0049] Figure 9 A flowchart illustrating another embodiment of the special effects generation method provided in this disclosure;
[0050] Figure 10 A schematic diagram of a project catalog provided in this disclosure;
[0051] Figure 11A A schematic diagram of a resource folder provided in this disclosure;
[0052] Figure 11B A diagram illustrating another resource folder provided in this disclosure;
[0053] Figure 12 This is a schematic diagram of a prefabricated folder provided in this disclosure;
[0054] Figure 13A flowchart illustrating another embodiment of the special effects generation method provided in this disclosure;
[0055] Figure 14 This is a schematic diagram illustrating an embodiment of a resource file display method provided in this disclosure;
[0056] Figure 15 This is a schematic diagram of an embodiment of a special effects generation device provided in this disclosure. Detailed Implementation
[0057] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0058] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.
[0059] In this disclosure, "special effects" refers to unique effects that, by adding special effects to images, can make the display of images more diverse. For example, special effects might include adding virtual props to an image. Figure 1A-1C As shown, this may involve deforming the target region in the image, such as... Figure 2 As shown, it could also involve changing the color of a target area in an image. Typically, the workflow for developers to create a special effect is as follows: Open the special effects creation interface, select the required resources from the resource options within the interface. Resources can be at least one of materials, models, textures, and mappings. After selecting the resources, set the corresponding parameters, which can include position, movement trajectory, deformation, etc.
[0060] For example, the developer needs to develop effect 1, which adds a virtual prop X1 to the image. The virtual prop X1 could be, for example, such as... Figure 1AThe hat shown is an example. In the special effects creation interface for Effect 1, select Material A1, Model B1, Texture C1, and Texture D1, and set the parameters of Material A1 to Pa1, Model B1 to Pb1, Texture C1 to Pc1, and Texture D1 to Pd1. The resource file generated based on Material A1 and its parameter Pa1 is Material File Fa1; the resource file generated based on Model B1 and its parameter P1 is Model File Fb1; the resource file generated based on Texture C1 and its parameter Pc1 is Texture File Fc1; and the resource file generated based on Texture D1 and its parameter Pd1 is Texture File Fd1. Based on Material File Fa1, Model File Fb1, Texture File Fc1, and Texture File Fd1, generate the target prefab file F1. Effect 1 generated based on the target prefab file F1 is shown below. Figure 1A As shown.
[0061] It should be noted that this embodiment only uses the example of resource files including material files, model files, texture files and texture files for illustration. In practical applications, resource files can include any one of material files, model files, texture files and texture files; or, resource files can include any two of material files, model files, texture files and texture files; or, resource files can include any three of material files, model files, texture files and texture files.
[0062] The developers need to develop Effect 2, which adds two virtual props to the image. For example, the virtual props could be... Figure 1B The star decoration shown. In the special effects creation interface of Special Effect 2, select Material A2, Model B2, Texture C2, and Texture D2, and set the parameters of Material A2 to Pa2, Model B2 to Pb2, Texture C2 to Pc2, and Texture D2 to Pd2. Generate material file Fa2 based on Material A2 and its parameter Pa2, model file Fb2 based on Model B2 and its parameter P2, texture file Fc2 based on Texture C2 and its parameter Pc2, and texture file Fd2 based on Texture D2 and its parameter Pd2. Generate target prefab file F2 based on material file Fa2, model file Fb2, texture file Fc2, and texture file Fd2. Special Effect 2 generated based on target prefab file F2 is as follows. Figure 1B As shown.
[0063] After creating the target prefab files F1 and F2, the developers need to create a new effect 3. Effect 3 is a combination of effects 1 and 2; that is, it adds virtual props X1 and X2 to the image. Therefore, in the effect 3 creation interface, the following settings are configured: material A1 and its parameter Pa1, model B1 and its parameter Pb1, texture C1 and its parameter Pc1, texture D1 and its parameter Pd1, material A2 and its parameter Pa2, model B2 and its parameter Pb2, texture C2 and its parameter Pc2, and texture D2 and its parameter Pd2. Material file Fa1 is generated based on material A1 and its parameter Pa1; model file Fb1 is generated based on model B1 and its parameter Pb1; texture file Fc1 is generated based on texture C1 and its parameter Pc1; texture file Fd1 is generated based on texture D1 and its parameter Pd1; material file Fa2 is generated based on material A2 and its parameter Pa2; model file Fb2 is generated based on model B2 and its parameter Pb2; texture file Fc2 is generated based on texture C2 and its parameter Pc2; texture file Fd2 is generated based on texture D2 and its parameter Pd2. Based on material file Fa1, model file Fb1, texture file Fc1, and texture file Fd1, and material file Fa2, model file Fb2, texture file Fc2, and texture file Fd2, a target prefab file F3 is generated. Effect 3 is generated based on the target prefab file F3. Figure 1C As shown.
[0064] Based on the above embodiments, when generating special effect 3, it is necessary to set the resources and parameters of special effect 1 and special effect 2 separately. Developers need to complete multiple manual resource selection operations. Therefore, the production process of special effect 3 is relatively complicated and takes a long time, resulting in low generation efficiency of special effect 3.
[0065] It should be noted that this embodiment only uses the combination of two special effects as an example to illustrate the combined special effects. In practical applications, the combined special effects can also be a combination of three or more special effects, and this disclosure does not impose any specific limitations on this.
[0066] In this disclosure, after generating the target prefab file F1 for effect 1 and the target prefab file F2 for effect 2, if the developer needs to develop a combined effect of effect 1 and effect 2, i.e., effect 3, they can import the target prefab file F1 and the target prefab file F2 into the effect creation interface of effect 3. Based on the target prefab file F1, a virtual prop X1 can be generated, and based on the target prefab file F2, a virtual prop X2 can be generated. The virtual prop X1 and the virtual prop X2 are superimposed to generate effect 3. In this way, there is no need to set the resources and parameters of effect 1 and effect 2 separately, which simplifies the production process of combined effects, shortens the production time, and thus improves the generation efficiency of combined effects.
[0067] Based on the above embodiments, all resources of Effect 1 and all resources of Effect 2 may have at least some of the same resources. The parameters of the resources of Effect 1 are different from the parameters of the resources of Effect 2. For the same resources in Effect 1 and Effect 2, the generated resource file of Effect 1 has the same filename as the resource file of Effect 2. For example, based on the above embodiments, if material A1 and material A2 are the same, the filenames of material files Fa1 and Fa2 are the same; if model B1 and model B2 are the same, the filenames of model files Fb1 and Fb2 are the same; if texture C1 and texture C2 are the same, the filenames of texture files Fc1 and Fc2 are the same; if texture D1 and texture D2 are the same, the filenames of texture files Fd1 and Fd2 are the same.
[0068] In some embodiments, all resources of effect 1 are identical to all resources of effect 2, i.e., material A1 is identical to material A2, model B1 is identical to model B2, texture C1 is identical to texture C2, and texture D1 is identical to texture D2. Therefore, material files Fa1 and Fa2 have the same filename, for example, both material files Fa1 and Fa2 are named "caizhiA1.material". Model files Fb1 and Fb2 have the same filename, for example, both model files Fb1 and Fb2 are named "moxingB1.mesh"; texture files Fc1 and Fc2 have the same filename, for example, both texture files Fc1 and Fc2 are named "tietuC1.texturing"; and texture files Fd1 and Fd2 have the same filename, for example, both texture files Fd1 and Fd2 are named "wenliD1.texture".
[0069] After importing all resource files from target prefab file F1 and target prefab file F2, each filename can only be recognized once. Therefore, only one of each material file, model file, texture file, and texture file can be recognized. For example, material file Fa1, model file Fb1, texture file Fc1, and texture file Fd1 can be recognized; or material file Fa2, model file Fb12, texture file Fc2, and texture file Fd2 can be recognized; or a portion of material file Fa1, model file Fb1, texture file Fc1, and texture file Fd1, and a portion of material file Fa2, model file Fb12, texture file Fc2, and texture file Fd2 can be recognized. If material file Fa1, model file Fb1, texture file Fc1, and texture file Fd1 are recognized, virtual prop X1 can be generated, i.e., effect 1 can be generated. If material file Fa2, model file Fb2, texture file Fc2, and texture file Fd2 are identified, virtual prop X2 can be generated, i.e., effect 2 is generated. If only a portion of material file Fa1, model file Fb1, texture file Fc1, and texture file Fd1, or a portion of material file Fa2, model file Fb12, texture file Fc2, and texture file Fd2 are identified, then neither virtual prop X1 nor virtual prop X2 can be generated, i.e., effects 1 and 2 cannot be generated. Obviously, none of the above embodiments can generate combined effect 3.
[0070] Based on the above, in this disclosure, a target folder is set for each target prefab file. The target folder includes resource files for each special effect, and the target folders in different target prefab files are named differently. For example, based on the above embodiment, a target folder M1 is set in target prefab file F1. Target folder M1 includes material file Fa1, model file Fb1, texture file Fc1, and texture file Fd1. The target folder M1 can be named "texiao1"; a target folder M2 is set in target prefab file F2. Target folder M2 includes material file Fa1, model file Fb1, texture file Fc1, and texture file Fd1. The target folder M1 can be named "texiao2". Importing target prefab files F1 and F2 means importing target folders M1 and M2. Since target folders M1 and M2 have different names, two paths for identifying resource files are established. One path identifies resource files through target folder M1, and the other through target folder M2. This avoids the situation where the same resource file is only identified once. In this way, when different effects correspond to the same resource file, all the resource files of each effect can still be obtained, ensuring the smooth generation of combined effects.
[0071] The technical solutions of this disclosure are described below with reference to several specific embodiments.
[0072] Figure 3 This is a flowchart illustrating an embodiment of a special effects generation method provided in this disclosure, as shown below. Figure 3 As shown, it includes:
[0073] S101, Obtain at least two target prefab files.
[0074] Each target prefab file corresponds to one special effect. Each target prefab file includes a target folder, which contains the resource files for the corresponding special effect. The target folders in different target prefab files have different names.
[0075] For example, target prefab files F1 and F2 are obtained, where target prefab file F1 corresponds to effect 1 and target prefab file F2 corresponds to effect 2. The target prefab files can be files with the suffix "prefab", for example, target prefab file F1 is "texiao1.prefab" and target prefab file F2 is "texiao2.prefab". Target prefab file F1 includes a target folder M1, and prefab file F2 includes a target folder M2. Target folders M1 and M2 are named differently, for example, target folder M1 is named "texiao1" and target folder M2 is named "texiao2".
[0076] Resource files can be files generated based on resources and their parameters. If the resource is a material, the resource file generated based on the material and its parameters is a material file; if the resource is a model, the resource file generated based on the model and its parameters is a model file; if the resource is a texture, the resource file generated based on the texture and its parameters is a texture file; if the resource is a texture, the resource file generated based on the texture and its parameters is a texture file. Special effects resources can be at least one of material, model, texture, and texture files. Therefore, special effects resource files can be at least one of material files, model files, texture files, and texture files.
[0077] The target folder M1 contains all the resource files for effect 1. In some embodiments, all the resource files for effect 1 may include any one of the following: material file Fa1, model file Fb1, texture file Fc1, and texture file Fd1. For example, all the resource files for effect 1 may include material file Fa1, or all the resource files for effect 1 may include model file Fb1, or all the resource files for effect 1 may include texture file Fc1, or all the resource files for effect 1 may include texture file Fd1. In some embodiments, all resource files for effect 1 may include any two of the following: material file Fa1, model file Fb1, texture file Fc1, and texture file Fd1. For example, all resource files for effect 1 may include material file Fa1 and model file Fb1, or all resource files for effect 1 may include material file Fa1 and texture file Fc1, or all resource files for effect 1 may include material file Fa1 and texture file Fd1, or all resource files for effect 1 may include model file Fb1 and texture file Fc1, or all resource files for effect 1 may include model file Fb1 and texture file Fd1, or all resource files for effect 1 may include texture file Fc1 and texture file Fd1. In some embodiments, all resource files for effect 1 may include any three of the following: material file Fa1, model file Fb1, texture file Fc1, and texture file Fd1. For example, all resource files for effect 1 may include material file Fa1, model file Fb1, and texture file Fc1; or all resource files for effect 1 may include material file Fa1, model file Fb1, and texture file Fd1; or all resource files for effect 1 may include model file Fb1, texture file Fc1, and texture file Fd1. In some embodiments, all resource files for effect 1 may include material file Fa1, model file Fb1, texture file Fc1, and texture file Fd1.
[0078] The target folder M2 contains all the resource files for effect 2. In some embodiments, all the resource files for effect 2 may include any one of the following: material file Fa2, model file Fb2, texture file Fc2, and texture file Fd2. For example, all the resource files for effect 2 may include material file Fa2, or all the resource files for effect 2 may include model file Fb2, or all the resource files for effect 2 may include texture file Fc2, or all the resource files for effect 2 may include texture file Fd2. In some embodiments, all resource files for effect 2 may include any two of the following: material file Fa2, model file Fb2, texture file Fc2, and texture file Fd2. For example, all resource files for effect 2 may include material file Fa2 and model file Fb2, or all resource files for effect 2 may include material file Fa2 and texture file Fc2, or all resource files for effect 2 may include material file Fa2 and texture file Fd2, or all resource files for effect 2 may include model file Fb2 and texture file Fc2, or all resource files for effect 2 may include model file Fb2 and texture file Fd2, or all resource files for effect 2 may include texture file Fc2 and texture file Fd2. In some embodiments, all resource files for effect 2 may include any three of the following: material file Fa2, model file Fb2, texture file Fc2, and texture file Fd2. For example, all resource files for effect 2 may include material file Fa2, model file Fb2, and texture file Fc2; or all resource files for effect 2 may include material file Fa2, model file Fb2, and texture file Fd2; or all resource files for effect 2 may include model file Fb2, texture file Fc2, and texture file Fd2. In some embodiments, all resource files for effect 2 may include material file Fa2, model file Fb2, texture file Fc2, and texture file Fd2.
[0079] It should be noted that this disclosure is only used as an example of obtaining two target preform files. In practical applications, it may be necessary to obtain three or more target preform files. This disclosure does not impose a specific limit on the number of target preform files obtained.
[0080] S103, Generate combined effects based on the at least two target prefab files.
[0081] For example, based on the above embodiments, when generating a combined effect 3 of effect 1 and effect 2, target prefab files F1 and F2 are imported. Effect 1 can be generated based on target prefab file F1, and effect 2 can be generated based on target prefab file F2. Effect 1 and effect 2 are combined and superimposed to generate combined effect 3. In this way, there is no need to set the resources and parameters of effect 1 and effect 2 separately, which simplifies the production process of combined effects, shortens the production time, and thus improves the generation efficiency of combined effects.
[0082] Based on the above embodiments, importing target prefab files F1 and F2 means importing target folders M1 and M2. The different names of target folders M1 and M2 establish two paths for identifying resource files: one through target folder M1 and the other through target folder M2. This avoids the situation where the same resource file is identified only once. Therefore, even when different effects correspond to the same resource file, all resource files for each effect can still be obtained, ensuring the successful generation of combined effects.
[0083] In this embodiment, at least two target prefab files are acquired, each corresponding to a specific effect. Each target prefab file includes a target folder containing the resource files for the corresponding effect. The target folders in different target prefab files have different names. A combined effect is generated based on at least two target prefab files. This allows for the generation of combined effects from multiple target prefab files, eliminating the need to add individual resources for each combined effect, simplifying the production process, shortening production time, and improving the efficiency of combined effect generation. Furthermore, the different names of the target folders in different target prefab files allow for the identification of the same resource files corresponding to different effects. This ensures that even when different effects correspond to the same resource files, all resource files for each effect can still be obtained, preventing unidentified resource files and ensuring the successful generation of combined effects.
[0084] Figure 4 This is a flowchart illustrating another embodiment of the special effects generation method provided in this disclosure. Figure 4 for Figure 3 Based on the illustrated embodiment, before executing S101, the following steps are also included:
[0085] S201, retrieve a resource file for a special effect.
[0086] For example, based on the above embodiments, before obtaining the target prefab file F1 and the target prefab file F2, it is necessary to first generate the target prefab file F1 and the target prefab file F2. First, obtain all resource files of effect 1 and all resource files of effect 2. For example, all resource files of effect 1 include material file Fa1, model file Fb1, texture file Fc1, and texture file Fd1, and all resource files of effect 2 include material file Fa2, model file Fb2, texture file Fc2, and texture file Fd2.
[0087] In the effects creation interface for Effect 1, developers can select at least one resource and set the parameters for each resource. Based on the selected resources and their parameters, the resource files for Effect 1 can be generated. For example, based on the selected material A1 and its parameter Pa1, material file Fa1 is generated; based on the selected model B1 and its parameter Pb1, model file Fb1 is generated; based on the selected texture C1 and its parameter Pc1, texture file Fa1 is generated; and based on the selected texture D1 and its parameter Pd1, texture file Fb1 is generated. In this way, based on all the resources of Effect 1 and their respective parameters, all resource files for Effect 1 can be generated.
[0088] In the effects creation interface of Effect 2, developers can select at least one resource and set the parameters for each resource. Based on the selected resources and their parameters, the resource files for Effect 2 can be generated. For example, based on the selected material A2 and its parameter Pa2, material file Fa2 is generated; based on the selected model B2 and its parameter Pb2, model file Fb2 is generated; based on the selected texture C2 and its parameter Pc2, texture file Fa2 is generated; and based on the selected texture D2 and its parameter Pd2, texture file Fb2 is generated. In this way, based on all the resources of Effect 2 and their respective parameters, all the resource files for Effect 2 can be generated.
[0089] S202, Create a target folder and copy the resource files to the target folder.
[0090] The target folder corresponds to the special effect.
[0091] For example, based on the above embodiments, a target folder M1 is created and renamed, for example, the target folder M1 is named "texiao1", such as... Figure 5A As shown. Then, copy all the resource files for Effect 1 to the target folder M1, for example, as shown. Figure 5B As shown, the material file Fa1 for effect 1 is named "caizhiA1.material", the model file Fb1 is named "moxingB1.mesh", the texture file Fc1 is named "tietuC1.texturing", and the texture file Fd1 is named "wenliD1.texture". These files are then placed in the target folder M1 "texiao1".
[0092] Create a target folder M2 and rename it, for example, name the target folder M2 "texiao2". Figure 6A As shown. Then, copy all resource files for Effect 2 to the target folder M2. If all resources for Effect 2 are identical to all resources for Effect 1, then all resource files for Effect 2 will have the same names as identical resource files in Effect 1. For example, like... Figure 6B As shown, the material file Fa2 for Effect 2 is named "caizhiA1.material", the model file Fb2 is named "moxingB1.mesh", the texture file Fc2 is named "tietuC1.texturing", and the texture file Fd2 is named "wenliD1.texture". These files are then placed in the target folder M2 "texiao2".
[0093] S203, Generate the target prefab file based on the target folder.
[0094] For example, a target prefab file F1 is generated based on the target folder M1, for instance, based on... Figure 5B The target folder M1 "texiao1" shown generates a target prefab file F1 named "texiao1.prefab", as shown. Figure 7 As shown. A target prefab file F2 is generated based on the target folder M2, for example, based on... Figure 6B The target folder M2 "texiao2" shown above generates a target prefab file F2 named "texiao2.prefab", as shown. Figure 8 As shown.
[0095] In the above Figure 3 Based on the illustrated embodiment, before executing S101, the following operations can also be performed by running a preset script:
[0096] S201', Obtain the resource files for the effects corresponding to at least two original prefab files.
[0097] The original prefab file includes the resource files for the corresponding special effects.
[0098] For example, the original prefab file f1 corresponds to effect 1, and the original prefab file f2 corresponds to effect 2. The original prefab file can be a file with the suffix "prefab". For example, the original prefab file f1 is "texiaoO1.prefab" and the original prefab file f2 is "texiaoO2.prefab". The original prefab file f1 is generated based on all the resource files of effect 1, and the original prefab file f2 is generated based on all the resource files of effect 2. For example, all the resource files of effect 1 include material file Fa1, model file Fb1, texture file Fc1, and texture file Fd1, and all the resource files of effect 2 include material file Fa2, model file Fb2, texture file Fc2, and texture file Fd2. Thus, the original prefab file f1 can be generated based on material file Fa1, model file Fb1, texture file Fc1, and texture file Fd1, and the original prefab file f2 can be generated based on material file Fa2, model file Fb2, texture file Fc2, and texture file Fd2.
[0099] The original prefab file is directly generated based on the resource files of special effects. If the resource files of different special effects are the same, the filenames of the same resource files in the original prefab files of the corresponding different special effects will be the same. For example, based on the above embodiment, when all resources of special effect 1 and all resources of special effect 2 are the same, the filenames of material file Fa1 and material file Fa2 are the same, the filenames of model file Fb1 and model file Fb2 are the same, the filenames of texture file Fc1 and texture file Fc2 are the same, and the filenames of texture file Fd1 and texture file Fd2 are the same. For example, the filenames of material file Fa1 and material file Fa2 are both "caizhiA1.material", the filenames of model file Fb1 and model file Fb2 are both "moxingB1.mesh", the filenames of texture file Fc1 and texture file Fc2 are both "tietuC1.texturing", and the filenames of texture file Fd1 and texture file Fd2 are both "wenliD1.texture".
[0100] In summary, after obtaining the original prefab files f1 and f2, parsing them will yield all the resource files for effect 1 and effect 2.
[0101] S202': For each effect, create a target folder and copy the resource files to the target folder.
[0102] The target folder corresponds to the special effect.
[0103] For example, based on the above embodiments, for effect 1, a target folder M1 is created and renamed, for example, the target folder M1 is named "texiao1", as shown. Figure 5A As shown. Then, copy all the resource files for Effect 1 to the target folder M1, for example, as shown. Figure 5B As shown, the material file Fa1 for effect 1 is named "caizhiA1.material", the model file Fb1 is named "moxingB1.mesh", the texture file Fc1 is named "tietuC1.texturing", and the texture file Fd1 is named "wenliD1.texture". These files are then placed in the target folder M1 "texiao1".
[0104] For effect 2, create a target folder M2 and rename it, for example, name the target folder M2 "texiao2". Figure 6A As shown. Then, copy all the resource files for Effect 2 to the target folder M2, for example, as shown. Figure 6B As shown, the material file Fa2 for Effect 2 is named "caizhiA1.material", the model file Fb2 is named "moxingB1.mesh", the texture file Fc2 is named "tietuC1.texturing", and the texture file Fd2 is named "wenliD1.texture". These files are then placed in the target folder M2 "texiao2".
[0105] S203, Generate the target prefab file based on the target folder.
[0106] For example, a target prefab file F1 is generated based on the target folder M1, for instance, based on... Figure 5B The target folder M1 "texiao1" shown generates a target prefab file F1 named "texiao1.prefab", as shown. Figure 7 As shown. A target prefab file F2 is generated based on the target folder M2, for example, based on... Figure 6BThe target folder M2 "texiao2" shown above generates a target prefab file F2 named "texiao2.prefab", as shown. Figure 8 As shown.
[0107] In this embodiment, the following operations are performed by running a preset script: obtaining resource files for special effects corresponding to at least two original prefab files, wherein the original prefab files include the resource files for the corresponding special effects; creating a target folder for each special effect, copying the resource files to the target folder, and the target folder corresponding to the special effect; generating a target prefab file based on the target folder. This method can automatically generate target prefab files based on the original prefab files without setting additional resources and parameters for the special effects corresponding to the original prefab files, which can improve the generation efficiency of special effects and also improve the utilization rate of the original prefab files.
[0108] Figure 9 This is a flowchart illustrating another embodiment of the special effects generation method provided in this disclosure. Figure 9 for Figure 4 Based on the illustrated embodiment, before executing S103, the following steps are also included:
[0109] S102, create a prefab folder and a resource folder in the project directory.
[0110] For example, when developing Composite Effect 3, the developer creates a prefab folder and a resource folder in the project directory. The prefab folder can be named "prefab", and the resource folder can be named "pass", such as... Figure 10 As shown.
[0111] It should be noted that, Figure 10 The naming of the prefab folder and the resource folder is only shown as an example. In practical applications, the prefab folder and the resource folder can be named flexibly. This disclosure does not impose specific restrictions on the naming of the prefab folder and the resource folder.
[0112] Based on S102, a specific description of a possible implementation method when executing S202 is provided, such as Figure 9 As shown:
[0113] "S202", create the target folder in the resource folder, and copy the resource files to the target folder.
[0114] For example, based on the above embodiments, when developing special effect 1, the developer, such as Figure 11AAs shown, create a target folder M1 in the resource folder "pass" and name the target folder M1 "texiao1". The target folder M1 "texiao1" includes the material file Fa1 "caizhiA1.material", the model file Fb1 "moxingB1.mesh", the texture file Fc1 "tietuC1.texturing", and the texture file Fd1 "wenliD1.texture".
[0115] When developers were developing Effects 2, such as Figure 11B As shown, create a target folder M2 in the resource folder "pass" and name the target folder M2 "texiao2". The target folder M2 "texiao2" includes the material file Fa2 "caizhiA1.material", the model file Fb2 "moxingB1.mesh", the texture file Fc2 "tietuC1.texturing" and the texture file Fd2 "wenliD1.texture".
[0116] Based on S102 and S202", a specific description of a possible implementation method when executing S203 is provided, such as Figure 9 As shown:
[0117] S203” generates the target prefab file based on the target folder and stores the target prefab file in the prefab folder.
[0118] For example, a target prefab file F1 is generated based on the target folder M1, for instance, based on... Figure 11A The target folder M1 "texiao1" is shown. A target prefab file F1 named "texiao1.prefab" is generated and stored in the prefab folder "prefab". Figure 12 As shown.
[0119] Generate a target prefab file F2 based on the target folder M2, for example, based on... Figure 11B The target folder M2 "texiao2" is shown. A target prefab file F2 named "texiao2.prefab" is generated and stored in the prefab folder "prefab". Figure 12 As shown.
[0120] Based on S102, S202” and S203”, a specific description of a possible implementation method when executing S101 is provided, such as Figure 9 As shown:
[0121] S101', Get the special effects compressed package.
[0122] The special effects compressed package includes: the prefab folder and the resource folder, and the prefab folder includes: the target prefab file.
[0123] For example, a special effects compressed package can be generated based on the prefab folder and resource folder in the project directory. After obtaining the special effects compressed package, it can be decompressed to obtain the prefab folder "prefab" and the resource folder "pass". The prefab folder "prefab" includes target prefab file F1 and target prefab file F2, for example, as shown below. Figure 12 As shown, the prefab folder contains target prefab files F1 "texiao1.prefab" and F2 "texiao2.prefab". The resource folder "pass" contains target folders M1 and M2. For example, as shown in Figure 11, the resource folder "pass" contains target folders M1 "texiao1" and M2 "texiao2".
[0124] In this embodiment, a target folder is created in the resource folder; a target prefab file is generated based on the target folder and stored in the prefab folder; a special effects compressed package is obtained, which includes a prefab folder and a resource folder, and the prefab folder includes the target prefab file; a prefab folder and a resource folder are created in the project directory. In this way, multiple target folders and multiple target prefab files are managed based on the resource folder and the prefab folder, which makes it easier for users to manage special effects files.
[0125] Figure 13 This is a flowchart illustrating another embodiment of the special effects generation method provided in this disclosure. Figure 13 for Figure 9 Based on the illustrated embodiment, it also includes:
[0126] S301, Based on the resource folder and the target folder, modify the path of the resource in the script file corresponding to the special effect.
[0127] For example, based on the above embodiment, a resource folder is created in the project directory, and a target folder is set in the resource folder to distinguish all resource files corresponding to different effects. Thus, a path node is added to the access path of all resource files for effect 1, thereby changing the access path of all resource files for effect 1. Similarly, a path node is added to the access path of all resource files for effect 2, thus changing the access path of all resource files for effect 2.
[0128] The script file corresponding to an effect can only modify the properties defined in the script within the target prefab file; it cannot interfere with the logic of the script within the target prefab file. It is typically exposed externally as an interface. The script file corresponding to the effect is also responsible for controlling all properties within the target prefab file. If the access paths of all resource files for the effect change, the resource paths in the script file corresponding to the effect need to be modified to ensure that all resource files for the effect can be accessed successfully.
[0129] In this embodiment, by modifying the resource path in the script file corresponding to the special effect based on the resource folder and the target folder, the resource path can be modified in a timely manner when the storage path of the resource file changes, ensuring the correctness of the resource path and guaranteeing the smooth generation of the special effect.
[0130] Optionally, based on the above embodiments, the resource file may further include: a control script, which is used to display the resource file of the special effect in an interface manner.
[0131] For example, such as Figure 14 As shown, after importing the target prefab file F1, the control script displays all resource files for Effect 1 in the effects creation interface via interfaces. Based on these interfaces, the parameters in the resource files can be reset without requiring the user to locate them in the program, making it convenient for users to modify resource file parameters.
[0132] It should be noted that, Figure 14 The resource file is illustrated using only the material file as an example. In actual applications, the interface for all resource files will be used for demonstration.
[0133] In this embodiment, the resource file also includes a control script, which is used to display the resource file of the special effects in an interface manner, so that users can modify the parameters of the resource file and improve the generation efficiency of the special effects.
[0134] This disclosure also provides a special effects generation device. Figure 15 This is a schematic diagram of the structure of an embodiment of a special effects generation device provided in this disclosure, as shown below. Figure 15 As shown, the special effects generation device includes:
[0135] The acquisition module 110 is used to acquire at least two target prefab files, wherein each target prefab file corresponds to an effect, and each target prefab file includes a target folder, which contains the resource files of the corresponding effect. The target folders in different target prefab files have different names.
[0136] The generation module 120 is used to generate combined effects based on the at least two target prefab files.
[0137] Optionally, module 110 can also be used to obtain a resource file for a special effect.
[0138] The special effects generation device also includes:
[0139] A creation module is used to create a target folder and copy the resource files to the target folder, which corresponds to the special effect.
[0140] The generation module 120 is also used to generate the target prefab file based on the target folder.
[0141] Optional special effects generation devices also include:
[0142] The execution module is used to perform the following operations by running a preset script: obtaining resource files for special effects corresponding to at least two original prefab files, wherein the original prefab files include the resource files for the corresponding special effects; creating a target folder for each special effect, copying the resource files to the target folder, wherein the target folder corresponds to the special effect; and generating the target prefab file based on the target folder.
[0143] Optionally, the module creation feature also creates prefab folders and resource folders in the project directory.
[0144] A module is created to further create the target folder within the resource folder.
[0145] The generation module 120 is further configured to generate the target prefab file based on the target folder, and store the target prefab file in the prefab folder.
[0146] The acquisition module 110 is further used to acquire a special effects compressed package, which includes: the prefab folder and the resource folder, wherein the prefab folder includes: the target prefab file.
[0147] Optional special effects generation devices also include:
[0148] The modification module is used to modify the resource path in the script file corresponding to the special effect based on the resource folder and the target folder.
[0149] Optionally, the resource file includes at least one of the following:
[0150] Material files; model files; texture files; texture files.
[0151] Optionally, the resource file may also include a control script, which is used to display the resource file of the special effect in an interface manner.
[0152] The apparatus in this embodiment can be used to execute the technical solutions of the above method embodiments, and its implementation principle and technical effect are similar, so they will not be described again here.
[0153] This disclosure also provides an electronic device, including: a processor, the processor being configured to execute a computer program stored in a memory, the computer program being executed by the processor to implement the steps of the above method embodiments.
[0154] This disclosure also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method embodiments.
[0155] This disclosure also provides a computer program product that, when run on a computer, causes the computer to perform the steps of the above-described method embodiments.
[0156] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0157] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for generating special effects, characterized in that, include: Obtain at least two target prefab files, wherein each target prefab file corresponds to one effect, and each target prefab file includes a target folder containing the resource files of the corresponding effect. The target folders in different target prefab files are named differently. Generate combined effects based on the at least two target prefab files; Before obtaining at least two target prefab files, the process also includes: The following operations are performed by running the preset script: Obtain resource files for special effects corresponding to at least two original prefab files, wherein the original prefab files include the resource files for the corresponding special effects; For each effect, a target folder is created, and the resource files are copied to the target folder, which corresponds to the effect; the target prefab file is generated based on the target folder.
2. The method according to claim 1, characterized in that, Before obtaining at least two target prefab files, the process also includes: Obtain the resource file for a special effect; Create a target folder, copy the resource files into the target folder, and the target folder corresponds to the special effect; The target prefab file is generated based on the target folder.
3. The method according to claim 1 or 2, characterized in that, Before generating the combined effects based on the at least two target prefab files, the process also includes: Create a prefab folder and a resource folder in the project directory; The creation of the target folder includes: Create the target folder in the resource folder; The step of generating the target prefab file based on the target folder includes: The target prefab file is generated based on the target folder, and the target prefab file is stored in the prefab folder; The acquisition of at least two target prefab files includes: Obtain the special effects compressed package, which includes: the prefab folder and the resource folder, wherein the prefab folder includes: the target prefab file.
4. The method according to claim 3, characterized in that, Also includes: Based on the resource folder and the target folder, modify the resource path in the script file corresponding to the special effect.
5. The method according to any one of claims 1-2, characterized in that, The resource file includes at least one of the following: Material files; model files; texture files; texture files.
6. The method according to claim 5, characterized in that, The resource file also includes a control script, which is used to display the resource file of the special effect in an interface manner.
7. A special effects generation device, characterized in that, include: The acquisition module is used to acquire at least two target prefab files, wherein each target prefab file corresponds to one special effect, and each target prefab file includes a target folder, which contains the resource files of the corresponding special effect. The target folders in different target prefab files have different names. The generation module is used to generate combined effects based on the at least two target prefab files; Before obtaining at least two target prefab files, the process also includes: The following operations are performed by running the preset script: Obtain resource files for special effects corresponding to at least two original prefab files, wherein the original prefab files include the resource files for the corresponding special effects; For each effect, a target folder is created, and the resource files are copied to the target folder, which corresponds to the effect; the target prefab file is generated based on the target folder.
8. An electronic device, characterized in that, include: A processor for executing a computer program stored in a memory, wherein the computer program, when executed by the processor, implements the steps of the method according to any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1-6.
Citation Information
Patent Citations
Folder naming method and terminal
CN110019027A
Three-dimensional animation production method and system and storage medium
CN111179391A
Resource sharing method
CN111744178A