JP2907357B2 - Method and apparatus for shading figures - Google Patents

Method and apparatus for shading figures

Info

Publication number
JP2907357B2
JP2907357B2 JP20190591A JP20190591A JP2907357B2 JP 2907357 B2 JP2907357 B2 JP 2907357B2 JP 20190591 A JP20190591 A JP 20190591A JP 20190591 A JP20190591 A JP 20190591A JP 2907357 B2 JP2907357 B2 JP 2907357B2
Authority
JP
Japan
Prior art keywords
gon
vertex
shading
normal
brightness
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.)
Expired - Fee Related
Application number
JP20190591A
Other languages
Japanese (ja)
Other versions
JPH0546781A (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.)
Fujifilm Business Innovation Corp
Original Assignee
Fuji Xerox 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 Fuji Xerox Co Ltd filed Critical Fuji Xerox Co Ltd
Priority to JP20190591A priority Critical patent/JP2907357B2/en
Publication of JPH0546781A publication Critical patent/JPH0546781A/en
Application granted granted Critical
Publication of JP2907357B2 publication Critical patent/JP2907357B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Digital Computer Display Output (AREA)
  • Image Generation (AREA)

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【産業上の利用分野】本発明は、二次元グラフィックス
により作成した立体的な形状の図形に陰影を付ける図形
の陰影付け方法及び装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a method and an apparatus for shading a figure for shading a three-dimensional figure created by two-dimensional graphics.

【0002】[0002]

【従来の技術】カタログやパンフレットなどのプレゼン
テーションを目的とする資料には、見やすさや理解度の
向上をはかるために立体的な図形のイラストが多用され
ており、その中でも角柱形状の図形は特に多く使われて
いる。このような図形を作成する方法の1つに三次元グ
ラフィックスがあるが、図形の向きを思うように調整す
るのが簡単でなく、さらには計算コストが高いため、オ
フィスユースには向かないという問題がある。
2. Description of the Related Art For presentation purposes such as catalogs and pamphlets, illustrations of three-dimensional figures are frequently used in order to improve legibility and understanding. Of these, prismatic figures are particularly common. It is used. One of the methods of creating such a figure is three-dimensional graphics, but it is not easy to adjust the orientation of the figure as desired, and the calculation cost is high, so it is not suitable for office use. There's a problem.

【0003】別の方法として二次元グラフィックスの利
用が考えられる。この場合、計算コストは三次元グラフ
ィックスに比べて安価になるが、三次元情報がないた
め、形状を設定した後の陰影を簡単に付けるための操作
および処理の提供が必要となる。陰影を付けるために例
えばペイント機能を用いて1面々々濃淡を付けていたの
では非常に面倒であり、技量も必要である。
As another method, use of two-dimensional graphics can be considered. In this case, the calculation cost is lower than that of three-dimensional graphics, but since there is no three-dimensional information, it is necessary to provide an operation and a process for easily adding a shadow after setting a shape. It would be very troublesome to add shading, for example, by using a paint function to add one-to-one shading, which requires skill.

【0004】二次元の処理で立体的な色表現を行う方法
にソフトシェーディングと呼ばれる同一面の内部にグラ
デーション的な陰影付けを行う技法がある。しかし立体
図形に陰影を付けようとする用途に対しては図形を構成
する各面ごとに色情報を指定しなければならず、しかも
図形を立体らしく見せるには適切な色指定を行う技量が
必要であり、それゆえ操作が簡単ではないという問題が
あった。
[0004] As a method of expressing a three-dimensional color by two-dimensional processing, there is a technique called soft shading for shading gradation inside the same surface. However, for applications where shadows are to be applied to three-dimensional figures, color information must be specified for each face that composes the figure, and the skill of specifying the appropriate colors is necessary to make the figure look like a three-dimensional figure. Therefore, there is a problem that the operation is not easy.

【0005】[0005]

【発明が解決しようとする課題】本発明は上記した問題
点を改善するために提案されたもので、二次元グラフィ
ックスにより立体的な図形を作成する場合に、簡単にさ
らには安価な計算コストで陰影付けできる方法及び装置
を提供することを目的とする。
SUMMARY OF THE INVENTION The present invention has been proposed in order to improve the above-mentioned problems, and is simple and inexpensive when calculating a three-dimensional figure by two-dimensional graphics. It is an object of the present invention to provide a method and an apparatus which can perform shading on a computer.

【0006】[0006]

