A method and apparatus for preserving the original colors of textures
By performing inverse tone mapping on texture data during HDR rendering, the problem of incomplete texture color display is solved, achieving the goal of saving manpower and time while maintaining rendering realism and glow effects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-12
- Publication Date
- 2026-03-06
AI Technical Summary
During HDR rendering, texture colors cannot be fully displayed, resulting in a significant difference between the processed image and the scene colors. This requires artists to modify the texture colors, increasing manpower costs and operational complexity.
By acquiring the texture data of the target to be rendered, performing an inverse tone mapping transformation, the texture data after inverse tone mapping is obtained, and then tone mapping it to low dynamic range in the high dynamic range pipeline. The inverse tone mapping transformation is implemented using Newton's iteration method, preserving the original texture colors.
It effectively saves manpower and time, maintains the realism of the rendering process, and does not change the rendering workflow. It can continue to enable the glow effect to ensure the realism of the rendered target.
Smart Images

Figure CN115272554B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of game rendering technology, and in particular to a method and apparatus for preserving the original colors of textures. Background Technology
[0002] HDR (High Dynamic Range) rendering uses a non-linear tone map to map the lighting on the display based on the scene's contrast, thus preserving as much detail as possible in terms of contrast. However, in the HDR pipeline, the tone mapping process can cause textures to fail to display their true colors, resulting in a significant difference between the processed and final colors in the scene. Currently, eliminating this color difference requires artists to modify the texture colors again, which is not only tedious but also significantly increases labor costs. Summary of the Invention
[0003] In view of the above problems, the present invention is proposed to provide a method and apparatus for preserving the original texture color to overcome or at least partially solve the above problems. The solution of the present invention not only effectively saves art-related personnel from the work process of modifying textures in the rendering process of high dynamic range pipeline, greatly saving manpower and time, but also only affects the transformation of texture data in the entire rendering process without changing the entire rendering process. It can continue to preserve the glow effect of the target to be rendered, and ensure the rendering realism of the target to be rendered.
[0004] According to one aspect of the present invention, a method for preserving the original color of a texture is provided, comprising:
[0005] Obtain the texture data of the target to be rendered, and perform an inverse tone mapping transformation on the texture data that needs to retain the original color to obtain the texture data after inverse tone mapping;
[0006] Apply the texture data after inverse tone mapping to the target to be rendered;
[0007] In the high dynamic range pipeline, the texture data after inverse tone mapping is tone-mapped to low dynamic range.
[0008] Optionally, an inverse tone mapping transformation is performed on the texture data that needs to retain its original colors, including:
[0009] The inverse hue mapping transformation function is obtained by iterating the gradient original function result and the parameter gradient value multiple times based on Newton's iteration method.
[0010] The inverse tone mapping transformation function is used to perform an inverse tone mapping transformation on the texture data that needs to retain its original color.
[0011] Optionally, the inverse tone mapping transformation function is obtained by iterating the gradient original function result and the parameter gradient values multiple times based on Newton's iteration method, including:
[0012] Define the number of iterations and the precision error threshold so that the iteration loop is skipped when the number of iterations or the precision error threshold is exceeded during the iteration process;
[0013] Based on the Newton iteration method, a gradient calculation process, a new parameter obtained by calculating the gradient primitive function, and an error evaluation calculation process are added to the iteration loop to obtain the inverse transformation function of tone mapping.
[0014] Optionally, a gradient calculation process is added to the iteration loop according to the Newton iteration method, including:
[0015] Define the minimum of partial derivatives;
[0016] Based on the minimum value of the partial derivative, a partial derivative calculation is added to the iterative loop, and a gradient calculation process is added according to the method of partial derivative calculation.
[0017] Optionally, based on the Newton iteration method, a new parameter calculated using the gradient antiderivative and an error evaluation calculation process are added to the iteration loop, including:
[0018] The new parameters needed for the next iteration and the current offset are calculated based on the partial derivatives of the current gradient; wherein the new parameters include linear color parameters;
[0019] The new parameters are used as input parameters for the next iteration. The new parameters and the next offset are calculated using the partial derivatives of the next gradient. This process continues until the number of iterations is exceeded or the offset exceeds the accuracy error threshold, at which point the iteration is skipped.
[0020] Optionally, after obtaining the inverse tone mapping transformation function by iterating the gradient original function result and parameter gradient value multiple times based on Newton's iteration method, the method further includes: adding the inverse tone mapping transformation function attribute to the texture editor and enabling the inverse tone mapping transformation function;
[0021] Performing an inverse tone mapping transformation on texture data that needs to retain its original color using the inverse tone mapping transformation function includes: in response to detecting that the texture editor has enabled the inverse tone mapping transformation function, performing an inverse tone mapping transformation on texture data that needs to retain its original color using the inverse tone mapping transformation function.
[0022] Optionally, applying the inverse tone-mapped texture data to the target to be rendered includes:
[0023] The texture color after the inverse tone mapping is superimposed on the target to be rendered;
[0024] The target to be rendered, which has the texture color superimposed with the inverse tone mapping, is directly output to the scene color.
[0025] Optionally, after toning the inverse-tone mapped texture data to low dynamic range in the high dynamic range pipeline, the method further includes:
[0026] Render a glow effect on the target to be rendered in the high dynamic range pipeline;
[0027] The glow effect of the target to be rendered is superimposed with the tone mapping result, and the superimposed target to be rendered is output to the target scene.
[0028] Optionally, the target scenario includes: a model loading interface or a skill tree interface.
[0029] According to another aspect of the present invention, an apparatus for preserving the original color of a texture is also provided, comprising:
[0030] The inverse transform module is suitable for obtaining the texture data of the target to be rendered. It performs an inverse tone mapping transformation on the texture data that needs to retain the original color to obtain the texture data after inverse tone mapping.
[0031] Application module, adapted to apply the texture data after inverse tone mapping to the target to be rendered;
[0032] A tone mapping module is adapted to tone map the inverse tone-mapped texture data to a low dynamic range in a high dynamic range pipeline.
[0033] According to another aspect of the present invention, a computer storage medium is also provided, the computer storage medium storing computer program code, which, when run on a computing device, causes the computing device to perform the method for preserving texture primary colors as described in any of the preceding embodiments.
[0034] According to another aspect of the present invention, a computing device is also provided, comprising: a processor; a memory storing computer program code; and, when the computer program code is executed by the processor, causing the computing device to perform the method for preserving texture primary colors as described in any of the preceding embodiments.
[0035] In this embodiment of the invention, the texture data of the target to be rendered is first obtained. An inverse tone mapping transformation is performed on the texture data whose original colors need to be preserved, resulting in inversely tone-mapped texture data. Then, the inversely tone-mapped texture data is applied to the target to be rendered, thereby enabling the inversely tone-mapped texture data to be tone-mapped to a low dynamic range in the high dynamic range pipeline. This invention performs an inverse tone mapping transformation on the texture data that needs to retain its original colors without modifying the high dynamic range rendering pipeline itself. This effectively eliminates the need for artists to modify textures during the high dynamic range rendering process, significantly saving manpower and time. Furthermore, it only affects the transformation of the texture data throughout the rendering process, without altering the overall rendering flow. This allows the target to retain its original colors and effectively enable glow effects, ensuring the realism of the rendered target.
[0036] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below.
[0037] The above and other objects, advantages and features of the present invention will become more apparent to those skilled in the art from the following detailed description of specific embodiments of the invention in conjunction with the accompanying drawings. Attached Figure Description
[0038] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this invention, illustrate exemplary embodiments of the invention and are used to explain the invention, but do not constitute an undue limitation of the invention. In the drawings:
[0039] Figure 1 A flowchart illustrating a method for preserving the original colors of a texture according to an embodiment of the present invention is shown;
[0040] Figure 2 A schematic diagram of a device for preserving the original color of a texture according to an embodiment of the present invention is shown;
[0041] Figure 3 A schematic diagram of a device for preserving the original color of a texture according to another embodiment of the present invention is shown;
[0042] Figure 4 A schematic diagram of a device for preserving the original color of a texture according to another embodiment of the present invention is shown. Detailed Implementation
[0043] Exemplary embodiments of the invention will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this invention will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
[0044] To address the aforementioned technical problems, embodiments of the present invention provide a method for preserving the original color of textures. Figure 1 A flowchart illustrating a method for preserving the original texture colors according to an embodiment of the present invention is shown. See also... Figure 1 The method for preserving the original color of the texture includes steps S102 to S106.
[0045] Step S102: Obtain the texture data of the target to be rendered, and perform an inverse tone mapping transformation on the texture data that needs to retain the original color to obtain the texture data after inverse tone mapping.
[0046] The primary colors of a typical texture are in the range of [0,1], while the texture colors obtained after the inverse transformation of tone mapping in this embodiment of the invention are also in the range of [0,1].
[0047] Step S104: Apply the texture data after inverse tone mapping to the target to be rendered.
[0048] Step S106: In the high dynamic range pipeline, tone map the texture data after inverse tone mapping to low dynamic range.
[0049] The High Dynamic Range (HDR) pipeline can perfectly preserve the lighting and texture information of the high dynamic range. It can map the high dynamic range lighting results onto the screen and use its limited dynamic range to fully express the contrast of the picture. Every part can show the details and brightness that should be there, which greatly improves the picture performance.
[0050] Although the High Dynamic Range (HDL) pipeline can accurately reflect real-world scenes, the data of the same size in the HDL pipeline is larger than that in the Low Dynamic Range (LDR) pipeline, requiring more storage space and bandwidth. Furthermore, typical LDR display devices can only discretize color channels to 8 bits, with only 255 levels in the color space, resulting in a limited range of colors that can be displayed. Therefore, HDL textures cannot be directly and completely displayed on LDR display devices. To enable HDL textures to be compatiblely displayed on LDR display devices, this invention uses tone mapping to compress the texture data in the HDL pipeline, reducing the dynamic range of the texture data to that of the Low Dynamic Range (LDR), thus allowing HDL texture data to adapt to low dynamic range displays.
[0051] This invention first acquires the texture data of the target to be rendered. Then, it performs an inverse tone mapping transformation on the texture data whose original colors need to be preserved, obtaining the texture data after inverse tone mapping (InverseTonemap). Next, this InverseTonemap texture data is applied to the target to be rendered. This allows the texture data to be tone-mapped to a low dynamic range (LVR) in the high dynamic range pipeline. By performing an inverse tone mapping transformation on the texture data that needs to retain its original colors, without modifying the LVR rendering pipeline itself, this invention effectively eliminates the need for artists to modify textures during the LVR rendering process, significantly saving manpower and time. Furthermore, since the entire rendering process only affects the texture data transformation and does not alter the overall rendering flow, the rendering of the target can still effectively enable glow effects, ensuring the realism of the rendered target.
[0052] Referring to step S102 above, in one embodiment of the present invention, to ensure that the color displayed by the target to be rendered after image processing is not significantly different from the final color in the scene, and without needing to shut down the high dynamic range rendering pipeline, the original color of the target to be rendered can be restored by modifying the texture data. This embodiment first performs an inverse transformation of tone mapping on the texture data that needs to retain its original color to counteract the influence of tone mapping during subsequent high dynamic range rendering, thereby preventing the texture color of the target to be rendered from being affected by the tone mapping function in the high dynamic range rendering process.
[0053] Since the parameters (such as color parameters) and values (such as color values) of a tone mapping function are not in one-to-one correspondence, multiple parameters will become the same value after tone mapping. Therefore, the inverse function cannot be directly obtained from the tone mapping function. Newton's iteration method, also known as the Newton-Raphson method, is a method for approximating the solution of equations in the real and complex number domains. The embodiments of this invention can realize the inverse tone mapping transformation based on Newton's iteration method.
[0054] Specifically, when performing the inverse tone mapping transformation on texture data that needs to retain its original colors, the inverse tone mapping transformation function is first obtained by iterating the original gradient function result and parameter gradient values multiple times using Newton's iteration method. In other words, Newton's iteration method approximates the result of the inverse tone mapping transformation function by iterating the original function result and parameter gradient values multiple times. Then, the inverse tone mapping transformation is performed on the texture data that needs to retain its original colors using the inverse tone mapping transformation function.
[0055] In an optional embodiment, during the process of obtaining the inverse tone mapping transform function by iterating the gradient primitive function result and parameter gradient values multiple times based on Newton's iteration method, the number of iterations and a precision error threshold can be defined first, so that the iteration loop is skipped when the number of iterations or the precision error threshold is exceeded. Then, according to Newton's iteration method, a gradient calculation process, a new parameter calculated through the gradient primitive function, and an error evaluation calculation process are added to the iteration loop, thereby obtaining the inverse tone mapping transform function.
[0056] The inverse tone mapping transform function is written in the form of Newton's iteration method. It approximates the result of the inverse tone mapping transform function by performing multiple iterations using the result of the original function and the gradient values of the parameters. The pseudocode for implementing the inverse tone mapping transform function can include the following:
[0057]
[0058]
[0059] This embodiment reimplements the Tonemap algorithm in the shader on the central processing unit using C++. In this embodiment, the MaxIter parameter in the pseudocode represents the defined number of iterations, used to control the maximum number of iterations. This embodiment defines 6 iterations, but other iteration numbers can be set. The MaxBiasSq parameter represents the defined precision error threshold to ensure data accuracy. By defining the number of iterations and the precision error threshold, it is ensured that the iteration loop is skipped if either the number of iterations or the precision error threshold is exceeded during the iteration process.
[0060] In this embodiment, a gradient calculation process is added to the iteration loop based on Newton's iteration method. First, a minimum partial derivative is defined. The Delta parameter, defined in the pseudocode above, is used to calculate the partial derivative. Then, based on the Delta minimum, partial derivative calculation is added to the iteration loop. The gradient calculation process is added according to the method of adding partial derivative calculation. In this embodiment, the partial derivative of the Tonemap function is calculated using PD = (FilmTonemap(OutColor+vDelta)-Fx) / Delta in the pseudocode above. Here, the Tonemap function is a tone mapping function.
[0061] This embodiment also incorporates a new parameter calculation and error evaluation process, obtained through the gradient antiderivative, into the iteration loop based on Newton's iteration method. First, the new parameters and the current offset are calculated based on the partial derivatives of the current gradient. Then, the obtained new parameters are used as input parameters for the next iteration loop, and the calculation of the new parameters and the next offset for the next iteration loop continues, using the partial derivatives of the next gradient. This process is repeated until the iteration count MaxIter is exceeded or the offset CurBias exceeds the accuracy error threshold MaxBiasSq, at which point the iteration loop is skipped.
[0062] The new parameter here can refer to the linear color parameter Color. In this embodiment, the linear color parameter Color required for the next iteration of the Tonemap function is found by the partial derivative obtained by gradient calculation. Then, the obtained linear color parameter Color is used to calculate the linear color parameter Color required for the next iteration of the Tonemap function, thereby realizing cyclic iteration. The linear color parameter Color here is a parameter located in the interval [0,1].
[0063] In this embodiment of the invention, the calculation process of CurBias = dot(PD, PD) in the pseudocode above is used to calculate the current offset, which is to realize the error evaluation calculation process. If the current offset CurBias > the maximum offset MaxBiasSq, the iteration loop can continue. If the current offset CurBias > the maximum offset MaxBiasSq is not satisfied, that is, the current offset exceeds the precision error threshold, the current iteration loop will be exited.
[0064] Of course, the pseudocode above is only an example of code applied to the UE4 (Unreal Engine 4) engine. The tone mapping function used for different engines will be slightly different. Furthermore, the overall pseudocode of the InverseFilmTonemap function is only an example of code, and this embodiment of the invention does not make any specific limitations on it.
[0065] The inverse tone mapping transformation function has been obtained using the above example. Next, the Inverse Tone Map property can be added to the texture editor. After adding the Inverse Tone Map property, if the Inverse Tone Map property is enabled, the inverse tone mapping transformation can be performed on the texture color.
[0066] In this embodiment of the invention, after obtaining the inverse tone mapping function by iterating the gradient primitive function result and parameter gradient values multiple times based on Newton's iteration method, an inverse tone mapping function attribute can be added to the texture editor to enable the inverse tone mapping function. Furthermore, during the process of performing the inverse tone mapping transformation on texture data that needs to retain its original color using the inverse tone mapping transformation function, if it detects that the texture editor has enabled the inverse tone mapping transformation function, the inverse tone mapping transformation can be performed on the texture data that needs to retain its original color using the inverse tone mapping transformation function.
[0067] In this embodiment, if the Inverse Tonemap function is enabled, the game system can perform an inverse tone map conversion process for each color in the texture of the target to be rendered.
[0068] Referring to step S104 above, in one embodiment of the present invention, in the process of applying the texture data after inverse tone mapping to the target to be rendered, the texture color after inverse tone mapping can be superimposed on the target to be rendered first, and then the target to be rendered with the superimposed texture color after inverse tone mapping is output to the scene color.
[0069] Therefore, after performing inverse tone mapping on the texture data, the material of the target to be rendered can use the texture data after inverse tone mapping. Furthermore, the target to be rendered, with the texture color superimposed with the inverse tone mapping, can be output to the scene color. Then, in step S106, the scene color can be processed in the High Dynamic Range (HDR) pipeline, that is, the inverse tone-mapped texture data is tone-mapped to Low Dynamic Range in the HDR pipeline.
[0070] During the process of mapping texture colors to low dynamic range, since the texture colors have already undergone the inverse transformation of tone mapping, the texture colors will approach the original colors of the textures when the inverse tone-mapped texture data is tone-mapped to low dynamic range in the high dynamic range (HDR) pipeline. That is, the inverse transformation operation plus the forward tone mapping operation will cancel out the two operations, thus effectively preserving the original colors of the textures.
[0071] Since the embodiments of the present invention perform an inverse tone mapping operation on the texture data that needs to retain the original color, rather than modifying the rendering pipeline, the function of still being able to enable the Bloom effect in the game interface can be effectively preserved.
[0072] Specifically, after performing step S106 to tone-map the texture data after inverse tone mapping to low dynamic range in the high dynamic range pipeline, a glow effect can also be rendered on the target to be rendered in the high dynamic range pipeline, thereby superimposing the glow effect of the target to be rendered with the tone mapping result, and outputting the superimposed target to be rendered to the target scene.
[0073] Therefore, the final rendering result of the target to be rendered using the embodiments of the present invention can effectively reflect the glow effect, thereby making the final game interface more realistic and improving the rendering realism of the target to be rendered.
[0074] In games, interfaces such as skill tree settings, model loading, and map selection are frequently used. These interfaces often require multiple layers, particle effects, and other visual elements to enhance their appearance. Multiple layers are also needed to simulate depth, and effects with glow are required. The target scene in this embodiment of the invention can be a model loading interface or a skill tree interface. This type of interface uses a standard high dynamic range (HDR) rendering environment. The scene model uses a no-lighting mode, and directly outputting texture colors to the scene will be affected by the tone map in HDR.
[0075] For example, during the loading of an interface containing a physical model, where the model includes a metallic material, the process begins by acquiring the texture color of the metallic material in the model to be rendered. Then, an inverse tone mapping transformation is performed on the texture color that needs to retain its original color to obtain the inverse tone-mapped texture color of the metallic material. This inverse tone-mapped texture color is then overlaid onto the metallic material in the physical model, and the physical model with the overlaid inverse tone-mapped texture color is directly output to the scene color. The scene color is then processed in the High Dynamic Range (HDR) pipeline, specifically by toning the inverse tone-mapped texture color to a low dynamic range (LVR) range. By toning the inverse tone-mapped texture data to a LVR range in the HDR pipeline, the original texture color is effectively preserved, resulting in a more realistic texture effect for the metallic material and a more lifelike physical model in the loading interface. More importantly, this process does not alter the overall rendering flow.
[0076] In this embodiment, the primary texture color is in the range [0,1], and the texture color value after inverse tone mapping is also in the range [0,1]. Therefore, the texture color can be in floating-point format or other formats. When the texture data after inverse tone mapping is toned to low dynamic range in the high dynamic range (HDR) pipeline, the rendering target in the scene uses floating-point format because it is in the HDR pipeline.
[0077] This invention employs an inverse tone mapping transformation function to perform an inverse tone mapping transformation on texture data that needs to retain its original color. The inverse tone mapping is used as a color conversion, and the texture data that needs to retain its original color is pre-converted. Then, in the high dynamic range pipeline, the texture data after inverse tone mapping is tone-mapped to the low dynamic range. Throughout the process, the inverse tone mapping function only affects the texture and does not change the rendering process. Moreover, it can still retain the glow effect of the target to be rendered, ensuring the rendering realism of the target.
[0078] Based on the same inventive concept, embodiments of the present invention also provide a device for preserving the original color of a texture. Figure 2 A schematic diagram of a device for preserving the original colors of textures according to an embodiment of the present invention is shown. See also Figure 2 The device for preserving the original texture colors includes an inverse transformation module 201, an application module 202, and a tone mapping module 203.
[0079] The inverse transformation module 201 is suitable for obtaining the texture data of the target to be rendered, performing an inverse transformation of tone mapping on the texture data that needs to retain the original color, and obtaining the texture data after inverse tone mapping.
[0080] Application module 202 is suitable for applying the texture data after inverse tone mapping to the target to be rendered;
[0081] The tone mapping module 203 is adapted to tone map inverse tone-mapped texture data to low dynamic range in a high dynamic range pipeline.
[0082] In an optional embodiment of the present invention, the inverse transformation module 201 is further adapted to perform multiple iterations of the gradient original function result and parameter gradient value based on the Newton iteration method to obtain the tone mapping inverse transformation function; and to perform the tone mapping inverse transformation on the texture data that needs to retain the original color through the tone mapping inverse transformation function.
[0083] In an optional embodiment of the present invention, the inverse transformation module 201 is further adapted to define the number of iterations and the precision error threshold so that the iteration loop is skipped when the number of iterations or the precision error threshold is exceeded during the iteration process; according to Newton's iteration method, a gradient calculation process, a new parameter calculated by the gradient primitive function, and an error evaluation calculation process are added to the iteration loop to obtain the tone mapping inverse transformation function.
[0084] In an optional embodiment of the present invention, the inverse transformation module 201 is further adapted to define a partial derivative minimum; add partial derivative calculation in the iterative loop based on the partial derivative minimum, and add gradient calculation process according to the method of partial derivative calculation.
[0085] In an optional embodiment of the present invention, the inverse transformation module 201 is further adapted to calculate the new parameters and the current offset required for the next iteration loop based on the partial derivatives calculated from the current gradient; wherein the new parameters include linear color parameters; the obtained new parameters are used as input parameters for the next iteration loop, and the new parameters and the next offset required for the next iteration loop are calculated again based on the partial derivatives calculated from the next gradient, and so on, until the number of iterations is exceeded or the offset exceeds the accuracy error threshold, at which point the iteration loop is skipped.
[0086] See Figure 3 In an optional embodiment of the present invention, the device for preserving the original texture color further includes an adding module 204.
[0087] Add module 204, which is suitable for adding the inverse tone mapping transformation function attribute to the texture editor after the inverse transformation module 201 obtains the inverse tone mapping transformation function by iterating the gradient original function result and parameter gradient value multiple times based on Newton's iteration method. This enables the inverse tone mapping transformation function.
[0088] The inverse transformation module 201 is also adapted to, in response to detecting that the texture editor has enabled the inverse tone mapping transformation function, perform an inverse tone mapping transformation on the texture data that needs to retain the original color through the inverse tone mapping transformation function.
[0089] In an optional embodiment of the present invention, the application module 202 is further adapted to superimpose the texture color after inverse tone mapping onto the target to be rendered; and directly output the target to be rendered with the superimposed texture color after inverse tone mapping to the scene color.
[0090] See Figure 4 In an optional embodiment of the present invention, the device for preserving the original texture color further includes a glow rendering module 205 and an output module 206.
[0091] The glow rendering module 205 is adapted to render glow effects on the target to be rendered in the high dynamic range pipeline after the tone mapping module 203 has tone-mapped the texture data after inverse tone mapping to low dynamic range in the high dynamic range pipeline.
[0092] Output module 206 is suitable for overlaying the glow effect of the target to be rendered with the tone mapping result, and outputting the overlaid target to be rendered to the target scene.
[0093] In an optional embodiment of the present invention, the target scene includes a loading model interface or a skill tree interface.
[0094] Those skilled in the art will clearly understand that the specific working process of the systems, devices, modules and units described above can be referred to the corresponding process in the foregoing method embodiments. For the sake of brevity, it will not be repeated here.
[0095] Furthermore, the functional units in the various embodiments of the present invention can be physically independent of each other, or two or more functional units can be integrated together, or all functional units can be integrated into one processing unit. The integrated functional units described above can be implemented in hardware, or in software or firmware.
[0096] Those skilled in the art will understand that if the integrated functional unit is implemented in software and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or all or part of it, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computing device (e.g., a personal computer, server, or network device) to execute all or part of the steps of the methods described in the embodiments of the present invention when running the instructions. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0097] Alternatively, all or part of the steps of the foregoing method embodiments can be implemented by hardware (such as a computing device, personal computer, server, or network device) related to program instructions. The program instructions can be stored in a computer-readable storage medium. When the program instructions are executed by the processor of the computing device, the computing device executes all or part of the steps of the methods described in the various embodiments of the present invention.
[0098] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that within the spirit and principles of the present invention, modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein; and these modifications or substitutions do not cause the corresponding technical solutions to depart from the protection scope of the present invention.
Claims
1. A method of preserving texture primaries, characterized by, The method comprises: obtaining texture data of a target to be rendered, and performing inverse tone mapping on the texture data of which the original color needs to be preserved to obtain inverse tone-mapped texture data; wherein the inverse tone mapping on the texture data of which the original color needs to be preserved comprises: performing multiple iterations on a gradient original function result and a parameter gradient value based on a Newton iteration method to obtain a tone mapping inverse transformation function, and performing inverse tone mapping on the texture data of which the original color needs to be preserved by using the tone mapping inverse transformation function; and after the tone mapping inverse transformation function is obtained by performing multiple iterations on the gradient original function result and the parameter gradient value based on the Newton iteration method, the method further comprises: adding the tone mapping inverse transformation function attribute on a texture editor, enabling the tone mapping inverse transformation function, and in response to detecting that the texture editor has enabled the tone mapping inverse transformation function, performing inverse tone mapping on the texture data of which the original color needs to be preserved by using the tone mapping inverse transformation function; applying the inverse tone-mapped texture data to the target to be rendered; and tone mapping the inverse tone-mapped texture data to a low dynamic range in a high dynamic range pipeline.
2. The method of claim 1, wherein, The method of performing multiple iterations on a gradient original function result and a parameter gradient value based on a Newton iteration method to obtain a tone mapping inverse transformation function comprises: defining an iteration number and an accuracy error threshold value, so that the iteration loop is skipped when the iteration number or the accuracy error threshold value is exceeded in the iteration process; adding a gradient calculation process, a new parameter calculated by a gradient original function, and an error evaluation calculation process in the iteration loop according to the Newton iteration method to obtain the tone mapping inverse transformation function.
3. The method of claim 2, wherein, The method of adding a gradient calculation process in the iteration loop according to the Newton iteration method comprises: defining a partial derivative minimum value; adding a partial derivative calculation in the iteration loop based on the partial derivative minimum value, and adding the gradient calculation process according to the partial derivative calculation.
4. The method of claim 3, wherein, The method of adding a new parameter calculated by a gradient original function and an error evaluation calculation process in the iteration loop according to the Newton iteration method comprises: calculating a new parameter and a current offset required for a next iteration loop according to a partial derivative calculated by a current gradient; wherein the new parameter comprises a linear color parameter; using the obtained new parameter as an input parameter for a next iteration loop, and continuing to calculate a new parameter and a next offset required for a next iteration loop according to a partial derivative calculated by a next gradient, and so on, until the iteration number or the offset exceeds the accuracy error threshold value, and the iteration loop is skipped.
5. The method of claim 1, wherein, The method of applying the inverse tone-mapped texture data to the target to be rendered comprises: superimposing the inverse tone-mapped texture color on the target to be rendered; and outputting the target to be rendered with the inverse tone-mapped texture color directly to a scene color.
6. The method of claim 1, wherein, After the inverse tone-mapped texture data is tone mapped to a low dynamic range in a high dynamic range pipeline, the method further comprises: rendering a glow effect on the target to be rendered in the high dynamic range pipeline; superimposing the glow effect of the target to be rendered and the tone mapping result, and outputting the superimposed target to be rendered to a target scene.
7. The method of claim 6, wherein The target scene includes a model loading interface or a skill tree interface.
8. An apparatus for preserving texture primaries, characterized by, Comprise: The inverse transform module is suitable for obtaining the texture data of the target to be rendered, and performing inverse tone mapping on the texture data which needs to retain the original color to obtain inverse tone-mapped texture data; wherein the inverse tone mapping on the texture data which needs to retain the original color comprises: based on Newton iteration method, the gradient original function result and the parameter gradient value are iterated multiple times to obtain a tone mapping inverse transform function, and the tone mapping inverse transform function is used to perform inverse tone mapping on the texture data which needs to retain the original color; and after the tone mapping inverse transform function is obtained by iterated multiple times based on Newton iteration method, the tone mapping inverse transform function attribute is added on the texture editor, the tone mapping inverse transform function is turned on, and in response to detecting that the texture editor has turned on the tone mapping inverse transform function, the tone mapping inverse transform function is used to perform inverse tone mapping on the texture data which needs to retain the original color; The application module is suitable for applying the inverse tone-mapped texture data on the target to be rendered; The tone mapping module is suitable for tone mapping the inverse tone-mapped texture data to low dynamic range in a high dynamic range pipeline.
Citation Information
Patent Citations
Image enhancement method and device
CN114511479A