This application is based upon and claims the benefit of priority from the prior Japanese Patent Application No. 2004-086077, filed on Mar. 24, 2004, the entire contents of which are incorporated herein by reference.
1. Field of the Invention
The present invention relates to a three-dimensional drawing model generation method and three-dimensional drawing method suitable for computer graphics (CG) and computer aided design (CAD), and a program thereof, and more particularly to a three-dimensional drawing model generation method and a three-dimensional model drawing method for decreasing the number of polygons using texture mapping, and a program thereof.
2. Description of the Related Art
Systems for constructing three-dimensional virtual models, such as mechanical products and electric components, on a computer are widely used in the field of computer graphics and computer aided design.
To express three-dimensional models, a model surface is defined by small polygons, by which various shapes are expressed. As
If this three-dimensional model is large scale or complicated, the number of polygons increases, so the drawing processing amount increases, which makes it difficult to draw at high-speed. Although the drawing processing capability is improving due to advancements in hardware, three-dimensional models are also becoming more complicated and are increasing in scale, so it is difficult to draw large scale models, such as automobiles, airplanes, ships and factory lines, smoothly.
When an entire view of a large model is drawn, small convex and bump portions are drawn small, and are hardly seen. Therefore, by making the area with such small bumps to be texture, small polygons can be decreased.
As
In a three-dimensional object (three-dimensional model), it has been proposed to automatically create texture on the face defined as a plane by a two-dimensional graphic function, as shown in
According to this conventional method, the number of polygons can be decreased by a texture model, but even with this, many planes exist in a three-dimensional model with complicated shapes, and the number of polygons thereof is enormous. Therefore further improvement is necessary to draw a three-dimensional model with complicated shapes smoothly.
With the foregoing in view, it is an object of the present invention to provide a three-dimensional model generation method and three-dimensional model drawing method for generating a texture model with less number of polygons, even if a three-dimensional model has complicated shapes, so as to draw at high-speed, and a program thereof.
It is another object of the present invention to provide a three-dimensional model generation method and a three-dimensional model drawing method for simplifying the shape of a three-dimensional model, and generating a texture model with less number of polygons so as to draw at high-speed, and a program thereof.
It is still another object of the present invention to provide a three-dimensional model generation method and a three-dimensional model drawing method for generating a texture model that is optimum for drawing according to an enlargement ratio of the three-dimensional model, so as to draw at high-speed, and a program thereof.
To achieve these objects, a three-dimensional drawing model generation method for generating a texture model for drawing a three-dimensional model as a texture image according to the present invention has the steps of flattening the surface of the three-dimensional model, acquiring the texture image of the flattened surface from the drawing image of the three-dimensional model, and generating the texture model by polygons of the flattened surface and the texture image.
A three-dimensional model drawing method for drawing a three-dimensional model as a texture image according to the present invention has the steps of drawing polygons of a model obtained by flattening the three-dimensional model, and mapping the texture image of the flattened model to the flattened model.
A program for generating a texture model for drawing a three-dimensional model as a texture image according to the present invention is a program for having a computer execute the steps of flattening the surface of the three-dimensional model, acquiring the texture image of the flattened surface from the drawing image of the three-dimensional model, and generating the texture model by polygons of the flattened surface and the texture image.
A three-dimensional model drawing program of the present invention is a program for drawing a three-dimensional model as a texture image and having a computer execute the steps of drawing polygons of a model obtained by flattening the three-dimensional model, and mapping the texture image of the flattened model to the flattened model.
In the three-dimensional drawing model generation method according to the present invention, it is preferable that the step of flattening has a step of generating a model that encloses the entirety of the three-dimensional model.
In the three-dimensional drawing model generation method according to the present invention, it is preferable that the step of flattening has a step of detecting a large hollow of the three-dimensional model, and a step of separating the three-dimensional model at the large hollow.
In the three-dimensional drawing model generation method according to the present invention, the step of detecting a large hollow of the three-dimensional model has a step of generating a model that encloses the entirety of the three-dimensional model, and a step of calculating the distance from the model that encloses the entirety of the three-dimensional model to the three-dimensional model, and a step of detecting the large hollow by the distance.
In the three-dimensional drawing model generation method according to the present invention, it is preferable that the step of flattening has a step of creating a projected image of the three-dimensional model, a step of linearly approximating a contour of the projected image, and a step of reconstructing the three-dimensional model by the linearly approximated contour.
In the three-dimensional drawing model generation method according to the present invention, it is preferable that the step of flattening has a step of extracting contours of the three-dimensional model, and a step of generating a closed face by connecting the contours.
In the three-dimensional drawing model generation method according to the present invention, it is preferable that the step of flattening has a step of creating a projected image of the separated three-dimensional models respectively, a step of linearly approximating contours of the projected image, and a step of reconstructing the separated three-dimensional model by the linearly approximated contours.
In the three-dimensional drawing model generation method according to the present invention, it is preferable that the step of detecting a large hollow has a step of detecting the large concave by comparing the distance being set and the calculated distance.
It is also preferable that the three-dimensional drawing model generation method according to the present invention has a step of generating texture models with different precision by changing the distance being set.
It is also preferable that the three-dimensional drawing model generation method according to the present invention has a step of generating texture models with different precision by changing the linear approximation precision of the contours of the projected image.
It is also preferable that the three-dimensional drawing model generation method according to the present invention has a step of calculating the difference between the drawing image of the texture model and the drawing image of the three-dimensional model, and a step of changing generation parameters of the texture model.
It is also preferable that the three-dimensional model drawing method according to the present invention has a step of selecting the flattened model and the texture image with different precision according to the distance between a view point and the three-dimensional model.
It is also preferable that the three-dimensional model drawing method according to the present invention has a step of detecting that the distance between the view point and the three-dimensional model became smaller than a predetermined value, and drawing a texture image from the three-dimensional model.
In the three-dimensional model drawing method according to the present invention, it is preferable that the selection step has a step of switching a plurality of flattened models and texture images with different precision, that were obtained by calculating the difference between the texture drawing image and the three-dimensional drawing image, according to the distance between the view point and the three-dimensional model.
It is also preferable that the three-dimensional model drawing method according to the present invention further has a step of switching the texture images according to the direction of the line of sight.
It is also preferable that the three-dimensional model drawing method according to the present invention further has a step of flattening the surface of the three-dimensional model, a step of acquiring the texture image of the flattened surface from the drawing image of the three-dimensional model, and generating the texture model by the polygons of the flattened surface and the texture image.
In the present invention, the appearance shape of the three-dimensional model is simplified, and small convex and bumps are deleted from the three-dimensional polygon model so as to create a model of which surface is flattened, so the number of polygons can be decreased and smooth drawing can be possible. Therefore a complicated model can be drawn smoothly and in real-time.
FIGS. 17 (A), 17 (B) and (C) are views depicting the projected images in
FIGS. 22 (A), (B) and (C) are diagrams depicting the view operation tool screen for
Embodiments of the present invention will now be described in the sequence of the three-dimensional model drawing system, texture model creation processing, texture model drawing processing and other embodiments, however the present invention is not limited to these embodiments.
[Three-dimensional Model Drawing System]
As
In other words, in the three-dimensional CAD system 3, normally software for converting the CAD data into polygon data for drawing has been installed, and using this, the CAD data is converted into polygon data and is stored in the input data storage area 20 of the storage device 2. Here, as described later with reference to
The CPU (Central Processing Unit) 1 executes the texture model generation processing 7 to be described in
The CPU 1 transfers the polygon data and texture data in the output data area 22 of the storage device 2 to the graphics board 5 by a drawing instruction, and the graphics board 5 converts it into a two-dimensional image for drawing, and displays it on the display 5.
The graphics board 5 is comprised of the CPU for graphics 50, frame buffer 52 and display controller 54. The user input device 4 also inputs such instructions as enlargement, reduction, rotation and shift of the model.
In the texture model generation processing 7, which is pre-processing, the appearance shape of the three-dimensional model is simplified by the three-dimensional polygon model 30, and a model 70, where small convex and bumps are deleted, is generated as shown in
Then in the texture image generation processing 72, data, for mapping the appearance of the polygon model 20 on the plane of the model 70 as a texture image, is generated. For example, as
In the drawing processing 8, simplified shaped polygons are drawn, on which texture is mapped. As
A method for creating the above mentioned model 70, of which shape is simplified, will be described. As
For the convex closure configuration, the shape 70-1, which is made of only convex parts, is calculated by determining the shape enclosing the dotted area, as if enclosing it with a balloon. As the dotted line in
As
In
If a large concave (non-convex section), as shown in the model 30-3 in
If the depth is a predetermined value or more, that area is regarded as the separation target, and the cutting plane that includes the deepest position (vertex) is considered, and this area is separated into three models, 70-3, 70-4 and 70-5. For each separated model, the convex separation is repeated until large non-convex sections no longer exist. By this, models with only convex/small bumps can be created.
To detect a non-convex section, a method of calculating the geometric difference between the original polygon model and the convex closure shaped polygon model can be used. In this method, the amount of calculation becomes enormous if the model is complicated. To decrease the amount of calculation, the depth of the non-convex section is calculated at high-speed using the depth calculation function for the hidden-surface processing of the graphics board 5.
As described later in
As a method of determining a simplified shape of the appearance, the convex closure configuration cannot make the surface flat if small convex sections exist, so in order to further decrease the number of polygons, these small convex sections are flattened. In other words, a surface with convex/bumps is flattened, and an appearance shape comprised of large surfaces is determined.
For flattening the surface, the silhouette method is used. As
The convex/bumps on the surface can be linearly approximated by the projection drawing processing and edge extraction processing, and the degree of flatness can be adjusted by the reduction ratio of the projection drawing and precision of the edge extraction. With this method as well, a rough model can be created to decrease the number of polygons.
In the silhouette method in
Therefore, as described above in
If a model has faces in various directions, such as the case of a dodecahedron, the projection directions must be increased. For this, a method of simplifying the appearance of each single component is used. As described later in
[Texture Model Generation Processing]
Now the texture model generation processing for drawing a three-dimensional model will be described in concrete terms.
The processing flow in
(S10) At first, the convex/bump tolerance T, which is a non-convex section detection parameter, is set. By this convex/bump tolerance, the precision of the model is determined. Then the original polygon data is input. The original polygon data, that is input data, is a set of parts constituting the model shown in
(S12) For this polygon model, convex closure configuration processing is performed. In the convex closure configuration, shape is calculated a shape comprised of only convex sections so as to enclose the group of dot with a balloon. In other words, from all the vertexes of the polygon model, the convex closure shape shown in
(S14) Then to execute convex separation, the deepest non-convex section is detected. As
(S16) It is judged where the deepest depth of the non-convex section is more than the convex/bump tolerance T, which was set in step S10. And when the detected depth is not more than the convex/bump tolerance T, the convex separation is ended, and processing advances to S20.
(S18) When the detected depth is more than the convex/bump tolerance T, on the other hand, the polygon model 30 is separated. In other words, the cutting plane that includes the deepest position (vertex) in the separation target is considered, and the model is separated, as shown in
(S20) The number pointer i of the separated polygon model is initialized to “0”, and processing for each separated model is executed.
(S22) Processing by the silhouette method is executed for the separated polygon model Pi. In other words, as
For example, as
(S24) Then the faces of the reconstructed model are converted into triangular polygons. And for each triangular polygon, a texture image to be mapped, is acquired from the projected images in
(S26) The number pointer i of the above mentioned separated model is incremented “1”, and it is judged whether processing of all the separated models has completed by the incremented value of the pointer i. If not completed, processing returns to step S22, and decreasing the polygons by flattening using the silhouette method and acquisition of texture are repeated. If the processing of all the separated models have been completed, the texture model generation processing ends.
Texture mapping is performed using the output data in
When the texture mapping and drawing are performed for the entire polygon model in
In this way, by simplifying a three-dimensional model with a complicated shape and decreasing the number of polygons, the appearance shape of the three-dimensional model with a complicated shape can be drawn smoothly.
Particularly, when it is necessary to change the view point position or to enlarge or reduce, the changed, enlarged or reduced screen can be displayed smoothly at high-speed.
[Texture Model Drawing Processing]
When the drawn model is enlarged and displayed, drawing speed and drawing quality can be maintained at a constant level by using an optimum texture model according to the enlargement ratio of the model at drawing.
In other words, for a scene viewed from a distance, a rough model is used, and the number of polygons is decreased considerably. For a model viewed closely, a detailed model is used to maintain the drawing quality. When a detailed model is used, the number of polygons increases but in the drawing processing, a function for automatically deleting the models outside the visual field (called Frustum-Culling) is used, so the number of polygons in total can be decreased.
For this, texture models with different approximate precisions must be provided, so texture models with different approximate precisions are created in the above mentioned texture model generation.
Specifically, in the above mentioned convex separation, the precision of separation can be changed by the depth of the non-convex section (tolerance). For flattening the surface, the depth of the bumps to be deleted can be changed by the resolution of the projected images. In other words, the rough model or detailed model are adjusted in pre-processing using the depth of the non-convex section in the convex separation, the scale and edge detection precision of the projected images in the silhouette method, and the drawing size when the texture image is acquired.
The processing flow in
For this mouse operation, the view operation tool, shown in
In the view point rotation tool in
In the zoom tool in
In
(S30) Based on the specified view point position, the enlargement ratio of the model is calculated.
(S32) It is judged whether the enlargement ratio is more than the threshold. When the enlargement ratio is more than the threshold, processing advances to return processing to the polygon model in step S38.
(S34) When the enlargement ratio is not more than the threshold, a texture model, according to the view point position and the enlargement ratio, is selected, and a texture image according to the line of sight direction is selected. A case when this texture image must be selected is a case when a texture image with roughness according to the enlargement ratio is selected. In the case of a hole, for example, the shadow changes depending on the direction of viewing, and the user may want to see the inside by not displaying or by moving a component. In such a case, the texture image is switched. For this, texture images from a plurality of directions and a texture image viewed from the rear side of the component are acquired in advance.
(S36) Then the position and direction of view point, vertex positions of the polygons, texture image, and mapping position (see
(S38) When the enlargement ratio is more than the threshold in step S32, processing returns to the original polygon model. In other words, when a texture model is selected in the drawing processing, if the distance from the view point reaches a predetermined distance or less, it is better to return to the original polygon model to display an accurate model. For this, the view point position and direction, vertex position of the polygon and color of the polygon (see
The drawing processing does not slow down if Frustum-Culling activates when view point approaches the model, as described above.
This is the same for the case of reduction. The texture model can be switched dynamically in this way by monitoring the enlargement ratio.
In order to switch the texture module smoothly in the drawing processing, it is effective to adjust the timing of switching and the degree of roughness of the model. In other words, in terms of memory capacitance, it is not a good idea to provide a texture model for each enlargement ratio unit that the user can specify.
Therefore, instead of providing models with all degrees of roughness, it is necessary to narrow down to models with a predetermined roughness. For this, the quantitative approximation evaluation function between the original polygon model and texture model to be provided is effective, so that only texture models having a predetermined approximation rate are provided.
The processing flow in
(S40) At first, the enlargement ratio is initialized (e.g. “1”). By this, the above mentioned depth tolerance of the convex separation and detection precision of the silhouette method are determined according to the enlargement ratio of the initial value.
(S42) The above mentioned texture model creation processing described in
(S44) Then the drawn image of the original polygon model and the drawn image of the texture model are compared. As
S=ΣΣ|R x,y−C x,y|/N/255
It is assumed that brightness takes a value 0-255, so the average of the difference of the brightness values is divided by “255”.
(S46) The calculated correlation value S and the threshold Th are compared. When the correlation value S is greater than the threshold Th, it is judged that the approximation degree is not good with these creation parameters, and switching of texture models is necessary as shown in
(S48) When the correlation value S is not greater than the threshold value Th, the approximation degree is good, so the enlargement ratio is incremented, and it is judged if the enlargement ratio is the maximum. If the enlargement ratio is not the maximum, the drawing model is enlarged, and processing returns to the calculation of the correlation value in step S44. If the enlargement ratio is the maximum, processing ends.
In this way, the drawing quality of texture expression is evaluated quantitatively, so the approximation degree can be acquired by measuring the correlation value from drawn images between the texture representation model and the accurate model. And by using this approximation degree, the texture model can be easily evaluated.
[Other Embodiments]
Other embodiments of the above mentioned three-dimensional model shape specification will be described.
The above embodiment is suitable for the case when the polygon model is a cube, that is a hexahedron. However, if the silhouette method is applied to the model 30, which has faces in various directions, such as a dodecahedron, as shown in
To prevent this, the appearance for each single component is simplified. In other words, the contours 32 of the component 30 are extracted, and the contours 32 are connected to create a closed face 34. This closed face 34 is separated into triangular polygons 34-1-34-4, and the texture images 705-708 are mapped on these polygons 34-1-34-4.
Now the shape simplification processing in
(S50) The polygon data in
(S52) The closed face 34 is created by connecting the contours 32. As
(S54) Each closed face 34 is separated into triangular polygons 34-1-34-4.
(S56) The texture image of this face is acquired, and each part of the texture image is corresponded to each polygon 34-1-34-4, so as to create the mapping data.
In this way as well, the appearance of the three-dimensional model can be simplified, and flattening is possible for each face, so the number of polygons can be decreased. This is effective particularly when there are many faces in the model.
In the above embodiments, a model of mechanism components was described as an example, but the present invention can also be applied to a model with other configurations. Also as an appearance simplification method, plane generation by a convex closure (or convex hull) configuration, silhouette method and contour extraction were described but as mentioned above, these methods can be used alone or combined according to the shape of the model.
The present invention was described by the embodiments, but the present invention can be modified in various ways within the scope of the essential character of the present invention, and these shall not excluded from the scope of the present invention.
The appearance shape of the three-dimensional model is simplified, and small bumps are deleted from the three-dimensional polygon model, so as to create a model of which surface is flattened, so the number of polygons can be decreased and smooth drawing can be possible. Therefore the present invention is particularly effective to draw a complicated model smoothly in real-time.
Number | Date | Country | Kind |
---|---|---|---|
2004-86077 | Mar 2004 | JP | national |