Cody Robson
CS 682
Description of Deliverables
· MeshUtils has a TextureDecaling.[h|cpp] files with an implementation of Texture Decals for use with a TriMesh mesh structure. Given a seed vertex the methods will return texture coordinates for neighboring vertices either in real world units or normalized for direct use with texturing. One can specify a group of vertices to receive texture coordinates or a radius in real world units in which only vertices within that radius (actually, slightly larger) are given texture coordinates.
· A tangent plane that can be placed at a picked vertex to represent the radius of a decal around a seed vertex. The tangent, binormal, and normal vectors are drawn and the neighboring vertices can be projected and drawn in this plane.
· An image file can be selected and applied at the current location, scale, and orientation of the tangent plane to the surface and rendered with the decal shader.
· The Text Decal Composer window can be opened and custom text decals can be applied to the surface. Described in detail below.
· Any currently applied decals can be saved to a text file in the current working directory specifying all the decal image files, their vertex regions, and the associated texture coordinates.
· A mesh can be automatically textured:
· Every vertex in the mesh is assigned a residue region, either specified by loading a protein molecule .pdb file or loading a non-.pdb mesh and having a copy of the mesh in .xsi format in the same directory with the vertices colored. Residues are created by contiguous regions of vertices who's color (a 1-jump neighbor voting) most closely matches black, white, red, blue, green, cyan, magenta, or yellow. 8-Coloring a mesh should be trivial to non-artists without much planning, allowing for any number of regions.
· The system attempts to orient each of these residue regions in one of three ways:
· Aligning the texture 'V' direction with the current world up vector.
· The previously mentioned aligning, and a second pass that rates each region by how perpendicular its seed normal is with the world up, as that is an indicator of how confident it is in its own orienting. Regions then blend their orientation with their most confidant neighbor's orientation.
· One region is oriented according to world up as above, and then each region is oriented against this original region, so that as the regions become less oriented with the world up they will at least show coherence with each other.
· For each of these regions (molecule residues or colored), the decal algorithm is run and a series of images are outputted into a “autodecaler” directory in the current working directory (given that the autodecaler directory exists). These images color the 2D region with data from the 3D mesh, including the normal image (described by the decal composer below), an image holding the ambient occlusion data (provided its been run) and curvature (defined in terms of the SimpleMeshViewer curvature coloring alogorithm), a border image, and an image that simply colors the region black and then colors over the triangles that overlap each other in red. (Overlap happens on very non-developable surfaces when the exponential maps tries to project them into 2D.)
· The normal image for each residue is then applied to the mesh, and operations can be run on these data-images to create custom text-labeling images (a system developed by Greg Cipriano and Prof. Mike Gleicher) and can be swapped in. Texture compression is a must because the typical molecule will have well over a hundred textures applied.
· Instead of selecting an image file, once the tangent plane's location, scale, and orientation are determined, a decal composer window can be opened. On this canvas one can define a bicubic spline that text can be positioned on.
· The text is fixed-width with simple arc-length kerning and adjustable size.
· If the underlying region has a residue defined (either from a .pdb file or assigned by mesh-color) the residue region is projected into the 2D canvas and shaded by normal direction.
· Areas with normals along the seed vertex normal (where the normal appears on the mesh, in the center of the tangent plane) are drawn in full 255 blue, and deviations in the normals in the U and V directions become increasingly red and green, respectively. If a neighbor vertex's normal points in a direction opposite of the seed vertex's normal, it is linearly blended to black.
· This is a very simple, lightweight shader that applies a texture and discards fragments outside of [0,1] texture coordinate space. This is not the same as GL_CLAMP texturing as it does not render the fragments that fall out of the texture space.