Game image processing method and device, storage medium, and computer equipment

By adding a color space conversion channel to the Unity engine's rendering pipeline, the three-dimensional image cache data is converted from linear space to gamma space and UI rendering, the transparency presentation problem of UI images in Linear color space is solved, and the game is improved Expression and production efficiency.

CN114882164BActive Publication Date: 2025-01-17SIKELI CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210542191.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-18
Publication Date
2025-01-17
Estimated Expiration
2042-05-18

AI Technical Summary

Technical Problem

Under the Linear color space of the Unity engine, the alpha alpha channel of UI pictures cannot be mixed correctly, resulting in inaccurate opacity of UI pictures, resulting in loss of accuracy of UI materials and inefficient production efficiency.

Method used

By adding a first conversion channel in the rendering pipeline, converting the three-dimensional image cache data from linear space to gamma space, and putting the UI material data in the gamma space into the UI cache for UI rendering, and finally, through the second conversion channel, the UI rendering results are converted from gamma space to linear space, achieving the correct alpha mix of three-dimensional scenes and UI materials.

Benefits of technology

Without changing the existing UI image production workflow, the color difference problem after UI images are rendered into the game development engine is solved, which improves image production efficiency, avoids color accuracy loss, and improves game performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114882164B_ABST
    Figure CN114882164B_ABST
Patent Text Reader

Abstract

The present application discloses a game image processing method and device, a storage medium, and a computer device. The method comprises: obtaining three-dimensional scene resource data and interface UI material data corresponding to a target game scene; writing the three-dimensional scene resource data into a three-dimensional image cache of a target rendering pipeline, rendering the three-dimensional scene resource data in the three-dimensional image cache through a three-dimensional rendering channel of the target rendering pipeline, and obtaining three-dimensional image cache data in a linear space; converting the color space of the three-dimensional image cache data into a gamma space through a first conversion channel, and putting the three-dimensional image cache data and interface UI material data in the gamma space into a UI cache of a target rendering pipeline, and performing UI rendering on the three-dimensional image cache data and interface UI material data in the UI cache through the UI rendering channel of the target rendering pipeline; and converting the color space of the UI rendering result into a linear space through a second conversion channel.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a game image processing method and device, a storage medium, and a computer device. Background Art

[0002] Since the Unity engine supports Linear color space, the light and shadow levels of Unity's 3D rendering have become more accurate and delicate, but the rendering of UI in Linear color space has become worse. Most UI assets are produced in sRGB color space (gamma color space) through software such as PS, and the format of UI images is also based on sRGB, resulting in the alpha channel of sRGB-based UI images not being mixed correctly in the engine's Linear color space, making the opacity of UI images not being presented correctly.

[0003] In order to match the alpha blending in the Linear color space, some teams restricted the use of semi-transparent assets, resulting in a loss of transparency accuracy in UI materials. Some teams made blind adjustments in PS software, where production staff adjusted the image multiple times until the image looked comfortable, resulting in cumbersome operations and low efficiency. Summary of the invention

[0004] In view of this, the present application provides a game image processing method and device, storage medium, and computer equipment, which solves the problem of color difference after the current UI image enters the game development engine for rendering without changing the existing UI image production workflow, and improves the game expression.

[0005] According to one aspect of the present application, a game image processing method is provided, comprising:

[0006] Acquire three-dimensional scene resource data and interface UI material data corresponding to the target game scene, wherein the color space of the three-dimensional scene resource data is a linear space, and the color space of the interface UI material data is a gamma space;

[0007] Writing the 3D scene resource data into a 3D image cache of a target rendering pipeline, and rendering the 3D scene resource data in the 3D image cache through a 3D rendering channel of the target rendering pipeline to obtain 3D image cache data in a linear space, wherein the target rendering pipeline is obtained by adding a first conversion channel and a second conversion channel in a universal rendering pipeline;

[0008] The color space of the three-dimensional image cache data is converted into a gamma space through the first conversion channel, and the three-dimensional image cache data in the gamma space and the interface UI material data are placed in the UI cache of the target rendering pipeline, and UI rendering is performed on the three-dimensional image cache data and the interface UI material data in the UI cache through the UI rendering channel of the target rendering pipeline; the color space of the UI rendering result is converted into a linear space through the second conversion channel.

[0009] Optionally, the obtaining of three-dimensional scene resource data and interface UI material data corresponding to the target game scene specifically includes:

