Weekly report 20101115

advertisement
Weekly report
I am currently working on the new technique of
texture representation with Bin Chan, which aims
to represent complicated architecture objects such
as buildings.
The technique applies 2-dimensional textures and
structure arrays to render an output image of a
3-dimensional object so that provides user a 3d
view of object described by the textures and arrays.
For any targeted structure object, we consider it
owns the properties of width, height and depth so
that it can be represented in 3 dimensional. We will
use textures and structure arrays to further
describe the structure of our object.
Brief description
We use 3 arrays to define the width, height and
depth information of our targeted object in 3d, this
can also be applied to 2D with only width and
height. We will have further discuss about the
arrays in the following.
The 2d texture contains pattern, color and depth
information.
Given the textures and structure arrays describing
the object's structure, we will perform a Raycast
method to render the targeted object based on a
cube.
The flow of this idea can be represented as the
following flow chart.
Create base object,
normally a cube.
Create Structure textures
and arrays.
Render the object using
Raycast method.
Ray hit?
No
Yes
Output pixel
color
Structure arrays and texture
The structure arrays describe the architecture
structure of our targeted object. We consider the
object is formed by blocks. Assume we have a
pattern looks like the following in 2d front view.
figure 1
Then we need to define this structure in numerical
arrays.
figure 2
Now we've defined one horizontal array
{30,75,100,75} and one vertical array
{140,20,100,20}, which have already specified the
basic structure of our target object.
In the Raycast rendering phase of our technique,
we need to perform a lookup method to locate our
current 3d space point's corresponding position in
the structure arrays and texture, therefore, in order
to make things easier, we have to further construct
the arrays.
The method of constructing our arrays depends on
the way we use to perform the lookup. So far, we
have tried 3 different ways of lookup, Linear,
Bi-tree and Heuristic.
We tried constructing the arrays in incremental,
normalized form to perform linear and bi-tree
lookup, so that all we need to do is comparing the
corresponding property such as Texture Coordinate
with our array elements and find the result.
The arrays we have shown previously and now is
constructed as
horizontal {30/280, 105/280,205/280,280/280}
vertical {140/280,160/280,260/280,280/280}
There are our structure arrays.
Linear Lookup
Linear lookup searches the position in the arrays
and texture one by one, this is the easiest method
of lookup but takes longest time.
Bi-tree Lookup
Start the lookup in the middle of the remaining
array and reduce our search range by half for each
time. Takes Log2(ArrayElementCount) times.
The Heuristic lookup is an approximate method.
We construct another group of arrays which have
much more elements than the structure arrays
have, the Heuristic arrays and the structure arrays
are one to one correspondent. We use the
Heuristic array to approximate the dimensions of
our targeted object. Each of the elements of the
Heuristic array contains the index of the structure
arrays, and a 1-255 error factor.
During the lookup, we can directly get the current
3d point position's corresponding index of the
structure arrays, from the Heuristic array. With the
error factor, we can locate the index more
preciously.
This method is fastest but takes more memory.
However, the existing insignificant error, may affect
the result of Raycast.
The Texture
The texture contains pattern and color information,
and more importantly, the usage of a cell.
We've created a cube at the very beginning of the
flow, with the structure arrays, we've actually
defined 3D a cube with voxels.
figure 3
you can find the pattern of figure 2 from this image,
the extra dimension of this cube shows the depth
array.
The texture is constructed as follow,
which is a 2D texture with height x (width x depth),
by here it is 4x(4x4), in unit of pixel. It's obvious
that we are trying to define a 3 dimensional texture
in 2 dimensional way. The reason why we do it in
this way is because it will be much easier to
maintain large scale 2D texture than to maintain 3D
ones in the future.
We can find that there are 4 layers of depth in this
texture. Those empty pixels in one layer, denoting
that current voxel of current depth layer in the
targeted object, is empty. Therefore in the Raycast
phase, these voxels would be directly cast through,
and those colored pixel would return us the color
of those voxels.
Raycast
Given a cube, the structure arrays and the texture,
we can start our Raycast phase.
The logic of our Raycast is simple, the flow diagram
is shown as follow.
Find the first intersect point of
cube and view point, define
view direction
Lookup current point position in
structure arrays and textures.
No
Empty
cell?
out of cube
boundary?
Yes
Yes
No
Step forward to next
voxel base on view
direction
Output color,
colored or empty.
As shown in the diagram, during the Raycast we
only need to do the lookup for once for every pixel
at the beginning. The index of structure arrays for
the beginning position is stored, and we only need
to maintain the offset of index and offset position.
This Raycast method is view direction independent,
we don't need to test the first intersection is on
which of the 6 faces of the cube like other Raycast
method.
Current Result Images
These images show an architecture object defined
by the structure arrays and the texture shown
previously, which is the result rendered by the
Raycast.
Download