【課題を解決するための手段】本発明は、前記目的を達
成するため、二次元平面上で第1のN角形(Nは3以上
の整数)の頂点と第2のN角形の頂点とを各々を結んで
ワイヤフレーム表示したN角柱の面に陰影付けする図形
の陰影付け方法であって、前記第1のN角形の辺の法線
を求めて該辺と前記第2のN角形の辺とを含む側面の法
線とする法線決定工程と、面の中心点と二次元平面上に
設定された光源の位置とを結ぶ光線を求める光線決定工
程と、前記側面の法線と前記光線との角度から該側面の
反射係数を求めて該側面の明るさを決定するとともに、
前記第1のN角形の頂点と前記第2のN角形の頂点とを
結ぶ直線と前記光線との角度から反射係数を求めて端面
の明るさを決定する工程とを有することを特徴とする。
According to the present invention, in order to achieve the above object, a first N polygon (N is 3 or more) on a two-dimensional plane is provided.
) And the vertex of the second N-gon
A method of shading a figure for shading a surface of an N prism displayed as a wire frame , wherein a normal line of a side of the first N polygon is provided.
To obtain the modulus of the side surface including the side and the side of the second N-gon.
The process of determining the normal line and the center point of the surface and the two-dimensional plane
A ray determinator that finds a ray connecting the set light source position
From the angle between the normal line of the side surface and the light ray,
While determining the reflection coefficient to determine the brightness of the side,
A vertex of the first N-gon and a vertex of the second N-gon
Determine the reflection coefficient from the angle between the straight line that connects and the light ray
Determining the brightness of the image.

【0007】また、本発明は、二次元平面上で第1のN
角形(Nは3以上の整数)の頂点と第2のN角形の頂点
とを各々を結んでワイヤフレーム表示したN角柱の面に
陰影付けする図形の陰影付け装置であって前記第1の
N角形の辺の法線を求めて該辺と前記第2のN角形の辺
とを含む側面の法線とする法線決定手段と、面の中心点
と二次元平面上に設定された光源の位置とを結ぶ光線を
求める光線決定手段と、前記側面の法線と前記光線との
角度から該側面の反射係数を求めて該側面の明るさを決
定するとともに、前記第1のN角形の頂点と前記第2の
N角形の頂点とを結ぶ直線と前記光線との角度から反射
係数を求めて端面の明るさを決定する手段とを有するこ
とを特徴とする。
Further, the present invention provides a method for controlling a first N on a two-dimensional plane.
A vertex of a polygon (N is an integer of 3 or more) and a vertex of a second N polygon
And N are connected to each other on the surface of N prism
A shading device for shading a figure, wherein the first shading device comprises:
The normal of the side of the N-gon is determined, and the side and the side of the second N-gon are determined.
Normal determining means for determining the normal of a side surface including:
And the ray connecting the position of the light source set on the two-dimensional plane
The ray determining means to be sought, and the normal of the side face and the ray
Obtain the reflection coefficient of the side from the angle and determine the brightness of the side.
And the vertex of the first N-gon and the second
Reflection from the angle between the straight line connecting the apex of the N-gon and the ray
Means for determining the brightness of the end face by obtaining a coefficient .

【0008】[0008]

【作用】本発明の作用を具体的に例を挙げて説明する。The operation of the present invention will be described specifically with reference to examples.

【0009】本発明において、図形の生成および陰影付
けを行う処理部は、図1に示すように、図形の頂点座標
値や光源の位置等の情報を記憶する図形情報記憶部11
と、図形の頂点列の並びを調べて並びかえを行う座標値
変換部12と、図形の各座標値から各面の法線ベクトル
を決定する法線ベクトル算出部13と、各面の位置と光
源の位置とから光線の向きを決定する光線ベクトル算出
部14と、法線ベクトルと光線ベクトルとから各面の明
るさを決定する明度情報算出部15と、明度情報に基づ
いて各面の塗りつぶしを行う描画処理部16と、上記し
た11〜16の各処理部の動作を司る制御部17とから
構成される。上記した11〜17をまとめたものを図形
情報処理部18と呼ぶ。画像メモリ19には描画処理部
16から生成された図形画像が表示結果として展開され
る。
In the present invention, as shown in FIG. 1, a processing section for generating and shading a figure includes a figure information storage section 11 for storing information such as the vertex coordinate value of the figure and the position of the light source.
A coordinate value conversion unit 12 for examining and rearranging the arrangement of the vertices of the figure, a normal vector calculation unit 13 for determining a normal vector of each surface from each coordinate value of the figure, A ray vector calculation unit 14 that determines the direction of a ray from the position of the light source, a brightness information calculation unit 15 that determines the brightness of each face from the normal vector and the ray vector, and fills each face based on the brightness information And a control unit 17 that controls the operations of the processing units 11 to 16 described above. A combination of the above items 11 to 17 is called a graphic information processing unit 18. In the image memory 19, the graphic image generated from the drawing processing unit 16 is developed as a display result.

【0010】本発明においては、陰影付けを行う図形を
形成するための図形の頂点座標値等の図形情報や光源の
位置等の情報をキーボード等の入力装置から入力して図
形情報記憶部11に格納し、この図形情報に基づいて描
画処理部16により陰影付けを行うべき図形を形成す
る。このとき座標値変換部12により図形の頂点列の並
びを調べて、例えば、頂点番号の大きくなる順番に従っ
て紙面に対して右回りになるように並びかえを行う。描
画処理部16は、この図形に対してワイヤフレームの形
態で表示する。
In the present invention, graphic information such as vertex coordinate values of a figure for forming a figure to be shaded and information such as a position of a light source are inputted from an input device such as a keyboard, and are inputted to the figure information storage section 11. The drawing processing unit 16 stores the figure and forms a figure to be shaded based on the figure information. At this time, the coordinate value conversion unit 12 checks the arrangement of the vertex rows of the graphic, and performs the rearrangement so that the vertex numbers become clockwise in the order of increasing vertex numbers, for example. The drawing processing unit 16 displays the figure in the form of a wire frame.

【0011】次に、法線ベクトル算出部13により、図
形の各座標値から陰影付けを行うべき各面の法線ベクト
ルを決定する。また、光線ベクトル算出部14は、各面
の位置と光源の位置とから光線の向き(光線ベクトル)
を決定する。明度情報算出部15は、法線ベクトルと光
線ベクトルとが成す角度から予めきめられた計算式に基
づいて各面の明るさを決定する。描画処理部16は、明
度情報算出部15で求められた明度情報に基づいて各面
の塗りつぶしを行う。塗りつぶし後の図形は、画像メモ
リ19に展開される。この画像メモリ19の内容をディ
スプレイに供給することにより、陰影が付けられた図形
が表示されることになる。
Next, the normal vector calculation unit 13 determines a normal vector of each surface to be shaded from each coordinate value of the figure. The light vector calculation unit 14 calculates the direction of light (light vector) based on the position of each surface and the position of the light source.
To determine. The brightness information calculation unit 15 determines the brightness of each surface based on a calculation formula determined in advance from the angle between the normal vector and the light vector. The drawing processing unit 16 paints each surface based on the brightness information obtained by the brightness information calculation unit 15. The figure after the painting is developed in the image memory 19. By supplying the contents of the image memory 19 to the display, a shaded figure is displayed.

【0012】[0012]

【実施例】本発明の一実施例を図を用いて説明する。An embodiment of the present invention will be described with reference to the drawings.

【0013】図2は、本発明を実施するためのハードウ
ェア構成の一例を示したものである。同図において、2
1は計算機、22は中央演算処理装置、23は図形情報
処理部、24は画像メモリ、25は入力装置、26はデ
ィスプレイ、27はスキャナ、28はプリンタ、29は
バスである。入力装置25は計算機21に命令等を与え
るためのものである。ディスプレイ26は図形を含む画
像を出力表示するものである。スキャナ27は画像を入
力するもので、プリンタ28は画像を出力するものであ
る。バス29は画像データや図形データや制御情報を受
渡しする役割を果たす。画像メモリ24は画像データを
記憶するものであり、図1における画像メモリ19に対
応している。また、中央演算処理装置22は処理装置全
体の制御や一般的な演算を行うものである。図形情報処
理部23は先に説明したように図形の生成/表示を行う
もので図1における図形情報処理部18に対応してい
る。
FIG. 2 shows an example of a hardware configuration for implementing the present invention. In the figure, 2
1 is a computer, 22 is a central processing unit, 23 is a graphic information processing unit, 24 is an image memory, 25 is an input device, 26 is a display, 27 is a scanner, 28 is a printer, and 29 is a bus. The input device 25 is for giving commands and the like to the computer 21. The display 26 outputs and displays an image including graphics. The scanner 27 is for inputting an image, and the printer 28 is for outputting an image. The bus 29 serves to transfer image data, graphic data, and control information. The image memory 24 stores image data, and corresponds to the image memory 19 in FIG. The central processing unit 22 controls the entire processing unit and performs general calculations. The graphic information processing unit 23 generates and displays a graphic as described above, and corresponds to the graphic information processing unit 18 in FIG.

【0014】以下、本発明の図形の陰影付け方法につい
て、図形の形状を入力して陰影を付けるべき図形を形成
する工程と、この図形に対して陰影を付ける工程に分け
て説明する。なお、以下に説明する処理は、特に注記し
ない場合には図2に示す図形情報処理部23において実
行されるものとする。
The method for shading a figure according to the present invention will be described below by dividing the step of inputting the shape of a figure into a figure to be shaded and the step of shading the figure. The processing described below is executed by the graphic information processing unit 23 shown in FIG. 2 unless otherwise specified.

【0015】初めに図形の形状の入力など陰影付けを行
う前までの処理について説明する。なお、形状設定まで
の処理例は一例なので必ずしもこれに限定する必要はな
い。
First, a description will be given of a process before shading such as input of a shape of a figure. It should be noted that the processing example up to the setting of the shape is an example, and is not necessarily limited to this.

【0016】図3は作成しようとする図形の完成予想の
例であり、今からこのようなN角形(Nは3以上の整
数)の角柱形状の図形を作成することにする。なお、図
において交差斜線を付した面が最も暗い面を示し、次い
でドットを付した面、横線を付した面の順で明るくなっ
ている。図4(a),(b),(c)は,図3の図形の
形状を入力する様子を示したものである。
FIG. 3 shows an example of the expected completion of a figure to be created. From now on, such an N polygon (N is an integer of 3 or more)
Let's create a prismatic figure of ( number) . In the figure, the surface with cross diagonal lines indicates the darkest surface, then the surface with dots and the surface with horizontal lines are brighter in this order. FIGS. 4A, 4B, and 4C show how the shape of the figure shown in FIG. 3 is input.

【0017】まず図4(a)に示すように角柱図形の上
面となる図形を入力装置25等を使用して入力し、続い
て図4(b)のように上面の図形を複写して任意の位置
に配置して下面の図形を得る。図4(c)が入力された
図形をワイヤフレームで表示したものである。図形の頂
点は、上面図形についてはP1 ,P2 ,・・・,P
n (nは2以上の整数)とし、下面図形については上面
図形の頂点と対応させてQ1 ,Q2 ,・・・,Qn とす
る。なお頂点は番号の大きくなる順番に従って紙面に対
して右回り方向となるように統一しておく。左回りに入
力した場合には右回りに揃えておく。これは後に行う陰
影処理の計算のためである。上面図形から下面図形まで
の相対距離はDX ,DY とする。本実施例の場合、頂点
2 ,P3 を結ぶ線がX軸に平行な線であり、頂点P3
と頂点Q3 とのX座標の差がDX 、Y座標の差がDY
ある。
First, as shown in FIG. 4A, a figure to be the upper surface of a prismatic figure is input using the input device 25 or the like, and then, as shown in FIG. To obtain a figure on the lower surface. FIG. 4C shows the input graphic displayed in a wire frame. The vertices of the figure are P 1 , P 2 ,.
and n (n is an integer of 2 or more), the lower surface shapes Q 1, Q 2 in correspondence with the vertices of the top graphic, ..., and Q n. Note that the vertices are unified so as to be clockwise with respect to the paper surface in the order of increasing numbers. When inputting counterclockwise, align it clockwise. This is for the calculation of the shadow processing performed later. The relative distances from the upper figure to the lower figure are D X and D Y. In the case of this embodiment, the line connecting the vertices P 2 and P 3 is a line parallel to the X axis, and the vertex P 3
The difference between the X coordinate and the vertex Q 3 is D X , and the difference between the Y coordinates is D Y.

【0018】形状の入力を終えた図4(c)の図形に対
しては隠面消去処理を行う。この処理は陰影処理と並行
して行っても良いが、この例では別に処理することにす
る。隠面消去処理の方法には様々なものがあるが、ここ
では限定しない。処理を行って表示した結果は図5のよ
うになる。隠面処理の1方法として操作者が表示すべき
面を指定することも考えられる。また各面の頂点の紙面
に対する回り具合を判定して表示すべき面を決定しても
構わない。
A hidden surface erasing process is performed on the figure of FIG. This processing may be performed in parallel with the shadow processing, but will be performed separately in this example. There are various methods of the hidden surface erasing process, but the method is not limited here. The result of performing the processing and displaying the result is as shown in FIG. As one method of the hidden surface processing, it is conceivable that the operator specifies a surface to be displayed. Also, the surface to be displayed may be determined by judging the degree of rotation of the vertex of each surface with respect to the paper surface.

【0019】次に、本発明による図形の陰影付け処理の
方法について説明する。
Next, a method of shading a figure according to the present invention will be described.

【0020】図6は図形に陰影を与えるために行う操作
の様子を示したものである。同図中の符号Lは光源を表
しており、これを任意の位置に配置して陰影の具合を調
整する。図7は陰影、つまり面の明るさを決定するため
の光源と図形の関係の様子を示すものである。図8は図
形の側面の陰影付けを行う処理フローであり、図9は図
形の上面の陰影付けを行う処理フローである。
FIG. 6 shows a state of an operation performed to give a shadow to a figure. Reference numeral L in the figure denotes a light source, which is arranged at an arbitrary position to adjust the degree of shading. FIG. 7 shows a state of a shadow, that is, a relationship between a light source and a graphic for determining surface brightness. FIG. 8 is a processing flow for shading the side surface of the graphic, and FIG. 9 is a processing flow for shading the upper surface of the graphic.