[0010] Traversing the three-dimensional scene objects in the target game scene, and acquiring the three-dimensional scene resource data corresponding to the three-dimensional scene objects;

[0011] Traverse the UI canvas object corresponding to the target game scene, and obtain the interface UI material data corresponding to the UI canvas object.

[0012] Optionally, before traversing the three-dimensional scene objects in the target game scene, the method further includes:

[0013] Identify whether the target game scene contains a three-dimensional scene object;

[0014] If included, then executing the traversal of the three-dimensional scene objects in the target game scene;

[0015] If not included, traverse the UI canvas object corresponding to the target game scene to obtain the interface UI material data corresponding to the UI canvas object.

[0016] Optionally, the putting the three-dimensional image cache data in the gamma space and the interface UI material data into the UI cache of the target rendering pipeline specifically includes:

[0017] Converting the color space of the UI material data to a linear space, performing reverse correction on the UI material data in the linear space, and sampling the reverse-corrected UI material data to convert the sampled UI material data back to a gamma space;

[0018] The three-dimensional image cache data in the gamma space and the sampled interface UI material data are placed in the UI cache.

[0019] Optionally, before obtaining the three-dimensional scene resource data and interface UI material data corresponding to the target game scene, the method further includes:

[0020] Identify common rendering pipelines in game engines;

[0021] After the 3D rendering channel of the universal rendering pipeline, a first conversion channel for converting the color space from the linear space to the gamma space is added, and after the UI rendering channel of the universal rendering pipeline URP, a second conversion channel for converting the color space from the gamma space to the linear space is added to obtain the target rendering pipeline.

[0022] Optionally, the method further comprises:

[0023] When receiving a new camera instruction for the target rendering pipeline, identifying whether the new camera indicated by the new camera instruction is a UI camera;

[0024] If the newly created camera is a UI camera, adding the newly created camera to the end of the camera stack of the target rendering pipeline;

[0025] If the newly created camera is not a UI camera, the newly created camera is inserted before the UI camera in the camera stack of the target rendering pipeline.

[0026] Optionally, after converting the color space of the UI rendering result into a linear space through the second conversion channel, the method further includes:

[0027] Based on the UI rendering results in linear space, the game image containing three-dimensional scene resources and interface UI materials is displayed.

[0028] Optionally, the three-dimensional image cache data in the linear space obtained through the three-dimensional rendering channel is in a first data format; the three-dimensional image cache data in the gamma space obtained through the first conversion channel is in a second data format; and the UI rendering result in the linear space obtained through the second conversion channel is in a third data format.

[0029] According to another aspect of the present application, a game image processing device is provided, comprising:

[0030] A data acquisition module, used to acquire the three-dimensional scene resource data and the interface UI material data corresponding to the target game scene, wherein the color space of the three-dimensional scene resource data is a linear space, and the color space of the interface UI material data is a gamma space;

[0031] A first rendering module is configured to write the 3D scene resource data into a 3D image cache of a target rendering pipeline, and render the 3D scene resource data in the 3D image cache through a 3D rendering channel of the target rendering pipeline to obtain 3D image cache data in a linear space, wherein the target rendering pipeline is obtained by adding a first conversion channel and a second conversion channel in a universal rendering pipeline;

[0032] A second rendering module is used to convert the color space of the three-dimensional image cache data into a gamma space through the first conversion channel, and put the three-dimensional image cache data under the gamma space and the interface UI material data into the UI cache of the target rendering pipeline, and perform UI rendering on the three-dimensional image cache data and the interface UI material data in the UI cache through the UI rendering channel of the target rendering pipeline; and convert the color space of the UI rendering result into a linear space through the second conversion channel.

[0033] Optionally, the data acquisition module is specifically used to:

[0034] Traversing the three-dimensional scene objects in the target game scene, and acquiring the three-dimensional scene resource data corresponding to the three-dimensional scene objects;

[0035] Traverse the UI canvas object corresponding to the target game scene, and obtain the interface UI material data corresponding to the UI canvas object.

[0036] Optionally, the data acquisition module is further used to:

[0037] Before traversing the three-dimensional scene objects in the target game scene, identifying whether the target game scene contains a three-dimensional scene object;

[0038] If included, then executing the traversal of the three-dimensional scene objects in the target game scene;

[0039] If not included, the traversal of the UI canvas object corresponding to the target game scene is executed.

[0040] Optionally, the first rendering module is further used to:

[0041] Converting the color space of the UI material data to a linear space, performing reverse correction on the UI material data in the linear space, and sampling the reverse-corrected UI material data to convert the sampled UI material data back to a gamma space;

