[go: up one dir, main page]

TWI482998B - Illumination environment simulation system and method - Google Patents

Illumination environment simulation system and method Download PDF

Info

Publication number
TWI482998B
TWI482998B TW099100450A TW99100450A TWI482998B TW I482998 B TWI482998 B TW I482998B TW 099100450 A TW099100450 A TW 099100450A TW 99100450 A TW99100450 A TW 99100450A TW I482998 B TWI482998 B TW I482998B
Authority
TW
Taiwan
Prior art keywords
triangle
illumination
dimensional object
object model
point
Prior art date
Application number
TW099100450A
Other languages
Chinese (zh)
Other versions
TW201124750A (en
Inventor
Chih Kuang Chang
Xin-Yuan Wu
Xiao-Chao Sun
Min Wang
Original Assignee
Hon Hai Prec Ind 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 Hon Hai Prec Ind Co Ltd filed Critical Hon Hai Prec Ind Co Ltd
Priority to TW099100450A priority Critical patent/TWI482998B/en
Publication of TW201124750A publication Critical patent/TW201124750A/en
Application granted granted Critical
Publication of TWI482998B publication Critical patent/TWI482998B/en

Links

Landscapes

  • Image Generation (AREA)

Description

光照環境類比系統及方法 Lighting environment analogy system and method

本發明涉及一種電腦輔助設計系統及方法,尤其是一種應用於三維量測領域中的光照環境類比系統及方法。 The invention relates to a computer aided design system and method, in particular to an illumination environment analogy system and method applied in the field of three-dimensional measurement.

在三維量測系統中,如果不對待測物體進行光照處理,待測物體無法顯示立體效果,只能顯示平面效果(如圖11所示),導致無法識別物體的細節特徵。而習知的輔助光照系統不能體現光源隨距離衰減的特性,從而導致待測物體顯示的立體效果不夠真實。 In the three-dimensional measurement system, if the object to be measured is not subjected to illumination processing, the object to be measured cannot display the stereoscopic effect, and only the planar effect (as shown in FIG. 11) can be displayed, resulting in the inability to recognize the detailed features of the object. However, the conventional auxiliary illumination system cannot reflect the characteristics of the light source attenuating with distance, and thus the stereoscopic effect displayed by the object to be tested is not real enough.

鑒於以上內容,有必要提供一種光照環境類比系統及方法,可以類比待測物體的光照效果,更真實地渲染待測物體的立體效果。 In view of the above, it is necessary to provide a lighting environment analogy system and method, which can simulate the stereoscopic effect of the object to be tested more realistically than the illumination effect of the object to be tested.

一種光照環境類比系統,應用於電子裝置。該系統包括三角網格化模組、光照環境配置模組、計算模組及顯示模組。三角網格化模組用於從與電子裝置相連接的儲存設備讀取三維物體,並對三維物體進行三角網格化處理。光照環境配置模組用於為所述三角網格化處理後的三維物體配置光照環境,包括確定光照範圍、光源位置、光照方向及光源強度參數。計算模組用於根據三維物體的初始顏色、沿光照方向的光照射線與三維物體上各三角形的面法向量的夾角及各三角形與光源位置的距離確定各三角形的實際 顯示顏色。顯示模組用於根據三維物體上各三角形的座標及實際顯示顏色將三維物體投影到與電子裝置相連接的顯示設備輸出。 An illumination environment analog system is applied to an electronic device. The system includes a triangular meshing module, a lighting environment configuration module, a computing module, and a display module. The triangular meshing module is configured to read a three-dimensional object from a storage device connected to the electronic device, and perform a triangular meshing process on the three-dimensional object. The lighting environment configuration module is configured to configure a lighting environment for the triangular meshed processed three-dimensional object, including determining an illumination range, a light source position, a light direction, and a light source intensity parameter. The calculation module is used to determine the actual shape of each triangle according to the initial color of the three-dimensional object, the angle between the illumination ray along the illumination direction and the surface normal vector of each triangle on the three-dimensional object, and the distance between each triangle and the position of the light source. Display color. The display module is configured to project the three-dimensional object to the display device connected to the electronic device according to the coordinates of the triangles on the three-dimensional object and the actual display color.

一種光照環境類比方法,應用於電子裝置。該方法包括:(A)三角網格化步驟:從與電子裝置相連接的儲存設備讀取三維物體,並對三維物體進行三角網格化處理;(B)光照環境配置步驟:為所述三角網格化處理後的三維物體配置光照環境,包括確定光照範圍、光源位置、光照方向及光源強度參數;(C)三角形顯示顏色計算步驟:根據三維物體的初始顏色、沿光照方向的光照射線與三維物體上各三角形的面法向量的夾角及各三角形與光源位置的距離確定各三角形的實際顯示顏色;及(D)顯示步驟:根據三維物體上各三角形的座標及實際顯示顏色將三維物體投影到與電子裝置相連接的顯示設備輸出。 An illumination environment analogy method applied to an electronic device. The method comprises: (A) a triangular meshing step: reading a three-dimensional object from a storage device connected to the electronic device, and performing a triangular meshing process on the three-dimensional object; (B) a lighting environment configuration step: for the triangle The gridded processed 3D object configures the lighting environment, including determining the illumination range, the light source position, the illumination direction, and the light source intensity parameter; (C) the triangle display color calculation step: according to the initial color of the three-dimensional object, the illumination ray along the illumination direction The angle between the surface normal vectors of the triangles on the three-dimensional object and the distance between each triangle and the position of the light source determine the actual display color of each triangle; and (D) the display step: projecting the three-dimensional object according to the coordinates of the triangles on the three-dimensional object and the actual display color To the display device output connected to the electronic device.

相較於習知技術,本發明提供的光照環境類比系統及方法可以類比待測物體的光照效果,更真實地渲染待測物體的立體效果。 Compared with the prior art, the lighting environment analogy system and method provided by the present invention can simulate the stereoscopic effect of the object to be tested more realistically than the illumination effect of the object to be tested.

100‧‧‧電子裝置 100‧‧‧Electronic devices

10‧‧‧光照環境類比系統 10‧‧‧Lighting environment analogy system

11‧‧‧三角網格化模組 11‧‧‧Triangular grid module

13‧‧‧光照環境配置模組 13‧‧‧Light environment configuration module

15‧‧‧計算模組 15‧‧‧Computation Module

17‧‧‧顯示模組 17‧‧‧Display module

20‧‧‧儲存設備 20‧‧‧Storage equipment

30‧‧‧處理器 30‧‧‧ Processor

40‧‧‧顯示設備 40‧‧‧Display equipment

圖1係本發明光照環境類比系統較佳實施例之功能模組圖。 1 is a functional block diagram of a preferred embodiment of the illumination environment analog system of the present invention.

圖2係本發明光照環境類比方法較佳實施例之流程圖。 2 is a flow chart of a preferred embodiment of the illumination environment analogy method of the present invention.

圖3係圖2中步驟S210之具體流程圖。 FIG. 3 is a specific flowchart of step S210 in FIG. 2.

圖4係圖2中步驟S220之具體流程圖。 FIG. 4 is a specific flowchart of step S220 in FIG. 2.

圖5係圖2中步驟S230之具體流程圖。 FIG. 5 is a specific flowchart of step S230 in FIG. 2.

圖6係圖2中步驟S240之具體流程圖。 FIG. 6 is a specific flowchart of step S240 in FIG. 2.

圖7及圖8係對三維物體進行三角網格化之示意圖。 7 and 8 are schematic views of triangulation of a three-dimensional object.

圖9係對三維物體配置光照環境之示意圖。 Figure 9 is a schematic diagram of configuring a lighting environment for a three-dimensional object.

圖10係切分光照深度之示意圖。 Fig. 10 is a schematic diagram showing the division of the illumination depth.

圖11係三維量測中無光照環境下待測物體顯示之平面效果示意圖。 FIG. 11 is a schematic diagram showing the planar effect of the object to be measured in the no-light environment in the three-dimensional measurement.

圖12係利用本發明類比光照環境下待測物體顯示之立體效果示意圖。 FIG. 12 is a schematic diagram showing the stereoscopic effect of the object to be measured displayed in the analog lighting environment of the present invention.

如圖1所示,係本發明光照環境類比系統10較佳實施例之功能模組圖。該光照環境類比系統10安裝並運行於電子裝置100。該電子裝置100還包括儲存設備20、處理器30及顯示設備40。該電子裝置100可以為電腦或其他任何具有資料處理功能的裝置。 As shown in FIG. 1, it is a functional module diagram of a preferred embodiment of the illumination environment analog system 10 of the present invention. The lighting environment analog system 10 is installed and operates on the electronic device 100. The electronic device 100 further includes a storage device 20, a processor 30, and a display device 40. The electronic device 100 can be a computer or any other device having data processing functions.

儲存設備20用於儲存光照環境類比系統10的電腦化程式碼。儲存設備20可以為電子裝置100內置的記憶體,也可以為電子裝置100外接的記憶體。 The storage device 20 is configured to store computerized code of the lighting environment analog system 10. The storage device 20 may be a memory built in the electronic device 100 or a memory external to the electronic device 100.

處理器30執行光照環境類比系統10的電腦化程式碼,對待測的三維物體提供類比的光照環境,在類比的光照環境下,得到三維物體更真實的立體顯示效果。 The processor 30 executes the computerized code of the lighting environment analog system 10, and provides an analog lighting environment for the three-dimensional object to be measured, and obtains a more realistic stereoscopic display effect of the three-dimensional object in an analog lighting environment.

顯示設備40用於顯示三維物體在類比的光照環境下的立體顯示效果。 The display device 40 is configured to display a stereoscopic display effect of the three-dimensional object in an analog lighting environment.

該光照環境類比系統10包括:三角網格化模組11、光照環境配置模組13、計算模組15及顯示模組17。 The lighting environment analog system 10 includes a triangular meshing module 11, a lighting environment configuration module 13, a computing module 15, and a display module 17.

三角網格化模組11用於對三維物體進行三角網格化處理(具體介 紹請參見下文關於圖3的描述)。 The triangular meshing module 11 is used for triangulating the three-dimensional object (specifically See below for the description of Figure 3).

光照環境配置模組13用於為所述三角網格化處理後的三維物體配置光照環境,包括確定光照範圍、光源位置、光照方向及光源強度參數(具體介紹請參見下文關於圖4的描述)。 The lighting environment configuration module 13 is configured to configure a lighting environment for the triangular meshed processed three-dimensional object, including determining an illumination range, a light source position, a light direction, and a light source intensity parameter (for details, please refer to the description of FIG. 4 below) .

計算模組15用於根據三維物體的初始顏色、沿光照方向的光照射線與三維物體上各三角形的面法向量的夾角及各三角形與光源位置的距離確定各三角形的實際顯示顏色(具體介紹請參見下文關於圖5的描述)。 The calculation module 15 is configured to determine the actual display color of each triangle according to the initial color of the three-dimensional object, the angle between the illumination ray in the illumination direction and the surface normal vector of each triangle on the three-dimensional object, and the distance between each triangle and the position of the light source. See description below with respect to Figure 5).

