Resource processing method, apparatus and electronic device

By decrypting and displaying encrypted shader resources in the external environment, ensuring that their display icons and usage methods are consistent with those in the internal environment, the problem of inefficiency in using encrypted shader resources in the external environment is solved, thereby enhancing staff's trust and experience.

CN114996723BActive Publication Date: 2025-10-21NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210420646.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-20
Publication Date
2025-10-21
Estimated Expiration
2042-04-20

AI Technical Summary

Technical Problem

In existing technologies, using cryptographic shader resources in external environments requires additional operations, resulting in low work efficiency. Furthermore, the usage methods are inconsistent with those in internal environments, affecting staff's trust and experience.

Method used

By receiving encrypted shader files and decrypting them in memory using resource handling tools, it ensures that the display icons and usage of decrypted shader resources in the external environment are consistent with those in the internal environment. This includes overriding specific classes to achieve decryption and display.

Benefits of technology

While ensuring that resources are not leaked, it improves the efficiency of external environment in processing resources, reduces staff's perception of resource encryption, and enhances trust and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114996723B_ABST
    Figure CN114996723B_ABST
Patent Text Reader

Abstract

The application provides a resource processing method and device and electronic equipment, receiving an encrypted shader file from a second device; wherein the encrypted shader file comprises an encrypted shader resource and a resource processing tool; in response to an opening operation of a target engine, obtaining a decrypted shader resource based on the resource processing tool; and displaying an object name of a shader object in the decrypted shader resource on a specified interface. In this way, the encrypted shader resource and the resource processing tool make the display icon of the decrypted shader resource after decryption processing in the first device the same as the display icon in the second device, and make the use mode of the encrypted shader resource in the first device the same as the use mode in the second device, thereby ensuring that the resource is not leaked, improving the work efficiency of processing the resource in an external environment, reducing the perception of resource encryption of the staff, and improving the trust and work experience of the staff.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a resource processing method, device and electronic equipment. Background Art

[0002] As a third-party commercial game engine, Unity has a strong outsourcing market. To ensure that the external environment is consistent with the internal development environment, and that artwork created in the external environment looks the same when imported into a project, custom shader resources are often required. However, using custom shader resources in an external environment carries the risk of resource leakage, necessitating encryption of these custom shader resources.

[0003] In related technologies, shaders are usually packaged into asset bundles (compressed resource packages), and then the shader resources in the compressed resource packages are encrypted to prevent the leakage of shader source code. However, when using encrypted shaders in an external environment, it is necessary to set a material for each object that needs to use the shader by clicking the control each time the project is opened. If the shader of the material needs to be changed, it is necessary to click and select the shader that needs to be changed. This encryption method requires some additional operations in the external environment, which reduces work efficiency. In addition, the way shaders are used in the external environment is also different from that in the internal environment. When people in the external environment perform additional operations, they are prone to negative emotions of not being trusted, and the experience is poor. Summary of the Invention

[0004] In view of this, the purpose of the present invention is to provide a resource processing method, device and electronic device to improve the work efficiency of processing resources in an external environment while ensuring that resources are not leaked, while reducing the staff's perception of resource encryption and improving the staff's sense of trust and work experience.

[0005] In a first aspect, an embodiment of the present invention provides a resource processing method, which is applied to a first device, and the method includes: receiving an encrypted shader file from a second device; wherein the encrypted shader file includes: an encrypted shader resource and a resource processing tool; in response to an opening operation of a target engine, based on the resource processing tool, decrypting the encrypted shader resource to obtain a decrypted shader resource; wherein the display icon of the decrypted shader resource in the first device is the same as the display icon in the second device; and displaying the object name of the shader object in the decrypted shader resource on a specified interface to indicate that the encrypted shader resource is used in the same manner in the first device as in the second device.

[0006] Furthermore, based on the resource processing tool, the encrypted shader resources are decrypted to obtain the decrypted shader resources, including: using the resource processing tool to enable the target engine to decrypt the encrypted shader resources in the memory space through the decryption code in the resource processing tool to obtain the decrypted shader resources; based on the icon resources in the decrypted shader resources, the display icon of the decrypted shader resources is displayed on the resource display interface of the target engine.

[0007] Furthermore, the above-mentioned resource processing tool includes a first target subclass that inherits and is rewritten from the first target class; through the resource processing tool, the target engine decrypts the encrypted shader resources in the memory space through the decryption code in the resource processing tool to obtain the decrypted shader resources, including: through the code in the first target subclass, the target engine obtains the encrypted shader resources from the disk space, and decrypts the encrypted shader resources in the memory space to obtain the decrypted shader resources.

[0008] Furthermore, the character string in the statement indicating the target hlsl file in the encrypted shader resource is text information in the encrypted target hlsl file; wherein the target hlsl file is an unofficial hlsl file.

[0009] Furthermore, the decrypted shader resource has specified attributes, including: the decrypted shader resource is displayed as garbled characters when opened in a text editor.

[0010] Furthermore, the encrypted resource file also includes shader interface resources; the shader interface resources are used to indicate how parameters are displayed in the Inspect interface of the target engine.

[0011] Furthermore, before the step of displaying the shader object in the decrypted shader resource on the specified interface, the method also includes: using the resource processing tool to enable the target engine to create a shader object of the decrypted shader resource in the memory space through the target code in the resource processing tool, and adding the shader object to the decrypted shader resource.

[0012] Furthermore, the resource processing tool also includes a second target subclass that inherits and rewrites the second target class; the step of displaying the object name of the shader object in the decrypted shader resource on the specified interface includes: loading the shader object in the decrypted shader resource through the code in the second target subclass, and displaying the shader object on the specified interface by calling.

[0013] Furthermore, the above method also includes: creating a material resource based on the decrypted shader resource, and sending the material resource to the second device.

[0014] In a second aspect, an embodiment of the present invention provides a resource processing method, which is applied to a second device, and the method includes: responding to an encryption operation on a target file, encrypting a shader resource in the target file to obtain an encrypted shader resource; determining an encrypted shader file based on the encrypted shader resource and a preset resource processing tool; sending the encrypted shader file to a first device, so that the first device, in response to an opening operation of a target engine, decrypts the encrypted shader resource based on the resource processing tool to obtain a decrypted shader resource; wherein the display icon of the decrypted shader resource on the first device is the same as the display icon on the second device; and displaying the shader object in the decrypted shader resource on a specified interface to indicate that the encrypted shader resource is used in the same manner in the first device as in the second device.

[0015] Furthermore, in response to the encryption operation on the target file, the shader resources in the target file are encrypted, and before the step of obtaining the encrypted shader resources, the method also includes: replacing the string in the statement indicating the target hlsl file in the initial shader resource with the text information in the target hlsl file to obtain the shader resource; wherein the target hlsl file is an unofficial hlsl file.

[0016] Furthermore, based on the encrypted shader resources and the preset resource processing tool, the steps of determining the encrypted shader file include: obtaining the shader interface resources in the target file; and determining the shader interface resources, the encrypted shader resources, and the preset resource processing tool as the encrypted shader file.