[0042] The three-dimensional image cache data in the gamma space and the sampled interface UI material data are placed in the UI cache.

[0043] Optionally, the device further comprises: a pipeline transformation module, which is used to:

[0044] Before obtaining the three-dimensional scene resource data and the interface UI material data corresponding to the target game scene, determining the general rendering pipeline in the game engine;

[0045] After the 3D rendering channel of the universal rendering pipeline, a first conversion channel for converting the color space from the linear space to the gamma space is added, and after the UI rendering channel of the universal rendering pipeline, a second conversion channel for converting the color space from the gamma space to the linear space is added to obtain the target rendering pipeline.

[0046] Optionally, the pipeline transformation module is further used to:

[0047] When receiving a new camera instruction for the target rendering pipeline, identifying whether the new camera indicated by the new camera instruction is a UI camera;

[0048] If the newly created camera is a UI camera, adding the newly created camera to the end of the camera stack of the target rendering pipeline;

[0049] If the newly created camera is not a UI camera, the newly created camera is inserted before the UI camera in the camera stack of the target rendering pipeline.

[0050] Optionally, the device further comprises:

[0051] The display module is used to display a game image including three-dimensional scene resources and interface UI materials based on the UI rendering result in the linear space after converting the color space of the UI rendering result into the linear space through the second conversion channel.

[0052] Optionally, the three-dimensional image cache data in the linear space obtained through the three-dimensional rendering channel is in a first data format; the three-dimensional image cache data in the gamma space obtained through the first conversion channel is in a second data format; and the UI rendering result in the linear space obtained through the second conversion channel is in a third data format.

[0053] According to another aspect of the present application, a storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the above-mentioned game image processing method is implemented.

[0054] According to another aspect of the present application, a computer device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the above-mentioned game image processing method when executing the program.

[0055] By means of the above technical scheme, the present application provides a game image processing method and device, storage medium, and computer equipment, which obtain three-dimensional scene resource data and interface UI material data, call the pre-configured target rendering pipeline, and then perform 3D rendering on the three-dimensional scene resource data through the default three-dimensional rendering channel in the target rendering pipeline, use the first conversion channel to convert the color space of the 3D rendering result into the gamma space, and use the default UI rendering channel to perform UI rendering on the 3D rendering result and UI material in the gamma space, so that the three-dimensional scene resources and the interface UI material can achieve alpha blending, and finally use the second conversion channel to convert the color space of the UI rendering result into a linear space for output. The present application does not require changing the existing UI image production workflow, does not require manual adjustment of the output space of the UI material, improves the image production efficiency, avoids the loss of color accuracy, and solves the problem of color difference after the current UI image enters the game development engine for rendering, thereby improving the game's expressiveness.

[0056] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0058] Figure 1 A schematic diagram showing a flow chart of a game image processing method provided by an embodiment of the present application;

[0059] Figure 2 A schematic diagram of a process flow of a target rendering pipeline generation method provided in an embodiment of the present application is shown;

[0060] Figure 3 A schematic diagram of a target rendering pipeline provided by an embodiment of the present application is shown;

[0061] Figure 4 A schematic diagram of a process of creating a new camera provided in an embodiment of the present application is shown;

[0062] Figure 5 A schematic diagram of a process flow of a target rendering pipeline generation method provided in an embodiment of the present application is shown;

[0063] Figure 6 A schematic diagram of a process flow of another target rendering pipeline generation method provided in an embodiment of the present application is shown;

[0064] Figure 7 A rendering effect comparison diagram provided by an embodiment of the present application is shown;

[0065] Figure 8 A schematic diagram of the structure of a game image processing device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0066] The present application will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.

[0067] In this embodiment, a game image processing method is provided. Figure 1 As shown, the method includes:

[0068] Step 101, obtaining three-dimensional scene resource data and interface UI material data corresponding to a target game scene, wherein the color space of the three-dimensional scene resource data is a linear space, and the color space of the interface UI material data is a gamma space;

[0069] Step 102, writing the 3D scene resource data into a 3D image cache of a target rendering pipeline, rendering the 3D scene resource data in the 3D image cache through a 3D rendering channel of the target rendering pipeline to obtain 3D image cache data in a linear space, wherein the target rendering pipeline is obtained by adding a first conversion channel and a second conversion channel in a universal rendering pipeline;