顯示模組17用於根據三維物體上各三角形的座標及實際顯示顏色將三維物體投影到顯示設備40輸出(具體介紹請參見下文關於圖6的描述)。 The display module 17 is configured to project a three-dimensional object to the display device 40 according to the coordinates of the triangles on the three-dimensional object and the actual display color (for details, please refer to the description of FIG. 6 below).

如圖2所示,係本發明光照環境類比方法較佳實施例之流程圖。 2 is a flow chart of a preferred embodiment of the illumination environment analogy method of the present invention.

步驟S210,三角網格化模組11對三維物體進行三角網格化處理(具體介紹請參見圖3)。 In step S210, the triangular meshing module 11 performs a triangular meshing process on the three-dimensional object (refer to FIG. 3 for specific introduction).

步驟S220,光照環境配置模組13為所述三角網格化處理後的三維物體配置光照環境,包括確定光照範圍、光源位置、光照方向及光源強度參數(具體介紹請參見圖4)。 In step S220, the illumination environment configuration module 13 configures the illumination environment for the three-dimensional object after the triangle meshing process, including determining the illumination range, the light source position, the illumination direction, and the light source intensity parameter (refer to FIG. 4 for specific introduction).

步驟S230,計算模組15根據三維物體的初始顏色、沿光照方向的光照射線與三維物體上各三角形的面法向量的夾角及各三角形與光源位置的距離確定各三角形的實際顯示顏色(具體介紹請參見圖5)。 Step S230, the calculation module 15 determines the actual display color of each triangle according to the initial color of the three-dimensional object, the angle between the illumination ray in the illumination direction and the surface normal vector of each triangle on the three-dimensional object, and the distance between each triangle and the position of the light source (specific introduction See Figure 5).