[0017] Furthermore, the above-mentioned resource processing tool is used to: enable the target engine in the first device to decrypt the encrypted shader resources in the memory space through the decryption code in the resource processing tool to obtain the decrypted shader resources; and display the display icon of the decrypted shader resources in the resource display interface of the target engine according to the icon resources in the decrypted shader resources.

[0018] Furthermore, the step of sending the encrypted shader file to the first device includes: sending the encrypted shader file to a designated directory; wherein the designated target includes a path selection tool; the path selection tool is used to send the encrypted shader file to the designated device through pre-configured path information; in response to the selection operation of the target path information, sending the encrypted shader file to the first device corresponding to the target path information.

[0019] Furthermore, the method also includes: receiving material resources from the first device, determining the path name of the referenced encrypted shader resource from the material resources; obtaining the initial shader resource in the target file according to the path name; and replacing the shader resource referenced by the material resource with the initial shader resource.

[0020] Furthermore, the method further includes: compiling the code in the resource processing tool to obtain the resource processing tool in a specified format; and performing obfuscation processing on the resource processing tool in the specified format to obtain a final resource processing tool.

[0021] Furthermore, the step of performing obfuscation processing on the resource processing tool of the specified format to obtain the final resource processing tool includes: modifying the function names of functions other than the specified function in the resource processing tool of the specified format to obtain the final resource processing tool; setting the name attribute of the specified function in the final resource processing tool so that the function name of the specified function cannot be modified.

[0022] In a third aspect, an embodiment of the present invention provides a resource processing device, which is arranged in a first device, and the device includes: a receiving module for receiving an encrypted shader file from a second device; wherein the encrypted shader file includes: encrypted shader resources and a resource processing tool; a decryption module for decrypting the encrypted shader resources based on the resource processing tool in response to an opening operation of a target engine to obtain a decrypted shader resource; wherein the display icon of the decrypted shader resource in the first device is the same as the display icon in the second device; a display module for displaying the object name of the shader object in the decrypted shader resource on a specified interface to indicate that the encrypted shader resource is used in the same manner as in the second device.

[0023] In a fourth aspect, an embodiment of the present invention provides a resource processing device, which is arranged in a second device, and includes: an encryption module, which is used to respond to an encryption operation on a target file, encrypt the shader resources in the target file, and obtain an encrypted shader resource; a determination module, which is used to determine the encrypted shader file based on the encrypted shader resource and a preset resource processing tool; a sending module, which is used to send the encrypted shader file to the first device, so that the first device, in response to an opening operation of the target engine, decrypts the encrypted shader resource based on the resource processing tool to obtain a decrypted shader resource; wherein the display icon of the decrypted shader resource in the first device is the same as the display icon in the second device; and the shader object in the decrypted shader resource is displayed on a specified interface to indicate that the encrypted shader resource is used in the same manner as in the second device.

[0024] In a fifth aspect, an embodiment of the present invention provides an electronic device comprising a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement any one of the resource processing methods of the first aspect, or implement any one of the resource processing methods of the second aspect.

[0025] In a sixth aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement any resource processing method of the first aspect, or implement any resource processing method of the second aspect.

[0026] The embodiments of the present invention bring the following beneficial effects:

[0027] The present invention provides a resource processing method, apparatus, and electronic device, which receive an encrypted shader file from a second device; the encrypted shader file includes an encrypted shader resource and a resource processing tool; in response to an open operation of a target engine, obtain a decrypted shader resource based on the resource processing tool; and display the object name of the shader object in the decrypted shader resource on a designated interface. In this method, the encrypted shader resource and the resource processing tool ensure that the display icon of the decrypted shader resource in the first device is the same as the display icon in the second device, and the encrypted shader resource is used in the same manner in the first device as in the second device. While ensuring that the resources are not leaked, the efficiency of resource processing in an external environment is improved, while reducing staff's perception of resource encryption, thereby improving staff's trust and work experience.

[0028] Other features and advantages of the present invention will be described in the following description, and in part will become apparent from the description, or understood by practicing the present invention. The purposes and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.

[0029] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.

[0031] Figure 1 A flowchart of a resource processing method provided by an embodiment of the present invention;

[0032] Figure 2 A flowchart of another resource processing method provided by an embodiment of the present invention;

[0033] Figure 3 A schematic diagram of the structure of a resource processing device provided by an embodiment of the present invention;

[0034] Figure 4 A schematic structural diagram of another resource processing device provided by an embodiment of the present invention;

[0035] Figure 5 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0036] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work shall fall within the scope of protection of the present invention.

[0037] Currently, the Unity engine, as a third-party commercial game engine, has a very strong outsourcing market. When third-party staff are needed to assist with art development, it is often necessary to provide them with customized shader resources to ensure that their working environment is consistent with the internal development environment and that the resulting effects are consistent with those of projects imported into the internal development environment. Because providing shader resources to third-party staff carries the risk of shader resource leakage, customized shader resources need to be encrypted.

[0038] The existing shader encryption scheme uses encrypted shaders differently from the original shaders. Because the shader is encrypted and encapsulated, the shader cannot be directly selected in the material and requires multiple clicks. For example, the shader resources are packaged into an assetbundle, and then the shader resources in the resource compression package are encrypted to prevent the leakage of the shader source code. However, when third-party staff use encrypted shaders, they need to click the StartCheckFakeMaterail control every time they open the project, and then attach a RenderFakeMaterials component to each object that uses the shader. The RenderFakeMaterials component will have a corresponding material FakeMaterialAssets object. To change the shader of a material, double-click the FakeMaterialAssets object in the corresponding order. Then change the shader to be selected in the drop-down box.

[0039] This encryption method requires some additional operations in the external working environment of third-party staff, which reduces work efficiency. In addition, the way of using shaders in the external working environment of third-party staff is also different from that in the internal development environment. When third-party staff perform additional operations, they are prone to negative emotions such as being distrusted, and the experience is poor. In addition, after the Unity version is upgraded, there are many difficult-to-clear errors in the process of using the encrypted shader. Based on this, an embodiment of the present invention provides a resource processing method, device and electronic device, which can be applied to electronic devices with resource processing functions, such as computers, laptops and other devices.

[0040] To facilitate understanding of this embodiment, a resource processing method disclosed in an embodiment of the present invention is first described in detail. This method is applied to a first device, which is generally a device used by a third-party staff member and can be understood as an external environment. Figure 1 As shown, the method includes:

[0041] Step S102: receiving an encrypted shader file from a second device; wherein the encrypted shader file includes: encrypted shader resources and resource processing tools;

[0042] A shader is a piece of program code that runs on a GPU (Graphic User Interface). In Unity, a shader is a resource that contains shader code. The above-mentioned encrypted shader resources usually refer to encrypted code resources. The above-mentioned resource processing tool is mainly used to decrypt encrypted shader resources, and at the same time, enables the decrypted shader resources to be directly compiled and executed in the target engine of the first device without the need for third-party staff to perform additional click operations. The above-mentioned encrypted shader resources are mainly used to produce material resources. The above-mentioned encrypted shader files can also be understood as encrypted project files.