[0070] Step 103, converting the color space of the 3D image cache data into a gamma space through the first conversion channel, and placing the 3D image cache data and the interface UI material data in the gamma space into a UI cache of the target rendering pipeline, and performing UI rendering on the 3D image cache data and the interface UI material data in the UI cache through the UI rendering channel of the target rendering pipeline;

[0071] Step 104: convert the color space of the UI rendering result into a linear space through the second conversion channel.

[0072] The embodiment of the present application solves the problem of color difference after mixing the three-dimensional scene graph in linear space and the interface UI graph produced in gamma space without changing the UI material production workflow, which can not only ensure that the accuracy of the UI graph is not lost, but also improve the image effect.

[0073] In the above embodiment, first, the three-dimensional scene resource data of any target game scene in the game and the pre-made interface UI material data corresponding to the scene are obtained, wherein the three-dimensional scene resource data can be obtained by the game developer through the game engine by drawing the scene in the linear space, and the interface UI material data can be obtained by the image processing software PS in the gamma space. Secondly, the data is written into the pre-built target rendering pipeline, which is obtained by adding two conversion channels for color space conversion to the general rendering pipeline. The three-dimensional scene resource data is rendered in the three-dimensional image cache of the target rendering pipeline through the default three-dimensional rendering channel (such as Draw Object Pass), and the three-dimensional image cache data obtained by the rendering is captured, and the color space of the three-dimensional image cache data is converted from the linear space to the gamma space through the first conversion channel pre-added in the pipeline, and then transferred to the UI cache in the gamma space, and the interface UI material data belonging to the gamma space is also put into the UI cache for UI rendering. Finally, through the default UI rendering channel in the target rendering pipeline, UI rendering is performed on the 3D image cache data and interface UI material data placed in the UI cache. Through the UI rendering process, alpha blending is performed on the rendering cache data of the 3D scene in the gamma space and the UI material in the linear space to ensure that the correct transparency can be obtained. Then, the second conversion channel pre-added in the pipeline is used to convert the final rendering result back to the linear space for image output, ensuring that the RGB color of the final output image is the correct color replaced back to the linear space. Because the alpha blending of UI images is completed in the gamma space, there is no wrong alpha blending result, which is compatible with 3D rendering in linear space and UI rendering in gamma space.

[0074] By applying the technical solution of this embodiment, the three-dimensional scene resource data and the interface UI material data are obtained, and the pre-configured target rendering pipeline is called. Then, the three-dimensional scene resource data is 3D rendered through the default three-dimensional rendering channel in the target rendering pipeline, and the color space of the 3D rendering result is converted into the gamma space using the first conversion channel. The 3D rendering result and the UI material are UI rendered in the gamma space through the default UI rendering channel, so that the three-dimensional scene resources and the interface UI material can achieve alpha blending, and finally the color space of the UI rendering result is converted into the linear space using the second conversion channel for output. The embodiment of the present application does not need to change the existing UI picture production workflow, does not need to manually adjust the output space of the UI material, improves the image production efficiency, avoids the loss of color accuracy, and solves the problem of color difference after the current UI picture enters the game development engine for rendering, thereby improving the game expression.

[0075] In the embodiment of the present application, the universal rendering pipeline that supports customization is modified, and the target rendering pipeline obtained by the modification is used to solve the UI rendering problem, and support the normal sRGB asset production process of UI designers. For example, the universal rendering pipeline URP provided by the game engine unity, the current universal rendering pipeline URP is a programmable rendering pipeline that supports customization of the pipeline.

[0076] In the embodiment of the present application, the target rendering pipeline can be obtained by modifying the general rendering pipeline in the game engine, such as Figure 2 As shown, optionally, the target rendering pipeline can be generated by the following steps:

[0077] S1, determine the general rendering pipeline in the game engine;

[0078] S2, adding a first conversion channel for converting the color space from the linear space to the gamma space after the 3D rendering channel of the universal rendering pipeline, and adding a second conversion channel for converting the color space from the gamma space to the linear space after the UI rendering channel of the universal rendering pipeline to obtain the target rendering pipeline.