步驟S240,顯示模組17根據三維物體上各三角形的座標及實際顯 示顏色將三維物體投影到顯示設備40輸出(具體介紹請參見圖6)。 Step S240, the display module 17 according to the coordinates of the triangles on the three-dimensional object and the actual display The color is projected onto the display device 40 output (see Figure 6 for details).

如圖3所示,係圖2中步驟S210之具體流程圖。 As shown in FIG. 3, it is a specific flowchart of step S210 in FIG. 2.

步驟S310,三角網格化模組11從儲存設備20中讀取一個三維物體模型。 In step S310, the triangular meshing module 11 reads a three-dimensional object model from the storage device 20.

步驟S320,三角網格化模組11檢查該三維物體模型是否由三角面片組成,如果是由三角面片組成,則流程直接進入步驟S380,否則流程進入步驟S330。 In step S320, the triangular meshing module 11 checks whether the three-dimensional object model is composed of triangular patches. If it is composed of triangular patches, the flow directly proceeds to step S380, otherwise the flow proceeds to step S330.

步驟S330,三角網格化模組11將該三維物體模型轉換為B樣條曲面,得到B樣條曲面在UV參數平面內的封閉邊界線,對該封閉邊界線以U直線和V直線進行等分,得到若干個小方格(如圖7所示)。 In step S330, the triangular meshing module 11 converts the three-dimensional object model into a B-spline surface, and obtains a closed boundary line of the B-spline surface in the UV parameter plane, and the U-line and the V-line are performed on the closed boundary line. Points, get a few small squares (as shown in Figure 7).

步驟S340,三角網格化模組11將與封閉邊界線無交點的小方格的四個頂點按逆時針順序組成兩個三角形。例如,如圖8中所示的小方格box4的四個頂點P、Q、I、O均落入封閉邊界線內,則三角網格化模組11將頂點P、Q、I、O按照逆時針順序連接組成兩個三角形OQP、OIQ。 In step S340, the triangular meshing module 11 forms two triangles in a counterclockwise order of the four vertices of the small square having no intersection with the closed boundary line. For example, if the four vertices P, Q, I, and O of the small square box 4 shown in FIG. 8 fall within the closed boundary line, the triangular meshing module 11 follows the vertices P, Q, I, and O. The two triangles OQP and OIQ are formed by connecting counterclockwise.

步驟S350,對於與封閉邊界線有交點的小方格,三角網格化模組11將小方格的頂點中落入封閉邊界曲線內的頂點、小方格與封閉邊界曲線的交點及封閉邊界線上的邊界點加入2D點組成的佇列Q。例如,如圖8中所示的小方格box1中有封閉邊界線上的邊界點M,小方格box1與封閉邊界曲線的交點E、F;小方格box2中有頂點D落入封閉邊界曲線內,;小方格box2與封閉邊界曲線的交點E、 F、C、G,則三角網格化模組11將點M、E、F、C、D、G加入2D點組成的佇列Q。 Step S350, for a small square having an intersection with the closed boundary line, the triangular meshing module 11 falls into the vertices of the small square lattice, the intersection of the small square and the closed boundary curve, and the closed boundary. The boundary point on the line is added to the queue Q composed of 2D points. For example, as shown in FIG. 8 , the small square box 1 has a boundary point M on a closed boundary line, an intersection point E and F of a small square box 1 and a closed boundary curve; and a small square box 2 has a vertex D falling into a closed boundary curve. Inside, the intersection of the small square box2 and the closed boundary curve, F, C, and G, the triangular meshing module 11 adds the points M, E, F, C, D, and G to the array Q composed of 2D points.

步驟S360,三角網格化模組11讀取2D點組成的佇列Q中的第一點p1及與點p1最近的點p2,P1、p2組成三角形A的一條邊,三角形第三點p3的查找原則是邊p1p2對應的內角在三角形A的內角中最大以及三角形A的外接圓內沒有佇列Q中的點,使得三角形A接近於等邊三角形。 In step S360, the triangular meshing module 11 reads the first point p1 of the array Q composed of 2D points and the point p2 closest to the point p1, P1 and p2 form one side of the triangle A, and the third point p3 of the triangle The search principle is that the inner angle corresponding to the edge p1p2 is the largest among the inner corners of the triangle A and the circumscribed circle of the triangle A has no point in the array Q, so that the triangle A is close to the equilateral triangle.

步驟S370,三角網格化模組11根據上述查找原則在佇列Q中查找其他三角形的頂點,得到三維物體模型上的所有三角形。 In step S370, the triangular meshing module 11 searches for the vertices of other triangles in the queue Q according to the above-mentioned search principle, and obtains all the triangles on the three-dimensional object model.

步驟S380,三角網格化模組11輸出三維物體模型上的所有三角形組成的佇列T。 In step S380, the triangular meshing module 11 outputs a queue T composed of all triangles on the three-dimensional object model.

如圖4所示,係圖2中步驟S220之具體流程圖。 As shown in FIG. 4, it is a specific flowchart of step S220 in FIG. 2.

步驟S410,光照環境配置模組13根據三角網格化處理後的三維物體模型的最大空間包圍盒的座標確定光照範圍。例如,假設三維物體模型的最大空間包圍盒為圖9中所示的長方體,則光照範圍即為該長方體區域。 In step S410, the illumination environment configuration module 13 determines the illumination range according to the coordinates of the maximum space bounding box of the three-dimensional object model after the triangular meshing process. For example, assuming that the maximum space bounding box of the three-dimensional object model is the rectangular parallelepiped shown in FIG. 9, the illumination range is the rectangular parallelepiped region.

步驟S420,光照環境配置模組13根據所述最大空間包圍盒上表面中心點的座標確定光源位置的座標。例如,假設圖9中所示的長方體上表面中心點的座標為(x1,y1,z1),則光源位置的座標為(x1,y1,z1)。 In step S420, the illumination environment configuration module 13 determines the coordinates of the position of the light source according to the coordinates of the center point of the upper surface of the maximum space bounding box. For example, assuming that the coordinates of the center point of the upper surface of the rectangular parallelepiped shown in FIG. 9 are (x1, y1, z1), the coordinates of the position of the light source are (x1, y1, z1).

