JP2010224733A - Rendering device and program - Google Patents
Rendering device and program Download PDFInfo
- Publication number
- JP2010224733A JP2010224733A JP2009069626A JP2009069626A JP2010224733A JP 2010224733 A JP2010224733 A JP 2010224733A JP 2009069626 A JP2009069626 A JP 2009069626A JP 2009069626 A JP2009069626 A JP 2009069626A JP 2010224733 A JP2010224733 A JP 2010224733A
- Authority
- JP
- Japan
- Prior art keywords
- value
- source
- interpolation point
- destination
- bilinear filter
- 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
Links
Images
Landscapes
- Image Generation (AREA)
Abstract
Description
この発明は、描画処理技術に係り、特にバイリニアフィルタとαブレンディング部とを備えたレンダリング装置およびプログラムに関する。 The present invention relates to a drawing processing technique, and more particularly, to a rendering apparatus and a program including a bilinear filter and an α blending unit.
スプライト画像等のレンダリングに関連した技術として、αブレンディングとバイリニアフィルタ処理がある。ここで、αブレンディングは、レンディング対象である画像(以下、ソース画像という。)の各画素のカラー値(R、G、Bの各成分の輝度)と各画素の透明度を示すα値と、ソース画像の背景となるレンダリング先の画像(以下、ディスティネーション画像という。)の各画素のカラー値とに基づき、ソース画像がレンダリングされた後のディスティネーション画像の各画素(ソース画像とディスティネーション画像とがオーバラップした領域の各画素)のカラー値を演算する技術である。さらに詳述すると、このαブレンディングでは、図3に示すように、ソース画像を構成する1つの画素(以下、ソース画素という。)のカラー値がSC、このソース画素に対応したディスティネーション画像の画素(以下、ディスティネーション画素という。)のカラー値がDである場合、次式に示すカラー値D’を算出し、レンダリング後におけるディスティネーション画素のカラー値とする。
D’=α*SC+(1−α)*D ……(1)
これにより、レンダリング後の画像において、レンダリング前のディスティネーション画像がソース画像越しにα値に応じた透明度で透けて見える状態を演出することができる。
Techniques related to rendering of sprite images and the like include α blending and bilinear filter processing. Here, α blending is a color value (luminance of each component of R, G, B) of each pixel of an image to be rendered (hereinafter referred to as a source image) and an α value indicating transparency of each pixel, Each pixel (source image and destination image) of the destination image after the source image is rendered based on the color value of each pixel of the rendering destination image (hereinafter referred to as the destination image) that becomes the background of the source image. Is a technique for calculating the color value of each pixel in the overlapping area. More specifically, in this α blending, as shown in FIG. 3, the color value of one pixel constituting the source image (hereinafter referred to as source pixel) is SC, and the pixel of the destination image corresponding to this source pixel. When the color value (hereinafter referred to as the destination pixel) is D, the color value D ′ shown in the following equation is calculated and used as the color value of the destination pixel after rendering.
D ′ = α * SC + (1−α) * D (1)
Thereby, in the rendered image, it is possible to produce a state where the destination image before rendering can be seen through with transparency corresponding to the α value over the source image.
一方、バイリニアフィルタ処理は、スプライト画像等のソース画像を拡大、回転等してディスティネーション画像にレンダリングする際に、レンダリング対象であるソース画像(拡大等してレンダリングする場合には拡大等がなされた後のもの)において、レンダリング先のディスティネーション画像のディスティネーション画素と同一位置を占める補間点のカラー値を演算する線形補間処理手段である。さらに詳述すると、バイリニアフィルタ処理では、図4に示すように、ソース画像を構成する各画素のうちディスティネーション画素の位置に対応した補間点PP(x、y)を囲む周囲4個の画素P(m、n)、P(m+1、n)、P(m、n+1)、P(m+1、n+1)の各カラー値SC0、SC1、SC2、SC3を用いて、次式に示す演算を行い、補間点PP(x、y)に対応したカラー値SC(x、y)を算出する。
SC(x、y)
=B0*SC0+B1*SC1+B2*SC2+B3*SC3 ……(2)
On the other hand, in bilinear filter processing, when rendering a source image such as a sprite image to a destination image by enlarging or rotating the source image, the source image that is the rendering target (when enlarging or rendering is enlarged, etc.) And a linear interpolation processing means for calculating a color value of an interpolation point that occupies the same position as the destination pixel of the destination image of the rendering destination. More specifically, in the bilinear filter processing, as shown in FIG. 4, four surrounding pixels P surrounding the interpolation point PP (x, y) corresponding to the position of the destination pixel among the pixels constituting the source image. Using the color values SC0, SC1, SC2, and SC3 of (m, n), P (m + 1, n), P (m, n + 1), and P (m + 1, n + 1), the calculation shown in the following equation is performed for interpolation. A color value SC (x, y) corresponding to the point PP (x, y) is calculated.
SC (x, y)
= B0 * SC0 + B1 * SC1 + B2 * SC2 + B3 * SC3 (2)
ここで、B0〜B3は、補間点PP(x、y)の周囲4個の画素P(m、n)、P(m+1、n)、P(m、n+1)、P(m+1、n+1)に対する位置関係により定まるバイリニア係数である。周囲4個の画素の各画素位置間隔を1とした場合における補間点の座標値x、yの小数部を各々p、qとした場合、各バイリニア係数B0〜B3は、次式により与えられる。
B0=(1−p)*(1−q) ……(3)
B1=(1−q)*p ……(4)
B2=(1−p)*q ……(5)
B3=p*q ……(6)
Here, B0 to B3 correspond to the four pixels P (m, n), P (m + 1, n), P (m, n + 1), and P (m + 1, n + 1) around the interpolation point PP (x, y). This is a bilinear coefficient determined by the positional relationship. When the interpolated point coordinate values x and y are fractional parts p and q when the pixel position interval of the four surrounding pixels is 1, the bilinear coefficients B0 to B3 are given by the following equations.
B0 = (1-p) * (1-q) (3)
B1 = (1-q) * p (4)
B2 = (1-p) * q (5)
B3 = p * q (6)
そして、バイリニア係数B0〜B3には、次式に示す関係がある。
B0+B1+B2+B3
=(1−p)(1−q)+p(1−q)+(1−p)q+pq
=1 ……(7)
The bilinear coefficients B0 to B3 have the relationship shown in the following equation.
B0 + B1 + B2 + B3
= (1-p) (1-q) + p (1-q) + (1-p) q + pq
= 1 (7)
レンダリングにおいては、以上述べたバイリニアフィルタ処理とαブレンディングとを併用する場合がある。図5は、このバイリニアフィルタ処理とαブレンディングとを併用するレンダリングの処理内容を示すものである。図5に示すように、バイリニアフィルタ処理とαブレンディングとを併用するレンダリングでは、まず、ソース画像における補間点PP(x、y)の周囲4個の画素P(m、n)、P(m+1、n)、P(m、n+1)、P(m+1、n+1)の各α値A0、A1、A2、A3を用いて、次式に示すバイリニアフィルタ処理を実行し、補間点PP(x、y)に適用するα値Aを算出する。
A=B0*A0+B1*A1+B2*A2+B3*A3 ……(8)
In rendering, the above-described bilinear filter processing and α blending may be used in combination. FIG. 5 shows the contents of rendering processing using this bilinear filter processing and α blending together. As shown in FIG. 5, in rendering that uses bilinear filtering and α blending in combination, first, four pixels P (m, n), P (m + 1, P) around the interpolation point PP (x, y) in the source image. n), P (m, n + 1), and P (m + 1, n + 1) using the α values A0, A1, A2, and A3, the bilinear filter processing shown in the following equation is executed, and the interpolation point PP (x, y) Α value A to be applied to is calculated.
A = B0 * A0 + B1 * A1 + B2 * A2 + B3 * A3 (8)
また、補間点PP(x、y)の周囲4個の画素P(m、n)、P(m+1、n)、P(m、n+1)、P(m+1、n+1)の各カラー値SC0、SC1、SC2、SC3を用いて、次式に示すバイリニアフィルタ処理を実行し、補間点PP(x、y)のソースカラー値SCを算出する。
SC=B0*SC0+B1*SC1+B2*SC2+B3*SC3 ……(9)
Further, the color values SC0 and SC1 of the four pixels P (m, n), P (m + 1, n), P (m, n + 1), and P (m + 1, n + 1) around the interpolation point PP (x, y). , SC2 and SC3, the bilinear filter processing shown in the following equation is executed to calculate the source color value SC of the interpolation point PP (x, y).
SC = B0 * SC0 + B1 * SC1 + B2 * SC2 + B3 * SC3 (9)
そして、以上の2種類のバイリニアフィルタ処理により得られる補間点PP(x、y)のソースカラー値SCおよびα値Aと、ディスティネーション画素のディスティネーションカラー値Dとを用いて、次式に示すαブレンディングを実行し、レンダリング後のディスティネーション画素のカラー値D’を算出するのである。
D’=A*SC+(1−A)*D ……(10)
なお、バイリニアフィルタ処理とαブレンディングを併用したレンダリングに関する文献としては、例えば特許文献1がある。
Then, using the source color value SC and α value A of the interpolation point PP (x, y) obtained by the above two types of bilinear filter processing and the destination color value D of the destination pixel, the following expression is given. α blending is executed, and the color value D ′ of the destination pixel after rendering is calculated.
D ′ = A * SC + (1-A) * D (10)
ところで、上述した従来のバイリニアフィルタとαブレンディングを併用したレンダリングは、ソース画像がα値の大きく変化するエッジを含む場合に、レンダリング後の画像において、本来、小さなα値が適用されるべき画素の色がレンダリング後の画像のエッジ部分に過剰に現れ、エッジ部分が不自然な色になるという問題があった。以下、図6を参照し、この問題について詳述する。 By the way, in the rendering using the conventional bilinear filter and α blending described above, when the source image includes an edge whose α value greatly changes, the rendering of the pixel to which a small α value should be originally applied in the rendered image. There is a problem in that the color appears excessively on the edge portion of the rendered image, and the edge portion becomes an unnatural color. Hereinafter, this problem will be described in detail with reference to FIG.
図6に示す例では、ソース画像であるスプライト100をディスティネーション画像である背景画像200にレンダリングしている。ここで、スプライト100は拡大処理がなされており、α値が1である円状領域101とその周囲のα値が0である領域102とを有している。そして、図示の例では、バイリニアフィルタ処理とαブレンディングを併用して、スプライト100を背景画像200にレンダリングしている。図6において、スプライト100における補間点PP(x、y)は、円状領域101のエッジの上にあり、この補間点PP(x、y)の周囲の4画素のうちソース画素P(m、n)およびP(m、n+1)はα値が1である円状領域101内にあり、ソース画素P(m+1、n)およびP(m+1、n+1)はα値が0である領域102内にある。ここで、ソース画素P(m+1、n)およびP(m+1、n+1)は、α値が0であるので、レンダリング後は、背景画像200の画素の色を透過させるべきものである。従って、レンダリング後において、円状領域101のエッジ上の補間点PP(x、y)の画素のカラーは、円状領域101の画素のカラーと背景領域200の画素のカラーが混ざったものになるべきであり、α値が0である領域102の画素のカラーが混ざったものになるべきではない。
In the example illustrated in FIG. 6, the
しかしながら、従来のバイリニアフィルタ処理とαブレンディングを併用したレンダリングでは、ソース画素P(m、n)、P(m+1、n)、P(m、n+1)、P(m+1、n+1)のカラー値に前掲式(9)のバイリニアフィルタ処理を施して、後処理であるαブレンディングに引き渡すカラー値SCを算出する。このため、αブレンディングの対象となるカラー値は、前掲式(9)に示すように、α値が0である領域内の画素のカラー値SC1およびSC3を含んだものとなり、αブレンディング後における補間点PP(x、y)の画素のカラー値も、本来含まれるべきではないカラー値SC1およびSC3を含んだものとなる。このため、レンダリング後におけるスプライト100の円状領域101のエッジが不自然なカラーになるのである。以上、ソース画像においてエッジの一方の側のα値が1であり、他方の側のα値が0である典型例について説明したが、このような典型例に該当しなくても、ソース画像においてエッジを境にα値が大きく変化する場合には、同様に、レンダリング後におけるエッジのカラーが不自然なものになる不具合が発生していた。
However, in rendering using both conventional bilinear filtering and α blending, the color values of the source pixels P (m, n), P (m + 1, n), P (m, n + 1), and P (m + 1, n + 1) are described above. Bilinear filter processing of Expression (9) is performed to calculate a color value SC to be passed to α blending as post-processing. Therefore, the color value to be subjected to α blending includes the color values SC1 and SC3 of the pixels in the region where the α value is 0, as shown in the above equation (9), and interpolation after α blending is performed. The color value of the pixel at the point PP (x, y) also includes color values SC1 and SC3 that should not be included originally. For this reason, the edge of the
この発明は、以上説明した事情に鑑みてなされたものであり、バイリニアフィルタ処理とαブレンディングを併用してレンダリングを行う場合において、α値が大きく変化するエッジをレンダリング対象であるソース画像が含んでいる場合に、レンダリング後の画像の当該エッジ部分のカラーが不自然になるのを防止する技術的手段を提供することを目的としている。 The present invention has been made in view of the circumstances described above, and when rendering is performed by using bilinear filter processing and α blending together, the source image to be rendered includes an edge whose α value greatly changes. It is an object of the present invention to provide a technical means for preventing the color of the edge portion of an image after rendering from becoming unnatural.
本願発明者は、以上の問題について鋭意検討した結果、次のような考えに至った。すなわち、上述のような不具合を発生させないためには、図1に示すように、ソース画像における補間点PP(x、y)の周囲の4個のソース画素P(m、n)、P(m+1、n)、P(m、n+1)、P(m+1、n+1)の各ソースカラー値SC0、SC1、SC2、SC3の各々と、ディスティネーション画素のディスティネーションカラー値Dとのαブレンディングを各々行い、この4種類のαブレンディングの結果得られる4個のカラー値にバイナリフィルタ処理を施すことによりレンダリング後のディスティネーション画素のカラー値D’を算出するべきである、との考えである。 The inventor of the present application diligently studied the above problem, and as a result, came up with the following idea. That is, in order to prevent the above-described problem from occurring, as shown in FIG. 1, four source pixels P (m, n) and P (m + 1) around the interpolation point PP (x, y) in the source image. , N), P (m, n + 1), each source color value SC0, SC1, SC2, SC3 of P (m + 1, n + 1) and a destination color value D of the destination pixel are α-blended, It is thought that the color value D ′ of the destination pixel after rendering should be calculated by performing binary filter processing on the four color values obtained as a result of these four types of α blending.
このようなレンダリングを行う場合、レンダリング後のディスティネーション画素のカラー値D’は、次式に示すものとなる。
D’=B0*(A0*SC0+(1−A0)*D)+
B1*(A1*SC1+(1−A1)*D)+
B2*(A2*SC2+(1−A2)*D)+
B3*(A3*SC3+(1−A3)*D) ……(11)
When such rendering is performed, the color value D ′ of the destination pixel after rendering is represented by the following equation.
D ′ = B0 * (A0 * SC0 + (1-A0) * D) +
B1 * (A1 * SC1 + (1-A1) * D) +
B2 * (A2 * SC2 + (1-A2) * D) +
B3 * (A3 * SC3 + (1-A3) * D) (11)
上記式の右辺において、バイリニア係数B0〜B3が各々乗算される4個の括弧の中の各値は、ソースカラー値SC0、SC1、SC2、SC3の各々と、ディスティネーション画素のディスティネーションカラー値Dとのαブレンディングの結果である。 In the right side of the above equation, each value in the four parentheses multiplied by the bilinear coefficients B0 to B3 is the source color value SC0, SC1, SC2, SC3 and the destination color value D of the destination pixel. It is the result of α blending.
前掲図6の例の場合、上記式(11)におけるα値A0およびA2が1、α値A1およびA3が0となることから、レンダリング後のディスティネーション画素のカラー値D’は、次式のようになる。
D’=B0*(1*SC0+(1−1)*D)+
B1*(0*SC1+(1−0)*D)+
B2*(1*SC2+(1−1)*D)+
B3*(0*SC3+(1−0)*D)
=B0*SC0+B1*D+B2*SC2+B3*D ……(12)
このように、図1に示すレンダリングを行うと、レンダリング後のディスティネーション画素のカラー値D’は、スプライト100の円状領域101内の画素のカラー値SC0、SC2と、背景画像の画素のカラー値Dとが混ざったものとなり、本来意図したエッジのカラー値となる。
In the case of the example shown in FIG. 6, since the α values A0 and A2 in the above equation (11) are 1 and the α values A1 and A3 are 0, the color value D ′ of the destination pixel after rendering is expressed by the following equation: It becomes like this.
D ′ = B0 * (1 * SC0 + (1-1) * D) +
B1 * (0 * SC1 + (1-0) * D) +
B2 * (1 * SC2 + (1-1) * D) +
B3 * (0 * SC3 + (1-0) * D)
= B0 * SC0 + B1 * D + B2 * SC2 + B3 * D (12)
As described above, when the rendering shown in FIG. 1 is performed, the color values D ′ of the destination pixels after rendering are the color values SC0 and SC2 of the pixels in the
以上のように、バイリニアフィルタ処理とαブレンディングを併用したレンダリングでは、αブレンディングを行ってからバイリニアフィルタ処理を行うようにすれば、上述したエッジのカラーが不自然なものとなる不具合を防止することができる。しかし、既存のレンダリング装置は、αブレンディングがバイリニアフィルタ処理の後に実行されることを前提に構成されており、上記のようにバイリニアフィルタ処理をαブレンディング処理の後処理とすることは、レンダリング装置全体の構成に与える影響が大きく、現実的にみて実施が困難である。 As described above, in rendering that uses bilinear filter processing and α blending in combination, if the bilinear filter processing is performed after α blending, the above-described problem that the edge color becomes unnatural can be prevented. Can do. However, the existing rendering device is configured on the assumption that α blending is executed after bilinear filter processing. As described above, bilinear filter processing is post-processing of α blending processing. This has a large effect on the configuration of the system and is difficult to implement in practice.
そこで、この発明では、バイリニアフィルタ処理の後にαブレンディングを行うという基本的な演算順序は崩さず、αブレンディングの全演算のうちバイリニアフィルタを利用して演算することが可能な部分を選んでバイリニアフィルタに実行させ、その結果をαブレンディングに引き渡すことにより、結果的に前掲式(11)と同じ演算を行う。具体的には次の通りである。 Therefore, in the present invention, the basic calculation order of performing the α blending after the bilinear filter processing is not broken, and the bilinear filter is selected by selecting a portion that can be calculated using the bilinear filter from all the α blending operations. And the result is transferred to α blending, and as a result, the same operation as the above equation (11) is performed. Specifically, it is as follows.
まず、前掲式(11)は、次のように変形可能である。
ラー値D’は、次式に示すものとなる。
D’=B0*(A0*SC0+(1−A0)*D)+
B1*(A1*SC1+(1−A1)*D)+
B2*(A2*SC2+(1−A2)*D)+
B3*(A3*SC3+(1−A3)*D)
=B0*A0*SC0+B0*(1−A0)*D+
B1*A1*SC1+B1*(1−A1)*D+
B2*A2*SC2+B2*(1−A2)*D+
B3*A3*SC3+B3*(1−A3)*D
=B0*A0*SC0+B1*A1*SC1+
B2*A2*SC2+B3*A3*SC3+
B0*D−B0*A0*D+B1*D−B1*A1*D+
B2*D−B2*A2*D+B3*D−B3*A3*D
=B0*A0*SC0+B1*A1*SC1+
B2*A2*SC2+B3*A3*SC3+
(B0−B0*A0+B1−B1*A1+
B2−B2*A2+B3−B3*A3)*D ……(13)
First, the above equation (11) can be modified as follows.
The error value D ′ is represented by the following equation.
D ′ = B0 * (A0 * SC0 + (1-A0) * D) +
B1 * (A1 * SC1 + (1-A1) * D) +
B2 * (A2 * SC2 + (1-A2) * D) +
B3 * (A3 * SC3 + (1-A3) * D)
= B0 * A0 * SC0 + B0 * (1-A0) * D +
B1 * A1 * SC1 + B1 * (1-A1) * D +
B2 * A2 * SC2 + B2 * (1-A2) * D +
B3 * A3 * SC3 + B3 * (1-A3) * D
= B0 * A0 * SC0 + B1 * A1 * SC1 +
B2 * A2 * SC2 + B3 * A3 * SC3 +
B0 * D-B0 * A0 * D + B1 * D-B1 * A1 * D +
B2 * D-B2 * A2 * D + B3 * D-B3 * A3 * D
= B0 * A0 * SC0 + B1 * A1 * SC1 +
B2 * A2 * SC2 + B3 * A3 * SC3 +
(B0-B0 * A0 + B1-B1 * A1 +
B2-B2 * A2 + B3-B3 * A3) * D (13)
上記式(13)において、バイリニア係数B0、B1、B2、B3の総和は1であることから、上記式(13)は次のようになる。
D’=B0*A0*SC0+B1*A1*SC1+
B2*A2*SC2+B3*A3*SC3+
{1−(B0*A0+B1*A1+B2*A2+B3*A3)}*D
……(14)
In the above equation (13), since the sum of the bilinear coefficients B0, B1, B2, and B3 is 1, the above equation (13) is as follows.
D ′ = B0 * A0 * SC0 + B1 * A1 * SC1 +
B2 * A2 * SC2 + B3 * A3 * SC3 +
{1- (B0 * A0 + B1 * A1 + B2 * A2 + B3 * A3)} * D
(14)
この発明では、上記式(14)の右辺におけるB0*A0*SC0+B1*A1*SC1+B2*A2*SC2+B3*A3*SC3と、B0*A0+B1*A1+B2*A2+B3*A3の演算をバイリニアフィルタに実行させる。そして、これらの演算結果を利用した右辺全体の演算をαブレンディング部に実行させるのである。 In the present invention, the bilinear filter executes B0 * A0 * SC0 + B1 * A1 * SC1 + B2 * A2 * SC2 + B3 * A3 * SC3 and B0 * A0 + B1 * A1 + B2 * A2 + B3 * A3 on the right side of the above equation (14). Then, the α blending unit executes the calculation of the entire right side using these calculation results.
ここで、B0*A0*SC0+B1*A1*SC1+B2*A2*SC2+B3*A3*SC3は、ソース画像においてレンダリング先であるディスティネーション画像のディスティネーション画素となる補間点を囲む4個のソース画素の各ソースカラー値SC0、SC1、SC2、SC3に4個のソース画素の各α値A0、A1、A2、A3を各々乗算し、各α値乗算後の4個のソースカラー値A0*SC0、A1*SC1、A2*SC2、
A3*SC3に対し、4個のソース画素と補間点との位置関係により定まる4個のバイリニアフィルタ係数B0、B1、B2、B3を用いたバイリニアフィルタ処理を施すことにより得られる補間点ソースカラー値である。また、B0*A0+B1*A1+B2*A2+B3*A3は、4個のソース画素の各α値A0、A1、A2、A3に4個のバイリニアフィルタ係数B0、B1、B2、B3を用いたバイリニアフィルタ処理を施すことにより得られる補間点ソースα値である。
Here, B0 * A0 * SC0 + B1 * A1 * SC1 + B2 * A2 * SC2 + B3 * A3 * SC3 is the source of each of the four source pixels surrounding the interpolation point that is the destination pixel of the destination image that is the rendering destination in the source image The color values SC0, SC1, SC2, and SC3 are respectively multiplied by the α values A0, A1, A2, and A3 of the four source pixels, and the four source color values A0 * SC0 and A1 * SC1 after the multiplication of the respective α values. , A2 * SC2,
Interpolation point source color value obtained by performing bilinear filter processing using four bilinear filter coefficients B0, B1, B2, and B3 determined by the positional relationship between the four source pixels and the interpolation points for A3 * SC3 It is. B0 * A0 + B1 * A1 + B2 * A2 + B3 * A3 is a bilinear filter process using four bilinear filter coefficients B0, B1, B2, B3 for each α value A0, A1, A2, A3 of the four source pixels. This is the interpolation point source α value obtained by applying.
そして、αブレンディング部では、ディスティネーション画素のディスティネーションカラー値Dと補間点ソースカラー値B0*A0*SC0+B1*A1*SC1+B2*A2*SC2+B3*A3*SC3とを補間点ソースα値B0*A0+B1*A1+B2*A2+B3*A3に基づいて混合し、上記式(14)に示すαブレンディング後のディスティネーション画素のカラー値D’を算出するのである。 In the α blending unit, the destination color value D of the destination pixel and the interpolation point source color value B0 * A0 * SC0 + B1 * A1 * SC1 + B2 * A2 * SC2 + B3 * A3 * SC3 are combined with the interpolation point source α value B0 * A0 + B1 *. Based on A1 + B2 * A2 + B3 * A3, mixing is performed, and the color value D ′ of the destination pixel after α blending shown in the above equation (14) is calculated.
以上のように、この発明によれば、バイリニアフィルタ処理の後にαブレンディングを行うという基本的な演算順序を崩さず、結果的に上記式(11)の演算を行うことができる。従って、レンダリング対象であるソース画像にα値が大きく変化するエッジがある場合に、レンダリング後の画像において当該エッジに対応した部分のカラーが不自然になるのを防止することができる。 As described above, according to the present invention, the calculation of the above formula (11) can be performed as a result without destroying the basic calculation order of performing the α blending after the bilinear filter processing. Accordingly, when the source image to be rendered has an edge whose α value greatly changes, it is possible to prevent the color of the portion corresponding to the edge in the rendered image from becoming unnatural.
以下、図面を参照し、この発明の実施の形態を説明する。
図2は、この発明の一実施形態であるレンダリング装置の構成を示すブロック図である。このレンダリング装置は、例えばゲーム機等に用いられる画像処理用LSIの一部の回路をなすものであり、同画像処理用LSI内においてスプライト画像を例えばゲーム機の表示対象である画像にレンダリングする処理を行うものである。図示のように、レンダリング装置は、バイリニアフィルタ1と、αブレンディング部2と、ソース画像メモリ3と、ディスティネーション画像メモリ4とを有する。ここで、ソース画像メモリ3は、レンダリング対象であるソース画像の画像データを記憶するメモリである。このソース画像の画像データは、ソース画像を構成する各画素を示す画素データの集合体である。1個の画素を示す画素データは、画素のカラーのR、G、Bの各成分の輝度を示すデータと、画素の透明度を示すα値により構成されている。ディスティネーション画像メモリ4は、ソース画像のレンダリング先であるディスティネーション画像の画像データを記憶するメモリである。
Embodiments of the present invention will be described below with reference to the drawings.
FIG. 2 is a block diagram showing a configuration of a rendering apparatus according to an embodiment of the present invention. This rendering apparatus forms part of a circuit of an image processing LSI used in, for example, a game machine, and the process of rendering a sprite image into an image that is a display target of the game machine, for example, in the image processing LSI. Is to do. As illustrated, the rendering apparatus includes a
バイリニアフィルタ処理およびαブレンディングを併用したレンダリングを行う場合において、バイリニアフィルタ1には、ディスティネーション画素に対応した補間点PP(x、y)のx、y座標値の小数部p、qと、レンダリング先であるディスティネーション画像のディスティネーション画素に対応した補間点PP(x、y)を囲む4個のソース画素P(m、n)、P(m+1、n)、P(m、n+1)、P(m+1、n+1)の各ソースカラー値SC0、SC1、SC2、SC3と、各ソースα値A0、A1、A2、A3が与えられる。この場合、バイリニアフィルタ1は、まず、次式に示す演算を行う。
AB0=B0*A0 ……(15)
AB1=B1*A1 ……(16)
AB2=B2*A2 ……(17)
AB3=B3*A3 ……(18)
When rendering is performed using bilinear filter processing and α blending together, the
AB0 = B0 * A0 (15)
AB1 = B1 * A1 (16)
AB2 = B2 * A2 (17)
AB3 = B3 * A3 (18)
次にバイリニアフィルタ1は、下記式(19)に従って補間点ソースカラー値SCを算出するとともに、下記式(20)に従って補間点ソースα値Aを算出する。
SC=AB0*SC0+AB1*SC1+AB2*SC2+AB3*SC3
……(19)
A=B0*A0+B1*A1+B2*A2+B3*A3 ……(20)
Next, the
SC = AB0 * SC0 + AB1 * SC1 + AB2 * SC2 + AB3 * SC3
...... (19)
A = B0 * A0 + B1 * A1 + B2 * A2 + B3 * A3 (20)
バイリニアフィルタ1は、この補間点ソースカラー値SCおよび補間点ソースα値Aをαブレンディング部2に送る。αブレンディング部2は、ディスティネーション画素のディスティネーションカラー値Dをディスティネーション画像メモリ4から読み出し、このディスティネーションカラー値Dと、補間点ソースカラー値SCおよび補間点ソースα値Aとを用いて次式に示す演算を行い、レンダリング後のディスティネーションカラー値D’を算出する。
D’=SC+(1−A)*D ……(21)
The
D ′ = SC + (1-A) * D (21)
通常のαブレンディングでは、補間点ソースカラー値SCにα値を乗算するが、本実施形態では、上記式(21)に示すように補間点ソースカラー値SCへのα値の乗算は行わない。これは、本実施形態においてバイリニアフィルタ1は、α値が乗算された後の4個のソースカラー値にバイリニアフィルタ処理を施したものを補間点ソースカラー値SCとして出力するからである。本実施形態において、上記式(21)の演算結果は、次式(22)に示すように前掲式(14)と同じものになる。従って、α値が大きく変化するエッジをレンダリング対象であるソース画像が含んでいる場合であっても、レンダリング後の画像の当該エッジ部分のカラーが不自然になるのを防止することができる。
D’=SC+(1−A)*D
=(AB0*SC0+AB1*SC1+AB2*SC2+AB3*SC3)+
{1−(B0*A0+B1*A1+B2*A2+B3*A3)}*D
=B0*A0*SC0+B1*A1*SC1+
B2*A2*SC2+B3*A3*SC3+
{1−(B0*A0+B1*A1+B2*A2+B3*A3)}*D
……(22)
αブレンディング部2は、このカラー値D’をレンダリング後のディスティネーション画素のカラー値としてディスティネーション画像メモリ4に上書きする。
In normal α blending, the interpolation point source color value SC is multiplied by the α value, but in this embodiment, the interpolation point source color value SC is not multiplied by the α value as shown in the above equation (21). This is because in the present embodiment, the
D '= SC + (1-A) * D
= (AB0 * SC0 + AB1 * SC1 + AB2 * SC2 + AB3 * SC3) +
{1- (B0 * A0 + B1 * A1 + B2 * A2 + B3 * A3)} * D
= B0 * A0 * SC0 + B1 * A1 * SC1 +
B2 * A2 * SC2 + B3 * A3 * SC3 +
{1- (B0 * A0 + B1 * A1 + B2 * A2 + B3 * A3)} * D
...... (22)
The
以上のように、本実施形態によれば、バイリニアフィルタ処理の後にαブレンディングを行うという演算の順序を崩さずに、バイリニアフィルタ処理およびαブレンディングを併用したレンダリングを行い、その際に、α値が大きく変化するエッジをレンダリング対象であるソース画像が含んでいる場合であっても、レンダリング後の画像の当該エッジ部分のカラーが不自然になるのを防止することができる。 As described above, according to the present embodiment, rendering that uses bilinear filter processing and α blending is performed without destroying the order of operations of performing α blending after bilinear filter processing. Even when the source image to be rendered includes an edge that varies greatly, it is possible to prevent the color of the edge portion of the rendered image from becoming unnatural.
以上、この発明の一実施形態について説明したが、この発明には他にも実施形態があり得る。例えば次の通りである。 Although one embodiment of the present invention has been described above, the present invention may have other embodiments. For example:
(1)バイリニアフィルタ1は、次式に示すように、前掲式(19)の補間点ソースカラー値SCを補間点ソースα値Aによって除算したものを補間点ソースカラー値SCとして出力してもよい。
SC=(AB0*SC0+AB1*SC1+AB2*SC2+AB3*SC3)/A
……(23)
(1) As shown in the following equation, the
SC = (AB0 * SC0 + AB1 * SC1 + AB2 * SC2 + AB3 * SC3) / A
...... (23)
この態様において、後段のαブレンディング部2は、次式に示すように通常のαブレンディングを行えば、前掲式(14)と同じ値のレンダリング後のディスティネーションカラー値D’を得ることができる。
D’=A*SC+(1−A)*D
=A*{(AB0*SC0+AB1*SC1+
AB2*SC2+AB3*SC3)/A}+(1−A)*D
=(AB0*SC0+AB1*SC1+AB2*SC2+AB3*SC3)+
(1−A)*D
=(AB0*SC0+AB1*SC1+AB2*SC2+AB3*SC3)+
{1−(B0*A0+B1*A1+B2*A2+B3*A3)}*D
=B0*A0*SC0+B1*A1*SC1+
B2*A2*SC2+B3*A3*SC3+
{1−(B0*A0+B1*A1+B2*A2+B3*A3)}*D
……(24)
In this aspect, the subsequent
D '= A * SC + (1-A) * D
= A * {(AB0 * SC0 + AB1 * SC1 +
AB2 * SC2 + AB3 * SC3) / A} + (1-A) * D
= (AB0 * SC0 + AB1 * SC1 + AB2 * SC2 + AB3 * SC3) +
(1-A) * D
= (AB0 * SC0 + AB1 * SC1 + AB2 * SC2 + AB3 * SC3) +
{1- (B0 * A0 + B1 * A1 + B2 * A2 + B3 * A3)} * D
= B0 * A0 * SC0 + B1 * A1 * SC1 +
B2 * A2 * SC2 + B3 * A3 * SC3 +
{1- (B0 * A0 + B1 * A1 + B2 * A2 + B3 * A3)} * D
(24)
従って、この態様においても、上記実施形態と同様な効果が得られる。また、この態様は、αブレンディング部2の演算内容を通常のαブレンディングから変えなくて済むという利点がある。また、この態様において、バイリニアフィルタ1が出力する補間点ソースカラー値SCは、α値(具体的には補間点ソースα値A)が乗算されていない内容のものなので、バイリニアフィルタ1とαブレンディング部2との間に輝度操作を行う他の演算手段が介在する場合でも、輝度操作の演算内容に変更を加える必要がないという利点がある。
Therefore, also in this aspect, the same effect as the above embodiment can be obtained. Further, this aspect has an advantage that the calculation content of the
(2)上記実施形態では、ソース画像を構成する各ソース画素の画素データがα値を含んでいたが、ソース画素にα値を対応付ける態様はこれに限定されるものではない。例えばあるカラー値を持った画素にはα=1、別のあるカラー値を持った画素にはα=0という具合に、カラー値にα値を対応付けてもよい。 (2) In the above embodiment, the pixel data of each source pixel constituting the source image includes the α value. However, the mode of associating the α value with the source pixel is not limited to this. For example, the α value may be associated with the color value such that α = 1 for a pixel having a certain color value and α = 0 for another pixel having a certain color value.
(3)この発明は、上記各実施形態(上記(1)および(2)に示すような変形された態様を含む。)のバイリニアフィルタ1およびαブレンデイング部2を備えた専用のハードウェアとして実現する他、コンピュータを上記各実施形態のバイリニアフィルタ1およびαブレンデイング部2として機能させるコンピュータプログラムとして実現してもよい。
(3) The present invention is a dedicated hardware provided with the
1……バイリニアフィルタ、2……αブレンディング部、3……ソース画像メモリ、4……ディスティネーション画像メモリ。
DESCRIPTION OF
Claims (4)
前記ディスティネーション画素のディスティネーションカラー値と前記補間点ソースカラー値とを前記補間点ソースα値に基づいて混合し、αブレンディング後の前記ディスティネーション画素のカラー値を算出するαブレンディング部と
を具備することを特徴とするレンダリング装置。 In the source image, each source color value of the four source pixels surrounding the interpolation point that becomes the destination pixel of the destination image that is the rendering destination in the source image is multiplied by each α value of the four source pixels, and each α value multiplication is performed. Bilinear filter processing using four bilinear filter coefficients determined by the positional relationship between the four source pixels and the interpolation point is performed on the subsequent four source color values, and an interpolation point source is obtained based on the result. A bilinear filter that calculates a color value and performs bilinear filter processing using the four bilinear filter coefficients on each α value of the four source pixels to calculate an interpolation point source α value;
An α blending unit that mixes the destination color value of the destination pixel and the interpolation point source color value based on the interpolation point source α value, and calculates the color value of the destination pixel after α blending. A rendering device characterized by:
前記αブレンディング部は、前記補間点ソースα値を1から差し引いた値を前記ディスティネーションカラー値に乗算し、この乗算結果と前記補間点ソースカラー値とを加算することにより、αブレンディング後の前記ディスティネーション画素のカラー値を算出することを特徴とする請求項1に記載のレンダリング装置。 The bilinear filter outputs, as the interpolation point source color value, a result obtained by performing bilinear filter processing using the four bilinear filter coefficients on the four source color values after each α value multiplication,
The α blending unit multiplies the destination color value by a value obtained by subtracting the interpolation point source α value from 1, and adds the multiplication result and the interpolation point source color value to obtain the α blended value. The rendering apparatus according to claim 1, wherein the color value of the destination pixel is calculated.
前記αブレンディング部は、前記補間点ソースα値を1から差し引いた値を前記ディスティネーションカラー値に乗算し、この乗算結果と、前記補間点ソースα値と前記補間点ソースカラー値との乗算結果を加算することにより、αブレンディング後の前記ディスティネーション画素のカラー値を算出することを特徴とする請求項2に記載のレンダリング装置。 The bilinear filter performs bilinear filter processing using the four bilinear filter coefficients on the four source color values after each α value multiplication, and divides the result by the interpolation point source α value. Is output as the interpolation point source color value,
The α blending unit multiplies the destination color value by a value obtained by subtracting the interpolation point source α value from 1 and multiplies the multiplication result by the interpolation point source α value and the interpolation point source color value. The rendering apparatus according to claim 2, wherein the color value of the destination pixel after α blending is calculated by adding.
ソース画像においてレンダリング先であるディスティネーション画像のディスティネーション画素となる補間点を囲む4個のソース画素の各ソースカラー値に前記4個のソース画素の各α値を各々乗算し、各α値乗算後の4個のソースカラー値に対し、前記4個のソース画素と前記補間点との位置関係により定まる4個のバイリニアフィルタ係数を用いたバイリニアフィルタ処理を施すことにより補間点ソースカラー値を算出するとともに、前記4個のソース画素の各α値に前記4個のバイリニアフィルタ係数を用いたバイリニアフィルタ処理を施して補間点ソースα値を算出するバイリニアフィルタと、
前記ディスティネーション画素のディスティネーションカラー値と前記補間点ソースカラー値とを前記補間点ソースα値に基づいて混合し、αブレンディング後の前記ディスティネーション画素のカラー値を算出するαブレンディング部と
として機能させることを特徴とするコンピュータプログラム。 Computer
In the source image, each source color value of the four source pixels surrounding the interpolation point that becomes the destination pixel of the destination image that is the rendering destination in the source image is multiplied by each α value of the four source pixels, and each α value multiplication is performed. Interpolation point source color values are calculated by performing bilinear filter processing using the four bilinear filter coefficients determined by the positional relationship between the four source pixels and the interpolation points for the subsequent four source color values. And a bilinear filter that calculates an interpolation point source α value by subjecting each α value of the four source pixels to bilinear filter processing using the four bilinear filter coefficients;
A function as an α blending unit that mixes the destination color value of the destination pixel and the interpolation point source color value based on the interpolation point source α value and calculates the color value of the destination pixel after α blending. A computer program characterized by causing
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2009069626A JP5310164B2 (en) | 2009-03-23 | 2009-03-23 | Rendering device and program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2009069626A JP5310164B2 (en) | 2009-03-23 | 2009-03-23 | Rendering device and program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2010224733A true JP2010224733A (en) | 2010-10-07 |
JP5310164B2 JP5310164B2 (en) | 2013-10-09 |
Family
ID=43041870
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2009069626A Active JP5310164B2 (en) | 2009-03-23 | 2009-03-23 | Rendering device and program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP5310164B2 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108492342A (en) * | 2018-03-22 | 2018-09-04 | 网易(杭州)网络有限公司 | Merge method, apparatus, processor, storage medium and the terminal of broken figure |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2002063591A (en) * | 2000-06-05 | 2002-02-28 | Namco Ltd | Game system, program and information storage medium |
JP2003006673A (en) * | 2001-06-25 | 2003-01-10 | Namco Ltd | Image generating system, program and information storage medium |
JP2004334661A (en) * | 2003-05-09 | 2004-11-25 | Namco Ltd | Image generating system, program, and information storage medium |
JP2006018382A (en) * | 2004-06-30 | 2006-01-19 | Yamaha Corp | Image processing method and device |
-
2009
- 2009-03-23 JP JP2009069626A patent/JP5310164B2/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2002063591A (en) * | 2000-06-05 | 2002-02-28 | Namco Ltd | Game system, program and information storage medium |
JP2003006673A (en) * | 2001-06-25 | 2003-01-10 | Namco Ltd | Image generating system, program and information storage medium |
JP2004334661A (en) * | 2003-05-09 | 2004-11-25 | Namco Ltd | Image generating system, program, and information storage medium |
JP2006018382A (en) * | 2004-06-30 | 2006-01-19 | Yamaha Corp | Image processing method and device |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108492342A (en) * | 2018-03-22 | 2018-09-04 | 网易(杭州)网络有限公司 | Merge method, apparatus, processor, storage medium and the terminal of broken figure |
CN108492342B (en) * | 2018-03-22 | 2022-05-03 | 网易(杭州)网络有限公司 | Method, device, processor, storage medium and terminal for merging broken graphs |
Also Published As
Publication number | Publication date |
---|---|
JP5310164B2 (en) | 2013-10-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP6038171B2 (en) | User interface device | |
US20190098278A1 (en) | Image processing apparatus, image processing method, and storage medium | |
JP5022366B2 (en) | Device for generating interpolated frames | |
JP5701374B2 (en) | Image enlargement apparatus and method | |
JP2010157163A (en) | Image processing method and image processor | |
JP2006338692A5 (en) | ||
US20130004061A1 (en) | Image processing device, image processing program, and method for generating image | |
JP4240395B2 (en) | Image composition apparatus, electronic device, image composition method, control program, and readable recording medium | |
JP5610327B1 (en) | Image processing apparatus, image processing method, and program | |
JP2006190306A (en) | Method and device for processing mosaic of image | |
JP2009060373A5 (en) | ||
US20180033185A1 (en) | Texture mapping apparatus, texture mapping method, and computer readable medium | |
JP2006526834A (en) | Adaptive image interpolation for volume rendering | |
JP2008059582A (en) | Level of detail value calculating method for reducing power consumption, and 3-dimensional rendering system using the same | |
JP5310164B2 (en) | Rendering device and program | |
US9286714B2 (en) | Apparatus and method for processing graphics primitives | |
JP2010079883A (en) | Information processing apparatus, image processing method, and program | |
KR100733505B1 (en) | Resolution converting method | |
EP3125191A1 (en) | Image processing device | |
JP2016121875A (en) | X-ray inspection device | |
KR101807229B1 (en) | Accelerated super-resolution processing method for TV video images, accelerated super-resolution processing device for TV video images that is used in same method, first to sixth accelerated super-resolution processing programs, and first to second storage media | |
JP2004282593A (en) | Contour correction device | |
JP5736745B2 (en) | 2D color gradation display device | |
JP2887255B2 (en) | Image synthesis device | |
JP2006251850A (en) | Image processing system, image processing method, program for image processing method, and recording medium recording the same program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20120120 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20130225 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20130305 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20130429 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20130604 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20130617 |
|
R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 Ref document number: 5310164 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |