Game map processing method and device, electronic equipment and storage medium
By identifying and adjusting the stickers in the game development engine, generate a consistent secondary postpartum post, and replace it under the default path, solve the problem of inconsistency of the sticker adjustment effect caused by different gaming and image processing software algorithms, realize Has efficient sticker processing and consistent visual effects.
Patent Information
- Application Number
- CN202411411152.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-09
- Publication Date
- 2025-01-28
AI Technical Summary
In the prior art, the algorithms used by game development engines and image processing software are different, which leads to the image processing software being unable to achieve the effect of adjusting the maps in the game development engine, resulting in the color of the model baked by bulletin boards and the color adjusted in the game development engine. Big difference.
By obtaining the storage path and the post -sticker parameters in the game development engine, identify and adjust the corresponding original stickers, generate the second adjustment of the post with the consistency of the post -texture, and replace it under the default path to achieve realization Quick replacement and modification of the original sticker.
The 1: 1 restore of the internal texture of the game development engine has been realized, and the effect of the image processing software cannot achieve the effect of the internal texture of the game development engine. The announcement board cannot obtain the problem of the display effect after adjustment.
Smart Images

Figure CN119367757A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of game technology, and in particular to a game texture processing method, device, electronic device and storage medium. Background Art
[0002] During the game development process, multiple pre-made textures are usually imported from the default path into the game development engine for use. In order to adapt to different game environments, the saturation, brightness and other attribute parameters displayed by some of the textures imported into the game development engine are sometimes adjusted to achieve the best display effect for each texture. The change of the attribute parameters displayed by the texture in the game development engine will only affect the display effect of the texture in the viewing angle, and will not cause substantial changes to the attribute parameters of the original texture stored in the default path. In addition, the tools used in the game development engine (such as the billboard) read the original texture stored in the default path to bake the vegetation model in the distant view of the game scene, that is, the billboard cannot obtain the display effect of the texture adjusted in the game development engine, which causes a large difference between the color of the model baked by the billboard and the color adjusted in the game development engine.
[0003] In the prior art, game artists use image processing software outside the game development engine to approximately adjust the original texture stored in the default path to obtain an adjusted texture, so that the adjusted texture is consistent with the texture in the game development engine in terms of visual effect.
[0004] However, since the game development engine and the image processing software use different algorithms, the image processing software cannot achieve the same effect as the texture adjustment in the game development engine. Summary of the invention
[0005] The purpose of the present invention is to provide a game texture processing method, device, electronic device and storage medium to solve the technical problems existing in the prior art in view of the above-mentioned deficiencies in the prior art.
[0006] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:
[0007] In a first aspect, an embodiment of the present application provides a method for processing game textures, the method comprising:
[0008] Obtaining a texture storage path and obtaining current parameters of at least one first adjusted texture in the game development engine, wherein a plurality of original textures are stored in the texture storage path;
[0009] According to the identifier of each of the first adjusted textures, obtaining the target original texture corresponding to each of the first adjusted textures in the texture storage path;
[0010] According to the current parameters of each of the first adjusted textures, pixels in the target original texture corresponding to each of the first adjusted textures in the texture storage path are adjusted to obtain second adjusted textures corresponding to each of the target original textures, and the target original textures in the texture storage path are replaced with the second adjusted textures.
[0011] In a second aspect, the embodiment of the present application further provides a game texture processing device, the device comprising:
[0012] An acquisition module, used to acquire a texture storage path and current parameters of at least one first adjusted texture in a game development engine, wherein the texture storage path stores a plurality of original textures; and acquire a target original texture corresponding to each first adjusted texture in the texture storage path according to an identifier of each first adjusted texture;
[0013] An adjustment module, configured to adjust pixels in a target original texture corresponding to each of the first adjusted textures in the texture storage path according to current parameters of each of the first adjusted textures, to obtain a second adjusted texture corresponding to each of the target original textures;
[0014] A storage module is used to replace the target original texture in the texture storage path with the second adjusted texture.
[0015] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium through the bus, and the processor executes the machine-readable instructions to perform the steps of the game texture processing method provided in the first aspect.
[0016] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the game texture processing method provided in the first aspect is executed.
[0017] The beneficial effects of this application are:
[0018] The embodiment of the present application provides a method, device, electronic device and storage medium for processing game textures. In this solution, based on the texture storage path and the current parameters of the plurality of first adjusted textures in the game development engine, the target original textures corresponding to the plurality of first adjusted textures in the game development engine are screened out in batches, and based on the current parameters of the plurality of first adjusted textures in the game development engine, each pixel in the target original texture corresponding to the plurality of first adjusted textures is adjusted and processed respectively, and the second adjusted textures corresponding to the plurality of target original textures are generated, so that the second adjusted textures have the same display effect as the first adjusted textures, thereby realizing 1:1 restoration of the game development engine. The in-engine texture adjustment effect solves the problem in the prior art that image processing software cannot achieve the effect of texture adjustment in the game development engine; then, multiple target original textures stored in the default path are replaced with second adjusted textures corresponding to the multiple target original textures, thereby realizing rapid replacement and modification of multiple original textures stored in the default path, so that the generated second adjusted texture is consistent with the first texture in the game development engine in visual effect, greatly improving the processing efficiency of the original texture stored in the default path, and also solving the problem that the bulletin board in the game development engine cannot obtain the display effect of the texture adjusted in the game development engine. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0020] Figure 1 A flowchart of a method for processing game textures provided in an embodiment of the present application;
[0021] Figure 2 A flowchart of another method for processing game textures provided in an embodiment of the present application;
[0022] Figure 3 A flowchart of another method for processing game textures provided in an embodiment of the present application;
[0023] Figure 4 A schematic diagram of a query tool interface provided by a game development engine according to an embodiment of the present application;
[0024] Figure 5 A flowchart of another method for processing game textures provided in an embodiment of the present application;
[0025] Figure 6A flowchart of another method for processing game textures provided in an embodiment of the present application;
[0026] Figure 7 A flowchart of another method for processing game textures provided in an embodiment of the present application;
[0027] Figure 8 A schematic diagram of the structure of a game texture processing device provided in an embodiment of the present application;
[0028] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0029] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.
[0030] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0031] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.
[0032] First, the background technology related to this application is explained.
[0033] Usually, in order to adapt to different environments in the game, game artists use the Unreal Editor provided by the game development engine to adjust the saturation, brightness and other attribute parameters displayed on some textures that have been imported into the game development engine to achieve the best display effect for each texture.
[0034] However, changes to the attribute parameters displayed by the texture in the game development engine will only affect the display effect of the texture in terms of viewing angle, but will not cause changes to the attribute parameters of the original texture stored in the default path. In addition, the tools used in the game development engine (such as the billboard) read the original texture stored in the default path to bake the vegetation model in the distance in the game scene, that is, the billboard cannot obtain the display effect of the texture adjusted in the game development engine, which results in a large difference between the model color baked by the billboard and the color adjusted in the game development engine.
[0035] In the related technology, game artists use image processing software (Photoshop, PS for short) outside the game development engine to approximately adjust the original texture stored in the default path to obtain the adjusted texture, so that the adjusted texture is consistent with the texture in the game development engine in terms of visual effect.
[0036] However, since the game development engine and the image processing software use different algorithms, the image processing software cannot achieve the display effect after the texture is adjusted in the game development engine.
[0037] The embodiment of the present application is based on the above-mentioned problem. The present application provides a method for processing game textures. Based on the texture storage path and the current parameters of multiple first adjusted textures in the game development engine, the target original textures corresponding to the multiple first adjusted textures in the game development engine are identified in batches. Based on the current parameters of the multiple first adjusted textures in the game development engine, each pixel in the target original texture corresponding to the multiple first adjusted textures is adjusted and processed respectively to generate second adjusted textures corresponding to the multiple target original textures. Then, the multiple target original textures stored in the default path are replaced with the second adjusted textures corresponding to the multiple target original textures, thereby realizing rapid replacement and modification of the multiple original textures stored in the default path, so that the generated second adjusted texture is consistent with the first texture in the game development engine in visual effect, greatly improving the processing efficiency of the original textures stored in the default path, and also solving the problem that the bulletin board in the game development engine cannot obtain the display effect of the texture adjusted in the game development engine.
[0038] The implementation principles and corresponding beneficial effects of the game texture processing method steps provided in this application will be explained through multiple specific embodiments as follows.
[0039] In one embodiment, reference Figure 1As shown, a game texture processing method is provided. Optionally, the execution subject of the method can be a terminal device with data processing function, and a game development engine such as Unreal Engine (UE) is installed on the terminal device.
[0040] It should be understood that in other embodiments, the order of some steps in the game texture processing method can be interchanged according to actual needs, or some steps can be omitted or deleted. Figure 1 As shown, the method includes:
[0041] S101. Obtain a texture storage path, and obtain current parameters of at least one first adjusted texture in a game development engine.
[0042] The texture storage path stores a plurality of original textures. For example, the texture storage path may be a designated directory for storing a large number of original textures by default in a game development engine, such as the texture storage path: / Game / Client / Art / tree / Texture.
[0043] The first adjusted texture is a texture that is imported into the game engine from the default path and then adjusted by the game artist. Only the display effect of the texture is adjusted, and no substantial modification is made to each pixel in the texture. For example, the original brightness parameter of the texture T1 in the game development engine is 1, and the current brightness parameter adjusted by the game artist is 2, which means that the display brightness of the texture T1 is increased.
[0044] In one practicable manner, for example, a user may input a texture storage path through a texture processing interface provided by a game development engine, and directly obtain current parameters of at least one first adjusted texture from the game development engine. The current parameters of the first adjusted texture may be modified parameters or original parameters.
[0045] Optionally, in the solution provided in the present application, the user can also customize the map search range, and then obtain the target original map corresponding to each first adjusted map according to the path information input by the user, thereby improving the flexibility of the query.
[0046] S102: Obtain, according to the identifier of each first adjusted texture, a target original texture corresponding to each first adjusted texture in a texture storage path.
[0047] Exemplarily, for example, the identifier of the first adjusted texture may be a name, a number, or the like.
[0048] In this embodiment, a plurality of original textures are stored in the traversed texture storage path, and the identifiers of the plurality of original textures are compared one by one with the identifiers of the first adjusted textures. If the name of the original texture Y1 is the same as the name of the first adjusted texture T1, it can be determined that the original texture Y1 is the target original texture corresponding to the first adjusted texture T1, and the traversal is stopped until the target original textures corresponding to the first adjusted textures are obtained.
[0049] S103: According to the current parameters of each first adjusted texture, pixels in the target original texture corresponding to each first adjusted texture in the texture storage path are adjusted to obtain second adjusted textures corresponding to each target original texture, and the target original texture in the texture storage path is replaced with the second adjusted texture.
[0050] Exemplarily, for example, the current parameters of the first adjusted map include: brightness, brightness curve, hue, saturation, and the like.
[0051] In this embodiment, the first adjusted texture T1 is taken as an example for introduction. For example, if the brightness in the current parameters of the first adjusted texture T1 is 2, the brightness in the current parameters of the first adjusted texture T1 can be used to adjust the brightness of each pixel in the target original texture Y1 corresponding to the first adjusted texture T1, that is, the original brightness of each pixel in the target original texture Y1 is adjusted to 2, and the second adjusted texture T1' corresponding to the target original texture Y1 is generated, so that the second adjusted texture T1' has the same display effect as the first adjusted texture T1, and a 1:1 restoration of the texture adjustment effect in the game development engine is achieved, which solves the problem that the image processing software in the prior art cannot achieve the effect of the texture adjustment in the game development engine; at the same time, the target original texture Y1 stored in the default path is replaced with the second adjusted texture T1', and the target original texture Y1 stored in the default path is quickly replaced and modified, which improves the processing efficiency of the original texture stored in the default path, and also solves the problem that the bulletin board in the game development engine cannot obtain the display effect of the texture after adjustment in the game development engine.
[0052] In summary, the embodiment of the present application provides a method for processing game textures. In this solution, based on the texture storage path and the current parameters of the multiple first adjusted textures in the game development engine, the target original textures corresponding to the multiple first adjusted textures in the game development engine are batch-screened, and based on the current parameters of the multiple first adjusted textures in the game development engine, each pixel in the target original texture corresponding to the multiple first adjusted textures is adjusted and processed respectively, and the second adjusted textures corresponding to the multiple target original textures are generated, so that the second adjusted textures have the same display effect as the first adjusted textures, thereby realizing a 1:1 restoration of the textures in the game development engine. The invention can achieve the effect of adjusting the texture in the game development engine by adjusting the texture in the default path, and solves the problem that the image processing software in the prior art cannot achieve the effect of the texture adjusted in the game development engine; then, the multiple target original textures stored in the default path are replaced with the second adjusted textures corresponding to the multiple target original textures, thereby realizing the rapid replacement and modification of the multiple original textures stored in the default path, so that the generated second adjusted texture is consistent with the first texture in the game development engine in visual effect, greatly improving the processing efficiency of the original texture stored in the default path, and also solving the problem that the bulletin board in the game development engine cannot obtain the display effect of the texture adjusted in the game development engine.
[0053] The following embodiment will explain in detail how to determine which texture parameters of multiple textures loaded in the game development engine have been adjusted by the game artist.
[0054] Optionally, refer to Figure 2 As shown, the current parameters of the first adjusted texture in the game development engine in the above step S101 include:
[0055] S201. Obtain multiple loaded textures currently loaded in the game development engine.
[0056] Exemplarily, for example, the loaded maps may be textures and colors to be rendered onto surfaces of different game models in game production overload. For example, the loaded maps may be: color maps, normal maps, mixed maps, and the like.
[0057] S202: Filter at least one loaded texture whose current parameters are different from original parameters from a plurality of loaded textures, and use each loaded texture whose current parameters are different from original parameters as a first adjusted texture.
[0058] It should be noted that the current parameters include multiple parameter items. As long as the current parameter value of a parameter item in the loaded texture is inconsistent with the original parameter value, the current parameter of the loaded texture is determined to be different from the original parameter, and the loaded texture is used as a first adjusted texture.
[0059] In one practicable manner, for example, the currently loaded multiple textures can be directly read from the game development engine, and based on the current parameters and original parameters of each loaded texture, it is determined whether each loaded texture has been modified by the game artist. Figure 1 If the original brightness parameter is 1 and the current brightness parameter is 2, it can be determined that the original brightness parameter is inconsistent with the current brightness parameter, that is, the loaded sticker Figure 1 is an adjusted texture. For example, a loaded texture Figure 2 If the original brightness parameter is 1 and the current brightness parameter is also 1, it can be determined that the original brightness parameter is consistent with the current brightness parameter, that is, the loaded sticker Figure 2 It is not an adjusted texture. Therefore, the current parameters of multiple loaded textures in the game development engine are compared with the original parameters, and the textures with changed parameters are screened out in batches, so as to realize the rapid screening of multiple loaded textures in the game development engine.
[0060] The following embodiments will be used to explain in detail how to batch search for the original textures corresponding to the first adjusted textures in the game development engine.
[0061] Optionally, refer to Figure 3 As shown, the above step S102 includes:
[0062] S301, calling a batch search process pre-packaged in a game development engine.
[0063] S302: When the batch search process is running, the target original texture corresponding to each first adjusted texture is obtained from the texture storage path according to the identifier of each first adjusted texture.
[0064] Optionally, in order to improve the search efficiency for the target original texture corresponding to each first adjusted texture, a blueprint can be used in the UE engine to pre-write the search code corresponding to the batch search service, and the search code can be encapsulated into a search plug-in to prevent business code confusion when the search code corresponding to the batch search service is called in the game development engine.
[0065] In this embodiment, for example, referring to Figure 4As shown, it is a schematic diagram of the query tool interface provided by the game development engine of the embodiment of the present application. The user can input the texture storage path through the input box corresponding to the texture path in the query tool interface, and can also input the texture suffix through the input box corresponding to the texture name suffix. The UE engine responds to the user triggering the query control, and calls the batch search process in the UE engine. During the batch search process, the identifier of each first adjusted texture is compared with the identifiers of multiple original textures stored in the texture storage path in turn, so as to find the target original texture corresponding to each first adjusted texture in batches, that is, the user does not need to search manually, which improves the efficiency of querying the target original texture corresponding to each first adjusted texture. At the same time, continue to refer to Figure 4 As shown, the detaiview function provided in the UE engine can also be used to load the target original textures corresponding to the screened first adjusted textures, and display multiple target original textures to be processed in the middle area of the tool interface to facilitate users to verify the multiple target original textures queried.
[0066] In one feasible method, for example, this solution sets a string variable to separate the current parameters of each first adjusted texture in the game development engine (for example, the current parameters include: brightness, brightnessCurve, natural saturation Vibrance, saturation Saturation, RGB curve RGBCurve, hue, etc.) and the texture storage path with "," for transferring variables, and then calls a batch search process in the UE engine, and exports the target original texture corresponding to each first adjusted texture found under the texture storage path to the specified directory.
[0067] The following embodiments will be used to explain in detail how to adjust the target original texture corresponding to each first adjusted texture according to the current parameters of each first adjusted texture.
[0068] Optionally, refer to Figure 5 As shown, in the above step S103, according to the current parameters of each first adjusted texture, pixels in the target original texture corresponding to each first adjusted texture in the texture storage path are adjusted to obtain the second adjusted texture corresponding to each target original texture, including:
[0069] S501, the game development engine calls the texture adjustment process that is pre-packaged and stored in the target storage area.
[0070] S502: When the texture adjustment process is running, the component values of the pixels of the target original texture corresponding to the first adjusted texture in each color channel are adjusted according to the current parameters of the first adjusted texture to obtain a second adjusted texture corresponding to the target original texture.
[0071] For example, the texture adjustment process is a texture adjustment code written in Python by a user for a texture adjustment service in a game development engine, and the texture adjustment code is packaged into an exe execution file. For example, the exe execution file is stored in a project storage area, and the texture adjustment process is called by an application program interface provided by the game development engine.
[0072] In this example, continue to refer to Figure 4 As shown, after querying the target original textures corresponding to each first adjusted texture, the UE engine responds to the user triggering the texture generation control provided on the tool interface, calling the texture adjustment process, and when the texture adjustment process is running, the target original texture corresponding to the first adjusted texture is processed to obtain the original parameters of the target original texture, such as the original brightness parameter and the original saturation parameter, and then the current brightness parameter and the current saturation parameter of the first adjusted texture are used to adjust the brightness and saturation of each pixel in the target original texture, and the second adjusted texture corresponding to the target original texture is generated, that is, the adjustment operation of the component value of each pixel in each color channel in the target original texture is realized. In this way, it can be ensured that the display effect of the second adjusted texture is consistent with that of the first adjusted texture in terms of viewing angle, which solves the problem that the image processing software in the prior art cannot achieve the effect after the texture adjustment in the game development engine.
[0073] In one achievable manner, for example, the texture adjustment code is written in Python outside the UE engine, and after completion, the texture adjustment code can be packaged into an exe executable file for calling and executing in the UE engine.
[0074] Optionally, refer to Figure 6 As shown, the above step S502 includes:
[0075] S601, determining the component value of each pixel in the target original map in the RGB color space according to the color attribute of the target original map.
[0076] The target original map is in RGB format, that is, the color attribute of the target original map is the component value of each primary color of each pixel in the RGB color space.
[0077] For example, for a certain pixel in the target original map, the component value of the red primary color of the pixel in the RGB color space is 128, the component value of the green primary color is 128, and the component value of the blue primary color is 128, that is, the viewing angle display effect of the pixel in the game development engine is determined by the component value of the RGB color space.
[0078] S602: Determine the component value of each pixel in the target original map in the HSV color space according to the component value of each pixel in the target original map in the RGB color space.
[0079] S603: Update the component value of each pixel in the target original map in the HSV color space according to the current parameters of the first adjusted map, and generate an adjusted HSV format map.
[0080] Optionally, since the game artist only adjusts the parameters such as hue, brightness and saturation of the first adjusted map in the game development engine, in order to ensure that the second adjusted map generated in the end is consistent with the display effect of the first adjusted map in terms of viewing angle. Therefore, it is necessary to convert the target original map into the HSV format. Specifically, for example, the conversion formula between the RGB format and the HSV format can be used to calculate and process the component value of each pixel in the target original map in the RGB color space, and obtain the component value of each pixel in the target original map in the HSV color space, that is, to obtain the component value of the hue (Hue), the component value of the saturation (Saturation) and the component value of the brightness (Value) of each pixel in the target original map in the HSV color space; then, based on the current parameters of the first adjusted map, the component value of each pixel in the target original map in the HSV color space is adjusted pixel by pixel to generate an adjusted HSV format map.
[0081] S604: Perform color space conversion and correction processing on the adjusted HSV format map to generate a second adjusted map corresponding to the target original map.
[0082] Optionally, in order to ensure that the adjusted HSV format map is consistent with the format of multiple original maps stored in the default path, the adjusted HSV format map needs to be converted into an adjusted RGB format map; at the same time, in order to make the viewing angle display effect of the adjusted RGB format map more natural and realistic, the adjusted RGB format map can also be corrected to adjust the brightness and contrast of the adjusted RGB format map to generate a second adjusted map corresponding to the target original map.
[0083] In one achievable manner, for example, the specific adjustment process is as follows:
[0084] 1. Create three variables and set PixelHue = H, PixelSaturation = S; PixelValue = value; and record the current brightness parameter of the first adjusted map as AdjustBrightness, the current brightness curve as AdjustBrightnessCurve, the current natural saturation parameter as AdjustSaturation, and the current hue parameter as AdjustHue;
[0085] 2. Calculate brightness: PixelValue = PixelValue * AdjustBrightness;
[0086] 3. Calculate the brightness curve: use the pow function to adjust the PixelValue;
[0087] 4. Calculate saturation: PixelSaturation = PixelSaturation * AdjustSaturation.
[0088] 5. Calculate the hue: PixelHue = PixelHue + AdjustHue;
[0089] 6. Constrain HSV values, i.e. PixelHue = PixelHue%360, and remap negative values;
[0090] 7: Map PixelSaturation and PixelValue to [0,1]: Set PixelSaturation to a value between [0,1].
[0091] 8: HSV to linear RGB: Convert the calculated PixelHue / PixelSaturation / PixelValue values to RGB.
[0092] Optionally, continue to refer to Figure 4As shown, after generating the second adjusted texture corresponding to the target original texture, the UE engine responds to the user triggering the texture re-import control provided on the tool interface to realize the batch automatic import and replacement of the second adjusted texture. Among them, when the texture adjustment process in the UE engine ends, the UE engine will call the pre-packaged texture re-import process, and when the texture re-import process is running, the generated second adjusted texture will be saved to the specified folder, and the target original texture will be replaced and modified. At the same time, the color attributes of the second adjusted texture will be restored to the default values one by one using a FOR loop, and then the GetAssetSourceFiles node will be used to read the texture storage path, and the texture storage path will be normalized and detected, and the non-standard texture storage path will be replaced with a string, and then the SetAssetSourceFiles node will be used to reset the path information of the texture asset record. Then use the Reimport node in the UE engine (find the corresponding texture asset through the path, then import the texture asset into the UE engine and replace the original texture resource), rewrite the internal code, expose the method to the blueprint call, and pass in the path information obtained by the GetAssetSourceFiles node to replace the texture.
[0093] Therefore, the user can use the above-mentioned Figure 4 The operation controls shown in the figure can complete the export and batch generation of textures, and can adaptively identify the setting format and shunt processing of textures without operating outside the UE engine. It realizes the path reading of textures and the import overlay processing of textures, and solves the problem of slow batch processing of textures.
[0094] Optionally, the above step S601 includes:
[0095] The color parameters of the target original map are processed linearly and matrixed to obtain the component value of each pixel in the target original map in the RGB color space.
[0096] Optionally, in order to improve the processing efficiency of the texture, it is proposed to first perform linear processing on each pixel in the target original texture to obtain a linearized texture, and then perform matrix processing on the linearized texture.
[0097] In one feasible method, for example, the normalized value corresponding to each value in the RGB color space is recorded in a preset array, that is, the linear result of each pixel in the target original map can be obtained by querying from the preset array. For example, the value of the red primary color of a certain pixel in the RGB color space is 128. Correspondingly, the component value of the red primary color can be determined to be 0.41 by querying the array, that is, the linear result of each pixel in the target original map can be obtained in turn; then, the linear result of each pixel is NUMPY matrixed to obtain the component value of each pixel in the target original map in the RGB color space, which greatly improves the processing efficiency, quickly generates the corresponding map, and solves the problem of batch generation. At this point, the matrix storage and processing of each pixel in the target original map is realized.
[0098] Optionally, the above step S602 includes:
[0099] Using a preset first color space conversion algorithm, the component value of each pixel in the target original map in the RGB color space is converted into a component value in the HSV color space, and the component value of each pixel in the target original map in the HSV color space is determined.
[0100] Optionally, the first color space conversion algorithm may be a LinerRGBToHsv algorithm, which is an optimization based on a texture processing algorithm in a UE engine. The algorithm in the UE engine is executed pixel by pixel, and is inefficient when executed externally.
[0101] In this embodiment, the existing RGB to HSV color space conversion formula can be used, such as converting the component value of each pixel in the target original map in the RGB color space into the component value in the HSV color space, and storing the component value of each pixel in the target original map in the RGB color space in the NP matrix.
[0102] Optionally, refer to Figure 7 As shown, the above S604 includes:
[0103] S701: Use a preset second color space conversion algorithm to perform color space conversion processing on the adjusted HSV format map to generate an adjusted RGB format map.
[0104] Exemplarily, for example, the second color space conversion algorithm can be HSVToLinearRGBArray, that is, using HSVToLinearRGBArray, that is, the parameters passed into HSVToLinearRGBArray are PixelHue / PixelSaturation / PixelValue, and after the calculation is completed, the adjusted RGB format map can be generated, thereby realizing the conversion processing of the adjusted HSV format map.
[0105] S702: Correct the adjusted RGB format texture to generate a corrected RGB format texture, and use the corrected RGB format texture as a second adjusted texture corresponding to the target original texture.
[0106] In one feasible manner, for example, a gamma correction algorithm may be used to correct the adjusted RGB format map generated above to generate a corrected RGB format map, so as to improve the brightness and contrast of the corrected RGB format map to achieve a more natural and realistic visual effect.
[0107] Among them, the specific implementation process of the Gamma correction algorithm is as follows:
[0108] 1. Limit the range of RGB values, namely:
[0109] RGB_Target[...,0]=np.maximum(0,np.minimum(RGB_Target[...,0],1))RGB_Target[...,1]=np.maximum(0,np.minimum(RGB_Target[...,1],1))
[0110] RGB_Target[...,2]=np.maximum(0,np.minimum(RGB_Target[...,2],1));
[0111] The above defined range ensures that the RGB values in RGB_Target are within the range of [0,1]. The np.minimum and np.maximum functions are used to clip all out-of-range values to the legal range.
[0112] Among them, RGB_Target[...,0]: processes the red channel, RGB_Target[...,1]: processes the green channel, and RGB_Target[...,2]: processes the blue channel.
[0113] 2. Gamma Correction
[0114] Apply gamma correction to convert RGB values from linear space to sRGB space. According to the sRGB standard, the conversion formula is divided into two parts:
[0115] If the value is less than or equal to 0.0031308, use linear scaling * 12.92; otherwise, use the power function transformation np.power(value,1.0 / 2.4)*1.055-0.055.
[0116] 3. Convert the RGB value to an integer as follows:
[0117] RGB_Target[...,0]=np.floor(RGB_Target[...,0]*255.999).astype(int)RGB_Target[...,1]=np.floor(RGB_T arget[...,1]*255.999).astype(int)RGB_Target[...,2]=np.floor(RGB_Target[...,2]*255.999).astype(int)
[0118] At this point, the gamma-corrected RGB value [0,1] range is converted to an integer value in the range [0,255]. In this case, 255.999 is multiplied instead of 255 to ensure that the maximum value 1.0 is correctly mapped to 255; p.floor is used to round the floating point number down to an integer; and astype(int) is used to convert the result to an integer type.
[0119] 4. Combine RGBA arrays.
[0120] It should be noted that, after acquiring the target original textures corresponding to the multiple first adjusted textures, this solution processes the target original textures corresponding to the first adjusted textures respectively to generate the second adjusted textures corresponding to the target original textures.
[0121] Based on the same inventive concept, a game texture processing device corresponding to the game texture processing method is also provided in the embodiment of the present application. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the above-mentioned game texture processing method in the embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0122] Figure 8 This is a schematic diagram of the structure of the game texture processing device provided in the embodiment of the present application, refer to Figure 8 As shown, the device comprises:
[0123] The acquisition module 801 is used to acquire a texture storage path and current parameters of at least one first adjusted texture in the game development engine, wherein the texture storage path stores a plurality of original textures; and acquire a target original texture corresponding to each first adjusted texture in the texture storage path according to an identifier of each first adjusted texture;
[0124] An adjustment module 802, configured to adjust pixels in a target original texture corresponding to each of the first adjusted textures in the texture storage path according to current parameters of each of the first adjusted textures, to obtain a second adjusted texture corresponding to each of the target original textures;
[0125] The storage module 803 is used to replace the target original texture in the texture storage path with the second adjusted texture.
[0126] Optionally, the acquisition module 801 is specifically configured to:
[0127] Obtain multiple loaded textures currently loaded in the game development engine;
[0128] At least one loaded texture having a current parameter different from an original parameter is selected from the plurality of loaded textures, and each of the loaded textures having a current parameter different from an original parameter is used as a first adjusted texture.
[0129] Optionally, the acquisition module 801 is specifically configured to:
[0130] Calling a batch search process prepackaged in the game development engine;
[0131] When the batch search process is running, the target original texture corresponding to each first adjusted texture is acquired from the texture storage path according to the identifier of each first adjusted texture.
[0132] Optionally, the adjustment module 802 is specifically configured to:
[0133] The game development engine calls the texture adjustment process pre-packaged and stored in the target storage area;
[0134] When the texture adjustment process is running, the component values of the pixels of the target original texture corresponding to the first adjusted texture in each color channel are adjusted according to the current parameters of the first adjusted texture to obtain a second adjusted texture corresponding to the target original texture.
[0135] Optionally, the adjustment module 802 is specifically configured to:
[0136] Determine the component value of each pixel in the target original map in the RGB color space according to the color parameters of the target original map;
[0137] Determine the component value of each pixel in the target original map in the HSV color space according to the component value of each pixel in the target original map in the RGB color space;
[0138] According to the current parameters of the first adjusted map, the component value of each pixel in the target original map in the HSV color space is updated to generate an adjusted HSV format map;
[0139] The adjusted HSV format map is subjected to color space conversion processing and correction processing to generate a second adjusted map corresponding to the target original map.
[0140] Optionally, the adjustment module 802 is specifically configured to:
[0141] The color attributes of the target original map are linearly and matrix-processed to obtain the component value of each pixel in the target original map in the RGB color space.
[0142] Optionally, the adjustment module 802 is specifically configured to:
[0143] Using a preset first color space conversion algorithm, the component value of each pixel in the target original map in the RGB color space is converted into a component value in the HSV color space, and the component value of each pixel in the target original map in the HSV color space is determined.
[0144] Optionally, the adjustment module 802 is specifically configured to:
[0145] Using a preset second color space conversion algorithm, performing color space conversion processing on the adjusted HSV format map to generate an adjusted RGB format map;
[0146] The adjusted RGB format map is corrected to generate a corrected RGB format map, and the corrected RGB format map is used as a second adjusted map corresponding to the target original map.
[0147] The above-mentioned device is used to execute the method provided by the aforementioned embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.
[0148] The above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more digital singnal processors (DSP), or one or more field programmable gate arrays (FPGA). For another example, when a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0149] Fig. 9 This is a structural diagram of an electronic device provided in an embodiment of the present application. The electronic device includes: a processor 901, a storage medium 902 and a bus 903. The storage medium 902 stores machine-readable instructions executable by the processor 901. When the electronic device is running, the processor 901 communicates with the storage medium 902 through the bus 903. The processor 901 executes the machine-readable instructions to perform the following steps:
[0150] Obtaining a texture storage path and obtaining current parameters of at least one first adjusted texture in the game development engine, wherein a plurality of original textures are stored in the texture storage path;
[0151] According to the identifier of each of the first adjusted textures, obtaining the target original texture corresponding to each of the first adjusted textures in the texture storage path;
[0152] According to the current parameters of each of the first adjusted textures, pixels in the target original texture corresponding to each of the first adjusted textures in the texture storage path are adjusted to obtain second adjusted textures corresponding to each of the target original textures, and the target original textures in the texture storage path are replaced with the second adjusted textures.
[0153] Optionally, the processor 901 executes the step of obtaining the current parameters of the first adjusted texture in the game development engine, specifically for:
[0154] Obtain multiple loaded textures currently loaded in the game development engine;
[0155] At least one loaded texture having a current parameter different from an original parameter is selected from the plurality of loaded textures, and each of the loaded textures having a current parameter different from an original parameter is used as a first adjusted texture.
[0156] Optionally, the processor 901 executes the step of obtaining, according to the identifier of each of the first adjusted textures, a target original texture corresponding to each of the first adjusted textures in the texture storage path, specifically for:
[0157] Calling a batch search process prepackaged in the game development engine;
[0158] When the batch search process is running, the target original texture corresponding to each first adjusted texture is acquired from the texture storage path according to the identifier of each first adjusted texture.
[0159] Optionally, the processor 901 executes, according to the current parameters of each of the first adjusted textures, adjusting the pixels in the target original texture corresponding to each of the first adjusted textures in the texture storage path to obtain a second adjusted texture corresponding to each of the target original textures, specifically for:
[0160] The game development engine calls the texture adjustment process pre-packaged and stored in the target storage area;
[0161] When the texture adjustment process is running, the component values of the pixels of the target original texture corresponding to the first adjusted texture in each color channel are adjusted according to the current parameters of the first adjusted texture to obtain a second adjusted texture corresponding to the target original texture.
[0162] Optionally, the processor 901 performs the step of adjusting the component values of the pixels of the target original map corresponding to the first adjusted map in each color channel according to the current parameters of the first adjusted map to obtain the second adjusted map corresponding to the target original map, specifically for:
[0163] Determine the component value of each pixel in the target original map in the RGB color space according to the color parameters of the target original map;
[0164] Determine the component value of each pixel in the target original map in the HSV color space according to the component value of each pixel in the target original map in the RGB color space;
[0165] According to the current parameters of the first adjusted map, the component value of each pixel in the target original map in the HSV color space is updated to generate an adjusted HSV format map;
[0166] The adjusted HSV format map is subjected to color space conversion processing and correction processing to generate a second adjusted map corresponding to the target original map.
[0167] Optionally, the processor 901 performs the step of determining the component value of each pixel in the target original map in the RGB color space according to the color parameter of the target original map, specifically for:
[0168] The color attributes of the target original map are linearly and matrix-processed to obtain the component value of each pixel in the target original map in the RGB color space.
[0169] Optionally, the processor 901 performs the step of determining the component value of each pixel in the target original map in the HSV color space according to the component value of each pixel in the target original map in the RGB color space, specifically for:
[0170] Using a preset first color space conversion algorithm, the component value of each pixel in the target original map in the RGB color space is converted into a component value in the HSV color space, and the component value of each pixel in the target original map in the HSV color space is determined.
[0171] Optionally, the processor 901 performs the color space conversion processing and correction processing on the adjusted HSV format map to generate a second adjusted map corresponding to the target original map, specifically for:
[0172] Using a preset second color space conversion algorithm, performing color space conversion processing on the adjusted HSV format map to generate an adjusted RGB format map;
[0173] The adjusted RGB format map is corrected to generate a corrected RGB format map, and the corrected RGB format map is used as a second adjusted map corresponding to the target original map.
[0174] Optionally, the present invention further provides a program product, such as a computer-readable storage medium, comprising a program, which is used to execute when executed by a processor, and the processor performs the following steps:
[0175] Obtaining a texture storage path and obtaining current parameters of at least one first adjusted texture in the game development engine, wherein a plurality of original textures are stored in the texture storage path;
[0176] According to the identifier of each of the first adjusted textures, obtaining the target original texture corresponding to each of the first adjusted textures in the texture storage path;
[0177] According to the current parameters of each of the first adjusted textures, pixels in the target original texture corresponding to each of the first adjusted textures in the texture storage path are adjusted to obtain second adjusted textures corresponding to each of the target original textures, and the target original textures in the texture storage path are replaced with the second adjusted textures.
[0178] Optionally, the processor executes the step of obtaining the current parameters of the first adjusted texture in the game development engine, specifically for:
[0179] Obtain multiple loaded textures currently loaded in the game development engine;
[0180] At least one loaded texture having a current parameter different from an original parameter is selected from the plurality of loaded textures, and each of the loaded textures having a current parameter different from an original parameter is used as a first adjusted texture.
[0181] Optionally, the processor executes the step of acquiring, according to the identifier of each of the first adjusted textures, a target original texture corresponding to each of the first adjusted textures in the texture storage path, specifically for:
[0182] Calling a batch search process prepackaged in the game development engine;
[0183] When the batch search process is running, the target original texture corresponding to each first adjusted texture is obtained from the texture storage path according to the identifier of each first adjusted texture.
[0184] Optionally, the processor executes, according to the current parameters of each of the first adjusted textures, adjusting pixels in the target original texture corresponding to each of the first adjusted textures in the texture storage path to obtain a second adjusted texture corresponding to each of the target original textures, specifically for:
[0185] The game development engine calls the texture adjustment process pre-packaged and stored in the target storage area;
[0186] When the texture adjustment process is running, the component values of the pixels of the target original texture corresponding to the first adjusted texture in each color channel are adjusted according to the current parameters of the first adjusted texture to obtain a second adjusted texture corresponding to the target original texture.
[0187] Optionally, the processor performs the step of adjusting the component values of pixels in each color channel of the target original map corresponding to the first adjusted map according to the current parameters of the first adjusted map to obtain a second adjusted map corresponding to the target original map, specifically for:
[0188] Determine the component value of each pixel in the target original map in the RGB color space according to the color parameters of the target original map;
[0189] Determine the component value of each pixel in the target original map in the HSV color space according to the component value of each pixel in the target original map in the RGB color space;
[0190] According to the current parameters of the first adjusted map, the component value of each pixel in the target original map in the HSV color space is updated to generate an adjusted HSV format map;
[0191] The adjusted HSV format map is subjected to color space conversion processing and correction processing to generate a second adjusted map corresponding to the target original map.
[0192] Optionally, the processor performs the step of determining the component value of each pixel in the target original map in the RGB color space according to the color parameter of the target original map, specifically for:
[0193] The color attributes of the target original map are linearly and matrix-processed to obtain the component value of each pixel in the target original map in the RGB color space.
[0194] Optionally, the processor performs the step of determining the component value of each pixel in the target original map in the HSV color space according to the component value of each pixel in the target original map in the RGB color space, specifically for:
[0195] Using a preset first color space conversion algorithm, the component value of each pixel in the target original map in the RGB color space is converted into a component value in the HSV color space, and the component value of each pixel in the target original map in the HSV color space is determined.
[0196] Optionally, the processor performs the color space conversion processing and correction processing on the adjusted HSV format map to generate a second adjusted map corresponding to the target original map, specifically for:
[0197] Using a preset second color space conversion algorithm, performing color space conversion processing on the adjusted HSV format map to generate an adjusted RGB format map;
[0198] The adjusted RGB format map is corrected to generate a corrected RGB format map, and the corrected RGB format map is used as a second adjusted map corresponding to the target original map.
[0199] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0200] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0201] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0202] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviated: ROM), random access memory (English: Random Access Memory, abbreviated: RAM), disk or optical disk and other media that can store program codes.
Claims
1. A method for processing game textures, characterized in that: The method comprises: Obtaining a texture storage path and obtaining current parameters of at least one first adjusted texture in the game development engine, wherein a plurality of original textures are stored in the texture storage path; According to the identifier of each of the first adjusted textures, obtaining the target original texture corresponding to each of the first adjusted textures in the texture storage path; According to the current parameters of each of the first adjusted textures, pixels in the target original texture corresponding to each of the first adjusted textures in the texture storage path are adjusted to obtain second adjusted textures corresponding to each of the target original textures, and the target original textures in the texture storage path are replaced with the second adjusted textures.
2. The method according to claim 1, characterized in that The obtaining current parameters of the first adjusted texture in the game development engine includes: Obtain multiple loaded textures currently loaded in the game development engine; At least one loaded texture having a current parameter different from an original parameter is selected from the plurality of loaded textures, and each of the loaded textures having a current parameter different from an original parameter is used as a first adjusted texture.
3. The method according to claim 1, characterized in that The acquiring, according to the identifier of each of the first adjusted textures, a target original texture corresponding to each of the first adjusted textures in the texture storage path comprises: Calling a batch search process prepackaged in the game development engine; When the batch search process is running, the target original texture corresponding to each first adjusted texture is acquired from the texture storage path according to the identifier of each first adjusted texture.
4. The method according to claim 1, characterized in that: According to the current parameters of each of the first adjusted textures, pixels in the target original texture corresponding to each of the first adjusted textures in the texture storage path are adjusted to obtain second adjusted textures corresponding to each of the target original textures, including: Calling a texture adjustment process prepackaged in the game development engine; When the texture adjustment process is running, the component values of the pixels of the target original texture corresponding to the first adjusted texture in each color channel are adjusted according to the current parameters of the first adjusted texture to obtain a second adjusted texture corresponding to the target original texture.
5. The method according to claim 4, characterized in that The step of adjusting the component values of pixels in each color channel of the target original map corresponding to the first adjusted map according to the current parameters of the first adjusted map to obtain a second adjusted map corresponding to the target original map includes: Determine the component value of each pixel in the target original map in the RGB color space according to the color parameters of the target original map; Determine the component value of each pixel in the target original map in the HSV color space according to the component value of each pixel in the target original map in the RGB color space; According to the current parameters of the first adjusted map, the component value of each pixel in the target original map in the HSV color space is updated to generate an adjusted HSV format map; The adjusted HSV format map is subjected to color space conversion processing and correction processing to generate a second adjusted map corresponding to the target original map.
6. The method according to claim 5, characterized in that Determining the component value of each pixel in the target original map in the RGB color space according to the color parameter of the target original map includes: The color attributes of the target original map are linearly and matrix-processed to obtain the component value of each pixel in the target original map in the RGB color space.
7. The method according to claim 5, characterized in that Determining the component value of each pixel in the target original map in the HSV color space according to the component value of each pixel in the target original map in the RGB color space includes: Using a preset first color space conversion algorithm, the component value of each pixel in the target original map in the RGB color space is converted into a component value in the HSV color space, and the component value of each pixel in the target original map in the HSV color space is determined.
8. The method according to claim 5, characterized in that The step of performing color space conversion and correction processing on the adjusted HSV format map to generate a second adjusted map corresponding to the target original map includes: Using a preset second color space conversion algorithm, performing color space conversion processing on the adjusted HSV format map to generate an adjusted RGB format map; The adjusted RGB format map is corrected to generate a corrected RGB format map, and the corrected RGB format map is used as a second adjusted map corresponding to the target original map.
9. A game texture processing device, characterized in that: The device comprises: An acquisition module, used to acquire a texture storage path and current parameters of at least one first adjusted texture in a game development engine, wherein the texture storage path stores a plurality of original textures; and acquire a target original texture corresponding to each first adjusted texture in the texture storage path according to an identifier of each first adjusted texture; An adjustment module, configured to adjust pixels in a target original texture corresponding to each of the first adjusted textures in the texture storage path according to current parameters of each of the first adjusted textures, to obtain a second adjusted texture corresponding to each of the target original textures; A storage module is used to replace the target original texture in the texture storage path with the second adjusted texture.
10. An electronic device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of any method as claimed in claims 1-8.
11. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is executed.