Color mixing method, system, computer equipment and storage medium
Technical Field
The present invention relates to the field of computer graphics, and in particular, to a method, system, computer device and computer-readable storage medium for color mixing.
Background
Translucent blending (AlphaBlending) is a common color blending method that is intended to achieve a translucent effect. Transparency (Alpha) is a type of data that appears in a 32-bit bitmap file that specifies the transparency of pixels in an image, i.e., the file can specify the transparency of each pixel by adding a fourth channel, the Alpha channel, to the original 24-bit true color file. Alpha set to 0 indicates transparent, Alpha set to 1 indicates opaque, and values in between this range indicate translucent. The semi-transparent mixing is to calculate a new color and an old color to generate the new color, the semi-transparent mixing technology at the present stage is to multiply a source color and a superposition color by a coefficient and then add them to obtain an output color value, when a plurality of colors are superposed, each color needs to be superposed according to the sequence of the superposition colors, but the traditional calculation mode completely depends on the arrangement sequence of the superposition colors, when the superposed colors cannot be sorted, for example: when objects in a three-dimensional scene are drawn, the traditional semitransparent mixing technology can be very difficult to calculate the color superposition.
Therefore, a color mixing method is required to solve the above problems.
Disclosure of Invention
The present invention is directed to solving at least one of the problems of the prior art or the related art.
To this end, one aspect of the invention is to propose a method of color mixing.
Another aspect of the invention is to provide a system for color mixing.
Yet another aspect of the invention is directed to a computer device.
Yet another aspect of the present invention is to provide a computer-readable storage medium.
In view of the above, according to one aspect of the present invention, there is provided a method of color mixing, comprising: acquiring a source color, at least one superimposed color and a transparency value corresponding to the at least one superimposed color in the image; performing first rendering according to the source color and the transparency value to obtain a first rendering color value; determining an accumulated additive color according to at least one additive color; determining an empirical parameter according to the transparency value; and performing second rendering according to the first rendering color value, the accumulated superposed color and the empirical parameters to obtain an output color value.
According to the color mixing method provided by the invention, the source color, the superimposed color and the corresponding transparency value in the superimposed color in the image are obtained, and the first rendering color value is obtained according to the source color and the transparency values of all the superimposed colors; calculating through at least one superimposed color to determine an accumulated superimposed color, and determining an empirical parameter according to transparency values of all superimposed colors; therefore, the output color value, namely the final mixed color, can be obtained according to the three parameters of the first rendering color value, the accumulated superposed color and the empirical parameter. In the process, the determination of the final mixed color can be completed only by acquiring the source color and the transparency values corresponding to the superposed color without depending on the sequence of the arrangement of the superposed colors, the determination process is simple, the mixed color can be determined without repeatedly accumulating and repeatedly superposing, the obtained mixed effect is close to the rendering effect obtained by the traditional semitransparent mixing technology, the transparent mixing calculation with definite sequence of the superposed colors is completely suitable, the data calculation amount in the color mixing process is reduced, and the problem of processing the superposed color mixing in a modeling manner can be realized.
The above-mentioned method for color mixing according to the present invention may further have the following technical features:
in the above technical solution, preferably, the output color value is calculated by the following formula:
Coutput=Coutput1+C∑×ρ
wherein, CoutputIs an output color value, Coutput1Is a first rendering color value, C∑Is the cumulative additive color and ρ is an empirical parameter.
In the technical scheme, the formula for calculating the output color is as the formula, and the output color value C isoutputRendering color value C with first pass, respectivelyoutput1Cumulative additive color C∑And the empirical parameter rho is correlated, the mixed color after superposition of multiple superposed colors can be directly obtained through calculation by the formula, iteration is not required to be repeatedly carried out on the source color once according to the superposition color superposition sequence, the calculation amount in the color superposition process is reduced, and the final output color can be directly obtained through formula calculation, so that the color superposition process can be modeled and digitized, and the color superposition processing is accelerated.
In the above technical solution, preferably, the first-pass rendering color value is calculated by the following formula:
wherein, Coutput1Is a first rendering color value, CBaseIs the source color, AlphaiIs the transparency value corresponding to the ith superimposed color, and n is the number of superimposed colors.
In the technical scheme, the color value C is rendered for the first timeoutput1Is calculated with CBaseIs the source color CBaseAnd the transparency value Alpha corresponding to the ith superimposed coloriIt is relevant to thereby introduce the source colour in the calculation of rendering to carry out the multiplication accumulation after getting the benefit respectively to the transparency of all stack colours, use the multiplication accumulation result that obtains to carry out the preliminary treatment to the source colour, so that render as the object of being rendered in the rendering of second time, the computational formula of rendering colour value for the first time is simple and clear in addition, easily realizes digitization and modelling.
In the above technical solution, preferably, the accumulated superimposed color is calculated by the following formula:
wherein, C∑Is the cumulative addition of color CiIs the ith superimposed color and n is the number of superimposed colors.
In this solution, the additive color C is accumulated∑Is a superimposed color CiThe accumulated result is used for calculating all the superimposed colors, when the second rendering is carried out, the result is used as the superimposed colors to process the first rendering result, and no limit requirement is set for the sequence of the superimposed colors in the accumulation process, so that the situation that semitransparent mixed calculation is difficult when the sequence of the superimposed colors cannot be determined is avoided.
In the above technical solution, preferably, the empirical parameter is calculated by the following formula:
ρ=g(Alpha1,Alpha2,Alpha3,……Alphan)
where ρ is an empirical parameter and g is AlphaiFunction as input value, AlphaiIs the transparency value corresponding to the ith superimposed color.
In the technical scheme, the experience parameter rho and the transparency value Alpha corresponding to the ith superimposed coloriCorrelation, the calculated result can be obtained directly by inputting the transparency value of each superimposed color as an input value into the function g for the cumulative superimposed color C∑The weight is set, numerical value overflow and color error are avoided after the color value is rendered for the first time and the accumulated superposed color is added, and the fact that the calculated output color value is close to the rendering effect obtained by the traditional semitransparent mixing technology can be effectively guaranteed by using empirical parameters.
According to another aspect of the invention, there is provided a system for color mixing, comprising:
the system comprises an acquisition unit, a display unit and a display unit, wherein the acquisition unit is used for acquiring a source color, at least one superposed color and a transparency value corresponding to the at least one superposed color in an image; the first computing unit is used for performing first rendering according to the source color and the transparency value to obtain a first rendering color value; the second calculation unit is used for determining the accumulated superposition color according to at least one superposition color; the third calculation unit is used for determining an empirical parameter according to the transparency value; and the fourth calculating unit is used for performing second rendering according to the first rendering color value, the accumulated superposition color and the experience parameter to obtain an output color value.
According to the color mixing system, the first calculation unit is used for conducting first-pass rendering on the source color, the superposed colors and the transparency values corresponding to the superposed colors in the image acquired by the acquisition unit according to the source color and the transparency values corresponding to all the superposed colors to obtain first-pass rendering color values; calculating at least one superposition color by using a second calculating unit to determine an accumulated superposition color, and determining an empirical parameter according to transparency values of all the superposition colors by using a third calculating unit; therefore, the output color value, namely the final mixed color, can be obtained by using the fourth calculation unit according to the three parameters of the first rendering color value, the accumulated superposition color and the empirical parameter. In the process, the determination of the final mixed color can be completed only by acquiring the source color and the transparency values corresponding to the superposed color without depending on the sequence of the arrangement of the superposed colors, the determination process is simple, the mixed color can be determined without repeatedly accumulating and repeatedly superposing, the obtained mixed effect is close to the rendering effect obtained by the traditional semitransparent mixing technology, the transparent mixing calculation with definite sequence of the superposed colors is completely suitable, the data calculation amount in the color mixing process is reduced, and the problem of processing the superposed color mixing in a modeling manner can be realized.
In the foregoing technical solution, preferably, the fourth calculating unit calculates the output color value by using the following formula:
Coutput=Coutput1+C∑×ρ
wherein, CoutputIs an output color value, Coutput1Is a first rendering color value, C∑Is the cumulative additive color and ρ is an empirical parameter.
In the technical scheme, the formula for calculating the output color is as the formula, and the output color value C isoutputRendering color value C with first pass, respectivelyoutput1Cumulative additive color C∑And the empirical parameter rho is correlated, the fourth calculation unit can be used for directly calculating the mixed color after the superposition of multiple superposed colors through the formula, iteration is not required to be repeatedly performed on the source color once according to the superposition color superposition sequence, the calculated amount in the color superposition process is reduced, the final output color can be directly obtained through formula calculation, and the color superposition process can be modeled and digitized, so that the color superposition processing is accelerated.
In the above technical solution, preferably, the first calculating unit calculates the first rendering color value by using the following formula:
wherein, Coutput1Is a first rendering color value, CBaseIs the source color, AlphaiIs the transparency value corresponding to the ith superimposed color, and n is the number of superimposed colors.
In the technical scheme, the color value C is rendered for the first timeoutput1Is calculated with CBaseIs the source color CBaseAnd the transparency value Alpha corresponding to the ith superimposed coloriIt is relevant to thereby introduce the source colour in the calculation of rendering to carry out the multiplication accumulation after getting the benefit respectively to the transparency that all stack colours correspond, use the multiplication accumulation result that obtains to carry out the preliminary treatment to the source colour, so that render as the object of being rendered in the rendering of second time, the computational formula of rendering colour value for the first time is simple and clear in addition, easily realizes digitization and modelling.
In the above technical solution, preferably, the second calculating unit calculates the cumulative superimposed color using the following formula:
wherein, C∑Is the cumulative addition of color CiIs the ith superimposed color and n is the number of superimposed colors.
In this solution, the additive color C is accumulated∑Is a superimposed color CiThe accumulated result is used for calculating all the superimposed colors, when the second rendering is carried out, the result is used as the superimposed colors to process the first rendering result, and no limit requirement is set for the sequence of the superimposed colors in the accumulation process, so that the situation that semitransparent mixed calculation is difficult when the sequence of the superimposed colors cannot be determined is avoided.
In the above technical solution, preferably, the third calculating unit calculates the empirical parameter by using the following formula:
ρ=g(Alpha1,Alpha2,Alpha3,……Alphan)
where ρ is an empirical parameter and g is AlphaiFunction as input value, AlphaiIs the transparency value corresponding to the ith superimposed color.
In the technical scheme, the experience parameter rho and the transparency value Alpha corresponding to the ith superimposed coloriCorrelation, the calculated result can be obtained directly by inputting the transparency value of each superimposed color as an input value into the function g for the cumulative superimposed color C∑The weight is set, numerical value overflow and color error are avoided after the color value is rendered for the first time and the accumulated superposed color is added, and the fact that the calculated output color value is close to the rendering effect obtained by the traditional semitransparent mixing technology can be effectively guaranteed by using empirical parameters.
According to yet another aspect of the invention, a computer device is proposed, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the method of color mixing as defined in any of the above when executing the computer program.
According to the computer equipment provided by the invention, when a processor executes a computer program, the first-pass rendering is carried out by acquiring the source color, the superposed color and the corresponding transparency value in the superposed color in the image and according to the source color and the transparency values corresponding to all the superposed colors, so as to obtain a first-pass rendering color value; calculating through at least one superimposed color to determine an accumulated superimposed color, and determining an empirical parameter according to transparency values of all superimposed colors; therefore, the output color value, namely the final mixed color, can be obtained according to the three parameters of the first rendering color value, the accumulated superposed color and the empirical parameter. In the process, the determination of the final mixed color can be completed only by acquiring the source color and the transparency values corresponding to the superposed color without depending on the sequence of the arrangement of the superposed colors, the determination process is simple, the mixed color can be determined without repeatedly accumulating and repeatedly superposing, the obtained mixed effect is close to the rendering effect obtained by the traditional semitransparent mixing technology, the transparent mixing calculation with definite sequence of the superposed colors is completely suitable, the data calculation amount in the color mixing process is reduced, and the problem of processing the superposed color mixing in a modeling manner can be realized.
According to yet another aspect of the invention, a computer-readable storage medium is proposed, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method of color mixing as defined in any of the above.
When the computer program is executed by the processor, the first-pass rendering is carried out according to the source color and the transparency values corresponding to all the superposed colors by acquiring the source color, the superposed colors and the corresponding transparency values in the superposed colors in the image, so as to obtain first-pass rendering color values; calculating through at least one superimposed color to determine an accumulated superimposed color, and determining an empirical parameter according to transparency values of all superimposed colors; therefore, the output color value, namely the final mixed color, can be obtained according to the three parameters of the first rendering color value, the accumulated superposed color and the empirical parameter. In the process, the determination of the final mixed color can be completed only by acquiring the source color and the transparency values corresponding to the superposed color without depending on the sequence of the arrangement of the superposed colors, the determination process is simple, the mixed color can be determined without repeatedly accumulating and repeatedly superposing, the obtained mixed effect is close to the rendering effect obtained by the traditional semitransparent mixing technology, the transparent mixing calculation with definite sequence of the superposed colors is completely suitable, the data calculation amount in the color mixing process is reduced, and the problem of processing the superposed color mixing in a modeling manner can be realized.
Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
The above and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 shows a schematic flow chart diagram of one embodiment of a method of color mixing of the present invention;
FIG. 2 shows a schematic block diagram of one embodiment of a system for color mixing of the present invention;
FIG. 3 shows a schematic block diagram of a computer apparatus 300 of one embodiment of the present invention.
Detailed Description
In order that the above objects, features and advantages of the present invention can be more clearly understood, a more particular description of the invention will be rendered by reference to the appended drawings. It should be noted that the embodiments and features of the embodiments of the present application may be combined with each other without conflict.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, however, the present invention may be practiced in other ways than those specifically described herein, and therefore the scope of the present invention is not limited to the specific embodiments disclosed below.
An embodiment of the first aspect of the present invention proposes a method of color mixing, and fig. 1 shows a schematic flow chart of an embodiment of the method of color mixing of the present invention. Wherein, the method comprises the following steps:
s102, obtaining a source color, at least one superimposed color and a transparency value corresponding to the at least one superimposed color in the image;
s104, performing first rendering according to the source color and the transparency value to obtain a first rendering color value;
s106, determining the accumulated superimposed color according to at least one superimposed color;
s108, determining empirical parameters according to the transparency value;
and S110, performing second rendering according to the first rendering color value, the accumulated superposed color and the empirical parameters to obtain an output color value.
In the embodiment, a first rendering pass is performed by obtaining a source color, a superimposed color and a corresponding transparency value in the superimposed color in an image and according to the source color and the transparency values of all the superimposed colors to obtain a first rendering color value; calculating through at least one superimposed color to determine an accumulated superimposed color, and determining an empirical parameter according to transparency values of all superimposed colors; therefore, the output color value, namely the final mixed color, can be obtained according to the three parameters of the first rendering color value, the accumulated superposed color and the empirical parameter. In the process, the determination of the final mixed color can be completed only by acquiring the source color and the transparency values corresponding to the superposed color without depending on the sequence of the arrangement of the superposed colors, the determination process is simple, the mixed color can be determined without repeatedly accumulating and repeatedly superposing, the obtained mixed effect is close to the rendering effect obtained by the traditional semitransparent mixing technology, the transparent mixing calculation with definite sequence of the superposed colors is completely suitable, the data calculation amount in the color mixing process is reduced, and the problem of processing the superposed color mixing in a modeling manner can be realized.
In one embodiment of the present invention, preferably, the output color value is calculated by the following formula:
Coutput=Coutput1+C∑×ρ
wherein, CoutputIs an output color value, Coutput1Is a first rendering color value, C∑Is the cumulative additive color and ρ is an empirical parameter.
In this embodiment, the formula for the calculation of the output color is as above, the output color value CoutputRendering color value C with first pass, respectivelyoutput1Cumulative additive color C∑And the empirical parameter rho is correlated, the mixed color after superposition of multiple superposed colors can be directly obtained through calculation by the formula, iteration is not required to be repeatedly carried out on the source color once according to the superposition color superposition sequence, the calculation amount in the color superposition process is reduced, and the final output color can be directly obtained through formula calculation, so that the color superposition process can be modeled and digitized, and the color superposition processing is accelerated.
In one embodiment of the present invention, preferably, the first-pass rendering color value is calculated by the following formula:
wherein, Coutput1Is a first rendering color value, CBaseIs the source color, AlphaiIs the transparency value corresponding to the ith superimposed color, and n is the number of superimposed colors.
In this embodiment, color value C is rendered for the first timeoutput1Is calculated with CBaseIs the source color CBaseAnd the transparency value Alpha corresponding to the ith superimposed coloriIt is relevant to thereby introduce the source colour in the calculation of rendering to carry out the multiplication accumulation after getting the benefit respectively to the transparency of all stack colours, use the multiplication accumulation result that obtains to carry out the preliminary treatment to the source colour, so that render as the object of being rendered in the rendering of second time, the computational formula of rendering colour value for the first time is simple and clear in addition, easily realizes digitization and modelling.
In one embodiment of the present invention, preferably, the cumulative superimposed color is calculated by the following formula:
wherein, C∑Is the cumulative addition of color CiIs the ith superimposed color and n is the number of superimposed colors.
In this embodiment, the cumulative superimposed color C∑Is a superimposed color CiThe accumulated result is used for calculating all the superimposed colors, when the second rendering is carried out, the result is used as the superimposed colors to process the first rendering result, and no limit requirement is set for the sequence of the superimposed colors in the accumulation process, so that the situation that semitransparent mixed calculation is difficult when the sequence of the superimposed colors cannot be determined is avoided.
In one embodiment of the present invention, preferably, the empirical parameters are calculated from the following formula:
ρ=g(Alpha1,Alpha2,Alpha3,……Alphan)
where ρ is an empirical parameter and g is AlphaiFunction as input value, AlphaiIs the transparency value corresponding to the ith superimposed color.
In this embodiment, the empirical parameter ρ is the transparency value Alpha corresponding to the ith superimposed coloriCorrelation, the calculated result can be obtained directly by inputting the transparency value of each superimposed color as an input value into the function g for the cumulative superimposed color C∑The weight is set, numerical value overflow and color error are avoided after the color value is rendered for the first time and the accumulated superposed color is added, and the fact that the calculated output color value is close to the rendering effect obtained by the traditional semitransparent mixing technology can be effectively guaranteed by using empirical parameters.
In an embodiment of the second aspect of the present invention, a system for color mixing is proposed, and fig. 2 shows a schematic block diagram of an embodiment of the system for color mixing of the present invention. The proposed system 200 of color mixing comprises: an obtaining unit 202, configured to obtain a transparency value corresponding to a source color, at least one superimposed color, and at least one superimposed color in an image; the first calculation unit 204 is configured to perform a first rendering pass according to the source color and the transparency value to obtain a first rendering color value; a second calculating unit 206, configured to determine an accumulated additive color according to at least one additive color; a third calculation unit 208 for determining an empirical parameter based on the transparency value; and the fourth calculating unit 210 is configured to perform second rendering according to the first rendering color value, the accumulated superposition color, and the experience parameter to obtain an output color value.
In the embodiment, the first calculation unit performs first rendering on the source color, the superimposed color and the transparency value corresponding to the superimposed color in the image acquired by the acquisition unit according to the source color and the transparency value to obtain a first rendering color value; calculating at least one superposition color by using a second calculating unit to determine an accumulated superposition color, and determining an empirical parameter by using a third calculating unit according to transparency values of all superposition colors; therefore, the output color value, namely the final mixed color, can be obtained by using the fourth calculation unit according to the three parameters of the first rendering color value, the accumulated superposition color and the empirical parameter. In the process, the determination of the final mixed color can be completed only by acquiring the source color and the transparency values corresponding to the superposed color without depending on the sequence of the arrangement of the superposed colors, the determination process is simple, the mixed color can be determined without repeatedly accumulating and repeatedly superposing, the obtained mixed effect is close to the rendering effect obtained by the traditional semitransparent mixing technology, the transparent mixing calculation with definite sequence of the superposed colors is completely suitable, the data calculation amount in the color mixing process is reduced, and the problem of processing the superposed color mixing in a modeling manner can be realized.
In an embodiment of the present invention, preferably, the fourth calculating unit 210 calculates the output color value by using the following formula:
Coutput=Coutput1+C∑×ρ
wherein, CoutputIs an output color value, Coutput1Is a first rendering color value, C∑Is the cumulative additive color and ρ is an empirical parameter.
In the technical scheme, the formula for calculating the output color is as the formula, and the output color value C isoutputRendering color value C with first pass, respectivelyoutput1Cumulative additive color C∑And the empirical parameter ρ is correlated, the fourth calculating unit 210 can directly calculate the mixed color obtained by superimposing a plurality of superimposed colors by the formula, iteration is not required to be repeatedly performed once for the source color according to the superimposed color superimposing sequence, the calculated amount in the color superimposing process is reduced, and the final output color can be directly obtained by formula calculation, so that the color superimposing process can be modeled and digitized, and the color superimposing process is accelerated.
In an embodiment of the present invention, preferably, the first calculation unit 204 calculates the first-pass rendering color value by using the following formula:
wherein, Coutput1Is a first rendering color value, CBaseIs the source color, AlphaiIs the transparency value corresponding to the ith superimposed color, and n is the number of superimposed colors.
In this embodiment, color value C is rendered for the first timeoutput1Is calculated with CBaseIs the source color CBaseAnd the transparency value Alpha corresponding to the ith superimposed coloriIt is relevant to thereby introduce the source colour in the calculation of rendering to carry out the multiplication accumulation after getting the benefit respectively to the transparency of all stack colours, use the multiplication accumulation result that obtains to carry out the preliminary treatment to the source colour, so that render as the object of being rendered in the rendering of second time, the computational formula of rendering colour value for the first time is simple and clear in addition, easily realizes digitization and modelling.
In one embodiment of the present invention, preferably, the second calculation unit calculates the cumulative superimposed color using the following formula:
wherein, C∑Is the cumulative addition of color CiIs the ith superimposed color and n is the number of superimposed colors.
In this embodiment, the cumulative superimposed color C∑Is a superimposed color CiThe accumulated result is used for calculating all the superimposed colors, when the second rendering is carried out, the result is used as the superimposed colors to process the first rendering result, and no limit requirement is set for the sequence of the superimposed colors in the accumulation process, so that the situation that semitransparent mixed calculation is difficult when the sequence of the superimposed colors cannot be determined is avoided.
In one embodiment of the present invention, preferably, the third calculating unit calculates the empirical parameter by using the following formula:
ρ=g(Alpha1,Alpha2,Alpha3,……Alphan)
where ρ is an empirical parameter and g is AlphaiFunction as input value, AlphaiIs the transparency value corresponding to the ith superimposed color.
In this embodiment, the empirical parameter ρ is the transparency value Alpha corresponding to the ith superimposed coloriCorrelation, the calculated result can be obtained directly by inputting the transparency value of each superimposed color as an input value into the function g for the cumulative superimposed color C∑The weight is set, numerical value overflow and color error are avoided after the color value is rendered for the first time and the accumulated superposed color is added, and the fact that the calculated output color value is close to the rendering effect obtained by the traditional semitransparent mixing technology can be effectively guaranteed by using empirical parameters.
In an embodiment of the third aspect of the present invention, a computer device is provided, and fig. 3 shows a schematic block diagram of a computer apparatus 300 according to an embodiment of the present invention. Wherein, this computer device 300 includes: a memory 302, a processor 304 and a computer program stored on the memory 302 and executable on the processor 304, the processor 304 when executing the computer program implementing the steps of the method of color mixing as described in any one of the above.
In the computer device 300 provided by the invention, when the processor 304 executes the computer program, the first-pass rendering is performed by obtaining the source color, the superimposed color and the corresponding transparency value in the superimposed color in the image and according to the source color and the transparency values corresponding to all the superimposed colors, so as to obtain a first-pass rendering color value; calculating through at least one superimposed color to determine an accumulated superimposed color, and determining an empirical parameter according to transparency values of all superimposed colors; therefore, the output color value, namely the final mixed color, can be obtained according to the three parameters of the first rendering color value, the accumulated superposed color and the empirical parameter. In the process, the determination of the final mixed color can be completed only by acquiring the source color and the transparency values corresponding to the superposed color without depending on the sequence of the arrangement of the superposed colors, the determination process is simple, the mixed color can be determined without repeatedly accumulating and repeatedly superposing, the obtained mixed effect is close to the rendering effect obtained by the traditional semitransparent mixing technology, the transparent mixing calculation with definite sequence of the superposed colors is completely suitable, the data calculation amount in the color mixing process is reduced, and the problem of processing the superposed color mixing in a modeling manner can be realized.
An embodiment of the fourth aspect of the invention proposes a computer-readable storage medium having stored thereon a computer program which, when being executed by a processor, carries out the steps of the method of color mixing according to any one of the above.
When the computer program is executed by the processor, the first-pass rendering is carried out according to the source color and the transparency values corresponding to all the superposed colors by acquiring the source color, the superposed colors and the corresponding transparency values in the superposed colors in the image, so as to obtain first-pass rendering color values; calculating through at least one superimposed color to determine an accumulated superimposed color, and determining an empirical parameter according to transparency values of all superimposed colors; therefore, the output color value, namely the final mixed color, can be obtained according to the three parameters of the first rendering color value, the accumulated superposed color and the empirical parameter. In the process, the determination of the final mixed color can be completed only by acquiring the source color and the transparency values corresponding to the superposed color without depending on the sequence of the arrangement of the superposed colors, the determination process is simple, the mixed color can be determined without repeatedly accumulating and repeatedly superposing, the obtained mixed effect is close to the rendering effect obtained by the traditional semitransparent mixing technology, the transparent mixing calculation with definite sequence of the superposed colors is completely suitable, the data calculation amount in the color mixing process is reduced, and the problem of processing the superposed color mixing in a modeling manner can be realized.
In the description herein, the description of the terms "one embodiment," "some embodiments," "specific embodiments," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
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 spirit and principle of the present invention should be included in the protection scope of the present invention.