1. Technical Field
Embodiments of the present disclosure relates to three-dimensional (3D) measurement technology, and more particularly, to a lighting environment simulation system and method applied in 3D measurement field.
2. Description of Related Art
If a 3D measurement system does not provide a lighting environment for objects to be measured, the system may only obtain rough surface information of the objects, as illustrated in a model of a mobile phone shell shown in
What is needed, therefore, is an improved system and method to overcome the aforementioned problem.
The disclosure is illustrated by way of examples and not by way of limitation in the figures of the accompanying drawings in which like references indicate similar elements. It should be noted that references to “an” or “one” embodiment in this disclosure are not necessarily to the same embodiment, and such references mean at least one.
In general, the word “module,” as used hereinafter, refers to logic embodied in hardware or firmware, or to a collection of software instructions, written in a programming language, such as, for example, Java, C, or assembly. One or more software instructions in the modules may be embedded in firmware. It will be appreciated that modules may comprised connected logic units, such as gates and flip-flops, and may comprise programmable units, such as programmable gate arrays or processors. The modules described herein may be implemented as either software and/or hardware modules and may be stored in any type of computer-readable medium or other computer storage device.
As shown in
The meshing module 11 is operable to triangulate the 3D object into a plurality of triangles. A detailed description is given in
The lighting effect simulation module 13 is operable to simulate lighting effects for the 3D object, including determining lighting parameters for the triangulated 3D object, such as a lighting range, a light source position, a lighting direction and light source intensity parameters. In one embodiment, the light source intensity parameters may include a lighting depth and attenuation coefficients of points on the lighting depth. A detailed description is given in
The calculation module 15 is operable to determine an actual display color for each triangle of the 3D object according to an original color of the 3D object, an intersection angle between a light ray S along the lighting direction and a normal vector of the triangle, and a distance between the triangle and the light source position. A detailed description is given in
The display module 17 is operable to project the 3D object onto the display device 40 according to coordinates and the actual display color of each triangle of the 3D object. A detailed description is given in
In block S210, the meshing module 11 triangulates the 3D object into a plurality of triangles. A detailed description is given in
In block S220, the lighting effect simulation module 13 simulates lighting effects for the 3D object, including determining lighting parameters for the 3D object, such as a lighting range, a light source position, a lighting direction and light source intensity parameters. As mentioned above, the light source intensity parameters may include a lighting depth and attenuation coefficients of points on the lighting depth. A detailed description is given in
In block S230, the calculation module 15 determines an actual display color for each triangle of the 3D object according to an original color of the 3D object, an intersection angle between a light ray S along the lighting direction and a normal vector of the triangle, and a distance between the triangle and the light source position. A detailed description is given in
In block S240, the display module 17 projects the 3D object to the display device 40 according to coordinates and the actual display color of each triangle of the 3D object. A detailed description is given in
In block S310, the meshing module 11 reads the 3D object from the storage device 20, and determines that if the 3D object consists of triangles. If the 3D object consists of triangles, the procedure directly goes to S370. Otherwise, if the 3D object does not consist of triangles, the procedure goes to block S320.
In block S320, the meshing module 11 converts the 3D object to a B-spline curved surface, determines a closed boundary curve of the B-spline curved surface in a parametric plane, and divides the closed boundary curve by a plurality of horizontal lines (hereinafter referred to “U-lines”) and vertical lines (hereinafter referred to “V-lines”), to obtain a plurality of grids (as shown in
In block S330, if a grid has no intersection point with the closed boundary curve, the meshing module 11 generates two triangles by connecting four vertices of the grid anti-clockwise. For example, as shown in
In block S340, if a grid has one or more intersection points with the closed boundary curve, the meshing module 11 adds the one or more intersection points, one or more vertices of the grid which fall in the closed boundary curve, and boundary points of the closed boundary line into a two-dimensional (2D) data structure Q1. For example, as shown in
In block S350, the meshing module 11 reads a first point p1 and a second point p2 nearest to the point p1 from the 2D data structure Q1, where p1 and p2 construct one side of a triangle A. The meshing module 11 further determines a third point p3 of the triangle A according to a determination rule that there is no 2D point of the 2D data structure Q1 in a circumcircle of the triangle A consisted by the points p1, p2, and p3.
In block S360, the meshing module 11 determines vertices of other triangles in the 2D data structure Q1 according to the determination rule, to generate the plurality of triangles of the 3D object.
In block S370, the meshing module 11 stores the information of each triangle into a record list T according to a sequence of generating the triangles.
In block S410, the lighting effect simulation module 13 determines the lighting range according to coordinates of a maximum bounding box of the 3D object. For example, supposing the cuboid shown in
In block S420, the lighting effect simulation module 13 determines the light source position according to coordinates of a center point of an upper surface of the maximum bounding box. For example, supposing coordinates of the center point of the upper surface of the cuboid in
In block S430, the lighting effect simulation module 13 determines a lighting cone according to the light source position and the lighting range, takes a rotation axis of the lighting cone as the light ray S along the lighting direction, and takes a height of the rotation axis as the lighting depth. For example, as shown in
In block S440, the lighting effect simulation module 13 divides the lighting depth into n sections to obtain a set of points on the lighting depth, calculates a distance between each point on the lighting depth and the light source position, and calculates an attenuation coefficient K for each point according to a corresponding distance. For example, as shown in
In block S510, the calculation module 15 calculates a normal vector of each triangle of the 3D object according to coordinates of three vertices of the triangle. For example, supposing three vertices of the triangle A are v0, v1, and v2, then the calculation module 15 calculates a normal vector N1 of the triangle A as follows: N1==(v1−v0) cross (v2−v0), where “cross” represents the cross product.
In block S520, the calculation module 15 reads original red, green, and blue (RGB) values of the 3D object, and averagely divides the original RGB values into 90 RGB value intervals, so that each vector intersection angle corresponds to a corresponding RGB value interval. For example, supposing an original color of the 3D object is yellow, then the calculation module 15 divides RGB values of the yellow color to 90 RGB value intervals, to obtain 90 RGB values from light yellow to deep yellow. It is understood that if a normal vector intersection angle between an object and a light source is more than 90 degrees, then the object is not visible by eyes, so that the original RGB values of the 3D object are divided to 90 RGB value intervals for following use.
In block S530, the calculation module 15 calculates a vector intersection angle between the light ray S and a normal vector of each triangle, and determines a RGB value interval Ith corresponding to the vector intersection angle. For example, if the vector intersection angle a1 between the light ray S and the normal vector N1 of the triangle A is 30.5 degrees, then the vector intersection angle a1 corresponds to the 30th (i.e., Ith=30th) RGB value interval.
In block S540, the calculation module 15 determines a distance between each triangle and the light ray S, determines the attenuation coefficient K of each triangle according to a corresponding distance, and determines an actual display color of each triangle according to a RGB value interval corresponding to an integer part of Ith*K. For example, if the distance between the triangle A and the light ray S is 8.1 cm, the lighting depth is 10 cm, then the attenuation coefficient K of the triangle A is 0.81, and int(30*0.81)=24. That is, an actual display color of the triangle A falls in the 24th RGB value interval.
In block S550, the calculation module 15 stores actual color information of all the triangles of the 3D object into a data structure C1.
In block S610, the display module 17 determines a display range of a display plane according to a resolution of the display device 40. For example, if the resolution of the display device 40 is 1024*768 pixels, the display module 17 determines the display range of the display plane is a rectangle defined by four pixel points P1(0,0), P2(1023,0), P3(1023, 767), and P4(0, 767) (as shown in
In block S620, the display module 17 determines 2D coordinates of all the triangles of the 3D object by projecting all the triangles to the display plane. For example, as shown in
In block S630, the display module 17 displays all the triangles of the 3D object on the display plane according to the 2D coordinates and actual display colors of all the triangles. For example,
Although certain inventive embodiments of the present disclosure have been specifically described, the present disclosure is not to be construed as being limited thereto. Various changes or modifications may be made to the present disclosure without departing from the scope and spirit of the present disclosure.
Number | Date | Country | Kind |
---|---|---|---|
2009 1 0311058 | Dec 2009 | CN | national |
Number | Name | Date | Kind |
---|---|---|---|
6771264 | Duluk et al. | Aug 2004 | B1 |
7095409 | Cook et al. | Aug 2006 | B2 |
7098925 | Lake et al. | Aug 2006 | B1 |
8018454 | Brabec et al. | Sep 2011 | B2 |
8115767 | Stich | Feb 2012 | B2 |
8243071 | Wang et al. | Aug 2012 | B2 |
Number | Date | Country | |
---|---|---|---|
20110134121 A1 | Jun 2011 | US |