[0043] It should be noted that the above-mentioned resource processing tools generally include resource import tools and resource configuration tools, such as the ScriptedImporter class and the AssetPostprocessor class. Specifically, the above-mentioned resource processing tools are obtained by overriding the OnImportAsset and OnPostprocessAllAssets methods.

[0044] Step S104: In response to the opening operation of the target engine, the encrypted shader resource is decrypted based on the resource processing tool to obtain a decrypted shader resource; wherein the display icon of the decrypted shader resource in the first device is the same as the display icon in the second device;

[0045] The target engine mentioned above is typically the Unity engine, and the encrypted shader resources are typically displayed as files with the .ytShader suffix, where ytShader is the suffix of the example encrypted shader file. Specifically, when a third-party worker opens the target engine on a first device, the resource processing tool can decrypt the file with the .ytShader suffix. Specifically, the OnImportAsset method is rewritten as the first program code of the first device. The first device program automatically executes the first program code, decrypting the encrypted shader resources in the device's memory to the original shader resource form in the second device's memory, thereby providing the functionality of the original plaintext shader resource. The plaintext shader resource in the first device's memory is not stored as a file and is invisible to the user. Simultaneously, the display icon of the decrypted shader resource is also displayed in a designated location on the target engine. Since the original shader resource form in the internal development environment can be decrypted, the display icon of the decrypted shader resource in the target engine of the first device is the same as the display icon on the second device, thereby reducing the perception of shader resource encryption to third-party workers and helping to maintain trust.

[0046] Step S106 : Display the object name of the shader object in the decrypted shader resource on a designated interface to indicate that the encrypted shader resource is used in the same manner in the first device as in the second device.

[0047] The above-mentioned shader object refers to an object of a shader resource (which can be understood as a class instance), which can be created in advance. The above-mentioned specified interface usually refers to the material inspect interface, or the inspect window drop-down menu (in the drop-down menu of the material viewing window). Generally, in an internal development environment, for the use of resource shaders, the displayed shader resources can be directly dragged and assigned to the target material, and the shader resources can be selected in the drop-down menu of the material's Inspector window. In order to enable third-party staff to use encrypted shader resources in an external working environment in the same way as in an internal development environment, in this embodiment, by inheriting the AssetPostprocessor class and rewriting the OnPostprocessAllAssets method, the above-mentioned resource processing tool is obtained. Specifically, the decrypted shader resource can be loaded with a shader object through the resource processing tool, and ShaderUtil.RegisterShader() can be called to make the object name of the shader object displayed in the material inspect window drop-down menu, and the corresponding resource corresponding to the corresponding shader object can be found by Shader.Find.

[0048] In addition, encrypted shader files often include other interface resources, which can also be displayed in the material inspector window. The encrypted shader file mentioned above is usually a DLL file. In actual implementation, no interface button is required. The decryption and other display steps are automatically executed when the engine is opened. The purpose is to make the encrypted shader software use unconscious to third-party staff.

[0049] This embodiment provides a resource processing method that receives an encrypted shader file from a second device; the encrypted shader file includes an encrypted shader resource and a resource processing tool; in response to an open operation of a target engine, obtains a decrypted shader resource based on the resource processing tool; and displays the object name of the shader object in the decrypted shader resource on a designated interface. In this method, the encrypted shader resource and the resource processing tool ensure that the display icon of the decrypted shader resource in the first device is the same as the display icon in the second device, and the encrypted shader resource is used in the same manner in the first device as in the second device. While ensuring that the resources are not leaked, the efficiency of resource processing in an external environment is improved, while reducing staff's perception of resource encryption, thereby improving staff's trust and work experience.

[0050] A possible implementation of the above-mentioned step of decrypting the encrypted shader resources based on the resource processing tool to obtain the decrypted shader resources is as follows:

[0051] (1) Using the resource processing tool, the target engine decrypts the encrypted shader resources in the memory space through the decryption code in the resource processing tool to obtain the decrypted shader resources;

[0052] (2) Based on the icon resource in the decrypted shader resource, the display icon of the decrypted shader resource is displayed on the resource display interface of the target engine.

[0053] The above-mentioned resource processing tool can be a code resource after the class is rewritten. In response to the opening operation of the target engine, the code in the resource processing tool is automatically executed, and the code enables the target engine to load the shader resource. Specifically, the encrypted shader resource is obtained in the disk space, and then the encrypted shader resource is decrypted in the memory space. After the decryption is completed, the decrypted shader resource is also obtained in the memory space. Then, based on the icon resource in the decrypted shader resource, the display icon of the decrypted shader resource is displayed in the resource display interface of the target engine. In this way, the target engine is enabled to decrypt the decrypted shader resource in the memory space through the resource processing tool. Under the premise of ensuring that the resource is not leaked, the icon resource of the encrypted shader can also be obtained without encryption perception, so that the same display icon as the decrypted shader resource is displayed in the target engine.

[0054] Furthermore, the resource processing tool includes a first target subclass that inherits and rewrites the first target class. This first target class can be the ScriptedImporter class, specifically a first target subclass that inherits the ScriptedImporter class and rewrites OnImportAsset. This subclass includes code for obtaining shader resources, decrypting shader resources, and other object creation functions. ScriptedImporter is a function introduced by the target engine, enabling it to recognize many files it otherwise wouldn't recognize.

[0055] A resource processing tool is used to enable the target engine to decrypt the encrypted shader resources in the memory space through the decryption code in the resource processing tool to obtain the decrypted shader resources. A possible implementation method is: through the code in the first target subclass, the target engine obtains the encrypted shader resources from the disk space, and decrypts the encrypted shader resources in the memory space to obtain the decrypted shader resources.

[0056] By inheriting the ScriptedImporter class and overriding OnImportAsset, the first target subclass described above is obtained. The code for obtaining and decrypting shader resources is used to enable the target engine to obtain encrypted shader resources from disk. To prevent resource leaks, the first target subclass does not decrypt the encrypted shader resources on disk. Instead, it decrypts the encrypted shader resources in memory using the code for decrypting shader resources, and then obtains the decrypted shader resources in memory. This approach, through class overriding, allows the target engine to obtain encrypted shader resources from disk and decrypt the decrypted shader resources in memory, further reducing the risk of resource leaks while ensuring that the resource usage remains unchanged.

[0057] Typically, shader resources contain include statements, such as include "xx.hlsl." This means that the shader resource should include the xx.hlsl file and execute its instructions when compiling. Compilation, in this context, refers to the process of translating human-readable high-level language code into machine-readable instructions. Shader resource code must be compiled before it can be executed on a computer. "HLSL" stands for High-Level Shader Language and is also used as the suffix for public code files referenced by shaders. HLSL files include both official HLSL files and those written by the project team. To prevent resource file leaks, not only the shader resources need to be encrypted, but also the HLSL files written by the project team. However, if both the shader resources and the HLSL files written by the project team are encrypted separately, the encrypted HLSL file's program code must be inserted when compiling the encrypted shader resources. This requires modifying the compilation process. When compiling the shader resources, the encrypted xx.hlsl file is decrypted and used to replace the include statement. However, the process of modifying the compilation is inconvenient.