步驟S430,光照環境配置模組13根據光源位置及光照範圍確定一個光照圓錐,確定該光照圓錐的旋轉軸為光照射線S,光照方向與光照射線S相同,旋轉軸的高度即為光照深度。例如,如圖9所 示,光照環境配置模組13以光源位置為頂點,以三維物體模型的最大空間包圍盒(即所述長方體)上下表面的距離為旋轉軸高度繪製光照圓錐。 In step S430, the illumination environment configuration module 13 determines an illumination cone according to the position of the light source and the illumination range, and determines that the rotation axis of the illumination cone is the illumination ray S, the illumination direction is the same as the illumination ray S, and the height of the rotation axis is the illumination depth. For example, as shown in Figure 9. The illumination environment configuration module 13 takes the position of the light source as a vertex, and draws the illumination cone with the distance between the upper and lower surfaces of the maximum space bounding box (ie, the rectangular parallelepiped) of the three-dimensional object model as the height of the rotation axis.

步驟S440,光照環境配置模組13將光照深度切分成n個光照段得到點序列,計算每個點到光照射線S頂點的距離得到各點的衰減係數,確定光源強度佇列P,P中的各元素包括各點序列中某一點到光照射線S頂點的距離及該點的衰減係數,其中各點的衰減係數為該點到光照射線S頂點的距離與光照深度的比值。如圖10所示,假設線段G1G5為光照深度(G1為光照射線S頂點),並被光照環境配置模組13切分成4個光照段得到點序列G1、G2、G3、G4、G5,則點G1的衰減係數為0,G2的衰減係數為|G1G2|/|G1G5|,G3的衰減係數為|G1G3|/|G1G5|,G4衰減係數為|G1G4|/|G1G5|,G5衰減係數為|G1G5|/|G1G5|=1。 Step S440, the illumination environment configuration module 13 divides the illumination depth into n illumination segments to obtain a sequence of points, calculates the distance of each point to the apex of the illumination ray to obtain the attenuation coefficient of each point, and determines the intensity of the light source in the column P, P. Each element includes a distance from a point in each sequence of points to the apex of the illumination ray and an attenuation coefficient at that point, wherein the attenuation coefficient of each point is the ratio of the distance from the point to the apex of the illumination ray S to the depth of illumination. As shown in FIG. 10, it is assumed that the line segment G1G5 is the illumination depth (G1 is the apex of the illumination ray S), and is divided into four illumination segments by the illumination environment configuration module 13 to obtain the point sequence G1, G2, G3, G4, G5. The attenuation coefficient of G1 is 0, the attenuation coefficient of G2 is |G1G2|/|G1G5|, the attenuation coefficient of G3 is |G1G3|/|G1G5|, the attenuation coefficient of G4 is |G1G4|/|G1G5|, and the attenuation coefficient of G5 is | G1G5|/|G1G5|=1.

如圖5所示,係圖2中步驟S230之具體流程圖。 As shown in FIG. 5, it is a specific flowchart of step S230 in FIG. 2.

步驟S510,計算模組15根據各三角形頂點座標計算各三角形的面法向量,得到三維物體模型所有三角形的面法向量組成的佇列N。例如假設三角形A的頂點為v0,v1,v2,則三角形A的面法向量為normal=cross((v1-v0),(v2-v0))。 In step S510, the calculation module 15 calculates the surface normal vectors of the triangles according to the coordinates of the vertices of the triangles, and obtains the array N of the surface normal vectors of all the triangles of the three-dimensional object model. For example, assuming that the vertex of the triangle A is v0, v1, v2, the face normal vector of the triangle A is normal=cross((v1-v0), (v2-v0)).

步驟S520,計算模組15讀取三維物體模型的初始RGB顏色值,將該初始RGB顏色值等分為90個RGB顏色值區間,得到由從明到暗漸變的RGB顏色值組成的顏色佇列L。例如,假設三維物體模型的初始顏色為黃色,則計算模組15將該黃色的RGB值等分為90個RGB顏色值區間,得到由從明黃到暗黃漸變的90組RGB顏色值。之所以等分為90個顏色區間,是根據一個物體(例如該三維物體)與光 源的向量夾角超過90度時,該物體不可見的原理。 Step S520, the calculation module 15 reads the initial RGB color value of the three-dimensional object model, and divides the initial RGB color value into 90 RGB color value intervals to obtain a color array composed of RGB color values from light to dark gradients. L. For example, assuming that the initial color of the three-dimensional object model is yellow, the calculation module 15 divides the RGB value of the yellow into 90 RGB color value intervals to obtain 90 sets of RGB color values from the bright yellow to the dark yellow gradient. The reason is divided into 90 color intervals, which are based on an object (such as the three-dimensional object) and light. The principle that the object is invisible when the angle of the vector of the source exceeds 90 degrees.

步驟S530,計算模組15計算光照射線S與各三角形的面法向量的向量夾角,確定各向量夾角所對應的顏色區間Ith。例如,假設光照射線S與三角形A的向量夾角為30.5度,則該向量夾角對應於第30個顏色區間。 In step S530, the calculation module 15 calculates a vector angle between the illumination ray S and the surface normal vector of each triangle, and determines a color interval Ith corresponding to each vector angle. For example, assuming that the angle between the illumination ray S and the triangle A is 30.5 degrees, the vector angle corresponds to the 30th color interval.

步驟S540,計算模組15計算光照射線S與各三角形的中心點的距離,根據光源強度佇列P中距離與衰減係數的對應關係得到各三角形的衰減係數k,根據Ith*k的整數部分所對應的顏色區間得到的各三角形的實際顯示顏色。例如,假設光照射線S與三角形A中心點的距離為8.1cm,光照深度為10cm,則三角形A中心點的衰減係數為0.81,三角形A的實際顏色區間為int(30*0.81)=24,即三角形A的實際顏色值為第24個顏色區間的RGB值。 Step S540, the calculation module 15 calculates the distance between the illumination ray S and the center point of each triangle, and obtains the attenuation coefficient k of each triangle according to the correspondence between the distance and the attenuation coefficient in the intensity of the light source, according to the integer part of Ith*k. The actual display color of each triangle obtained from the corresponding color interval. For example, assuming that the distance between the illumination ray S and the center point of the triangle A is 8.1 cm and the illumination depth is 10 cm, the attenuation coefficient of the center point of the triangle A is 0.81, and the actual color interval of the triangle A is int (30*0.81)=24. The actual color value of the triangle A is the RGB value of the 24th color interval.

