02560 Web Graphics and Scientific Visualization

Week 5 - drawing a sampled surface (grid types, loading from files, computing normals)

Scientific visualization often requires data input. In the previous weeks, we have seen different examples of input data. Tabulated curves were used for colour input in the colour example from Week 1, image data were used as textures in the globe example from Week 3, a mathematical function was used as input in the surface example from Week 4. In this week, we will load a triangle mesh from a file to draw the surface reconstruction of point sampled data. Such a triangle mesh could also have been exported from CAD or 3D modelling software.

Load a triangle mesh from a PLY file or an OBJ file. A loader for the PLY format is available in the code samples from DV and a loader for the OBJ format is available in the code samples from GL. There is a JavaScript library file for loading OBJ files available in the bunny example for the lecture. Three different triangle meshes in PLY format are available in the code samples from DV. You can use Blender to convert from PLY to OBJ or to create your own custom triangle mesh.

Based on the exercises from previous weeks, make sure that you can draw, illuminate, and shade your loaded triangle mesh, and that you can interact with the camera using the mouse. If the model file does not include vertex normals, you should compute them yourself to get proper shading.

Try to visualize the surface normals as colours. Can you think of other functions or attributes that one could visualize as colours painted on the object surface. Draw your mesh in wireframe to show the unstructured grid, or consider how to do it (inspiration and a WebGL version). Discuss the different grid types and consider implicit and explicit surface representations.

Reading Material

DV Sections 3.1-3.5. Continuous data, sampled data, discrete datasets, cell types, and grid types.
GL Chapter 10, the tenth subsection (pp. 414-430). Load and display 3D models.
suppl. Bærentzen, J. A., and Aanæs, H. Signed distance computation using the angle weighted pseudo-normal. IEEE Transactions on Visualization and Computer Graphics 11(3):243-253, May 2005.