The present invention relates to a drawing data generation device and image drawing device that render a two-dimensional or three-dimensional shape using polygon groups which are managed in a tree structure and render a model at a plurality of levels of detail.
As a method of rendering a two-dimensional or three-dimensional shape in computer graphics, a polygon model has been widely used. The polygon model renders a shape by merging triangles which are mainly used as a unit shape.
To improve the rendering power of the polygon model, texture mapping is widely used which assigns a two-dimensional texture image to the surface of a polygon, followed by mapping and drawing. Generally, a drawing flow using the texture mapping issues a command to select a texture image to be used to a polygon drawing device like a GPU, and then issues a polygon drawing command. Since the selection command takes an especially long processing time, a texture atlas has been generally used which merges a plurality of texture images to a single image in advance as shown in
Using the texture atlas enables reducing the number of commands issued in the drawing processing as shown in
On the other hand, since the drawing time of a polygon model depends on the number of polygons to be drawn, a model comprising a lot of polygons will take a long time. In such a case, to reduce the drawing time, an LOD (Level Of Detail) technique is generally used as shown in patent documents 1 and 2, for example. The LOD technique is a technique for reducing the number of polygons to be drawn by reconstructing part of a model with a smaller number of polygons in accordance with the relationships between viewpoint and the position of the model or by properly using models with different levels of detail prepared in advance. In the LOD using models with different levels of detail, model groups are often managed in a tree structure. For example, a non-patent document 1 discloses a technique that assigns a node of the tree structure to a single polygon model, and assigns a simplified model formed by merging child nodes to a parent node to manage them.
Here, when generating a texture atlas by merging the texture images used in the LOD described above, if the number of the nodes of the tree structure is large, it is necessary to generate a plurality of texture atlases. In this case, since the target nodes to be drawn in the tree structure is only part of all the nodes, to carry out high speed drawing, it is necessary to appropriately generate the texture atlases in such a manner as to reduce the number of times of issuing a texture image designating command at the drawing, and to draw.
However, a method has not been proposed conventionally which carries out drawing by generating texture atlases by selecting combinations of the texture images from the texture image groups related to the nodes of the tree structure in such a manner as to reduce the texture image selection commands used at the drawing, and to implement such a method has been desired.
The present invention is implemented to solve the foregoing problem. Therefore it is an object of the present invention to provide a drawing data generation device and an image drawing device capable of generating texture atlases in such a manner as to reduce the texture image selection commands used at the drawing.
A drawing data generation device in accordance with the present invention comprises: a node acquisition unit that receives as its input, polygon groups which have a plurality of levels of detail represented in a tree structure and render a model at the plurality of levels of detail, and texture image groups properly assigned to the polygon groups, respectively, and that determines nodes corresponding to the texture image groups to be merged; and a texture atlas generating unit that generates a texture atlas group by merging the texture image groups using information about the nodes the node acquisition unit generates, and that converts texture coordinates of vertices of the polygon groups while relating the texture coordinates to a drawing position.
The drawing data generation device in accordance with the present invention is configured in such a manner as to determine the nodes corresponding to the texture image groups to be merged, and to generate the texture atlas groups by merging the texture image groups using the information about the nodes. Accordingly, it can generate the texture atlas in such a manner as to reduce the texture image selection commands used at the drawing.
According to the present invention, it manages polygon groups with a plurality of levels of detail having proper texture images in a tree structure, and generates, when child nodes in the tree structure which are merged and simplified correspond to a parent node, a texture atlas from the texture image groups so as to enable carrying out drawing with a smaller number of texture image designating commands, followed by appropriately selecting the polygon groups to be drawn and carrying out drawing by mapping the texture atlas.
The best mode for carrying out the invention will now be described with reference to the accompanying drawings to explain the present invention in more detail.
As shown in
The node acquisition unit 11 of the preprocessing unit 1 is a processing unit that receives polygon groups which have a plurality of levels of detail represented in a tree structure and which render a model in the plurality of levels of detail, and texture image groups properly assigned to the polygon groups, respectively, and that determines nodes corresponding to the texture image groups to be merged. The texture atlas generating unit 12 is a processing unit that generates a texture atlas group by merging the texture image groups using information about the nodes the node acquisition unit 11 generates, and that converts the texture coordinates of vertices of the polygon groups while relating the texture coordinates to the drawing position.
The drawing node determining unit 21 in the run-time processing unit 2 is a processing unit that using the tree structure, polygon groups and texture atlas groups the texture atlas generating unit 12 outputs, decides the polygon groups to become a drawing target using at least information about a viewpoint position. The drawing list generating unit 22 is a processing unit that generates a list showing drawing order of the drawing target polygon groups the drawing node determining unit 21 decides. The drawing unit 23 is a processing unit that issues to the polygon drawing device 4 a command of drawing the drawing target polygon groups using the list the drawing list generating unit 22 generates.
Next, the operation of the image drawing device of the embodiment 1 will be described.
In
Next, the operation of the node acquisition unit 11 will be described.
First, as the initialization processing, the node acquisition unit 11 makes each node at the same depth a single set. In addition, it decides that all the nodes at the depth 1-step closer to the root than the depth of the processing target are ancestor nodes. Then it decides that the nodes which are at the depth of the processing target and have the same ancestor node are mergeable range (step ST111).
Next, the node acquisition unit 11 selects one of the mergeable range (step ST112). Then from among the sets within the selected range, it selects two sets with the minimum gross area of the texture images corresponding to the nodes within the sets (step ST113), and decides on whether the sets are mergeable or not (step ST114). Here, the term “mergeable” means that when the node acquisition unit 11 merges all the texture image groups within the two sets selected to make a single image, the merged result comes within the texture size the hardware can use. Incidentally, whether the merged result comes within the texture size or not can be decided by solving a two-dimensional bin packing problem which packs the individual texture images into a rectangle with the texture size. When unmergeable, the node acquisition unit 11 decides the range as the unmergeable range and proceeds to step ST117. In contrast, when mergeable, the node acquisition unit 11 merges the two sets selected (step ST115), and decides on whether two or more sets remain within the range (step ST116).
If two or more sets are left within the range, the node acquisition unit 11 returns to step ST113 to repeat the same processing.
More specifically, the node acquisition unit 11 gathers the nodes at the same depth in the tree structure beginning from a nearer relative, and generates a node set that represents the set of the texture image groups capable of generating a texture atlas with the size closest to the maximum size the polygon drawing device can use.
Next, the operation of the texture atlas generating unit 12 will be described with reference to
The texture atlas generating unit 12 merges the texture images corresponding to the nodes within the sets the node acquisition unit 11 generates, and makes each of them a single texture atlas. Incidentally, although a generating method of the texture atlas is optional, it can be implemented by solving the two-dimensional bin packing problem as in the processing at step ST114 of the node acquisition unit 11, for example.
For example,
U′=0.5+0.5*U (1)
V′=0.5+0.5*V (2)
where (U, V) is the texture coordinates of a vertex before the conversion and (U′, V′) is the texture coordinates of the vertex after the conversion. Finally, the texture atlas generating unit 12 writes the input tree structure, the polygon groups with the texture coordinates of their vertices being updated, and the generated texture atlases on the HDD 3.
Next, the operation of the drawing node determining unit 21 in the run-time processing unit 2 will be described.
The drawing node determining unit 21 reads from the HDD 3 the tree structure, texture atlases and polygon groups the preprocessing unit 1 has recorded, and determines the polygon groups to be used as the drawing target from the input information such as the viewpoint position. In this case, it determines in such a manner as not to designate the same model with different levels of detail as the drawing target at the same time. Although the method of determining the drawing target is optional, the drawing node determining unit 21 can set a threshold for each node of the tree structure in advance, and determine the drawing target in accordance with relationships between the distance from the viewpoint and the threshold, for example. First, the drawing node determining unit 21 sets the root node as a temporary drawing target node, and if the distance between the viewpoint and the polygon group corresponding to the root node is not less than the threshold, it determines the polygon group corresponding to the root node as the drawing target. In contrast, if the distance is less than the threshold, it removes the root node from the drawing target, and determines a child of the root node as the temporary drawing target node. Then repeating the same decision on the temporary drawing target node makes it possible to determine the drawing target.
Next, the operation of the drawing list generating unit 22 will be described.
The drawing list generating unit 22 generates a list by gathering the IDs of the drawing target nodes for each set.
Next, the operation of the drawing unit 23 will be described with reference to the flowchart of
The drawing unit 23 selects a nonempty row in the list generated by the drawing list generating unit 22 (step ST231), and sends a command to select the texture atlas corresponding to the row selected to the polygon drawing device 4 (step ST232). Next, the drawing unit 23 selects the polygon groups corresponding to the IDs of the nodes included in the row selected (step ST233), and sends a command to draw the selected polygon groups to the polygon drawing device 4 (step ST234). Then it decides on whether step ST233 and step ST234 are applied to all the node IDs in the row (step ST235), and unless they are applied, it returns to step ST233. If they have already been applied, it decides on whether step ST231 to step ST235 have been applied to all the rows of the list or not (step ST236), and unless they have already been applied, it returns to step ST231. Incidentally, the drawing processing of a polygon in the polygon drawing device 4 is the same as a common polygon drawing method, the description thereof will be omitted.
As described above, according to the drawing data generation device of the embodiment 1, it comprises the node acquisition unit that receives as its input the polygon groups which have the plurality of levels of detail represented in the tree structure and render a model in the plurality of levels of detail and the texture image groups properly assigned to the polygon groups, respectively, and that determines the nodes corresponding to the texture image groups to be merged; and the texture atlas generating unit that merges the texture image groups using information about the nodes the node acquisition unit generates to generate the texture atlas groups, and that converts the texture coordinates of the vertices of the polygon groups while relating the texture coordinates to the drawing position. Accordingly, it can generate the texture atlases in such a manner as to reduce the texture image selection commands used at the drawing.
In addition, according to the drawing data generation device of the embodiment 1, the node acquisition unit gathers the nodes at the same depth in the tree structure beginning from a nearer relative, and generates a node set that represents the set of the texture image groups capable of generating a texture atlas with the size closest to the maximum size the polygon drawing device that carries out the polygon drawing can use. Accordingly, it can minimize the texture image selection commands used at the drawing, thereby being able to carry out high speed drawing.
In addition, according to the image drawing device of the embodiment 1, it comprises the node acquisition unit that receives as its input the polygon groups which have the plurality of levels of detail represented in the tree structure and render a model in the plurality of levels of detail and the texture image groups properly assigned to the polygon groups, respectively, and that determines the nodes corresponding to the texture image groups to be merged; the texture atlas generating unit that merges the texture image groups using information about the nodes the node acquisition unit generates so as to generate the texture atlas groups, and that converts the texture coordinates of the vertices of the polygon groups while relating the texture coordinates to the drawing position; the drawing node determining unit that determines the drawing target polygon groups using the information at least about the viewpoint position by using the tree structure, polygon groups, and texture atlas groups the texture atlas generating unit outputs; the drawing list generating unit that generates the list indicating the drawing order as to the drawing target polygon groups the drawing node determining unit determines; and the drawing unit that issues to the polygon drawing device the commands to draw the drawing target polygon groups using the list the drawing list generating unit generates. Accordingly, it can generate the texture atlases by selecting the combinations of the texture images in such a manner as to reduce the texture image selection commands used at the drawing, thereby being able to carry out high speed drawing.
In addition, according to the image drawing device of the embodiment 1, the drawing node determining unit determines the target nodes to be drawn in such a manner as not to select the same polygon group rendered at different levels of detail in accordance with the thresholds set for the individual nodes of the tree structure and the positional relationships with the viewpoint. Accordingly, it can reduce the drawing time.
In addition, according to the image drawing device of the embodiment 1, the drawing list generating unit is configured in such a manner as to generate the list indicating the polygon groups to become the drawing target for each set the node acquisition unit generates. Accordingly, it can carry out high speed drawing.
In addition, according to the image drawing device of the embodiment 1, the drawing unit is configured in such a manner as to refer to each row of the list the drawing list generating unit generates, issues the texture image designating command to a nonempty row only once, and issues a command to draw the individual polygon groups in the row. Accordingly, it can carry out high speed drawing.
Incidentally, it is to be understood that variations of any components of the embodiment or removal of any components of the embodiment is possible within the scope of the present invention.
As described above, a drawing data generation device and an image drawing device in accordance with the present invention reduce the number of the texture images used at the drawing by making texture atlases by merging the texture images which are very likely to be drawn at the same time, and draw the polygon models corresponding to each texture atlas collectively. Accordingly, they are suitably applied to computer graphics and the like.
1 preprocessing unit; 2 run-time processing unit; 3 HDD; 4 polygon drawing device; 11 node acquisition unit; 12 texture atlas generating unit; 21 drawing node determining unit; 22 drawing list generating unit; 23 drawing unit.
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/JP12/00531 | 1/27/2012 | WO | 00 | 5/27/2014 |