CN113450440A - Method and device for rendering image, computer readable storage medium and electronic equipment - Google Patents

Method and device for rendering image, computer readable storage medium and electronic equipment Download PDF

Info

Publication number
CN113450440A
CN113450440A CN202110694611.0A CN202110694611A CN113450440A CN 113450440 A CN113450440 A CN 113450440A CN 202110694611 A CN202110694611 A CN 202110694611A CN 113450440 A CN113450440 A CN 113450440A
Authority
CN
China
Prior art keywords
color
image
color information
lookup table
rendered
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110694611.0A
Other languages
Chinese (zh)
Other versions
CN113450440B (en
Inventor
王凯
阮浩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202110694611.0A priority Critical patent/CN113450440B/en
Publication of CN113450440A publication Critical patent/CN113450440A/en
Application granted granted Critical
Publication of CN113450440B publication Critical patent/CN113450440B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9017Indexing; Data structures therefor; Storage structures using directory or table look-up
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T13/00Animation
    • G06T13/203D [Three Dimensional] animation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses a method and a device for rendering an image, a computer readable storage medium and an electronic device. Wherein, the method comprises the following steps: acquiring an image to be rendered; determining target color information corresponding to an image to be rendered based on a preset color lookup table, wherein the color lookup table at least comprises: index identification and target color information corresponding to the image to be rendered, and incidence relation between the target color information and the index identification; and adjusting initial color information corresponding to the image to be rendered based on the target color information to obtain the target image. The invention solves the technical problem of inconsistent rendering results of the images.

Description

Method and device for rendering image, computer readable storage medium and electronic equipment
Technical Field
The present invention relates to the field of image processing, and in particular, to a method and an apparatus for rendering an image, a computer-readable storage medium, and an electronic device.
Background
At present, in the manufacturing process of Computer animation (Computer Graphics, abbreviated as CG), layered rendering is an essential link, and the sequence after layered rendering is further processed by post-synthesis software, so as to obtain a better effect. In addition, on the one hand, the layering rendering is easy to adjust, color correction and later-stage effect addition are facilitated, on the other hand, along with the fact that the quality of real-time rendering is greatly improved in recent years, some game engines gradually enter the CG manufacturing field. However, the existing game engine has a limitation on supporting layered rendering, for example, in order to ensure enough adjustment space during post-synthesis, the image output by the existing game engine to the post-synthesis stage must have a high dynamic range, however, the high dynamic range image is reduced to a low dynamic range after being subjected to tone mapping by the existing game engine, so that the tone mapping (Tonemap) algorithm of the game engine cannot be accurately reproduced in the post-synthesis software (the algorithm is a computer graphics technology for approximately displaying the high dynamic range image on a limited dynamic range medium). Moreover, the existing later-stage synthesis software is provided with respective color adjustment algorithms, and the color adjustment algorithms are different from the color adjustment algorithm result of the existing game engine, so that the final image rendering result is inconsistent with the real-time rendering result, and the result of rendering the image is inconsistent.
In view of the problem of inconsistent rendering results of the images, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the invention provides a method and a device for rendering an image, a computer-readable storage medium and electronic equipment, which are used for at least solving the technical problem of inconsistent rendering results of the image.
According to an aspect of an embodiment of the present invention, there is provided a method of rendering an image, including: acquiring an image to be rendered; determining target color information corresponding to an image to be rendered based on a preset color lookup table, wherein the color lookup table at least comprises: index identification and target color information corresponding to the image to be rendered, and incidence relation between the target color information and the index identification; and adjusting initial color information corresponding to the image to be rendered based on the target color information to obtain the target image.
Optionally, before determining the target color information corresponding to the image to be rendered based on a preset color lookup table, the method further includes: and performing initialization operation on the rendering environment of the game engine, wherein the initialization operation prohibits the game engine from performing color adjustment on the image to be rendered based on the pixel position of the image to be rendered.
Optionally, the preset color lookup table includes: the first color lookup table and the second color lookup table determine target color information corresponding to the image to be rendered based on a preset color lookup table, and the method comprises the following steps: mapping the initial color information of the image to be rendered from the first color range to the second color range based on the first color lookup table to obtain first color information; the first color information is mapped to target color information based on a second color lookup table.
Optionally, the first color lookup table is a one-dimensional color table, and the first color lookup table is used to convert the initial color information from a linear space to a logarithmic space; the second color lookup table is a three-dimensional color table, and the second color lookup table is used for converting the first color information from a logarithmic space to a linear space.
Optionally, before mapping the initial color information of the image to be rendered from the first color range into the second color range based on the first color lookup table, the method further includes: carrying out logarithm operation on the first color range to obtain a first result; calculating a logarithmic value corresponding to a preset pixel to obtain an offset value; calculating a first difference between the first result and the offset value to obtain a second result; a first color lookup table is constructed based on the second result.
Optionally, performing a logarithmic operation on the first color range to obtain a first result, including: acquiring a maximum color value and a minimum color value corresponding to the first color range; calculating a second difference value of a first logarithm value corresponding to the maximum color value and a second logarithm value corresponding to the minimum color value; calculating the product of the difference value and the logarithm value of the current pixel value to obtain a third result; calculating the sum of the third result and the second logarithm value to obtain a fourth result; and calculating the inverse logarithm value of the fourth result to obtain the first result.
Optionally, mapping the first color information to the target color information based on a second color lookup table includes: acquiring an index identifier corresponding to the first color information; acquiring second color information corresponding to the index identifier from a second color lookup table; and mapping the second color information in a linear space to obtain target color information.
According to another aspect of the embodiments of the present invention, there is also provided an apparatus for rendering an image, including: the acquisition module is used for acquiring an image to be rendered; a determining module, configured to determine target color information corresponding to an image to be rendered based on a preset color lookup table, where the color lookup table at least includes: index identification and target color information corresponding to the image to be rendered, and incidence relation between the target color information and the index identification; and the adjusting module is used for adjusting the initial color information corresponding to the image to be rendered based on the target color information to obtain the target image.
According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium having a computer program stored therein, wherein the computer program is configured to execute the method for rendering an image according to the embodiments of the present invention when the computer program runs.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including one or more processors; a storage device for storing one or more programs which, when executed by one or more processors, cause the one or more processors to implement a method for executing a program, wherein the program is arranged to perform the method of rendering an image of an embodiment of the invention when executed.
In the embodiment of the invention, the image to be rendered is obtained; determining target color information corresponding to an image to be rendered based on a preset color lookup table, wherein the color lookup table at least comprises: index identification and target color information corresponding to the image to be rendered, and incidence relation between the target color information and the index identification; and adjusting initial color information corresponding to the image to be rendered based on the target color information to obtain the target image. That is to say, the color lookup table at least comprises the index identifier corresponding to the image to be rendered, the target color information and the incidence relation between the target color information and the index identifier, so that the target color information corresponding to the image to be rendered can be determined, the initial color information corresponding to the image to be rendered is adjusted through the target color information, the target image for correct image rendering is obtained, a complex color adjustment algorithm carried by a game engine is avoided, the initial color corresponding to the image to be rendered is adjusted by directly utilizing the color lookup table, the technical effect of accurately rendering the image is achieved, and the technical problem that the rendering results of the image are inconsistent is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
fig. 1 is a block diagram of a hardware configuration of a mobile terminal of a method of rendering an image according to an embodiment of the present invention;
FIG. 2 is a flow diagram of a method of rendering an image according to an embodiment of the invention;
FIG. 3 is a flow chart of a method of converting a color lookup table according to an embodiment of the invention;
FIG. 4 is a characteristic graph of logarithmic space according to an embodiment of the invention;
FIG. 5 is a schematic diagram of a three-dimensional color table according to an embodiment of the invention;
FIG. 6 is a schematic diagram of another three-dimensional color table according to an embodiment of the invention;
FIG. 7 is a schematic illustration of a two-dimensional texture according to an embodiment of the present invention;
FIG. 8 is a diagram illustrating a digital synthesis software calling a three-dimensional color table according to an embodiment of the present invention;
fig. 9 is a schematic diagram of an apparatus for rendering an image according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The method provided by the embodiment of the application can be executed in a mobile terminal, a computer terminal or a similar operation device. Taking the example of being operated on a mobile terminal, fig. 1 is a hardware structure block diagram of the mobile terminal of a method for rendering an image according to an embodiment of the present invention. As shown in fig. 1, the mobile terminal may include one or more (only one shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, and optionally may also include a transmission device 106 for communication functions and an input-output device 108. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration, and does not limit the structure of the mobile terminal. For example, the mobile terminal may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 104 may be used for storing a computer program, for example, a software program and a module of an application software, such as a computer program corresponding to a method for rendering an image according to an embodiment of the present invention, and the processor 102 executes various functional applications and data processing by executing the computer program stored in the memory 104, so as to implement the method. The memory 104 may include high speed random access memory and may also include computer readable memory such as one or more magnetic storage devices, flash memory, or other non-volatile solid state memory. In some instances, the memory 104 may further include memory located remotely from the processor 102, which may be connected to the mobile terminal 10 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a Network adapter (NIC) that can be connected to other Network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used to communicate with the internet in a wireless manner.
FIG. 2 is a flow chart of a method of rendering an image according to an embodiment of the invention. As shown in fig. 2, the method comprises the steps of:
step S202, an image to be rendered is obtained.
In the technical solution provided by step S202 of the present invention, the image to be rendered may be an image that needs to be subjected to image rendering processing and is predetermined by a user.
In the above embodiment, before the image to be rendered is obtained, the rendering environment of the game engine may be preset, and the color adjustment algorithm based on the pixel position in the game engine is closed, so that when the subsequent image to be rendered is processed, the interference of the original color adjustment algorithm in the game engine may be avoided, and the final rendering result is more suitable for the actual rendering result.
Step S204, determining target color information corresponding to the image to be rendered based on a preset color lookup table, wherein the color lookup table at least comprises: index identification and target color information corresponding to the image to be rendered, and the incidence relation between the target color information and the index identification.
In the technical solution provided in step S204 of the present invention, after the image to be rendered is obtained, a Color LookUp Table (LUT for short) may be preset, and the target Color information corresponding to the image to be rendered is determined according to information in the Color LookUp Table, where the Color LookUp Table at least includes an index identifier corresponding to the image to be rendered, the target Color information, and an association relationship between the target Color information and the index identifier.
Alternatively, the color adjustment algorithm in the game engine may be implemented as a black box in this embodiment, which is used to generate the color lookup table, which may be used to map the input colors to the output colors.
And step S206, adjusting the initial color information corresponding to the image to be rendered based on the target color information to obtain the target image.
In the technical solution provided in step S206 of the present invention, after the target color information corresponding to the image to be rendered is determined, the degree of adjustment of the image to be rendered according to the target color information may be determined, and then the initial color information corresponding to the image to be rendered is adjusted, so as to obtain the target image.
Through the steps S202 to S206, the image to be rendered is obtained; determining target color information corresponding to an image to be rendered based on a preset color lookup table, wherein the color lookup table at least comprises: index identification and target color information corresponding to the image to be rendered, and incidence relation between the target color information and the index identification; and adjusting initial color information corresponding to the image to be rendered based on the target color information to obtain the target image. That is to say, the embodiment can determine the target color information corresponding to the image to be rendered by using the color lookup table at least including the index identifier and the target color information corresponding to the image to be rendered and the association relationship between the target color information and the index identifier, so that the initial color information corresponding to the image to be rendered is adjusted by using the target color information to obtain the target image for correct image rendering, thereby avoiding a complex color adjustment algorithm carried by a game engine, realizing the adjustment of the initial color corresponding to the image to be rendered by directly using the color lookup table, realizing the technical effect of accurately rendering the image, and further solving the technical problem of inconsistent rendering results of the image.
The above-described method of this embodiment is further described below.
As an optional implementation manner, before determining the target color information corresponding to the image to be rendered based on the preset color lookup table, the method further includes: and performing initialization operation on the rendering environment of the game engine, wherein the initialization operation prohibits the game engine from performing color adjustment on the image to be rendered based on the pixel position of the image to be rendered.
In this embodiment, before determining the target color information corresponding to the image to be rendered based on the preset color lookup table, since the color lookup table cannot correctly represent the color adjustment effect information based on the pixel position in the game engine, the rendering environment of the game engine may be initialized, and all the color adjustment effects based on the pixel position in the game engine may be removed, so as to prohibit the game engine from performing color adjustment on the image to be rendered based on the pixel position of the image to be rendered.
As an optional implementation, the preset color lookup table includes: the first color lookup table and the second color lookup table determine target color information corresponding to the image to be rendered based on a preset color lookup table, and the method comprises the following steps: mapping the initial color information of the image to be rendered from the first color range to the second color range based on the first color lookup table to obtain first color information; the first color information is mapped to target color information based on a second color lookup table.
In this embodiment, the preset color lookup table may include a first color lookup table and a second color lookup table, where the first color lookup table may be different from the second color lookup table, and the two color lookup tables may process color information of an image to be rendered, where the first color lookup table may map initial color information of the image to be rendered from a first color range to a second color range to obtain first color information, and the second color lookup table may map the obtained first color information to target color information, through which the image to be rendered may be processed.
As an optional implementation manner, the first color lookup table is a one-dimensional color table, and the first color lookup table is used for converting the initial color information from a linear space to a logarithmic space; the second color lookup table is a three-dimensional color table, and the second color lookup table is used for converting the first color information from a logarithmic space to a linear space.
In this embodiment, the first color lookup table may be a one-dimensional color table, and the one-dimensional color table may be configured to convert the initial color information of the image to be rendered from a linear space to a logarithmic space, that is, may map a color value corresponding to the initial color information of the image to be rendered from the linear space to the logarithmic space.
In the above embodiment, the high dynamic range is relatively large and can usually reach 0 to 255 ", but in a general case, in an image after the camera is correctly exposed, most of the luminance value ranges of the pixels fall within the range of 0 to 1, and if uniform color distribution is adopted for mapping, the proportion of the pixel values within the range of 0 to 1 in the pixel values within the range of 0 to 255 is very small, so that the color space is greatly wasted, and therefore, the high dynamic range value can be mapped to the logarithmic space from the linear space.
In this embodiment, the second color lookup table may be a three-dimensional color table, and the three-dimensional color table may be configured to convert the first color information of the image to be rendered from a logarithmic space to a linear space, that is, may convert a color numerical value corresponding to the first color information of the image to be rendered from the logarithmic space to the linear space.
For example, fig. 3 is a flowchart of a method for converting a color lookup table according to an embodiment of the invention. As shown in fig. 3, the one-dimensional color lookup table may convert the initial color information from a linear space to a Log2 space, the three-dimensional color lookup table may convert the first color information from a Log2 space to a linear space, and tone-map the image to be rendered after performing the conversion of the linear space and the Log2 space.
Optionally, the Log space in this embodiment may be a Log2 space, which may also be referred to as Log mapping.
In the above embodiment, since the mapping range adopted in the embodiment is "-8", the color values "0.00390625-1" are mapped to "-8-0" and the color values "1-256" are mapped to "0-8" according to the Log2 function, so that half of the range of the one-dimensional color table retains the color values in the range of "0.00390625-1". Fig. 4 is a characteristic graph of a logarithmic space according to an embodiment of the invention. As shown in FIG. 4, in the Log2 spatial signature curve, half of the values in the range "-4 ~ 4" on the vertical axis are mapped to the range "0 ~ 1" on the horizontal axis.
As an optional implementation, before mapping the initial color information of the image to be rendered from the first color range into the second color range based on the first color lookup table, the method further includes: carrying out logarithm operation on the first color range to obtain a first result; calculating a logarithmic value corresponding to a preset pixel to obtain an offset value; calculating a first difference between the first result and the offset value to obtain a second result; a first color lookup table is constructed based on the second result.
In this embodiment, before mapping the initial color information of the image to be rendered from the first color range into the second color range based on the first color lookup table, resulting in the first color information, the first color range may be calculated to construct the first color lookup table.
In the above embodiment, in actual calculation, an inverse color table may be generated by using an inverse function of the Log2 function. Since the color value cannot be represented by a negative number, the mapping result "-8" may be mapped to "0-1" again, and in order to solve the problem that the pixel value cannot be mapped to 0 (actually 0.00390625), an offset process may be performed, that is, an offset value of 0.00390625 is obtained, and the first color lookup table may be constructed based on the offset value.
As an alternative embodiment, performing a logarithm operation on the first color range to obtain a first result includes: acquiring a maximum color value and a minimum color value corresponding to the first color range; calculating a second difference value of a first logarithm value corresponding to the maximum color value and a second logarithm value corresponding to the minimum color value; calculating the product of the difference value and the logarithm value of the current pixel value to obtain a third result; calculating the sum of the third result and the second logarithm value to obtain a fourth result; and calculating the inverse logarithm value of the fourth result to obtain the first result.
In this embodiment, after the maximum color value and the minimum color value corresponding to the first color range are obtained, the maximum color value corresponding to the first color range may be subjected to logarithm processing, a first logarithm value is obtained, the minimum color value corresponding to the first color range is subjected to logarithm processing, and a second logarithm value is obtained, that is, the first logarithm value and the second logarithm value may be an upper limit value and a lower limit value corresponding to the mapping range.
In the above embodiment, the first result is the first color lookup table, and the calculation formula for constructing the first color lookup table may be as follows:
Color=pow(2,(Value*(MAX_Value-MIN_Value)+MIN_Value))-0.00390625
wherein, Color can be used to represent the Color information in the first Color lookup table; pow () may be used to represent the inverse of the Log2 function, Value may be used to represent the Log Value of the current pixel Value, MAX _ Value may be used to represent the upper limit Value of the mapping range, MIN _ Value may be used to represent the lower limit Value of the mapping range, and the values of MAX _ Value and MIN _ Value may be 8 and-8, respectively.
In the above embodiment, only one inverse operation is needed when the first color lookup table is used. Through the first color lookup table, all color values are mapped to Log2 space, wherein the color values of "0-1" occupy half of the space, and the other half is the color values of "1-255".
As an optional implementation, mapping the first color information to the target color information based on the second color lookup table includes: acquiring an index identifier corresponding to the first color information; acquiring color information corresponding to the index identifier from a second color lookup table; and mapping the second color information in a linear space to obtain target color information.
In this embodiment, the second color lookup table may include an index identifier corresponding to the first color information and the second color information, and when the first color information is mapped to the target color information based on the second color lookup table, the index identifier corresponding to the first color information may be obtained first, and then the color information corresponding to the index identifier may be obtained from the second color lookup table.
In the above embodiments, fig. 5 is a schematic diagram of a three-dimensional color table according to an embodiment of the present invention. As shown in fig. 5, the resolution of the three-dimensional color table is 4x4x4, each axis represents three components of R, G, and B, the three-dimensional color table may be represented by a cube, and each vertex of the cube may be used to represent an association relationship between an Index identifier (Index) and a current pixel Value (Value). For accuracy, this embodiment may also use a three-dimensional color table with a resolution of 64x64x64, as shown in fig. 6, where fig. 6 is a schematic diagram of another three-dimensional color table according to an embodiment of the present invention.
In the above embodiment, in order to obtain a correct mapping range, it is first necessary to map the pixel value mapped by the one-dimensional color table from Log2 space back to linear space, then use the mapped pixel value as an input value of the Tonemap algorithm of the game engine, and finally obtain a final mapped pixel value as a final three-dimensional color table.
Optionally, in the above embodiment, after the second color lookup table is used to convert the first color information from a logarithmic space to a linear space, the color adjustment algorithm of the game engine may be used to convert the first color information of the image to be rendered, so as to adjust the image to be rendered, so as to obtain the target image, where the target image may be a High Dynamic Range Imaging (HDR) image, and this image processing process may also be referred to as a baking process. HDR can provide more dynamic range and image detail than normal images, and a single color channel typically uses 16-bit or 32-bit representation.
In this embodiment, since the Tonemap algorithm of the game engine does not support three-dimensional textures, it is necessary to convert three-dimensional textures into two-dimensional textures, and fig. 7 is a schematic diagram of a two-dimensional texture according to an embodiment of the present invention, as shown in fig. 7, the resolution of the two-dimensional texture is 512x512, and the width and height of the texture are equally divided into 8 tiles, which can be used to represent a 64x64x64 three-dimensional texture.
It should be noted that, in this embodiment, the first color lookup table and the second color lookup table may support a color management system (OpenColorIO, abbreviated as "OCIO") that is commonly used at present, and the OCIO is a complete color space management solution for film production, visual special effects, and computer animations, so that all post-synthesis software supporting the OCIO can use the three-dimensional color table of the present application. Fig. 8 is a schematic diagram of a digital synthesis software calling a three-dimensional color table according to an embodiment of the present invention, and as shown in fig. 8, "Output-srgb (unal)", uses a first color lookup table and a second color lookup table in the present application.
The method for rendering the image according to the embodiment is completed by using a general computing function (computer Shader) of a Graphics Processing Unit (GPU for short), and the computing speed is very high.
The embodiment of the invention also provides a device for rendering the image. It should be noted that the apparatus for rendering an image according to this embodiment may be used to perform the method for rendering an image shown in fig. 2 according to the above embodiment of the present invention.
Fig. 9 is a schematic diagram of an apparatus for rendering an image according to an embodiment of the present invention. As shown in fig. 9, the apparatus 90 for rendering an image includes: an acquisition module 91, a determination module 92 and an adjustment module 93.
The obtaining module 91 is configured to obtain an image to be rendered.
A determining module 92, configured to determine target color information corresponding to the image to be rendered based on a preset color lookup table, where the color lookup table at least includes: index identification and target color information corresponding to the image to be rendered, and the incidence relation between the target color information and the index identification.
And the adjusting module 93 is configured to adjust initial color information corresponding to the image to be rendered based on the target color information, so as to obtain the target image.
Optionally, the apparatus further comprises: and the initialization module is used for carrying out initialization operation on the rendering environment of the game engine, wherein the initialization operation prohibits the game engine from carrying out color adjustment on the image to be rendered based on the pixel position of the image to be rendered.
Optionally, the preset color lookup table includes: a first color lookup table and a second color lookup table, and the determining module 92 includes: the first mapping unit is used for mapping the initial color information of the image to be rendered from the first color range to the second color range based on the first color lookup table to obtain first color information; a second mapping unit for mapping the first color information to target color information based on a second color lookup table.
Optionally, the first color lookup table is a one-dimensional color table, and the first color lookup table is used for converting the initial color information from a linear space to a logarithmic space; the second color lookup table is a three-dimensional color table, and the second color lookup table is used for converting the first color information from a logarithmic space to a linear space.
Optionally, the apparatus further comprises: the operation module is used for carrying out logarithmic operation on the first color range to obtain a first result; the first calculation module is used for calculating a logarithm value corresponding to a preset pixel to obtain an offset value; the second calculation module is used for calculating a first difference value between the first result and the offset value to obtain a second result; a first color lookup table is constructed based on the second result.
Optionally, the operation module includes: the acquiring unit is used for acquiring a maximum color value and a minimum color value corresponding to the first color range; the first calculation unit is used for calculating a second difference value of a first logarithm value corresponding to the maximum color value and a second logarithm value corresponding to the minimum color value; the second calculation unit is used for calculating the product between the difference value and the logarithm value of the current pixel value to obtain a third result; the third calculating unit is used for calculating the sum of the third result and the second logarithm value to obtain a fourth result; and the fourth calculating unit is used for calculating the inverse logarithm value of the fourth result to obtain the first result.
Optionally, the second mapping unit includes: the first obtaining subunit is configured to obtain an index identifier corresponding to the first color information; a second obtaining subunit, configured to obtain, from the second color lookup table, second color information corresponding to the index identifier; and the mapping unit is used for mapping the second color information in the linear space to obtain the target color information.
The device for rendering an image according to this embodiment may determine the target color information corresponding to the image to be rendered by using the color lookup table at least including the index identifier and the target color information corresponding to the image to be rendered and the association relationship between the target color information and the index identifier, so as to adjust the initial color information corresponding to the image to be rendered by using the target color information, thereby obtaining a target image for performing correct image rendering, avoiding a complex color adjustment algorithm carried by a game engine, and achieving an effect of directly adjusting the initial color corresponding to the image to be rendered by using the color lookup table, thereby achieving a technical effect of accurately rendering the image, and further solving a technical problem of inconsistent rendering results of the image.
Embodiments of the present invention also provide a computer-readable storage medium having a computer program stored therein, wherein the method of rendering an image according to an embodiment of the present invention is performed when the computer program is configured to run.
Optionally, in this embodiment, the storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Embodiments of the present invention also provide an electronic device comprising one or more processors; a storage device for storing one or more programs which, when executed by one or more processors, cause the one or more processors to implement a method for executing a program, wherein the program is arranged to perform the method of rendering an image of an embodiment of the invention when executed.
Optionally, the electronic device may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
It will be apparent to those skilled in the art that the modules or steps of the present invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A method of rendering an image, comprising:
acquiring an image to be rendered;
determining target color information corresponding to the image to be rendered based on a preset color lookup table, wherein the color lookup table at least comprises: the index identification corresponding to the image to be rendered, the target color information and the incidence relation between the target color information and the index identification;
and adjusting the initial color information corresponding to the image to be rendered based on the target color information to obtain a target image.
2. The method according to claim 1, wherein before determining target color information corresponding to the image to be rendered based on a preset color lookup table, the method further comprises:
performing an initialization operation on a rendering environment of a game engine, wherein the initialization operation prohibits the game engine from performing color adjustment on the image to be rendered based on a pixel position of the image to be rendered.
3. The method of claim 1, wherein the preset color lookup table comprises: the method comprises the steps of determining target color information corresponding to an image to be rendered based on a preset color lookup table by using a first color lookup table and a second color lookup table, wherein the target color information comprises the following steps:
mapping the initial color information of the image to be rendered from a first color range to a second color range based on the first color lookup table to obtain first color information;
mapping the first color information to the target color information based on the second color lookup table.
4. The method of claim 3, wherein the first color lookup table is a one-dimensional color table, and the first color lookup table is used for converting the initial color information from a linear space to a logarithmic space; the second color lookup table is a three-dimensional color table, and the second color lookup table is used for converting the first color information from the logarithmic space to the linear space.
5. The method of claim 3, wherein prior to mapping initial color information of the image to be rendered from a first color range into a second color range based on a first color lookup table, the method further comprises:
carrying out logarithm operation on the first color range to obtain a first result;
calculating a logarithmic value corresponding to a preset pixel to obtain an offset value;
calculating a first difference between the first result and the offset value to obtain a second result;
building the first color lookup table based on the second result.
6. The method of claim 5, wherein performing a logarithmic operation on the first color range to obtain a first result comprises:
acquiring a maximum color value and a minimum color value corresponding to the first color range;
calculating a second difference value of a first logarithm value corresponding to the maximum color value and a second logarithm value corresponding to the minimum color value;
calculating the product of the second difference value and the logarithm value of the current pixel value to obtain a third result;
calculating the sum of the third result and the second logarithm value to obtain a fourth result;
calculating an inverse logarithmic value of the fourth result, resulting in the first result.
7. The method of claim 3, wherein mapping the first color information to the target color information based on a second color lookup table comprises:
acquiring an index identifier corresponding to the first color information;
acquiring second color information corresponding to the index identifier from the second color lookup table;
and mapping the second color information in a linear space to obtain the target color information.
8. An apparatus for rendering an image, comprising:
the acquisition module is used for acquiring an image to be rendered;
a determining module, configured to determine target color information corresponding to the image to be rendered based on a preset color lookup table, where the color lookup table at least includes: the index identification corresponding to the image to be rendered, the target color information and the incidence relation between the target color information and the index identification;
and the adjusting module is used for adjusting the initial color information corresponding to the image to be rendered based on the target color information to obtain a target image.
9. A computer-readable storage medium, in which a computer program is stored, wherein the computer program is arranged to perform the method of rendering an image as claimed in any one of claims 1 to 7 when executed.
10. An electronic device, wherein the electronic device comprises one or more processors; storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to carry out a method for running a program, wherein the program is arranged to carry out the method of rendering an image of any one of claims 1 to 7 when run.
CN202110694611.0A 2021-06-22 2021-06-22 Method, apparatus, computer-readable storage medium, and electronic device for rendering image Active CN113450440B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110694611.0A CN113450440B (en) 2021-06-22 2021-06-22 Method, apparatus, computer-readable storage medium, and electronic device for rendering image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110694611.0A CN113450440B (en) 2021-06-22 2021-06-22 Method, apparatus, computer-readable storage medium, and electronic device for rendering image

Publications (2)

Publication Number Publication Date
CN113450440A true CN113450440A (en) 2021-09-28
CN113450440B CN113450440B (en) 2023-05-26

Family

ID=77812143

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110694611.0A Active CN113450440B (en) 2021-06-22 2021-06-22 Method, apparatus, computer-readable storage medium, and electronic device for rendering image

Country Status (1)

Country Link
CN (1) CN113450440B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114418917A (en) * 2022-03-11 2022-04-29 腾讯科技(深圳)有限公司 Data processing method, device, equipment and storage medium
CN114466244A (en) * 2022-01-26 2022-05-10 新奥特(北京)视频技术有限公司 Ultrahigh-definition high-dynamic-range imaging rendering method and device
CN114612607A (en) * 2022-02-11 2022-06-10 广东时谛智能科技有限公司 Shoe body design method and device based on three-dimensional model
WO2023016035A1 (en) * 2021-08-12 2023-02-16 荣耀终端有限公司 Video processing method and apparatus, electronic device, and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5940067A (en) * 1995-12-18 1999-08-17 Alliance Semiconductor Corporation Reduced memory indexed color graphics system for rendered images with shading and fog effects
US20020122207A1 (en) * 2000-12-28 2002-09-05 Xerox Corporation Fast Interpolation of large color lookup tables
US20070242878A1 (en) * 2006-04-13 2007-10-18 Tandent Vision Science, Inc. Method and system for separating illumination and reflectance using a log color space
WO2020224459A1 (en) * 2019-05-09 2020-11-12 腾讯科技(深圳)有限公司 Image processing method and device, terminal and storage medium
US20200413018A1 (en) * 2018-03-12 2020-12-31 Hewlett-Packard Development Company, L.P. Generating a color mapping
CN112619160A (en) * 2020-12-29 2021-04-09 网易(杭州)网络有限公司 Image processing method, image processing apparatus, non-volatile storage medium, and electronic apparatus

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5940067A (en) * 1995-12-18 1999-08-17 Alliance Semiconductor Corporation Reduced memory indexed color graphics system for rendered images with shading and fog effects
US20020122207A1 (en) * 2000-12-28 2002-09-05 Xerox Corporation Fast Interpolation of large color lookup tables
US20070242878A1 (en) * 2006-04-13 2007-10-18 Tandent Vision Science, Inc. Method and system for separating illumination and reflectance using a log color space
US20200413018A1 (en) * 2018-03-12 2020-12-31 Hewlett-Packard Development Company, L.P. Generating a color mapping
WO2020224459A1 (en) * 2019-05-09 2020-11-12 腾讯科技(深圳)有限公司 Image processing method and device, terminal and storage medium
CN112619160A (en) * 2020-12-29 2021-04-09 网易(杭州)网络有限公司 Image processing method, image processing apparatus, non-volatile storage medium, and electronic apparatus

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
LUM E B, ET AL.: "Texture hardware assisted rendering of time-varying volume data", 《VIS"01:PROCEEDINGS OF THE CONFERENCE ON VISUALIZATION》 *
孙略: "LUT在电影色彩管理中的应用与原理", 《现代电影技术》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023016035A1 (en) * 2021-08-12 2023-02-16 荣耀终端有限公司 Video processing method and apparatus, electronic device, and storage medium
CN114466244A (en) * 2022-01-26 2022-05-10 新奥特(北京)视频技术有限公司 Ultrahigh-definition high-dynamic-range imaging rendering method and device
CN114612607A (en) * 2022-02-11 2022-06-10 广东时谛智能科技有限公司 Shoe body design method and device based on three-dimensional model
CN114418917A (en) * 2022-03-11 2022-04-29 腾讯科技(深圳)有限公司 Data processing method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN113450440B (en) 2023-05-26

Similar Documents

Publication Publication Date Title
CN113450440A (en) Method and device for rendering image, computer readable storage medium and electronic equipment
CN106898040B (en) Virtual resource object rendering method and device
EP3238428B1 (en) Three dimensional, hue-plane preserving and differentiable quasi-linear transformation method for color correction
CN111199518B (en) Image presentation method, device and equipment of VR equipment and computer storage medium
CN110248242B (en) Image processing and live broadcasting method, device, equipment and storage medium
CN110443877B (en) Model rendering method, device, terminal equipment and storage medium
CN106303354A (en) A kind of face specially good effect recommends method and electronic equipment
Menk et al. Visualisation techniques for using spatial augmented reality in the design process of a car
CN112689140B (en) White balance synchronization method and device, electronic equipment and storage medium
CN110689626A (en) Game model rendering method and device
CN111784817B (en) Shadow display method and device, storage medium and electronic device
CN111489322A (en) Method and device for adding sky filter to static picture
CN111476851A (en) Image processing method, image processing device, electronic equipment and storage medium
CN110807735A (en) Image processing method, image processing device, terminal equipment and computer readable storage medium
US11962917B2 (en) Color adjustment method, color adjustment device, electronic device and computer-readable storage medium
CN111836029B (en) White balance adjusting method and system based on color gamut mapping and white balance terminal
EP3343514A1 (en) Method and device for differentiating objects
CN111105365A (en) Color correction method, medium, terminal and device for texture image
CN107454340B (en) Image synthesis method and device based on high dynamic range principle and mobile terminal
CN115690359A (en) Point cloud processing method and device, electronic equipment and storage medium
CN114663570A (en) Map generation method and device, electronic device and readable storage medium
CN114549732A (en) Model rendering method and device and electronic equipment
CN111784558A (en) Image processing method and device, electronic equipment and computer storage medium
CN114565709A (en) Data storage management method, object rendering method and device
CN116419076B (en) Image processing method and device, electronic equipment and chip

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant