Imposter Rendering

Source: QuteMol

Source: TexMol

Goals:

1) Render spheres with correct size and depth in shaders given four points at the center

2) Correctly calculate lighting on the spheres in the shaders.

3) Do the same for cylenders.

The parts of imposter rendering that I got to work correctly were scale in the X and Y directions and diffuse lighting (for both spheres and cylenders). The most important aspect not correctly working is the depth calculation. I have seperate shaders for spheres and cylenders, and a program to use them called 'Fing' in the cvs repository. At the moment I am reading values off the depth buffer while it renders to try and figure out why I'm not getting the correct depth values outputted from the fragment shader.

My implementation tried best to emulate qutemol as opposed to texmol, unfortunetly the qutemol source code writes its shaders in ARB shader assembly which isn't very human readable. The implementation (along with qutemol) is so far only suitable for a orthographic projection environment.

Example 1 The two left spheres are imposters without proper depth, the two spheres on the right are gluSpheres for comparison.

Example 2 The fragments outside the sphere's bounds are drawn in green instead of being discarded.

Shader Demo

Although not a part of my thesis project, I did write and complete two shader demos, a smaller basic one called ShaderDemoZero in cvs and the more comprehencive ShaderDemo. The comments were written to explain what each function call does both in setting up the shader and in the shaders themselves. Mohammed authored the tutorial webpages but I helped him with the parts he didn't completely understand or needed clarification on.

Example 1 A quad who's colors and position are defined by the slider and time variable and utilized within the shader.

Example 2 The most complicated shader, where additional vertex attributes are specified (tangents and binormals) which is put together with the light direction (specified by the slider) to implement normal-mapping.

Texture Decals

Source: Interactive Decal Compositing with Discrete Exponential Maps

Goals:

1) Draw a tangent plane at a picked vertex of variable size and orientation and then draw where the neighboring vertices would project to on this plane given the methods outlined in the above paper.

2) Convert these projected points into a texture coordinate plane and render a texture onto it.

3) Allow multiple textures to be oriented, sized and placed in this manner with decent performance.

This implementation ended up working very well. There are two 'modes' to this, both implemented in Greg's SimpleMeshViewer in cvs. The work methods for my implementation have been put in MeshUtils, and they use as many existing MeshUtils functions as possible, like finding the vertex neighbors within a given distance and the shortest path to each neighbor. The first mode, enabled by clicking the 'enable' checkbox in the ui, draws a tangent plane on the selected vertex with a radius and orientation specified by the two sliders. The neighboring vertices are drawn in green and their projected positions in the UV texture coordinate plane (the tangent plane) are drawn in cyan. Originally, to debug I had also drawn the straight-mapped projections of the neighboring points to compare to my projections with discrete exponential maps. This has since been removed, but by viewing the tangent plane (its transparent) from above you can easily see where the neighboring points below would be perpendicularly mapped and why the discrete exponential map projection does a better job. Once a texture is selected, clicking 'Apply' button will paste it onto the mesh at the selected vertex using the size and orientation parameters set by the sliders. Any number of decals can be applied in this way, and removed with the 'remove last' button. They overlap and have clean edges due to being rendered with their own custom (yet short) shader that clamps the triangles at the fragment level when they reach outside the uv coordinates. So far I have discovered a bug when subdividing a mesh that results in degenerate decal triangles, as well as placing a decal in a deep saddle produces similar solid-color triangles. I am going to try to fix this over break.

Example 1 A view of the tangent plane.

Example 2 A different view of the tangent plane.

Example 3 A decal applied to a surface.

Example 4 A decal applied to a coarse surface.

Example 5 A decal applied to a subdivided version of the previous surface.

Font Rendering

Source: This is an extension of the previous project and has no straightforward source. The font library to be used is wgl, which can be found at MSDN and the tutorial I used to get started was NeHe's Site

Goals:

1) Use the existing texture decaling implementation with font textures, created from rendering bitmap fonts to an offscreen framebuffer and binding the result to a texuture.

2) Allow this font to be rendered on a curve or series of curve primatives and placed at or between vertices.

This extension to Texture Decals didn't get as far as it needed to get this semseter, and although I don't expect much of anything I did with it to count towards this semester's assessment, I will be implementing it over break so I can at least begin next semester where I felt I should have been at this point.