[0058] Therefore, the character string in the statement indicating the target hlsl file in the encrypted shader resource is the text information in the encrypted target hlsl file; wherein, the target hlsl file is an unofficial hlsl file.

[0059] The above-mentioned unofficial hlsl file is the hlsl file written by the project team, that is, the hlsl file that needs to be encrypted to prevent leakage. The text information in the above-mentioned encrypted target hlsl file is the program code of the hlsl file. The above-mentioned statement indicating the target hlsl file is usually include "xx.hlsl", and xx.hlsl is the above-mentioned character string. Specifically, before the second device performs encryption processing, the character string of the include statement of the target hlsl file written by the project team, that is, "xx.hlsl", can be replaced with the program code of the target hlsl file, so that the target hlsl file is encrypted while encrypting the shader resources. Among them, the official hlsl file does not need to be encrypted.

[0060] In this method, the string in the statement indicating the target hlsl file in the encrypted shader resource is the text information in the encrypted target hlsl file, which realizes the simultaneous encryption of the program code in the target hlsl file and the shader resources, avoids the problem of inserting the program code of the decrypted hlsl file during the compilation of the shader resources, and improves the compilation efficiency.

[0061] To prevent code leakage within shader resources, the decryption process is performed in memory. This only retrieves the encrypted shader resources and does not expose the code within them to the target engine. Therefore, the decrypted shader resources have specific properties, including displaying garbled text when opened in a text editor.

[0062] It is understandable that when a third-party staff member uses the decrypted shader resource on the first device, the method of use is the same as that in the internal development environment. That is, the decrypted shader resource can be compiled normally, but the third-party staff member cannot view the program code in the decrypted shader resource. The specific reason is that the resource processing tool enables the target engine to decrypt the encrypted shader in the internal space, and only displays the icon resource in the decrypted shader resource in the target engine. In other words, the decrypted shader resource is not stored in the disk space of the first device, only an icon resource is saved. Since the text editor does not have a resource processing tool set, it is necessary to obtain the shader resource corresponding to the display icon from the disk space, but the shader resource in the disk space is an encrypted shader resource. Therefore, when the third-party staff member opens the shader resource in the text editor, it is actually the encrypted shader resource opened from the disk space, so it is displayed as garbled code.

[0063] In this way, if a third-party staff member opens the decrypted shader resource in a text editor, garbled characters will be displayed because the encrypted shader resource is obtained from the disk space, thus avoiding the leakage of shader resources.

[0064] The encrypted resource file also includes a shader interface resource; the shader interface resource is used to indicate how the parameters are displayed in the Inspect interface of the target engine.

[0065] It should be noted that some parameters in the shader resources need to be adjusted by artists. These parameters will usually be displayed in the form of drop-down boxes, sliders, etc. on the Inspect interface, so that the parameters can be selected through the slider or drop-down box. Therefore, the above-mentioned shader interface resources are also needed in the external environment to display the parameters so that the parameters can be adjusted through the display. The above-mentioned shader interface resources usually refer to ShaderGUI, which can modify the display method of the parameters in the Inspect interface. For example: decide whether a certain parameter is displayed as a drop-down box or a slider to adjust the parameters for the artist. Specifically, in the first device, the shader interface resources can be automatically executed through the resource processing tool, and the parameters can be displayed in the Inspect interface of the target engine through the display method corresponding to the shader interface resources. In this way, the display method of the parameters in the Inspect interface of the target engine is restored in the working environment of the third-party staff through the shader interface resources, so as to facilitate the adjustment of the parameters by the artists, while improving the consistency between the use of encrypted resources and the use of original resources by the third-party staff.

[0066] Furthermore, before the step of displaying the shader object in the decrypted shader resource on the specified interface, the above method also includes: using the resource processing tool to enable the target engine to create a shader object of the decrypted shader resource in the memory space through the target code in the resource processing tool, and adding the shader object to the decrypted shader resource.

[0067] Specifically, the resource processing tool may include class rewriting code that automatically provides some settings when the resource is imported, namely, creating an object instance of the decrypted shader resource, namely the above-mentioned shader object, and then adding it to the above-mentioned decrypted shader resource to enable subsequent loading and display of the shader object in the shader resource. In this method, by creating a shader object for the decrypted shader resource and adding the shader object to the decrypted shader resource, the purpose of displaying the shader resource in the specified interface of the target engine is achieved.

[0068] Furthermore, the above-mentioned resource processing tool also includes a second target subclass that inherits and rewrites the second target class; the second target class can be the AssetPostprocessor class, specifically inheriting the AssetPostprocessor class, rewriting OnPostprocessAllAssets, and obtaining the second target subclass, which includes code for loading the target object, calling the target code, and display code, etc. Among them, the AssetPostprocessor is used to automatically make some settings when importing resources, such as automatically setting the display method and display position of the resources when importing. As a manager for resource import, the AssetPostprocessor can perform some processing before, during, and after the import according to different resource types.

[0069] A possible implementation method of the step of displaying the object name of the shader object in the decrypted shader resource on the specified interface is as follows: through the code in the second target subclass, the shader object in the decrypted shader resource is loaded, and the shader object is displayed on the specified interface by calling.

[0070] By inheriting the AssetPostprocessor class and overriding OnPostprocessAllAssets, the second target subclass mentioned above is obtained. Through the code therein, the Shader object (shader object) is loaded from the file with the .ytShader suffix and ShaderUtil.RegisterShader() is called to make the Shader object appear in the drop-down menu of the material inspect window and can be found by Shader.Find. In this way, by overriding the class, when the target engine imports the shader resource, the object name of the shader object in the encrypted shader resource can be displayed in the specified interface. This allows third-party staff to use the encrypted shader in the same way as the unencrypted one in the working environment, while ensuring the encryption of the resource.

[0071] The method further includes: creating a material resource based on the decrypted shader resource, and sending the material resource to the second device. The purpose of this embodiment is to create a material resource using the encrypted shader resource in an external environment, i.e., outsourcing the resource, and then sending the created material resource to the second device for subsequent processing of the material resource.

[0072] The embodiment of the present invention provides a resource processing method, which is applied to a second device, which is usually a device used by artists in a project, and is mainly used to encrypt shader resources, which can be understood as an internal development environment. Figure 2 As shown, the method includes:

[0073] Step S202 , in response to the encryption operation on the target file, encrypting the shader resources in the target file to obtain encrypted shader resources;

[0074] The target files generally include files required to complete the target project, such as shader resources, hlsl files, etc. Specifically, the second device is provided with an encryption tool, which can automatically implement the encryption process mainly through the encryption control in the encryption tool. The encryption tool is generally a plug-in for the Unity engine.

[0075] Step S204, determining an encrypted shader file based on the encrypted shader resource and a preset resource processing tool;

[0076] Specifically, in response to the encryption operation on the target file, a folder with a specified name in the target file, namely the above-mentioned encrypted shader resources and the preset resource processing tool, is obtained, and the encrypted shader resources and the preset resource processing tool are copied to the outsourced project directory to obtain the above-mentioned encrypted shader file.

