• 沒有找到結果。

CHAPTER 1 INTRODUCTION

1.2 Overview

(a) (b) Figure 1.2 (a) An input model (b) A polycube of the model

1.2 Overview

The flow chart of the proposed system is shown in Figure 1.3. First, a user inputs a 3D model and a sample texture image. We process these two inputs separately. In next step, the polycube generation, the system will find the polycube of the input model. Then it will randomly select four diamond-shaped samples from the input texture in the sample selection.

According to the above-listed outputs, we reformulate the mechanism of Wang tiles [4] tiling textures onto a polycube seamlessly. In the step of rectangular cells

generation, the system converts the structure of a polycube to rectangular cells.

Finally, in cells mapping, we find texture mapping between the 3D model and the polycube according to the mapping function of each rectangular cell.

Figure 1.3 the system flowchart

The major contribution for this thesis is that we avoid user intervention and reduce extra time. We automatically construct a polycube by using a simple method.

The rectangular cells solve the problem that some portions of a model can not search for mapping region of the polycube. Furthermore, users can easily obtain a desired texture mapping through a simple interface.

The rest of this thesis is organized as follows. In Chapter 2 we review related work of polycube-maps [20] and Wang tiles [4]. Then we present how to construct a polycube with tiled textures in Chapter 3. In Chapter 4, we introduce the rectangular cells mapping in detail. Chapters 5 and 6 show the results and conclusions.

Chapter 2

Related Works

In this chapter, we discuss previous work related to our work. We focus on two topics: tile based texture and texture mapping.

2.1 Tile-Based Texture

Texture synthesis is roughly divided into three parts: pixel based [8] [24] [12], patch based [7] [21], and tile based. Tile based texture is our major previous work.

Wang tiles [23] [22], a tiling set consisting of a set of square tiles, was proposed by Wang [4] at first. The edges of a tile are assigned different colors each of which corresponds to one sample. All shared edges should have matched colors. Grunbaum and Shepherd [10] provided how to tile a plane with a finite set of Wang tiles aperiodically. They can create large non-repetitive textures. Culik [5] proved that thirteen tiles are enough to tile aperiodically.

Stam [19] was the first to consider non-periodic Wang tiles for texture synthesis.

He applied it to the rendering of water surface and caustic. Cohen et al. [4] further investigated this approach and invented an automatic method. They presented a

simple stochastic system which could non-periodically tile a large texture with a small set of Wang tiles. Their advantage is that creating a large texture with filled tiles is very efficient at runtime. An example is shown in Figure 2.1.

Figure 2.1 Four samples are combined to construct a set of eight tiles [4]

2.2 Texture Mapping

Texture mapping mostly followed the multi-chart approach. This approach focuses on partitioning, parameterization, and packing. Cignonoi et al. [3] and Carr and Hart [2] assigned a patch which consists of a single or pairs of triangles. However, it has seams all over the mesh. Other approaches [11] [13] [14] [16] [18] considered large patches and parameterized each patch. They still can not deal with this drawback.

In order to avoid this problem, several researchers [13] [17] [15] cut the surface where the seam is less visible.

Cube maps [1] achieved a seamless texture mapping but it requires the 3D model’s shape to be similar to cubic shape. Marco et al. [20] extended this concept to arbitrary meshes and provided a new mechanism, called polycube-maps. The flowchart of their algorithm is shown in Figure 2.2. Figure 2.2(a) is an input model.

A User defines the shape of the polycube which approximates the 3D model roughly,

as shown in Figure 2.2(d). Then he warps the polycube to approximate the model, as shown in Figure 2.2(b). The vertices of the model are projected on the polycube, as shown in Figure 2.3(c). Finally, the system warps the polycube inversely and optimizes the projections, as shown in Figure 2.2(e) and 2.2(f).

Figure 2.2 2D analogue: flowchart of polycube-maps [20]

For texture mapping, the 2D analogue is shown in Figure 2.3. First, a user roughly approximates the 3D model with a polycube. The system defines the dual space of the polycube. Each cell of the dual space was centered in a corner of the polycube, as shown in Figure 2.3(b). Finally, we may obtain the projection function of the cells, as shown in Figure 2.3(c).

Figure 2.4 shows that the polycube is converted to the dual cells. The advantage of this dual partition can decrease distortion because the projection function is varied with the structure of cell configuration.

(a) (b) (c)

Figure 2.3 2D analogue of polycube-maps (a) Polycube defined by a user (b) Dual space of the polycube (c) Projection function of the non-empty cells [20]

(a) (b)

Figure 2.4 (a) Polycube that consists of 10 cubes (b) Dual cells of the polycube [20]

Fu and Leung [9] combined the methods of polycube-maps [20] with Wang tiles [4] and accomplished a seamless texture mapping. The flowchart of their algorithm is shown in Figure 2.5. First, the input is a surface model. In the second step, they applied the approach of polycube-maps [20] to construct the polycube. because a tiling approach is general for any quad-based geometry. In the third step, they establish the mapping relation between the polycube and the model. They further applied a tiling assignment to map tiles onto the slices of the model. Finally, there are sets of tiled textures created for mapping on the model.

Figure 2.5 Flowchart of Fu and Leung [9] with a Bunny model

In this thesis, we propose a novel technique for texture mapping based on the Wang tiles and polycube-maps. Unlike polycube-maps [20], we avoid user intervention and construct the polycube automatically.

Chapter 3

Polycube with Tiled Texture

In this chapter, we discuss how to tile a texture onto a polycube seamlessly. We first discuss the construction of a polycube. Then we describe the seamless texture tiling process.

3.1 Polycube Construction

In polycube-maps [20], a user needs to define the shape of a polycube which is roughly similar to a 3D model. An example is shown in Figure 3.1. The structure of the polycube is usually very simpler so that it can avoid complicated projection.

However, the user needs to warp the surface of the polycube such that the polycube is close to the 3D model before projecting the vertices.

We use a simple method to construct the polycube automatically. Our system establishes a bounding box of the input model at first. A user can adjust a suitable parameter to set the size of the unit cube. According to this size, the system uniformly subdivides the bounding box into unit cubes.

(a) (b)

Figure 3.1 (a) 3D Model (b) Polycube of the 3D Model [20]

3.1.1 Triangle-Cube Intersection Algorithm

In order to construct a polycube, we need to search the unit cubes which intersect the 3D model. We use the triangle-cube intersection algorithm [6] which examines the intersection between 3D triangles and axis-aligned cubes to constructs a polycube of the 3D model. This algorithm is divided into three steps. The flow chart is shown in Figure 3.2. At the first step, there are a trivial-accept and three trivial-reject tests that eliminate easy cases. The second step detects triangle edges that penetrate any faces of a cube. The third steps examines whether cube corners poke through the interior of the triangle. The six tests of the three steps are described as follows:

1. First steps

(1) Face-Plane Trivial Accept

A unit cube intersects the model if it includes any vertices of the model.

Figure 3.2 Flow chart of triangle-cube intersection algorithm [6]

(2) Face-Plane Trivial Reject

A unit cube does not intersect if all vertices are outside the same face-plane of the unit cube. If the unit cube does not satisfy the above two conditions, we will check it in next step.

(3) Edge-Plane Trivial Reject

We compare the vertices of the model against the twelve planes which touch the twelve edges of the cube. And these planes are at 45 degrees to their adjacent faces. This enclosed volume is a rhombic dodecahedron, as shown in Figure 3.3. If all vertices are outside the rhombic dodecahedron, this cube does not intersect the model.

Figure 3.3 (a) Rhombic Dodecahedron (b) The relation between rhombic dodecahedron and the unit cube

(4) Corner-Plane Trivial Reject

We compare the vertices of all triangles against the eight planes that pass through one of the cube corners. These planes are perpendicular to the corresponding diagonal of the cube. This enclosed volume is octahedron, as shown in Figure 3.4. This cube does not intersect the model if the vertices which belong to the model are outside the octahedron

(a) (b)

Figure 3.4 (a) Octahedron (b) The relation between octahedron and the unit cube 2. Second Phase

(5) Triangle Edges VS. Cube

We check if any triangles of the model penetrate the cube in the second phase. We examine the relations between each edge of the triangles and six faces of the unit cube. If any edge penetrates it, the cube intersects the model.

3. Third Phase

(6) Cube Diagonals VS. Triangle

We check whether a cube corner pokes through the interior of the triangle by examining the relations between four cube diagonals and the triangle. We can obtain four intersection points which belong to diagonal lines and the plane which includes the triangle. Four corners of the cube do not poke through the triangle when the points are not inside the cube. However, if anyone is inside, we should further examine whether the point is inside the triangle. We use three cross products whose vectors belong to the point and the vertices of the triangle to

(a) (b)

check this point, as shown in Figure 3.5. The corner pokes through the interior of the triangle if three vectors have the same direction. Then the cube intersects the model.