步驟S550,計算模組15輸出三維物體模型上所有三角形的實際顯示顏色組成的顏色佇列C。 In step S550, the calculation module 15 outputs a color array C composed of the actual display colors of all the triangles on the three-dimensional object model.

如圖6所示,係圖2中步驟S240之具體流程圖。 As shown in FIG. 6, it is a specific flowchart of step S240 in FIG. 2.

步驟S610,顯示模組17根據顯示設備40的解析度,確定顯示平面的顯示範圍。例如,若顯示設備40的解析度為1024*768,則顯示模組17確定顯示平面的顯示範圍為P1(0,0),P2(1023,0),P3(1023,767),P4(0,767)四個圖元點確定的矩形區域。 In step S610, the display module 17 determines the display range of the display plane according to the resolution of the display device 40. For example, if the resolution of the display device 40 is 1024*768, the display module 17 determines that the display range of the display plane is P1 (0, 0), P2 (1023, 0), P3 (1023, 767), P4 (0). , 767) A rectangular area determined by four primitive points.

步驟S620,顯示模組17將三角形佇列T中的各三角形投影到顯示平面,得到三維物體模型上各三角形對應的平面三角形的2D頂點座標。如圖9所示,顯示模組17將三角形佇列T中的三角形A投影 到顯示平面得到平面三角形A2。如果有平面三角形超出顯示平面的顯示範圍,則顯示模組17將各平面三角形的2D頂點座標按相同比例(例如90%)縮小至顯示平面的顯示範圍內。 In step S620, the display module 17 projects the triangles in the triangle array T onto the display plane to obtain the 2D vertex coordinates of the plane triangle corresponding to each triangle on the three-dimensional object model. As shown in FIG. 9, the display module 17 projects the triangle A in the triangle array T A plane triangle A2 is obtained to the display plane. If there is a flat triangle beyond the display range of the display plane, the display module 17 reduces the 2D vertex coordinates of each planar triangle to the display range of the display plane by the same ratio (for example, 90%).

步驟S630,顯示模組17根據各三角形的實際顯示顏色及2D頂點座標在顯示設備40上顯示得到的所有平面三角形。如圖12所示,是利用本發明類比光照環境下待測物體顯示的立體效果示意圖。 In step S630, the display module 17 displays all the planar triangles on the display device 40 according to the actual display color of each triangle and the 2D vertex coordinates. As shown in FIG. 12, it is a schematic diagram of a stereoscopic effect displayed by an object to be measured in an analog lighting environment of the present invention.

以上所述僅為本發明之較佳實施例而已,且已達廣泛之使用功效,凡其他未脫離本發明所揭示之精神下所完成之均等變化或修飾,均應包含在下述之申請專利範圍內。 The above is only the preferred embodiment of the present invention, and has been used in a wide range of applications. Any other equivalent changes or modifications which are not departing from the spirit of the present invention should be included in the following claims. Inside.

100‧‧‧電子裝置 100‧‧‧Electronic devices

10‧‧‧光照環境類比系統 10‧‧‧Lighting environment analogy system

11‧‧‧三角網格化模組 11‧‧‧Triangular grid module

13‧‧‧光照環境配置模組 13‧‧‧Light environment configuration module

15‧‧‧計算模組 15‧‧‧Computation Module

17‧‧‧顯示模組 17‧‧‧Display module

20‧‧‧儲存設備 20‧‧‧Storage equipment

30‧‧‧處理器 30‧‧‧ Processor

40‧‧‧顯示設備 40‧‧‧Display equipment

Claims (9)

