Overview
The overall goal of my
final project was to develop a scene around a 3D model that I reconstructed
using AgiSoftÕs photogrammetry software, PhotoScan Professional 1.2.4. After
I scanned in a small cactus atop of a candle box using AgiSoft, I then
inserted a fish into the scene and modified the programÕs char_callback() so that the user could move the fish around the
scene using the keyboard. The keyboard controls for the fish are the
following: |
The scene also includes a
particle system that originates from the fishÕs mouth, creating a bubble-like
effect. (Please note that IÕm aware that fish donÕt blow bubbles, itÕs just
fun to watch). To create an underwater effect, I added in fog to fade the
scene into blue the further back the objects are in the scene and added
caustic textures to emulate water reflections on the floor of the tank. I
animated the caustic texture by rotating through 11 different textures which
were set to change based on a specific time interval and used Blinn-Phong to
light most of the objects within the scene. The program uses 3 different sets
of shaders: one that uses the fog effect, caustics, and optional Blinn-Phong;
another that uses the fog effect, caustics, a texture matrix, and
Blinn-Phong; and a third that shades a particle system with caustic
texturing. In addition to the fog effect and caustic texturing, thereÕs also
collision detection in the scene to add to the reality of the underwater
world. By establishing exclusive/inclusive bounds around the cactus and the
ŌtankĶ, where the fish can swim, the fish is unable to swim through the
cactus or swim outside the invisible bounds of the tank. |
Caustics (seen on
ŌseafloorĶ), particle system (from fishÕs mouth), 3D reconstructed cactus
(center)
Fog effect: Less fog because
closer (left), more fog because farther away (right)
Technical Difficulties
My original plan for this project
was to use AgiSoft to scan in a coffee mug and construct a scene around that
object, but in the process of photographing various mugs and trying to
reconstruct models from the images, I realized that I wouldnÕt be able to
successfully scan in a mug due to its glossy surface. While using the
software, I discovered that it works best with more matte colored objects
that donÕt have a lot of repeating patterns and/or textures on them. Also I
came across the problem of the software scanning in a lot of unwanted points,
such as the background or foreground of the image. In order to get the best
reconstruction that I possibly could, I took well over 300 photos of the
cactus from different angles and deleted the background in every photo to
ensure that the software would only try to reconstruct the cactus and not any
extraneous points picked up from its surroundings. I then went through the
dense point cloud of the model and deleted points that were out of place or
unnecessary. The whole process of creating the 3D reconstruction was pretty
laborious, but with the right backgrounds, cameras, camera angles/alignments,
and lighting the process becomes easier and more precise. One of the initial difficulties
I had after I finished reconstructing the cactus was adding a fish object to
the scene. The original fish obj file that I wanted to use, required normals
to be retrieved separately through an associated normals map. I spent a long
while working/debugging a new set of shaders that could handle processing
normals using normal maps, and I eventually got it to work. The unfortunate
news was that, despite my working shaders, the fishÕs lighting still appeared
wrong. After a careful look, it was determined that my shaders werenÕt the
issue, something was wrong with the obj file itself. So I ended up finding a
new obj file to use for the fish, but this one didnÕt use mapped normals,
thus I never ended up using the normal-mapping shaders I had worked on. |
Demos:
{click to view video demos}
Demo 1
Demo 2
Links to Concepts
AgiSoft PhotoScan Professional:
http://www.agisoft.com/pdf/PS_1.0.0%20-Tutorial%20(BL)%20-%203D-model.pdf
Caustic Textures:
http://alfonse.bitbucket.org/oldtut/Texturing/Tut17%20Projective%20Texture.html
Fog effect:
http://www.geeks3d.com/20100228/fog-in-glsl-webgl/