[0079] The embodiment of the present application can be modified based on the universal rendering pipeline URP of the game development engine unity to obtain a target rendering pipeline. The universal rendering pipeline URP includes multiple universal rendering process passes, such as a three-dimensional rendering channel (for implementing 3D rendering), a UI rendering channel (for implementing UI rendering), a post-processing process, etc. Figure 3 As shown, after the universal rendering pipeline is determined, a color space conversion channel is added after the three-dimensional rendering channel and the UI rendering channel, respectively, wherein a first conversion channel is added after the three-dimensional rendering channel 3D pass (three-dimensional rendering channel) for converting from linear space to gamma space, so that after 3D rendering, the color space of the 3D rendering result is converted from linear space to gamma space, so that alpha blending with the UI in the gamma space can be performed later to obtain correct transparency; in addition, a second conversion channel is added after the UI pass (UI rendering channel) for converting from gamma space to linear space, so that after UI rendering, the color space of the UI rendering result is converted from gamma space to linear space, so that output can be performed in linear space to ensure correct RGB colors.

[0080] In the embodiment of the present application, the rendering process in the rendering pipeline is implemented by a rendering camera. Optionally, the construction process of the target rendering pipeline further includes:

[0081] When receiving a new camera instruction for the target rendering pipeline, identify whether the new camera indicated by the new camera instruction is a UI camera; if the new camera is a UI camera, add the new camera to the end of the camera stack of the target rendering pipeline; if the new camera is not a UI camera, insert the new camera before the UI camera in the camera stack of the target rendering pipeline.

[0082] In this embodiment, because the original color space of the rendering pipeline is a linear space, the space will be converted to gamma before rendering the UI in the embodiment of the present application, so that alpha blending can be performed to obtain the correct mixed transparency. However, at this time, the color (RGB channel) has color difference because of the converted space. Therefore, it is necessary to convert it back to linear space after the UI camera rendering is completed to finally obtain the correct color and transparency. However, if other cameras are rendered after the UI camera, the transparency will be rendered in linear space again, and incorrect transparency will still be obtained. Therefore, the UI camera rendering should be the last step of the pipeline rendering process. Figure 4 As shown, taking the Camera Stack of the Universal Rendering Pipeline URP of the game development engine Unity as an example, if you want to create a new camera in the camera stack, you must first confirm the identity of the new camera. If it is a UI camera used for UI rendering, then add it to the end of the camera stack list. If it is another camera (such as a special effects camera), then insert it in front of the UI camera in the camera stack list to ensure that the rendering order of the target rendering pipeline is 3D camera->other cameras->UI camera.

[0083] Further, as a refinement and extension of the specific implementation of the above embodiment, in order to fully illustrate the specific implementation process of this embodiment, another game image processing method is provided, such as Figure 5 As shown, the method includes:

[0084] Step 201, identifying whether the target game scene contains a three-dimensional scene object.

[0085] Step 202, if included, traverse the three-dimensional scene objects in the target game scene to obtain the three-dimensional scene resource data corresponding to the three-dimensional scene objects; traverse the UI canvas objects corresponding to the target game scene to obtain the interface UI material data corresponding to the UI canvas objects.

[0086] Step 203: If not included, traverse the UI canvas object corresponding to the target game scene to obtain the interface UI material data corresponding to the UI canvas object.

[0087] Step 204: write the 3D scene resource data into the 3D image cache of the target rendering pipeline, render the 3D scene resource data in the 3D image cache through the 3D rendering channel of the target rendering pipeline to obtain the 3D image cache data in the linear space; and convert the color space of the 3D image cache data into the gamma space through the first conversion channel.

[0088] Optionally, the three-dimensional image cache data in the linear space obtained through the three-dimensional rendering channel is in a first data format; and the three-dimensional image cache data in the gamma space obtained through the first conversion channel is in a second data format.

[0089] In this embodiment, if Figure 6 As shown, first determine whether the target game scene contains a three-dimensional scene object, such as a 3D scene object. If it does, traverse the three-dimensional scene objects in the scene, obtain the three-dimensional scene resource data, and perform 3D rendering through 3Dpass, and convert the three-dimensional image cache data (3D cache) in the linear space to the gamma space, wherein the cache format of the three-dimensional image cache data in the linear space can be RGB111110Float (the first data format), and the cache format after conversion to the gamma space can be RGBA32UNorm (the second data format), and further, traverse the UI canvas objects in the pre-made UI canvas, that is, Figure 4 The UI canvas object in the game scene is used to obtain the UI material data. If the target game scene does not include a three-dimensional scene object, the UI canvas is directly traversed to obtain the UI material data.

[0090] Step 205, converting the color space of the interface UI material data into a linear space, reversely correcting the interface UI material data in the linear space, sampling the reversely corrected interface UI material data, so that the sampled interface UI material data is converted back into a gamma space.