一種光照環境類比方法,應用於電子裝置,該方法包括:三角網格化步驟:從與電子裝置相連接的儲存設備讀取三維物體模型,並對三維物體模型進行三角網格化處理;光照環境配置步驟:為所述三角網格化處理後的三維物體模型配置光照環境,包括:根據三角網格化處理後的三維物體模型的最大空間包圍盒的座標確定光照範圍;根據所述最大空間包圍盒上表面中心點的座標確定光源位置的座標;根據光源位置及光照範圍確定一個光照圓錐,確定該光照圓錐的旋轉軸為光照射線S,以光照射線S的方向為光照方向,以旋轉軸的高度為光照深度;及將光照深度切分成n個光照段得到點序列,計算每個點到光照射線S頂點的距離得到各點的衰減係數,確定光源強度佇列P,P中的各元素包括各點序列中某一點到光照射線S頂點的距離及該點的衰減係數,其中各點的衰減係數為該點到光照射線S頂點的距離與光照深度的比值;三角形顯示顏色計算步驟:根據三維物體模型的初始顏色、沿光照方向的光照射線與三維物體模型上各三角形的面法向量的夾角及各三角形與光源位置的距離確定各三角形的實際顯示顏色;及顯示步驟:根據三維物體模型上各三角形的座標及實際顯示顏色將三維物體模型投影到與電子裝置相連接的顯示設備輸出。 An illumination environment analogy method is applied to an electronic device, the method comprising: a triangular meshing step: reading a three-dimensional object model from a storage device connected to the electronic device, and performing a triangular meshing process on the three-dimensional object model; a configuration step of: configuring a lighting environment for the triangular meshed processed three-dimensional object model, comprising: determining an illumination range according to a coordinate of a maximum space bounding box of the three-dimensional object model after the triangular meshing process; The coordinates of the center point of the upper surface of the box determine the coordinates of the position of the light source; determine an illumination cone according to the position of the light source and the illumination range, and determine that the rotation axis of the illumination cone is the illumination ray S, the direction of the illumination ray S is the illumination direction, and the rotation axis The height is the illumination depth; and the illumination depth is divided into n illumination segments to obtain a sequence of points. The distance from each point to the apex of the illumination ray is calculated to obtain the attenuation coefficient of each point, and the intensity of the source is determined. P, each element in P includes The distance from a point in each sequence of points to the apex of the illumination ray and the attenuation coefficient at that point, where each point The attenuation coefficient is the ratio of the distance from the point to the apex of the illumination ray and the illumination depth; the triangle display color calculation step: according to the initial color of the three-dimensional object model, the illumination ray along the illumination direction and the surface normal vector of each triangle on the three-dimensional object model The angle of the angle and the distance between each triangle and the position of the light source determine the actual display color of each triangle; and the display step: projecting the three-dimensional object model to the output of the display device connected to the electronic device according to the coordinates of each triangle on the three-dimensional object model and the actual display color . 如申請專利範圍第1項所述之光照環境類比方法,其中,所述三角網格化步驟包括:檢查所述三維物體模型是否由三角面片組成,如果是由三角面片組成,則流程直接進入輸出三維物體模型上所有三角形組成的三角形佇列T的步 驟;如果所述三維物體模型不是由三角面片組成,則將該三維物體模型轉換為B樣條曲面,得到B樣條曲面在UV參數平面內的封閉邊界線,對該封閉邊界線以U直線和V直線進行等分,得到若干個小方格;將與封閉邊界線無交點的小方格的四個頂點按逆時針順序組成兩個三角形;對於與封閉邊界線有交點的小方格,將小方格的頂點中落入封閉邊界曲線內的頂點、小方格與封閉邊界曲線的交點及封閉邊界線上的邊界點加入二維點組成的二維點佇列Q;讀取二維點佇列中的第一點p1及與點p1最近的點p2,p1、p2組成三角形A的一條邊,三角形A第三點p3的查找原則是邊p1p2對應的內角在三角形A的內角中最大以及三角形A的外接圓內沒有二維點佇列Q中的點,使得三角形A接近於等邊三角形;根據上述查找原則在二維點佇列中查找其他三角形的頂點,得到三維物體模型上的所有三角形;及輸出三維物體模型上的所有三角形組成的三角形佇列T。 The illumination environment analogy method of claim 1, wherein the triangular meshing step comprises: checking whether the three-dimensional object model is composed of triangular patches, and if it is composed of triangular patches, the flow is directly Enter the step of the triangle array T of all triangles on the output 3D object model If the three-dimensional object model is not composed of triangular patches, the three-dimensional object model is converted into a B-spline surface, and a closed boundary line of the B-spline surface in the UV parameter plane is obtained, and the closed boundary line is U. The straight line and the V line are equally divided to obtain a plurality of small squares; the four vertices of the small square having no intersection with the closed boundary line are formed into two triangles in a counterclockwise order; for small squares having intersections with the closed boundary line Adding the vertex of the small square into the closed boundary curve, the intersection of the small square and the closed boundary curve, and the boundary point on the closed boundary line are added to the two-dimensional point array Q composed of two-dimensional points; The first point p1 in the point array and the point p2 closest to the point p1, p1, p2 form one side of the triangle A, and the third point p3 of the triangle A is searched by the inner angle of the side p1p2 corresponding to the inner angle of the triangle A The maximum and the circumscribed circle of the triangle A do not have a point in the two-dimensional point QQ, so that the triangle A is close to the equilateral triangle; according to the above search principle, the vertices of other triangles are searched in the two-dimensional point , column to obtain a three-dimensional object model. Up Triangular; triangle and all triangles on the three-dimensional object model consisting of the output queue T. 如申請專利範圍第2項所述之光照環境類比方法,其中,所述三角形顯示顏色計算步驟包括:根據各三角形頂點座標計算各三角形的面法向量,得到三維物體模型所有三角形的面法向量組成的佇列N;讀取三維物體模型的初始RGB顏色值,將該初始RGB顏色值等分為90個RGB顏色值區間,得到由從明到暗漸變的RGB顏色值組成的顏色佇列L;計算光照射線S與各三角形的面法向量的向量夾角,確定各向量夾角所對應的顏色區間Ith;計算光照射線S與各三角形的中心點的距離,根據光源強度佇列P中距離 與衰減係數的對應關係得到各三角形的衰減係數k,根據Ith*k的整數部分所對應的顏色區間得到各三角形的實際顯示顏色;及輸出三維物體模型上所有三角形的實際顯示顏色組成的顏色佇列C。 The illumination environment analogy method of claim 2, wherein the triangle display color calculation step comprises: calculating a surface normal vector of each triangle according to each triangle vertex coordinate, and obtaining a surface normal vector composition of all triangles of the three-dimensional object model. The initial RGB color value of the three-dimensional object model is read, and the initial RGB color value is equally divided into 90 RGB color value intervals to obtain a color 伫 column L composed of RGB color values from light to dark gradation; Calculate the angle between the illumination ray S and the surface normal vector of each triangle, determine the color interval Ith corresponding to each vector angle; calculate the distance between the illumination ray S and the center point of each triangle, and select the distance in the P according to the intensity of the light source. Corresponding relationship with the attenuation coefficient obtains the attenuation coefficient k of each triangle, and the actual display color of each triangle is obtained according to the color interval corresponding to the integer part of Ith*k; and the color of the actual display color of all triangles on the output three-dimensional object model伫Column C. 如申請專利範圍第3項所述之光照環境類比方法,其中,所述顯示步驟包括:根據所述顯示設備的解析度,確定顯示平面的顯示範圍;將三角形佇列T中的各三角形投影到顯示平面,得到三維物體模型上各三角形對應的平面三角形的二維頂點座標;及根據各三角形的實際顯示顏色及二維頂點座標在顯示設備上顯示得到的所有平面三角形。 The illumination environment analogy method of claim 3, wherein the displaying step comprises: determining a display range of the display plane according to the resolution of the display device; projecting each triangle in the triangle array T to The display plane obtains two-dimensional vertex coordinates of the planar triangle corresponding to each triangle on the three-dimensional object model; and all the planar triangles displayed on the display device according to the actual display color of each triangle and the two-dimensional vertex coordinates. 如申請專利範圍第4項所述之光照環境類比方法,其中,如果有平面三角形超出顯示平面的顯示範圍,則將各平面三角形的二維頂點座標按相同比例縮小至顯示平面的顯示範圍內。 The illumination environment analogy method of claim 4, wherein if the planar triangle is beyond the display range of the display plane, the two-dimensional vertex coordinates of each planar triangle are reduced to the display range of the display plane by the same scale. 一種光照環境類比系統,應用於電子裝置,該系統包括:三角網格化模組,用於從與電子裝置相連接的儲存設備讀取三維物體模型,並對三維物體模型進行三角網格化處理;光照環境配置模組,用於為所述三角網格化處理後的三維物體模型配置光照環境,包括:根據三角網格化處理後的三維物體模型的最大空間包圍盒的座標確定光照範圍;根據所述最大空間包圍盒上表面中心點的座標確定光源位置的座標;根據光源位置及光照範圍確定一個光照圓錐,確定該光照圓錐的旋轉軸為光照射線S,以光照射線S的方向為光照方向,以旋轉軸的高度為光照深度;及根據光源位置及光照範圍確定一個光照圓錐,確定該光照圓錐的旋轉軸為光照射線S,以光照射線S的方向為光照方向,以旋轉軸的高度為光照深度;及將光照深度切分成n個光照段得到點序列,計算每個點到光照射線S頂點的距離得到各點的衰減係數, 確定光源強度佇列P,P中的各元素包括各點序列中某一點到光照射線S頂點的距離及該點的衰減係數,其中各點的衰減係數為該點到光照射線S頂點的距離與光照深度的比值;計算模組,用於根據三維物體模型的初始顏色、沿光照方向的光照射線與三維物體模型上各三角形的面法向量的夾角及各三角形與光源位置的距離確定各三角形的實際顯示顏色;及顯示模組,用於根據三維物體模型上各三角形的座標及實際顯示顏色將三維物體模型投影到與電子裝置相連接的顯示設備輸出。 An illumination environment analog system is applied to an electronic device, the system comprising: a triangular meshing module, configured to read a three-dimensional object model from a storage device connected to the electronic device, and perform a triangular meshing process on the three-dimensional object model a lighting environment configuration module, configured to configure a lighting environment for the triangular meshing processed three-dimensional object model, comprising: determining an illumination range according to a coordinate of a maximum space bounding box of the three-dimensional object model after the triangular meshing process; Determining a coordinate of the position of the light source according to the coordinates of the center point of the upper surface of the maximum space bounding box; determining an illumination cone according to the position of the light source and the illumination range, determining that the rotation axis of the illumination cone is the illumination ray S, and the direction of the illumination ray S is the illumination Direction, the height of the rotation axis is the illumination depth; and determining an illumination cone according to the position of the light source and the illumination range, determining that the rotation axis of the illumination cone is the illumination ray S, the direction of the illumination ray S is the illumination direction, and the height of the rotation axis For the light depth; and divide the light depth into n illumination segments to get the point sequence, calculate each Light rays from a point S to the apex of each point to obtain the attenuation coefficient, Determining the intensity of the light source 伫 column P, each element in P includes the distance from a point in each sequence of points to the apex of the illumination ray and the attenuation coefficient of the point, wherein the attenuation coefficient of each point is the distance from the point to the apex of the illumination ray S and The ratio of the illumination depth; the calculation module is configured to determine the angle of each triangle according to the initial color of the three-dimensional object model, the angle between the illumination ray along the illumination direction and the surface normal vector of each triangle on the three-dimensional object model, and the distance between each triangle and the position of the light source The actual display color; and the display module is configured to project the three-dimensional object model to the display device connected to the electronic device according to the coordinates of the triangles on the three-dimensional object model and the actual display color. 如申請專利範圍第6項所述之光照環境類比系統,其中,所述三角網格化處理包括:檢查所述三維物體模型是否由三角面片組成,如果是由三角面片組成,則流程直接進入輸出三維物體模型上所有三角形組成的三角形佇列T的步驟;如果所述三維物體模型不是由三角面片組成,則將該三維物體模型轉換為B樣條曲面,得到B樣條曲面在UV參數平面內的封閉邊界線,對該封閉邊界線以U直線和V直線進行等分,得到若干個小方格;將與封閉邊界線無交點的小方格的四個頂點按逆時針順序組成兩個三角形;對於與封閉邊界線有交點的小方格,將小方格的頂點中落入封閉邊界曲線內的頂點、小方格與封閉邊界曲線的交點及封閉邊界線上的邊界點加入二維點組成的二維點佇列Q;讀取二維點佇列中的第一點p1及與點p1最近的點p2,p1、p2組成三角形A的一條邊,三角形A第三點p3的查找原則是邊p1p2對應的內角在三角形A的內角中最大以及三角形A的外接圓內沒有二維點佇列Q中的點,使得三角形A接近於等邊三角形; 根據上述查找原則在二維點佇列中查找其他三角形的頂點,得到三維物體模型上的所有三角形;及輸出三維物體模型上的所有三角形組成的三角形佇列T。 The illumination environment analogy system of claim 6, wherein the triangular meshing process comprises: checking whether the three-dimensional object model is composed of triangular patches, and if it is composed of triangular patches, the flow is directly Entering the step of outputting a triangular array T of all triangles on the three-dimensional object model; if the three-dimensional object model is not composed of triangular patches, converting the three-dimensional object model into a B-spline surface, obtaining a B-spline surface in the UV a closed boundary line in the parameter plane, the U-line and the V-line are equally divided into the closed boundary line to obtain a plurality of small squares; the four vertices of the small square having no intersection with the closed boundary line are formed in a counterclockwise order Two triangles; for small squares that have intersections with closed boundary lines, the vertices that fall into the closed boundary curve in the vertices of the small square, the intersection of the small square and the closed boundary curve, and the boundary points on the closed boundary line are added to The two-dimensional point 伫 column Q composed of dimensional points; the first point p1 in the two-dimensional point 伫 column and the point p2 closest to the point p1, p1, p2 form one side of the triangle A, and the triangle A Find the edge point p3 principle is p1p2 corresponding interior angle at the inner corner of the triangle A two-dimensional point in the queue does not point Q columns and triangular circumcircle A of the maximum, so that the triangle is close to an equilateral triangle A; According to the above search principle, the vertices of other triangles are searched in the two-dimensional point , column to obtain all the triangles on the three-dimensional object model; and the triangular 伫 column T composed of all the triangles on the three-dimensional object model is output. 如申請專利範圍第7項所述之光照環境類比系統,其中,所述確定各三角形的實際顯示顏色包括:根據各三角形頂點座標計算各三角形的面法向量,得到三維物體模型所有三角形的面法向量組成的佇列N;讀取三維物體模型的初始RGB顏色值,將該初始RGB顏色值等分為90個RGB顏色值區間,得到由從明到暗漸變的RGB顏色值組成的顏色佇列L;計算光照射線S與各三角形的面法向量的向量夾角,確定各向量夾角所對應的顏色區間Ith;計算光照射線S與各三角形的中心點的距離,根據光源強度佇列P中距離與衰減係數的對應關係得到各三角形的衰減係數k,根據Ith*k的整數部分所對應的顏色區間得到各三角形的實際顯示顏色;及輸出三維物體模型上所有三角形的實際顯示顏色組成的顏色佇列C。 The illumination environment analogy system of claim 7, wherein the determining the actual display color of each triangle comprises: calculating a surface normal vector of each triangle according to the coordinates of each triangle vertex, and obtaining a surface method of all triangles of the three-dimensional object model. The vector consists of the array N; the initial RGB color value of the three-dimensional object model is read, and the initial RGB color value is equally divided into 90 RGB color value intervals to obtain a color array consisting of RGB color values from light to dark gradients. L; calculating the angle between the illumination ray S and the surface normal vector of each triangle, determining the color interval Ith corresponding to each vector angle; calculating the distance between the illumination ray S and the center point of each triangle, according to the intensity of the light source, the distance between the P and the distance Corresponding relationship of attenuation coefficients obtains the attenuation coefficient k of each triangle, and the actual display color of each triangle is obtained according to the color interval corresponding to the integer part of Ith*k; and the color display of the actual display color of all triangles on the output three-dimensional object model C. 如申請專利範圍第8項所述之光照環境類比系統,其中,所述將三維物體模型投影到與電子裝置相連接的顯示設備輸出包括:根據所述顯示設備的解析度,確定顯示平面的顯示範圍;將三角形佇列T中的各三角形投影到顯示平面,得到三維物體模型上各三角形對應的平面三角形的二維頂點座標;及根據各三角形的實際顯示顏色及二維頂點座標在顯示設備上顯示得到的所有平面三角形。 The illumination environment analogy system of claim 8, wherein the projecting the three-dimensional object model to the display device output connected to the electronic device comprises: determining the display of the display plane according to the resolution of the display device a range; a triangle of the triangle 伫 column T is projected onto the display plane to obtain a two-dimensional vertex coordinate of the plane triangle corresponding to each triangle on the three-dimensional object model; and the actual display color and the two-dimensional vertex coordinates of the respective triangles are displayed on the display device Show all the resulting planar triangles.
TW099100450A 2010-01-11 2010-01-11 Illumination environment simulation system and method TWI482998B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW099100450A TWI482998B (en) 2010-01-11 2010-01-11 Illumination environment simulation system and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW099100450A TWI482998B (en) 2010-01-11 2010-01-11 Illumination environment simulation system and method

Publications (2)

Publication Number Publication Date
TW201124750A TW201124750A (en) 2011-07-16
TWI482998B true TWI482998B (en) 2015-05-01

Family

ID=45047200

Family Applications (1)

Application Number Title Priority Date Filing Date
TW099100450A TWI482998B (en) 2010-01-11 2010-01-11 Illumination environment simulation system and method

Country Status (1)

Country Link
TW (1) TWI482998B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6771264B1 (en) * 1998-08-20 2004-08-03 Apple Computer, Inc. Method and apparatus for performing tangent space lighting and bump mapping in a deferred shading graphics processor
US7095409B2 (en) * 2003-04-30 2006-08-22 Pixar Shot shading method and apparatus
US7098925B1 (en) * 2000-03-10 2006-08-29 Intel Corporation Shading of images using texture
CN101271587A (en) * 2008-02-25 2008-09-24 北京理工大学 A Light and Shadow Rendering Method Based on Transition Light Map

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6771264B1 (en) * 1998-08-20 2004-08-03 Apple Computer, Inc. Method and apparatus for performing tangent space lighting and bump mapping in a deferred shading graphics processor
US7098925B1 (en) * 2000-03-10 2006-08-29 Intel Corporation Shading of images using texture
US7095409B2 (en) * 2003-04-30 2006-08-22 Pixar Shot shading method and apparatus
CN101271587A (en) * 2008-02-25 2008-09-24 北京理工大学 A Light and Shadow Rendering Method Based on Transition Light Map

Also Published As

Publication number Publication date
TW201124750A (en) 2011-07-16

Similar Documents

Publication Publication Date Title
CN102087752B (en) Illumination environment simulation system and method thereof
US8368714B2 (en) Curved surface rendering system and method
CN102542599B (en) Offline image programming photoenvironment simulation system and method
US9158297B2 (en) Computing device and method for generating measurement program of product
TWI506243B (en) System and method for simulating a calibration path of a probe of a measuring machine
WO2007015928A2 (en) Method of generating surface defined by boundary of three-dimensional point cloud
US10127711B2 (en) Method and apparatus rendering caustics
CN102110308A (en) Three-dimensional solid graph display system and method
JP2019219248A (en) Point group processor, method for processing point group, and program
TWI506244B (en) System and method for computing distances between curved surfaces
CN108230442A (en) A kind of shield tunnel three-dimensional emulation method
TWI475511B (en) System and method for meshing curved surface
US9098937B2 (en) Electronic device and method for simulating three-dimensional model of workpiece
CN102841951B (en) Three-dimensional safety surface sets up system and method
JPWO2022113246A5 (en)
CN112802165A (en) Game scene snow accumulation rendering method, device and medium
TWI482998B (en) Illumination environment simulation system and method
Shen et al. Accurate extraction of brick shapes in masonry walls from dense terrestrial laser scanning point cloud
JP7368950B2 (en) Method and apparatus for efficient building footprint identification
TWI481829B (en) Image off-line programming system and method for simulating illumination environment
CN105427371A (en) Method for keeping graphic object equal-pixel area display in three-dimensional perspective projection scene
US8704831B2 (en) Irradiance rigs
CN113283102B (en) Quick simulation method for astronomical telescope cloud cluster crossing field of view
Zwoliński et al. Geometries of Cityscape: Analysis and Detection of Public Spaces Beneath Tall Buildings by 3D-Negatives
CN101763653A (en) Auxiliary parallelepiped space-based method for generating face-centered cubic grid straight line

Legal Events

Date Code Title Description
MM4A Annulment or lapse of patent due to non-payment of fees