【0021】先に図8に示す側面に対する陰影付け処理
を行う。
First, a shading process is performed on the side surface shown in FIG.

【0022】ステップS101では、表示対象となる側
面を1面づつ選択する。それらは隠面消去処理で表示す
べきものとみなした面である。ここでは図7に示すよう
に頂点列P5 ,Q5 ,Q1 ,P1 で囲まれた側面を例に
取りあげる。
In step S101, side surfaces to be displayed are selected one by one. These are the surfaces that are considered to be displayed in the hidden surface removal processing. Here, a side face surrounded by vertex rows P 5 , Q 5 , Q 1 , and P 1 as shown in FIG. 7 is taken as an example.

【0023】ステップS102では、選択した面の中心
位置となる箇所を求める。図7に示す例の場合、C5
選択面の中心点である。なお、中心位置を求めるのは、
光源の位置に拘わらず自然な明るさが得られるようにす
るためである。しかし、この位置に限定されるものでは
ない。
In step S102, a position that is the center position of the selected surface is determined. In the example shown in FIG. 7, C 5 is the center point of the selected surface. The center position is determined by
This is so that natural brightness can be obtained regardless of the position of the light source. However, it is not limited to this position.

【0024】ステップS103では、選択した面の4頂
点のうち上面側にあるP系列の2頂点を用いて、番号の
前の方を始点としたベクトルを求める。図7に示す例の
場合、点P5 から点P1 へのベクトルが求めるベクトル
である。この場合は数字で言うと1の方が小さいが頂点
列の順番として見れば1の方が後に位置するので大きく
なる。
In step S103, a vector starting from the front of the number is obtained by using two vertices of the P series on the upper surface side among the four vertices of the selected surface. In the example shown in FIG. 7, a vector to obtain a vector from the point P 5 to the point P 1. In this case, the number 1 is smaller in terms of numbers, but is larger when viewed as the order of the vertex row because 1 is located later.

【0025】ステップS104では、ステップS103
で求めたベクトルを反時計回りに90度回転させ、それ
を法線ベクトルとする。なお、ここでいう法線とは、二
次元的に見て頂点P1 ,P5 を結ぶ線に対して直角な線
を意味する。
In step S104, step S103
Is rotated 90 degrees counterclockwise, and is set as a normal vector. The normal here means a line perpendicular to the line connecting the vertices P 1 and P 5 when viewed two-dimensionally.

【0026】ステップS105では、法線ベクトルをそ
の始点が選択面の中心位置C5 と重なるところへ配置す
る。図7の中のNsが移動配置後の法線ベクトルであ
る。
[0026] In step S105, placing a normal vector to where the start point overlaps the center position C 5 of the selected face. Ns in FIG. 7 is a normal vector after the movement arrangement.

【0027】ステップS106では、光源Lの位置から
選択面の中心点C5へのベクトルを求め、それを光線ベ
クトルとする。
[0027] In step S106, obtains a vector to the center point C 5 of the selected face from the position of the light source L, is it a ray vector.

【0028】ステップS107では、光線ベクトルの反
対向きのベクトルを求め、それを逆光線ベクトルとす
る。図7の中のRが逆光線ベクトルである。
In step S107, a vector in the opposite direction of the ray vector is obtained, and is set as a reverse ray vector. R in FIG. 7 is a reverse ray vector.

【0029】ステップS108では、法線ベクトルNs
を基準としてこれに対する逆光線ベクトルRの向きの変
化角度を求める。角度は−180度から+180度の範
囲となる値として求めておく。
In step S108, the normal vector Ns
The change angle of the direction of the inverse ray vector R with respect to this is determined. The angle is obtained as a value in a range from -180 degrees to +180 degrees.

【0030】ステップS109では、変化角度の値を用
いて選択面の反射係数を求める。この係数を求めるため
の式を式(1)に示す。ここでθD は変化角度を、VR
は反射係数を表す。
In step S109, the reflection coefficient of the selected surface is determined using the value of the change angle. Equation (1) shows an equation for obtaining this coefficient. Here theta D change angle, V R
Represents a reflection coefficient.

【0031】 VR =(360−|θD |)/360 ・・・・(1) すなわち、反射係数VR は、選択面が光源Lに正対した
ときに最大値1となり、真後ろを向いたときに最小値
0.5となる。
[0031] V R = (360- | θ D |) / 360 ···· (1) In other words, the reflection coefficient V R is the maximum value of 1 when the selected surface is directly facing the light source L, and behind direction The minimum value is 0.5.