[0091] In this embodiment, before UI rendering, the color space of the interface UI material data is first converted to the linear space to ensure that the UI image can be previewed in the game development engine, to ensure that the UI image can be previewed in color in the editor, and that some UIs may be rendered as 3D objects (such as monster health bars) on a linear 3D cache. Converting the UI from the gamma space to the linear space can ensure that the UI can be accurately displayed in the linear space of the editor. In addition, based on the existing process in the pipeline, the interface UI material converted to the linear space can be reversed in the shader, and then the reversed corrected UI is sampled and converted back to the gamma space for the next step of UI rendering.

[0092] Step 206: put the three-dimensional image cache data in the gamma space and the sampled interface UI material data into the UI cache.

[0093] Step 207: Perform UI rendering on the three-dimensional image cache data and the interface UI material data in the UI cache through the UI rendering channel of the target rendering pipeline; and convert the color space of the UI rendering result into a linear space through the second conversion channel.

[0094] Step 208: Based on the UI rendering result in the linear space, a game image including three-dimensional scene resources and interface UI materials is displayed.

[0095] Optionally, the UI rendering result in the linear space obtained through the second conversion channel is in a third data format.

[0096] In this embodiment, the three-dimensional image cache data converted to the gamma space is put into the UI cache as UI material, and UI rendering is performed in the UI cache together with the sampled interface UI material data. Finally, after the UI rendering is completed, the UI rendering result in the UI cache is converted to the linear space to obtain the UI rendering result in the third data format (for example, RGBA32sRGB), and the drawing is output to display the game image containing the three-dimensional scene resources and the interface UI material on the screen to ensure that the color and transparency of the game screen displayed on the screen are correct. Figure 7 A rendering effect comparison diagram provided by an embodiment of the present application is shown. Figure 7 As shown, the images rendered using this solution have better transparency than those rendered by current 3D engines.

[0097] By applying the technical solution of this embodiment, the UI image production still uses the gamma color space, and the color space conversion is performed in the 3D engine rendering pipeline, which will not cause the loss of UI image source data accuracy, and also avoid the increase in workload caused by blind adjustments by developers. In addition, because the UI image production of this solution still uses Gamma color, the UI image asset production stage does not need to change the workflow, avoiding additional workload for UI designers. It helps to save the UI production cycle under the linear color space and enhance the versatility of UI assets.

[0098] Further, as Figure 1 The specific implementation of the method, the embodiment of the present application provides a game image processing device, such as Figure 8 As shown, the device comprises:

[0099] A data acquisition module, used to acquire the three-dimensional scene resource data and the interface UI material data corresponding to the target game scene, wherein the color space of the three-dimensional scene resource data is a linear space, and the color space of the interface UI material data is a gamma space;

[0100] A first rendering module is configured to write the 3D scene resource data into a 3D image cache of a target rendering pipeline, and render the 3D scene resource data in the 3D image cache through a 3D rendering channel of the target rendering pipeline to obtain 3D image cache data in a linear space, wherein the target rendering pipeline is obtained by adding a first conversion channel and a second conversion channel in a universal rendering pipeline;

[0101] A second rendering module is used to convert the color space of the three-dimensional image cache data into a gamma space through the first conversion channel, and put the three-dimensional image cache data under the gamma space and the interface UI material data into the UI cache of the target rendering pipeline, and perform UI rendering on the three-dimensional image cache data and the interface UI material data in the UI cache through the UI rendering channel of the target rendering pipeline; and convert the color space of the UI rendering result into a linear space through the second conversion channel.

[0102] Optionally, the data acquisition module is specifically used to:

[0103] Traversing the three-dimensional scene objects in the target game scene, and acquiring the three-dimensional scene resource data corresponding to the three-dimensional scene objects;

[0104] Traverse the UI canvas object corresponding to the target game scene, and obtain the interface UI material data corresponding to the UI canvas object.

[0105] Optionally, the data acquisition module is further used to:

[0106] Before traversing the three-dimensional scene objects in the target game scene, identifying whether the target game scene contains a three-dimensional scene object;

[0107] If included, then executing the traversal of the three-dimensional scene objects in the target game scene;

[0108] If not included, the traversal of the UI canvas object corresponding to the target game scene is executed.

[0109] Optionally, the first rendering module is further used to:

[0110] Converting the color space of the UI material data to a linear space, performing reverse correction on the UI material data in the linear space, and sampling the reverse-corrected UI material data to convert the sampled UI material data back to a gamma space;