4. Remaining

Finally, there are some remainding cubes which do not belong to any cases as mentioned before. These cubes do not intersect the model.

Figure 3.5 Three cross products of the conditional check

3.1.2 Correction of Polycube Structure

A polycube of the model has been constructed using the triangle-cube intersection algorithm [6]. The model is inside the polycube. However, some textures which are tiled on the surfaces of the polycube can not be mapped on the model because some unit cells that are converted from unit cubes do not intersect the model.

The followings describe the three properties of unit cells:

1. Each cell equals in size to a unit cube.

:The intersection point

:Cross product

2. Each cell is centered in a corner of the unit cubes.

3. Each cell intersects the polycube.

An example is shown in Figures 3.6 and 3.7. There are non-consecutive textures on the model by mapping with this polycube. In this section, we will detect non-intersectional cells and remove them to modify the structure of the polycube before tiling textures.

At first, we trace each intersectional cube of the polycube, as shown in Figure 3.6. For each cube, we should examine eight cells converted from the cube if they are intersecting the model. This cube is removed from the structure of the polycube if any non-mapping cell does not intersect it. Figure 3.8 is corrected structure from Figure 3.7.

Figure 3.6 2D analogue: relation between polycube and 3D model Internal Cube Intersectional Cube 3D Model Surface

Tiled Surface

As mentioned above, we construct the polycube of the 3D model by using the triangle-cube intersection algorithm [6] and correct the structure of the polycube.

Finally, the model is not inside the polycube. They are intersecting with each other.

Figure 3.7 2D analogue: relation between cells mapping and 3D model

Figure 3.8 2D analogue: correction of the polycube structure Cells of Polycube Mapping Direction Non-Mapping Cell Tile Un-Mapping On The Surface

3.2 Texture Tiling on Polycube

When the polycube has been produced, we extend the concept of Wang tiles [4]

to tile texture on the surfaces of the polycube. Our algorithm consists of two parts.

One is the edge coloring which arranges each square surface on the polycube corresponding to four samples. The other is the tile construction which synthesizes four samples to form a tile of each square surface. Finally, we accomplish a seamless texture tiling on the surfaces of the polycube.

3.2.1 Edge Coloring

This algorithm is based on the approach of Fu and Leung [9]. At first, there are four diamond samples randomly selected from the input texture. Then we divide all edges of the surfaces on the polycube into three groups, namely, X, Y, and Z, according to three axial directions. An example is shown in Figure 3.9. For each group, we randomly select two from four samples. Then each edge of the surface corresponds to a sample which is randomly selected from its group samples.

Figure 3.9 Edge groups of the unit cube Unit

Cube

X-Axis Edge Y-Axis Edge Z-Axis Edge

In order to tile textures on the 3D polycube seamlessly, we slightly modify the concept of Wang tiles [4] by rotating samples. An example is shown in Figure 3.10. A sample is divided into upper and lower portions. When it is tiled on the surface of a unit cube, the lower half is on the top side of the blue surface and the upper half is on the right side of the yellow surface. We should appropriately rotate a sample 90 degrees counterclockwise for keeping up seamless tiling when tiling on the yellow surface. Another example is shown in Figure 3.11. We should rotate a sample 90 degrees counterclockwise when tiling on the blue surface.

Figure 3.10 A unit cube with a tiled sample

Unit Cube Right Surface Top Surface

Tiled Sample Rotated Sample

Figure 3.11 Three unit cubes with a tiled sample

Therefore, we do not rotate samples when synthesizing tiles on the forward, left, backward, and right surfaces, as shown in Figure 3.12. When we synthesize tiles on the top and bottom surfaces, a sample which corresponds to the edge along X-axis may be rotated 180 degrees, as shown in Figure 3.13. And a sample which corresponds to the edge along Z-axis may be rotated 90 or 270 degrees counterclockwise, as shown in Figures 3.14 and 3.15.

Therefore, each edge on the surface of the polycube corresponds to a suitable sample. This sample may be rotated when tiled on the surface. We can tile textures on the surface seamlessly by using this algorithm.

Right Surface on the Unit Cube A

A

B

Top Surface on the Unit Cube B

Figure 3.12 Expansion of the unit cube from Figure 3.9

Figure 3.13 Four structures that we need to rotate a sample 180 degrees when tiling on the top or bottom surfaces. (a), (b), (c), and (d) are the portions of the polycube.

Lef Forward Right Backward

To

Bottom

Non-rotated Sample

(a)

(d) (b)

(c)