【0032】ステップS110では、反射係数の値を用
いて面の明るさを求める。明るさは256階調で表現す
る場合には式(2)で計算される。ここでLが明るさで
あり、255を白、0を黒と見なす。
In step S110, the brightness of the surface is determined using the value of the reflection coefficient. The brightness is calculated by equation (2) when expressing in 256 gradations. Here, L is brightness, 255 is regarded as white, and 0 is regarded as black.

【0033】L=255×VR ・・・・(2) なおこのように、明るさを256階調で表現する場合に
は、画像メモリ24として各画素毎に8ビットの深みを
有するフレームメモリを使用すればよい。また、カラー
表示を行う場合には、赤、青及び緑の3色分の画像メモ
リを使用すればよい。
[0033] L = 255 × V R ···· ( 2) In addition to this, a frame memory having a, the 8-bit depth for each pixel as the image memory 24 if expressed in 256 gradations brightness Should be used. When color display is performed, image memories for three colors of red, blue and green may be used.

【0034】ステップS111では、表示対象となる側
面を全て選択したかを判定する。Noの場合にはステッ
プS101に戻り、次の側面に対する陰影付け処理を実
行する。Yesの場合には処理を終了する。
In step S111, it is determined whether all the sides to be displayed have been selected. If No, the process returns to step S101 to execute shading processing for the next side face. If Yes, the process ends.

【0035】側面の処理が終了した後は、図9に示され
る上面に対する処理を行う。
After the processing on the side surface is completed, the processing on the upper surface shown in FIG. 9 is performed.

【0036】ステップS201では、上面の図形から下
面の図形までの相対距離情報(図4のDX ,DY 参照)
を取り出し、それを相対ベクトルとする。
In step S201, relative distance information from the upper figure to the lower figure (see D X and D Y in FIG. 4).
And make it a relative vector.

【0037】ステップS202では、相対ベクトルの反
対向きのベクトルを求め、それを法線ベクトルとする。
ここから先の処理は計算式の中身が若干異なるが側面に
対する処理と同様である。
In step S202, a vector in the opposite direction of the relative vector is obtained, and is set as a normal vector.
The subsequent processing is the same as the processing for the side, although the contents of the calculation formula are slightly different.

【0038】ステップS203では、上面図形の中心位
置を求める。図7に示す例の場合、Cuが中心点であ
る。 ステップS204では、法線ベクトルをその始点
が上面の中心位置Cuと重なるところへ配置する。図7
に示す例の場合、Nuが移動配置後の法線ベクトルであ
る。
In step S203, the center position of the top figure is obtained. In the example shown in FIG. 7, Cu is the center point. In step S204, the normal vector is arranged at a position where its start point overlaps the center position Cu on the upper surface. FIG.
In the example shown in FIG. 7, Nu is the normal vector after the movement arrangement.

【0039】ステップS205では、光源Lから上面の
中心点Cuへのベクトルを求め、それを光線ベクトルと
する。
In step S205, a vector from the light source L to the center point Cu on the upper surface is obtained, and is set as a light vector.

【0040】ステップS206では、光線ベクトルの反
対向きのベクトルを求め、それを逆光線ベクトルとす
る。
In step S206, a vector in the opposite direction to the light beam vector is obtained, and is set as a reverse light vector.

【0041】ステップS207では、法線ベクトルを基
準としてこれに対する逆光線ベクトルの向きの変化角度
を−180度から+180度の範囲となる値で求める。
In step S207, the angle of change of the direction of the inverse ray vector with respect to the normal vector is obtained as a value in the range of -180 degrees to +180 degrees.

【0042】ステップS208では変化角度の値を用い
て面の反射係数を求める。この係数を求めるための式を
式(3)に示す。ここでθD は変化角度を、VR は反射
係数を表す。
In step S208, the reflection coefficient of the surface is determined using the value of the change angle. Equation (3) shows an equation for obtaining this coefficient. Here theta D change angle, V R denotes a reflection coefficient.

【0043】 VR =(360−|θD |)/360 ・・・・(3) すなわち、反射係数VR は、選択面が光源Lに正対した
ときに最大値1となり、真後ろを向いたときに最小値
0.5となる。
[0043] V R = (360- | θ D |) / 360 ···· (3) i.e., the reflection coefficient V R is the maximum value of 1 when the selected surface is directly facing the light source L, and behind direction The minimum value is 0.5.

【0044】ステップS209では反射係数の値を用い
て面の明るさを求める。式(4)が256階調とした場
合の計算式である。ここでLが明るさである。
In step S209, the brightness of the surface is determined using the value of the reflection coefficient. Expression (4) is a calculation expression when 256 gradations are used. Here, L is brightness.