[0077] Step S206: Send the encrypted shader file to the first device so that the first device, in response to the opening operation of the target engine, decrypts the encrypted shader resource based on the resource processing tool to obtain the decrypted shader resource; wherein the display icon of the decrypted shader resource in the first device is the same as the display icon in the second device; and display the shader object in the decrypted shader resource in the specified interface to indicate that the encrypted shader resource is used in the same manner in the first device as in the second device.

[0078] Specifically, the encrypted shader file can be synchronized to the first device through SVN (Subversion, version control system). In this embodiment, there is no specially designed network transmission. Usually, SVN is used to synchronize the project folder to be sent to a third-party person to the third-party person's computer (first device). SVN is a version control system commonly used by software developers. In short, it is used for multiple people to jointly develop the same project and realize shared resources. Among them, the steps performed by the first device are the same as the steps described in the aforementioned embodiment, and will not be repeated here.

[0079] This embodiment provides a resource processing method that, in response to an encryption operation on a target file, encrypts a shader resource in the target file to obtain an encrypted shader resource; determines an encrypted shader file based on the encrypted shader resource and a preset resource processing tool; sends the encrypted shader file to a first device, so that the first device, in response to an open operation of a target engine, decrypts the encrypted shader resource based on the resource processing tool to obtain a decrypted shader resource; wherein the display icon of the decrypted shader resource in the first device is the same as the display icon in the second device; and displays the shader object in the decrypted shader resource on a specified interface to indicate that the encrypted shader resource is used in the same manner in the first device as in the second device. In this method, the encrypted shader resource and the resource processing tool ensure that the display icon of the decrypted shader resource in the first device is the same as the display icon in the second device, and the usage of the encrypted shader resource in the first device is the same as in the second device. While ensuring that the resources are not leaked, the efficiency of resource processing in an external environment is improved, while reducing staff's perception of resource encryption, thereby improving staff's trust and work experience.

[0080] In addition, in response to the encryption operation on the target file, the shader resources in the target file are encrypted to obtain the encrypted shader resources. Before the step, the above method also includes: replacing the string in the statement indicating the target hlsl file in the initial shader resource with the text information in the target hlsl file to obtain the shader resource; wherein the target hlsl file is an unofficial hlsl file.

[0081] In actual implementation, the official hlsl file does not need to be encrypted, but the target hlsl file written by the project team needs to be encrypted. Since it is inconvenient to insert the program code of the decrypted hlsl file when compiling the encrypted shader resource, before encrypting the initial shader resource and the hlsl file, it is necessary to replace the string in the statement indicating the target hlsl file in the initial shader resource with the text information in the encrypted target hlsl file, that is, the program code, to obtain the shader resource. Then, the shader resource is encrypted, and the shader resource and the target hlsl file can be encrypted at the same time. Because the content in the target hlsl file is already included in the shader resource after the replacement, the text information in the target hlsl file can be encrypted at the same time as the shader resource after the replacement, and the original target hlsl file does not need to be handed over to the first device.

[0082] In this method, because it is inconvenient to insert the decrypted hlsl file's text information when compiling an encrypted shader resource, the string in the statement indicating the target hlsl file in the initial shader resource is replaced with the resource following the text information in the encrypted target hlsl file before the encryption operation. The replaced shader resource is then encrypted. This encrypts the hlsl file's text information while encrypting the shader resource, allowing third-party staff to directly compile the encrypted shader resource without any unnecessary operations. While ensuring that resources are not leaked, this improves the efficiency of resource processing in an external environment, reduces staff's perception of resource encryption, and enhances their sense of trust and work experience.

[0083] The above steps of determining the encrypted shader file based on the encrypted shader resources and the preset resource processing tool are implemented as follows: obtaining the shader interface resources in the target file; determining the shader interface resources, the encrypted shader resources, and the preset resource processing tool as the encrypted shader file.

[0084] Specifically, in response to the encryption operation on the target file, a folder with a specified name in the target file, namely the above-mentioned encrypted shader resources and the preset resource processing tool, is obtained, and the encrypted shader resources and the preset resource processing tool are copied to the outsourced project directory to obtain the above-mentioned encrypted shader file.

[0085] Specifically, the above-mentioned shader interface resources can be pre-saved in a folder with a specified name, and in response to the encryption operation on the target file, the folder with the specified name in the target file, that is, the above-mentioned shader interface resources, can be obtained, and then the shader interface resources, encrypted shader resources, and preset resource processing tools can be automatically copied to the outsourced project directory to obtain the above-mentioned encrypted shader file.

[0086] It should be noted that shader resources sometimes have a CustomEditor specifying a subclass of ShaderGUI (the aforementioned shader interface resource) to customize the Inspect UI. Since ShaderGUI code files change frequently, shader interface resources are usually placed in a folder named beginning with "Wb." If project team members select some shader resources, this solution's shader encryption tool will only encrypt these selected shader resources. If some folders are selected, the encryption tool will encrypt all shader resources within these folders and output the encrypted files to the specified location (i.e., the outsourced project directory). Furthermore, if these folders contain subfolders beginning with "Wb," the encryption tool will automatically copy these subfolders to the specified location. Finally, the shader interface resources, encrypted shader resources, and the preset resource processing tool are identified as encrypted shader files.

[0087] In addition, the above-mentioned resource processing tool is used to: enable the target engine in the first device to decrypt the encrypted shader resources in the memory space through the decryption code in the resource processing tool to obtain decrypted shader resources; and display the display icon of the decrypted shader resources in the resource display interface of the target engine according to the icon resources in the decrypted shader resources.

[0088] The asset processing tool may include code obtained by integrating the ScriptedImporter class and overriding the OnImportAsset method, and code obtained by inheriting the AssetPostprocessor class and overriding the OnPostprocessAllAssets method.

[0089] Specifically, by inheriting the ScriptedImporter class and overriding OnImportAsset, the code for obtaining shader resources and the code for decrypting shader resources are obtained, so that the target engine obtains encrypted shader resources from the disk space. In order to avoid resource leakage, the first target subclass will not decrypt the encrypted shader resources in the disk space, but will decrypt the encrypted shader resources in the memory space through the code for decrypting shader resources, and then obtain the decrypted shader resources in the memory.

[0090] In addition, the above-mentioned resource processing tool is also used to: enable the target engine to create a shader object for the decrypted shader resource in the memory space through the target code in the resource processing tool, and add the shader object to the decrypted shader resource; load the shader object in the decrypted shader resource, and display the shader object in the specified interface by calling it. Specifically, by inheriting the AssetPostprocessor class and overriding OnPostprocessAllAssets to obtain the target code, load the Shader object (shader object) for the file with the .ytShader suffix and call ShaderUtil.RegisterShader() so that the Shader object appears in the drop-down menu of the material inspect window and can be found by Shader.Find.

[0091] In the above method, through class rewriting, the target engine obtains encrypted shader resources from disk space and decrypts the decrypted shader resources in memory space, further improving the risk of resource leakage while ensuring that the resource usage function remains unchanged. Similarly, through class rewriting, when the target engine imports shader resources, the object name of the shader object in the encrypted shader resource can be displayed on the designated interface. This allows third-party staff to use encrypted shaders in the same way as unencrypted ones in their work environment, while ensuring resource encryption.