[0111] The three-dimensional image cache data in the gamma space and the sampled interface UI material data are placed in the UI cache.

[0112] Optionally, the device further comprises: a pipeline transformation module, which is used to:

[0113] Before obtaining the three-dimensional scene resource data and the interface UI material data corresponding to the target game scene, determining the general rendering pipeline in the game engine;

[0114] After the 3D rendering channel of the universal rendering pipeline, a first conversion channel for converting the color space from the linear space to the gamma space is added, and after the UI rendering channel of the universal rendering pipeline URP, a second conversion channel for converting the color space from the gamma space to the linear space is added to obtain the target rendering pipeline.

[0115] Optionally, the pipeline transformation module is further used to:

[0116] When receiving a new camera instruction for the target rendering pipeline, identifying whether the new camera indicated by the new camera instruction is a UI camera;

[0117] If the newly created camera is a UI camera, adding the newly created camera to the end of the camera stack of the target rendering pipeline;

[0118] If the newly created camera is not a UI camera, the newly created camera is inserted before the UI camera in the camera stack of the target rendering pipeline.

[0119] Optionally, the device further comprises:

[0120] The display module is used to display a game image including three-dimensional scene resources and interface UI materials based on the UI rendering result in the linear space after converting the color space of the UI rendering result into the linear space through the second conversion channel.

[0121] Optionally, the three-dimensional image cache data in the linear space obtained through the three-dimensional rendering channel is in a first data format; the three-dimensional image cache data in the gamma space obtained through the first conversion channel is in a second data format; and the UI rendering result in the linear space obtained through the second conversion channel is in a third data format.

[0122] It should be noted that for other corresponding descriptions of the functional units involved in the game image processing device provided in the embodiment of the present application, reference can be made to Figures 1 to 6 The corresponding description in the method will not be repeated here.

[0123] Based on the above Figures 1 to 6 The method shown in the embodiment of the present application is accordingly provided with a storage medium on which a computer program is stored, and when the computer program is executed by a processor, the above-mentioned Figures 1 to 6 The game image processing method shown.

[0124] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present application.

[0125] Based on the above Figures 1 to 6 The method shown, and Figure 8 In order to achieve the above-mentioned purpose, the embodiment of the present application further provides a computer device, which can be a personal computer, a server, a network device, etc. The computer device includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to achieve the above-mentioned Figures 1 to 6 The game image processing method shown.

[0126] Optionally, the computer device may further include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a Bluetooth interface, a WI-FI interface), etc.

[0127] Those skilled in the art will appreciate that the computer device structure provided in this embodiment does not limit the computer device, and may include more or fewer components, or a combination of certain components, or different component arrangements.

[0128] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages and saves the hardware and software resources of the computer device, and supports the operation of information processing programs and other software and / or programs. The network communication module is used to realize communication between the components inside the storage medium, and communication with other hardware and software in the physical device.

[0129] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by means of software plus the necessary general hardware platform, or by hardware to obtain three-dimensional scene resource data and interface UI material data, call the pre-configured target rendering pipeline, and then first perform 3D rendering on the three-dimensional scene resource data through the default three-dimensional rendering channel in the target rendering pipeline, use the first conversion channel to convert the color space of the 3D rendering result into the gamma space, and use the default UI rendering channel to perform UI rendering on the 3D rendering result and UI material in the gamma space, so that the three-dimensional scene resources and the interface UI material can achieve alpha blending, and finally use the second conversion channel to convert the color space of the UI rendering result into a linear space for output. The embodiment of the present application does not need to change the existing UI picture production workflow, does not need to manually adjust the output space of the UI material, improves the image production efficiency, avoids the loss of color accuracy, and solves the problem of color difference after the current UI picture enters the game development engine for rendering, thereby improving the game expressiveness.

[0130] Those skilled in the art will appreciate that the accompanying drawings are only schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily necessary for implementing the present application. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario can be distributed in the devices of the implementation scenario according to the description of the implementation scenario, or can be changed accordingly and located in one or more devices different from the present implementation scenario. The modules of the above-mentioned implementation scenario can be combined into one module, or can be further split into multiple submodules.

[0131] The above serial numbers of this application are only for description and do not represent the advantages and disadvantages of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of this application, but this application is not limited to them, and any changes that can be thought of by technicians in this field should fall within the scope of protection of this application.

Claims