【0045】L=255×VR ・・・・(4) 以上のように表示対象となる側面と上面の明るさが決定
されたら、その明度値に従って各面を塗りつぶす。グレ
ースケールの陰影なら、上で求めた値をもとに赤、青及
び緑の画像メモリに同じ値を振り分け、その値で表示す
る。また赤、青及び緑に重みをおくことでカラーの陰影
表現が可能となる。
[0045] When L = 255 × V R ···· ( 4) Brightness of sides and top to be displayed as described above is determined, fill each surface according to the brightness value. In the case of a gray scale shadow, the same value is allocated to the red, blue and green image memories based on the value obtained above, and the value is displayed. Also, by giving weight to red, blue, and green, it is possible to express shades of color.

【0046】[0046]

【発明の効果】以上に述べたように、本発明において
は、三次元的な計算を行うことなく簡単な処理で二次元
図形に対して陰影付けを行うことができる。したがっ
て、低計算コストで立体的な図形を表示することがで
き、一般のオフィス等で簡便且つ容易に立体図形を使用
した資料等を作成することが可能となる。
As described above, according to the present invention, shading can be performed on a two-dimensional figure by a simple process without performing a three-dimensional calculation. Therefore, a three-dimensional figure can be displayed at a low calculation cost, and materials and the like using the three-dimensional figure can be easily and easily created in a general office or the like.

【図面の簡単な説明】[Brief description of the drawings]

【図1】 図形の生成および陰影付けを行う図形情報処
理部の例を示したものである。
FIG. 1 illustrates an example of a graphic information processing unit that performs generation and shading of a graphic.

【図2】 本発明を実施するためのハードウェア構成の
一例を示したものである。
FIG. 2 shows an example of a hardware configuration for implementing the present invention.

【図3】 作成しようとする図形の完成予想の例であ
る。
FIG. 3 is an example of an expected completion of a graphic to be created.

【図4】 図3の図形の形状を入力する様子を示したも
のである。
FIG. 4 is a diagram illustrating a state in which the shape of the figure in FIG. 3 is input.

【図5】 図4で入力した図形を隠面消去表示したもの
である。
FIG. 5 is a diagram in which the figure input in FIG.

【図6】 図形に陰影を与えるために行う操作の様子を
示したものである。
FIG. 6 shows a state of an operation performed to give a shadow to a figure.

【図7】 陰影を決定するための光源と図形の関係の様
子を示すものである。
FIG. 7 illustrates a relationship between a light source and a graphic for determining a shadow.

【図8】 図形の側面の陰影付けを行う処理フローであ
る。
FIG. 8 is a processing flow for shading the side of a figure.

【図9】 図形の上面の陰影付けを行う処理フローであ
る。
FIG. 9 is a processing flow for shading the upper surface of a figure.

【符号の説明】[Explanation of symbols]

11 図形情報記憶部、12 座標値変換部、13 法
線ベクトル算出部、14光線ベクトル算出部、15 明
度情報算出部、16 描画処理部、17制御部、18
図形情報処理部、19 画像メモリ、21 計算機、2
2 中央演算処理部、23 図形情報処理部、24 画
像メモリ、25 入力装置、26ディスプレイ、27
スキャナ、28 プリンタ
11 graphic information storage unit, 12 coordinate value conversion unit, 13 normal vector calculation unit, 14 ray vector calculation unit, 15 brightness information calculation unit, 16 drawing processing unit, 17 control unit, 18
Graphic information processing unit, 19 image memory, 21 computer, 2
2 central processing unit, 23 graphic information processing unit, 24 image memory, 25 input device, 26 display, 27
Scanner, 28 printer