[0092] The step of sending the encrypted shader file to the first device, a possible implementation method is: sending the encrypted shader file to a specified directory; wherein the specified target includes a path selection tool; the path selection tool is used to send the encrypted shader file to the specified device through pre-configured path information; in response to the selection operation of the target path information, sending the encrypted shader file to the first device corresponding to the target path information.

[0093] The above-mentioned designated directory usually refers to the outsourced project directory, and the above-mentioned path selection tool usually refers to the System.Windows.Forms.dll that comes with Unity. The FolderBrowserDialog class can be used to pop up a file browsing dialog box to select the pre-configured path information, and the encrypted shader file is sent to the first device corresponding to the path information based on the selected path information. It should be noted that the encryption program of this solution allows the user to specify the directory location for outputting the encrypted shader file. Specifically, the ChooseOutputFolder button can be clicked to pop up a file browsing dialog box to prompt the user to specify the sending directory. Among them, the selected one is the project folder path (the path for outputting the encrypted shader) that the second device wants to send to the first device. The function of popping up the file browsing dialog box is provided by System.Windows.Forms.dll, so it is necessary to put the System.Windows.Forms.dll and the encrypted shader file together in the outsourced project directory in advance.

[0094] In this method, a pop-up window of path information is provided to the project personnel sending the encrypted shader file through the path selection tool. The encrypted shader file can be sent to the first device by clicking to select the target path information, which simplifies the sending process and improves the sending efficiency.

[0095] The above method also includes: receiving material resources from the first device, determining the path name of the referenced encrypted shader resource from the material resources; obtaining the initial shader resource in the target file according to the path name; and replacing the shader resource referenced by the material resource with the initial shader resource.

[0096] Because the shader resources provided to third-party staff are encrypted, the material resources (i.e., outsourced resources) produced by the third-party staff reference the encrypted shader resources. After the third-party staff has produced the material resources, they need to deliver them to the project team of the second device. If the project team wants to modify the material resources, first, it determines the path name of the referenced encrypted shader resource from the material resources, and obtains the original shader resource (i.e., the initial shader resource) in the project project (i.e., the target file mentioned above) based on the path name; and replaces the shader resource referenced by the material resource with the initial shader resource. When modifying the material, the shader resource referenced is the initial shader resource, and the encrypted shader resource used by the first device can also be deleted.

[0097] In the above method, in order to continue to modify the material resources sent by the first device through the initial shader resources in the second device, the shader resources referenced by the material resources are replaced with the initial shader resources through the path name of the encrypted shader resources referenced by the material resources, so that the project team can use the initial shader resources to modify the material resources.

[0098] In order to avoid modifying the resource processing tool in the first device and affecting the use of the encrypted shader resources, the above method also includes: compiling the code in the resource processing tool to obtain a resource processing tool in a specified format; and obfuscating the resource processing tool in the specified format to obtain a final resource processing tool.

[0099] Specifically, the code in the resource processing tool is compiled into a DLL-format resource processing tool, i.e., the resource processing tool in the specified format, and the Dotfuscated tool is used to generate the final resource processing tool. In this way, the resource processing tool is obfuscated, preventing the program in the resource processing tool from being cracked.

[0100] Obfuscating a resource processing tool in a specified format to obtain a final resource processing tool includes: modifying the function names of functions other than a specified function in the resource processing tool in the specified format to obtain the final resource processing tool; and setting a name attribute of the specified function in the final resource processing tool to make the function name of the specified function unmodifiable.

[0101] When obfuscating a resource processing tool, all function names are modified by default. However, modifying the names of specific functions will prevent them from automatically responding to the target engine's open operation. Therefore, the names of specific functions are set to be unmodifiable during obfuscation.

[0102] In this implementation, the Dotfuscated tool will change the names of classes and functions, but the OnImportAsset() and OnPostprocessAllAssets() functions must be found by Unity using reflection in order to work. To prevent functions from being renamed, you can set exclusion rules to prohibit the "OnImportAsset" and "OnPostprocessAllAssets" functions from being renamed in the final asset processing tool. By setting the name property, the function name of the specified function cannot be modified, avoiding the problem of not being able to automatically respond to the target engine's open operation due to modifying the name of the specified function.

[0103] This approach ensures transparency for third-party workers using encrypted shaders on the first device. Specifically, third-party workers' use of encrypted shader resources is essentially the same as their use of unencrypted shader resources. This prevents shader resource leaks without adding additional workload to third-party workers, improving their efficiency. Reducing the awareness of shader resource encryption on third-party workers also helps maintain trust.

[0104] Corresponding to the above method embodiment, the embodiment of the present invention provides a resource processing device, which is arranged in a first device, such as Figure 3 As shown, the device includes:

[0105] The receiving module 31 is configured to receive an encrypted shader file from a second device, wherein the encrypted shader file includes: encrypted shader resources and resource processing tools;

[0106] a decryption module 32 configured to, in response to an opening operation of the target engine, decrypt the encrypted shader resource based on the resource processing tool to obtain a decrypted shader resource; wherein a display icon of the decrypted shader resource in the first device is the same as a display icon in the second device;

[0107] The display module 33 is configured to display the object name of the shader object in the decrypted shader resource on a designated interface to indicate that the encrypted shader resource is used in the same manner in the first device as in the second device.

[0108] This embodiment provides a resource processing device that receives an encrypted shader file from a second device; the encrypted shader file includes an encrypted shader resource and a resource processing tool; in response to an open operation of a target engine, obtains a decrypted shader resource based on the resource processing tool; and displays the object name of the shader object in the decrypted shader resource on a designated interface. In this method, the encrypted shader resource and the resource processing tool ensure that the display icon of the decrypted shader resource in the first device is the same as the display icon in the second device, and the encrypted shader resource is used in the same manner in the first device as in the second device. While ensuring that the resources are not leaked, the efficiency of resource processing in an external environment is improved, while reducing staff's perception of resource encryption, thereby improving staff's trust and work experience.

[0109] Furthermore, the above-mentioned decryption module is also used to: use the resource processing tool to enable the target engine to decrypt the encrypted shader resources in the memory space through the decryption code in the resource processing tool to obtain the decrypted shader resources; and display the display icon of the decrypted shader resources in the resource display interface of the target engine according to the icon resources in the decrypted shader resources.

[0110] Furthermore, the above-mentioned resource processing tool includes a first target subclass that inherits and rewrites the first target class; the above-mentioned decryption module is also used to: through the code in the first target subclass, enable the target engine to obtain encrypted shader resources from the disk space, and decrypt the encrypted shader resources in the memory space to obtain decrypted shader resources.

[0111] Furthermore, the character string in the statement indicating the target hlsl file in the encrypted shader resource is text information in the encrypted target hlsl file; wherein the target hlsl file is an unofficial hlsl file.

[0112] Furthermore, the decrypted shader resource has specified attributes, including: the decrypted shader resource is displayed as garbled characters when opened in a text editor.