1. A method for processing a game image, characterized in that: include: Determine a universal rendering pipeline in a game engine, add a first conversion channel for converting a color space from a linear space to a gamma space after a 3D rendering channel of the universal rendering pipeline, and add a second conversion channel for converting a color space from a gamma space to a linear space after a UI rendering channel of the universal rendering pipeline, so as to obtain a target rendering pipeline; wherein, when a new camera instruction for the target rendering pipeline is received, identify whether the new camera indicated by the new camera instruction is a UI camera; if the new camera is a UI camera, add the new camera to the end of a camera stack of the target rendering pipeline; if the new camera is not a UI camera, insert the new camera before the UI camera in the camera stack of the target rendering pipeline; Acquire three-dimensional scene resource data and interface UI material data corresponding to the target game scene, wherein the color space of the three-dimensional scene resource data is a linear space, and the color space of the interface UI material data is a gamma space; Writing the 3D scene resource data into a 3D image cache of a target rendering pipeline, and rendering the 3D scene resource data in the 3D image cache through a 3D rendering channel of the target rendering pipeline to obtain 3D image cache data in a linear space; The color space of the three-dimensional image cache data is converted into a gamma space through the first conversion channel, and the color space of the interface UI material data is converted into a linear space, the interface UI material data is reversely corrected in the linear space, and the reversely corrected interface UI material data is sampled so that the sampled interface UI material data is converted back to the gamma space; the three-dimensional image cache data in the gamma space and the sampled interface UI material data are placed in a UI cache, and UI rendering is performed on the three-dimensional image cache data and the interface UI material data in the UI cache through the UI rendering channel of the target rendering pipeline; The color space of the UI rendering result is converted into a linear space through the second conversion channel.

2. The method according to claim 1, characterized in that After converting the color space of the UI rendering result into the linear space through the second conversion channel, the method further includes: Based on the UI rendering results in linear space, the game image containing three-dimensional scene resources and interface UI materials is displayed.

3. The method according to claim 1, characterized in that The three-dimensional image cache data in the linear space obtained by the three-dimensional rendering channel is in a first data format; the three-dimensional image cache data in the gamma space obtained by the first conversion channel is in a second data format; The UI rendering result in the linear space obtained through the second conversion channel is in a third data format.

4. The method according to claim 1, characterized in that: The obtaining of the three-dimensional scene resource data and the interface UI material data corresponding to the target game scene specifically includes: Traversing the three-dimensional scene objects in the target game scene, and acquiring the three-dimensional scene resource data corresponding to the three-dimensional scene objects; Traverse the UI canvas object corresponding to the target game scene, and obtain the interface UI material data corresponding to the UI canvas object.

5. A game image processing device, characterized in that: include: A pipeline transformation module is used to determine a universal rendering pipeline in a game engine, add a first conversion channel for converting a color space from a linear space to a gamma space after a three-dimensional rendering channel of the universal rendering pipeline, and add a second conversion channel for converting a color space from a gamma space to a linear space after a UI rendering channel of the universal rendering pipeline, so as to obtain a target rendering pipeline; wherein, when a new camera instruction for the target rendering pipeline is received, it is identified whether the new camera indicated by the new camera instruction is a UI camera; if the new camera is a UI camera, the new camera is added to the end of a camera stack of the target rendering pipeline; if the new camera is not a UI camera, the new camera is inserted before the UI camera in the camera stack of the target rendering pipeline; A data acquisition module, used to acquire the three-dimensional scene resource data and the interface UI material data corresponding to the target game scene, wherein the color space of the three-dimensional scene resource data is a linear space, and the color space of the interface UI material data is a gamma space; A first rendering module, configured to write the 3D scene resource data into a 3D image cache of a target rendering pipeline, and render the 3D scene resource data in the 3D image cache through a 3D rendering channel of the target rendering pipeline to obtain 3D image cache data in a linear space; A second rendering module is used to convert the color space of the three-dimensional image cache data into a gamma space through the first conversion channel, convert the color space of the interface UI material data into a linear space, perform inverse correction on the interface UI material data in the linear space, sample the inversely corrected interface UI material data so that the sampled interface UI material data is converted back to the gamma space; put the three-dimensional image cache data in the gamma space and the sampled interface UI material data into a UI cache, perform UI rendering on the three-dimensional image cache data and the interface UI material data in the UI cache through the UI rendering channel of the target rendering pipeline; and convert the color space of the UI rendering result to a linear space through the second conversion channel.

6. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.

7. A computer device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Image processing method and device, storage medium and computer equipment

    CN114307143A

  • Image processing method and device, storage medium and computer equipment

    CN114307144A