Claims (2)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 二次元平面上で第1のN角形(Nは3以
上の整数)の頂点と第2のN角形の頂点とを各々を結ん
でワイヤフレーム表示したN角柱の面に陰影付けする
形の陰影付け方法であって前記第1のN角形の辺の法線を求めて該辺と前記第2の
N角形の辺とを含む側面の法線とする法線決定工程と、 面の中心点と二次元平面上に設定された光源の位置とを
結ぶ光線を求める光線決定工程と、 前記側面の法線と前記光線との角度から該側面の反射係
数を求めて該側面の明るさを決定するとともに、前記第
1のN角形の頂点と前記第2のN角形の頂点とを結ぶ直
線と前記光線との角度から反射係数を求めて端面の明る
さを決定する工程とを有する ことを特徴とする図形の陰
影付け方法。
1. A first N polygon (N is 3 or less ) on a two-dimensional plane.
Connect the vertex of the above integer) and the vertex of the second N-gon
A shadow shading method for shading a surface of an N prism displayed by a wire frame in (a) , wherein a normal line of a side of the first N polygon is obtained and the side and the second
A normal determining step for determining a normal to a side surface including the sides of the N-gon, and a center point of the surface and a position of the light source set on a two-dimensional plane
A light ray determining step of determining a light ray to be connected; and a reflection relation of the side face from an angle between a normal line of the side face and the light ray.
The brightness of the side surface is determined by calculating the number,
A straight line connecting the vertex of the first N-gon and the vertex of the second N-gon
The reflection coefficient is determined from the angle between the line and the light beam, and the brightness of the end face is determined.
Determining the shape of the figure.
【請求項2】 二次元平面上で第1のN角形(Nは3
以上の整数)の頂点と第2のN角形の頂点とを各々を結
んでワイヤフレーム表示したN角柱の面に陰影付けする
図形の陰影付け装置であって前記第1のN角形の辺の法線を求めて該辺と前記第2の
N角形の辺とを含む側面の法線とする法線決定手段と、 面の中心点と二次元平面上に設定された光源の位置とを
結ぶ光線を求める光線決定手段と、 前記側面の法線と前記光線との角度から該側面の反射係
数を求めて該側面の明るさを決定するとともに、前記第
1のN角形の頂点と前記第2のN角形の頂点とを結ぶ直
線と前記光線との角度から反射係数を求めて端面の明る
さを決定する 手段とを有することを特徴とする図形の陰
影付け装置。
2. A first N-gon on a two-dimensional plane (N is 3
(The above integer) and the vertex of the second N-gon
A shadow shading device for shading a surface of an N prism which is displayed in a wire frame , wherein a normal line of a side of the first N polygon is obtained to determine the normal of the side of the first N polygon.
A normal determining means for setting a normal to a side surface including the sides of the N-gon, a center point of the surface and a position of the light source set on a two-dimensional plane;
A ray determining means for determining a ray to be connected; and a reflection coefficient of the side face from an angle between a normal line of the side face and the ray.
The brightness of the side surface is determined by calculating the number,
A straight line connecting the vertex of the first N-gon and the vertex of the second N-gon
The reflection coefficient is determined from the angle between the line and the light beam, and the brightness of the end face is determined.
Means for determining the size of a figure.
JP20190591A 1991-08-12 1991-08-12 Method and apparatus for shading figures Expired - Fee Related JP2907357B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP20190591A JP2907357B2 (en) 1991-08-12 1991-08-12 Method and apparatus for shading figures

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP20190591A JP2907357B2 (en) 1991-08-12 1991-08-12 Method and apparatus for shading figures

Publications (2)

Publication Number Publication Date
JPH0546781A JPH0546781A (en) 1993-02-26
JP2907357B2 true JP2907357B2 (en) 1999-06-21

Family

ID=16448768

Family Applications (1)

Application Number Title Priority Date Filing Date
JP20190591A Expired - Fee Related JP2907357B2 (en) 1991-08-12 1991-08-12 Method and apparatus for shading figures

Country Status (1)

Country Link
JP (1) JP2907357B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004280388A (en) * 2003-03-14 2004-10-07 Sharp Corp Pseudo three-dimensional image creation device and projector device

Also Published As

Publication number Publication date
JPH0546781A (en) 1993-02-26

Similar Documents

Publication Publication Date Title
US6226012B1 (en) Method and apparatus for accelerating the rendering of graphical images
US5651104A (en) Computer graphics system and process for adaptive supersampling
US6191794B1 (en) Method and apparatus for scaling texture maps for graphical images
JP2682559B2 (en) Apparatus and method for displaying image of object on display device and computer graphics display system
US6469700B1 (en) Per pixel MIP mapping and trilinear filtering using scanline gradients for selecting appropriate texture maps
US5831624A (en) Level of detail texture filtering with dithering and mipmaps
US4975976A (en) Image transformation method and device
US4958272A (en) Apparatus and system for generating smooth shaded continuous tone images
JPH04222071A (en) Method and apparatus for texture mapping
JPH05307610A (en) Texture mapping method and its device
US5381519A (en) System for line interpolation for computer graphics displays
US6731289B1 (en) Extended range pixel display system and method
US6791569B1 (en) Antialiasing method using barycentric coordinates applied to lines
US6583790B1 (en) Apparatus for and method of converting height fields into parametric texture maps
JPH0927039A (en) Method and apparatus for computation of texel value for display of texture on object
EP0644509B1 (en) Method and apparatus for filling polygons
US6744440B1 (en) Image processing apparatus, recording medium, and program
JP2907357B2 (en) Method and apparatus for shading figures
JPH096988A (en) Apparatus for giving of depth instruction to color
JP3712015B2 (en) Image creating apparatus and method
JPH06236446A (en) Graphic display method/device
JPH06195470A (en) Method and system for printing-out of non-complex polygon by using vertical span
JP3453410B2 (en) Image processing apparatus and method
JPH0350686A (en) Graphic processing system
JP2000067266A (en) Method for displaying and editing raster image and computer aided graphic processing system utilizing the method

Legal Events

Date Code Title Description
LAPS Cancellation because of no payment of annual fees