[0113] Furthermore, the above-mentioned encrypted resource file also includes shader interface resources; the shader interface resources are used to indicate the display mode of parameters in the Inspect interface of the target engine.

[0114] Furthermore, the above-mentioned device also includes an object adding module, which is used to: through the resource processing tool, enable the target engine to create a shader object of the decrypted shader resource in the memory space through the target code in the resource processing tool, and add the shader object to the decrypted shader resource.

[0115] Furthermore, the above-mentioned resource processing tool also includes a second target subclass that inherits and rewrites the second target class; the above-mentioned object adding module is also used to: load the shader object in the decrypted shader resource through the code in the second target subclass, and display the shader object on the specified interface by calling.

[0116] Furthermore, the above-mentioned apparatus also includes a resource sending module, which is used to: create material resources based on the decrypted shader resources, and send the material resources to the second device.

[0117] Corresponding to the above method embodiment, the embodiment of the present invention provides a resource processing device, which is arranged in a second device, such as Figure 4 As shown, the device includes:

[0118] The encryption module 41 is configured to respond to an encryption operation on a target file and encrypt the shader resources in the target file to obtain encrypted shader resources;

[0119] A determination module 42, configured to determine an encrypted shader file based on the encrypted shader resource and a preset resource processing tool;

[0120] The sending module 43 is used to send the encrypted shader file to the first device, so that the first device, in response to the opening operation of the target engine, decrypts the encrypted shader resource based on the resource processing tool to obtain the decrypted shader resource; wherein the encrypted display form of the decrypted shader resource in the first device is the same as the display form in the second device; the shader object in the decrypted shader resource is displayed on the specified interface to indicate that the encrypted shader resource is used in the same manner as in the second device.

[0121] In the above method, by encrypting shader resources and resource processing tools, the display icon of the decrypted shader resources after decryption processing in the first device is the same as the display icon in the second device, and the usage method of the encrypted shader resources in the first device is the same as the usage method in the second device. On the premise of ensuring that resources are not leaked, the work efficiency of processing resources in the external environment is improved, and at the same time, the staff's perception of resource encryption is reduced, and the staff's sense of trust and work experience are improved.

[0122] Furthermore, the above device also includes a replacement module for: replacing the string in the statement indicating the target hlsl file in the initial shader resource with the text information in the target hlsl file to obtain the shader resource; wherein the target hlsl file is an unofficial hlsl file.

[0123] Furthermore, the above-mentioned determination module is also used to: obtain the shader interface resources in the target file; and determine the shader interface resources, the encrypted shader resources, and the preset resource processing tool as the encrypted shader file.

[0124] Furthermore, the above-mentioned resource processing tool is used to: enable the target engine in the first device to decrypt the encrypted shader resources in the memory space through the decryption code in the resource processing tool to obtain the decrypted shader resources; and display the display icon of the decrypted shader resources in the resource display interface of the target engine according to the icon resources in the decrypted shader resources.

[0125] Furthermore, the above-mentioned sending module is also used to: send the encrypted shader file to a specified directory; wherein the specified target includes a path selection tool; the path selection tool is used to send the encrypted shader file to a specified device through pre-configured path information; in response to the selection operation of the target path information, send the encrypted shader file to the first device corresponding to the target path information.

[0126] Furthermore, the above-mentioned device also includes a resource receiving module, which is used to: receive material resources from the first device, determine the path name of the referenced encrypted shader resource from the material resources; obtain the initial shader resource in the target file according to the path name; and replace the shader resource referenced by the material resource with the initial shader resource.

[0127] Furthermore, the above-mentioned device also includes a resource processing tool processing module, which is used to: compile the code in the resource processing tool to obtain the resource processing tool in a specified format; and perform obfuscation processing on the resource processing tool in the specified format to obtain the final resource processing tool.

[0128] Furthermore, the above-mentioned resource processing tool processing module is also used to: modify the function names of functions other than the specified function in the resource processing tool of the specified format to obtain the final resource processing tool; set the name attribute of the specified function in the final resource processing tool so that the function name of the specified function cannot be modified.

[0129] The resource processing device provided in the above embodiment has the same technical features as the resource processing method provided in the above embodiment, and therefore can solve the same technical problems and achieve the same technical effects.

[0130] This embodiment further provides an electronic device, including a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the above-mentioned resource processing method. The electronic device can be a server or a terminal device.

[0131] See also Figure 5As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores computer-executable instructions that can be executed by the processor 100. The processor 100 executes the computer-executable instructions to implement the above-mentioned resource processing method.

[0132] Furthermore, Figure 5 The electronic device shown further includes a bus 102 and a communication interface 103 , and the processor 100 , the communication interface 103 and the memory 101 are connected via the bus 102 .

[0133] The memory 101 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is achieved through at least one communication interface 103 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 102 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or one type of bus.

[0134] The processor 100 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by hardware integrated logic circuits in the processor 100 or software instructions. The above processor 100 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in conjunction with the embodiments of the present invention can be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium well-known in the art, such as a random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or register. The storage medium is located in the memory 101. The processor 100 reads the information in the memory 101 and, in conjunction with its hardware, completes the steps of the method of the aforementioned embodiment.

[0135] This embodiment further provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned resource processing method.

[0136] The computer program products of the resource processing methods, devices, electronic devices, and systems provided in the embodiments of the present invention include computer-readable storage media storing program codes. The instructions included in the program codes can be used to execute the methods described in the previous method embodiments. For specific implementations, please refer to the method embodiments and will not be repeated here.

[0137] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems and devices can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0138] In addition, in the description of the embodiments of the present invention, unless otherwise expressly specified or limited, the terms "mounted," "connected," and "connected" should be understood in a broad sense. For example, they may refer to fixed connections, detachable connections, or integral connections; they may refer to mechanical connections or electrical connections; they may refer to direct connections or indirect connections through an intermediate medium; and they may refer to internal communication between two components. Those skilled in the art will understand the specific meanings of the above terms in the present invention based on the specific circumstances.

[0139] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0140] In the description of the present invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicating orientations or positional relationships, are based on the orientations or positional relationships shown in the accompanying drawings and are intended solely to facilitate and simplify the description of the present invention. They are not intended to indicate or imply that the devices or components referred to must have, be constructed, or operate in a specific orientation, and therefore should not be construed as limitations on the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0141] Finally, it should be noted that the above embodiments are only specific implementation methods of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above embodiments within the technical scope disclosed by the present invention, or replace some of the technical features therein with equivalents. Such modifications, changes or replacements do not deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.

Claims

1. A resource processing method, characterized in that: The method is applied to a first device, and includes: Receiving an encrypted shader file from a second device; wherein the encrypted shader file includes: encrypted shader resources and resource processing tools; In response to an opening operation of the target engine, decrypting the encrypted shader resource based on the resource processing tool to obtain a decrypted shader resource; wherein a display icon of the decrypted shader resource in the first device is the same as a display icon in the second device; The object name of the shader object in the decrypted shader resource is displayed on a designated interface to indicate that the encrypted shader resource is used in the first device in the same manner as in the second device.