Bottom Surface X-axis Edge Backward Surface

Unit Cube Top Surface

Figure 3.14 Four structures that we need to rotate a sample 270 degrees counterclockwise when tiling on the top or bottom surfaces

Figure 3.15 Four structures that we need to rotate a sample 90 degrees counterclockwise when tiling on the top or bottom surfaces.

Z-axis Edge

3.2.2 Tile Construction

In this section, our system will tile textures on each square surface of the polycube by using the method based on the approach of Cohen et al. [4]. A user can choose image quilting [7] or graph cuts [21] algorithms to synthesize a tile from four diamond samples which correspond to the edge of the square surface.

Finally, we accomplish seamless texture tiling on the surface of the polycube. A result is shown in Figures 3.16 and 3.17

Figure 3.16 Laurana model with the polycube

Figure 3.17 Laurana model and polycube with tiled textures Input Texture

Chapter 4

Generation of Texture Mapping

In this chapter, we discuss how to generate rectangular cells which are transformed from the polycube and map textures onto the model. Our concept is based on polycube-maps [20]. In Section 4.1, we describe the generation of cells. In Section 4.2, some cells which intersect the model can not map any textures on the model. We construct rectangular cells to solve this problem. Then we accomplish cells mapping from the textures on the polycube to the model in section 4.3.

4.1 Transforming Polycubes to Polycells

In order to reduce mapping distortion, we apply cells mapping which is based on polycube-maps [20]. Our algorithm defines mapping directions according to the configuration inside a cell. Therefore, we need to transform the polycube to the polycell which consists of unit cells before mapping textures onto the model. We can easily construct the polycell by the properties as mentioned in Section 3.1.2. An example is shown in Figure 4.1.

Figure 4.1 2D analogue: relation between the polycube and the polycell

We further create the configurations inside external cells which intersect the portions of the tiles on the surfaces. We consider the intersection between external cells and the tiles on the polycube. Each tile is subdivided into four slices. An example is shown in Figure 4.2. There are 63 different configurations of the slices inside a cell. If we remove rotational and reflectional similarities, these configurations can be further reduced to six basic configurations, as shown in Figure 4.3.

Finally, we construct the polycell and the configurations inside each cell. There are some advantages:

1. It is easy to determine the vertices of the polycell.

2. The number of the configurations inside the cells is limited to six because the similarities of rotations and reflections are removed.

3. These basic configurations have different mapping functions. Each function Cells of Polycube

Tiles on the Surfaces Unit Cubes

is related to the structure of the tiles on the polycube so that we can reduce the distortion when mapping on the model.

Figure 4.2 2D analogue: relation between the polycube and the polycell

4.2 Rectangular Cells Construction

From Section 3.1.2, we know that all external cells intersect with the model surface. We will process each external cell to map textures on the model. However, we detect a few internal cells which intersect the model, but the configurations inside these cells are empty. A reason is that the polycube can not approximate the curvature of the model surface exactly. An example is shown in Figure 4.4. These internal cells, grouped in set Κ, can not map any textures and cause gaps on the model.

Unit Cubes Internal Cells

Configurations of Tile Slices inside the Cells

External Cells

Figure 4.3 Six basic configurations

In order to solve this problem, we combine each internal cell of Κ with an external cell which is adjacent to it. At first, adjacent external cells for each internal cell are numbered and processed from small to large. The purpose of this algorithm avoids an internal cell merging none of the external cell.

Then we examine six surfaces of the internal cell which intersects the model by using the triangle-cube intersection algorithm [6]. If only one surface intersects, we merge two cells which include this surface together. Figure 4.5 shows the modification of Figure 4.4. If more than one surface intersects, we choose an external cell whose configuration map is with lower distortion. Type4b has the lowest distortion in all configurations. Our priority for selection from high to low is Type 4b, Type 4a, Type 3, and Type 5. A resulting example is shown in Figure 4.6 and 4.7.

Type 6a and Type 6b are impossible adjacent to the internal cell in Κ because all

Type 3 Type 4a Type 4b

Type 5 Type 6a Type 6b

surfaces of the cells are connected the slices. Therefore, we do not apply these two configurations in rectangular cells.

Figure 4.4 2D analogue: an internal cell intersects the model but is empty

Therefore, we solve the empty problem in the internal cells of Κ by using rectangular cells. However, some of rectangular cells may create seams on the model.

Therefore, we solve the empty problem in the internal cells of Κ by using rectangular cells. However, some of rectangular cells may create seams on the model.

相關文件