2. The method according to claim 1, characterized in that The step of decrypting the encrypted shader resource based on the resource processing tool to obtain the decrypted shader resource includes: By means of the resource processing tool, the target engine decrypts the encrypted shader resource in a memory space by means of a decryption code in the resource processing tool to obtain the decrypted shader resource; According to the icon resource in the decrypted shader resource, a display icon of the decrypted shader resource is displayed on the resource display interface of the target engine.

3. The method according to claim 2, characterized in that The resource processing tool includes a first target subclass that inherits and rewrites the first target class; the first target class is the ScriptedImporter class, and the first target subclass is obtained by inheriting the ScriptedImporter class and rewriting OnImportAsset; The step of enabling the target engine to decrypt the encrypted shader resource in the memory space by using the decryption code in the resource processing tool to obtain the decrypted shader resource includes: The target engine obtains the encrypted shader resource from the disk space through the code in the first target subclass, and decrypts the encrypted shader resource in the memory space to obtain the decrypted shader resource.

4. The method according to claim 1, wherein The character string in the statement indicating the target hlsl file in the encrypted shader resource is the encrypted text information in the target hlsl file; wherein the target hlsl file is a pre-written hlsl file.

5. The method according to claim 1, wherein The decrypted shader resource has a specified attribute, and the specified attribute causes the decrypted shader resource to be displayed as garbled characters when opened in a text editor.

6. The method according to claim 1, characterized in that The encrypted resource file also includes a shader interface resource; the shader interface resource is used to indicate the display mode of parameters in the Inspect interface of the target engine.

7. The method according to claim 1, characterized in that Before the step of displaying the object name of the shader object in the decrypted shader resource on a designated interface, the method further includes: The target engine is enabled to create a shader object of the decrypted shader resource in a memory space through the target code in the resource processing tool through the resource processing tool, and add the shader object to the decrypted shader resource.

8. The method according to claim 7, characterized in that The resource processing tool further includes a second target subclass that inherits and rewrites the second target class; the second target class is the AssetPostprocessor class, and the second target subclass is obtained by inheriting the AssetPostprocessor class and rewriting OnPostprocessAllAssets; The step of displaying the object name of the shader object in the decrypted shader resource on a designated interface comprises: The shader object in the decrypted shader resource is loaded through the code in the second target subclass, and the shader object is displayed on a specified interface by calling.

9. The method according to claim 1, characterized in that The method further comprises: A material resource is created based on the decrypted shader resource, and the material resource is sent to the second device.

10. A resource processing method, characterized in that: The method is applied to a second device, and includes: In response to an encryption operation on a target file, encrypting a shader resource in the target file to obtain the encrypted shader resource; Determining an encrypted shader file based on the encrypted shader resource and a preset resource processing tool; The encrypted shader file is sent to a first device so that the first device, in response to an open operation of a target engine, decrypts the encrypted shader resource based on the resource processing tool to obtain a decrypted shader resource; wherein a display icon of the decrypted shader resource in the first device is the same as a display icon in the second device; and a shader object in the decrypted shader resource is displayed on a specified interface to indicate that the encrypted shader resource is used in the same manner in the first device as in the second device.

11. The method according to claim 10, characterized in that Before the step of encrypting the shader resources in the target file in response to the encryption operation on the target file to obtain the encrypted shader resources, the method further includes: The character string in the statement indicating the target hlsl file in the initial shader resource is replaced with the text information in the target hlsl file to obtain the shader resource; wherein the target hlsl file is a pre-written hlsl file.

12. The method according to claim 10, characterized in that The step of determining an encrypted shader file based on the encrypted shader resource and a preset resource processing tool includes: Obtaining the shader interface resource in the target file; The shader interface resource, the encrypted shader resource, and a preset resource processing tool are determined as an encrypted shader file.

13. The method according to claim 10, characterized in that The resource processing tool is used to: enabling a target engine in the first device to decrypt the encrypted shader resource in a memory space by using a decryption code in the resource processing tool to obtain the decrypted shader resource; According to the icon resource in the decrypted shader resource, a display icon of the decrypted shader resource is displayed on the resource display interface of the target engine.

14. The method according to claim 10, characterized in that The step of sending the encrypted shader file to the first device comprises: Sending the encrypted shader file to a designated directory; wherein the designated directory includes a path selection tool; the path selection tool is used to send the encrypted shader file to a designated device through pre-configured path information; In response to a selection operation of the target path information, the encrypted shader file is sent to a first device corresponding to the target path information.

15. The method according to claim 10, characterized in that The method further comprises: receiving a material resource from the first device, and determining a path name of a referenced encrypted shader resource from the material resource; According to the path name, an initial shader resource in a target file is obtained; and a shader resource referenced by the material resource is replaced with the initial shader resource.

16. The method according to claim 10, characterized in that The method further comprises: Compile the code in the resource processing tool to obtain a resource processing tool in a specified format; Obfuscation processing is performed on the resource processing tool in the specified format to obtain a final resource processing tool.

17. The method according to claim 16, characterized in that The step of performing obfuscation processing on the resource processing tool in the specified format to obtain the final resource processing tool includes: Modifying the function names of functions other than the specified function in the resource processing tool in the specified format to obtain the final resource processing tool; The name attribute of the specified function in the final resource processing tool is set so that the function name of the specified function cannot be modified.

18. A resource processing device, characterized in that: The device is provided in a first device, and includes: A receiving module, configured to receive an encrypted shader file from a second device; wherein the encrypted shader file includes: encrypted shader resources and resource processing tools; a decryption module, configured to, in response to an opening operation of the target engine, decrypt the encrypted shader resource based on the resource processing tool to obtain a decrypted shader resource; wherein a display icon of the decrypted shader resource in the first device is the same as a display icon in the second device; A display module is configured to display the object name of the shader object in the decrypted shader resource on a designated interface to indicate that the encrypted shader resource is used in the first device in the same manner as that in the second device.

19. A resource processing device, characterized in that: The device is provided in the second device, and includes: an encryption module, configured to respond to an encryption operation on a target file, encrypt the shader resources in the target file, and obtain the encrypted shader resources; A determination module, configured to determine an encrypted shader file based on the encrypted shader resource and a preset resource processing tool; A sending module is configured to send the encrypted shader file to a first device, so that the first device, in response to an open operation of a target engine, decrypts the encrypted shader resource based on the resource processing tool to obtain a decrypted shader resource; wherein a display icon of the decrypted shader resource in the first device is the same as a display icon in the second device; and a shader object in the decrypted shader resource is displayed on a specified interface to indicate that the encrypted shader resource is used in the same manner in the first device as in the second device.

20. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the resource processing method described in any one of claims 1 to 9, or implements the resource processing method described in any one of claims 10 to 17.

21. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by the processor, the computer-executable instructions prompt the processor to implement the resource processing method described in any one of claims 1 to 9, or to implement the resource processing method described in any one of claims 10 to 17.

Citation Information

Patent Citations

  • Shader simplifying method, shader simplifying device and graphic rendering method based on code motion

    CN104537706A

  • Encryption method and device for Shader files and decryption method and device for Shader files

    CN108256343A