calsoft enterprise solutions

White Papers

Visualization of Design Data - Current Techniques

Introduction

Till recently graphics were limited to high-end workstations. With continuous increase in the power of PCs and falling prices graphics has become commonplace now.

As more people have started using graphics the need for better and faster performance has become a norm in all PC software applications.

Visualization can broadly be split into two areas

  • Graphics for Gaming Data is as a means of creating images that are used to represent worlds that matter to the-user. Data itself is not important, representation is. Simultaneously, speed is of for real-time animation.
  • Rendering of Design data Data is the end. Not only is the representation important but also the dimensions and of the matter used.

Games depend heavily on the extent of realism achieved in without compromise on speed. Useful techniques have been developed for performance under various situations, which can be used in rendering of design.

The emergence has web has created another need to have the design data represented over the web with the speed of gaming graphics. This gave rise to intelligent formats and streaming techniques for graphics.

Companies like Microsoft, EAI, SGI and HP have dedicated considerable resources to come up with a solution for this problem. They have achieved significant success in defining standards and new technologies both in hardware and software. All this points to a world of graphics enriched Windows Applications based on standards.

This white paper tries to explore a number of ways in which graphical representation of your data can be improved and also the new emerging standards. The focus of current discussion is software.

It is assumed that the reader has working knowledge of Computer Graphics.

(Reference: A Primer on Computer Graphics)

The Graphics Pipeline

The computer assists us in converting our ideas into computer graphics. For instance, when we begin drawing an image, we usually do not think in pixel units. We think in terms of physical world units like inches and feet. The computer accepts our input, and outputs graphics. The system that manages this process is called the graphics pipeline.

Whether we are making graphics for visual impact or for aircraft design, the input comes to the computer from the front end of the graphics pipeline. Computers use the graphics pipeline to represent how they process data.

The pipeline processes and transforms the information, which allows it to be stored as pixel values in a data file. This file information can then be represented as an image on a screen, and output to hardcopy devices like printers or plotters. By taking the data that has been stored in the file, other computers can use that information to process and produce files that can drive other devices such as milling machinery to make parts, or molding machinery for plastic casts.

In today's computer graphics systems, most of the pipeline functions are performed independent of user input. Some of the functions are implemented in hardware, some in software. The key to optimum performance is a tight coupling between hardware and software, taking full advantage of the capabilities of each.

We will be exploring techniques used at both the second and the third level in the pipeline to bring realism to representations.

Techniques For Making 3D Graphics More Realistic

One can use primitives to represent any object. But images with curves and solid colors are not realistic to look at. In real life, eye perceives objects with various shades of color and varying curves at various points. These are often functions of distance and lighting.

In the graphics world these have to be simulated because there is no distance between the screen and the user and lighting is not a factor too. Following techniques can be used for creating more realisticimages. These techniques are based on what happens in real world.

Shading Models

This is a technique used as far back as stone ages by artists. Even today when an artist makes sketches he shades them to bring reality to the drawings. Designers working with wire-frames shade a wire frame's surface to create the illusion of a solid. This technique allows the designer to view the model as a real object, enhancing comprehension and making for better design, revision, and review.

Flat Shading

Flat shading is the simplest and least computationally intense shading technique: the lighting models calculate a single color and intensity for each polygon. The result is a flattened, faceted appearance that may reveal the underlying structure of the model, but is usually not very realistic. The benefit of flat shading is that it can be done quickly to help the engineer interpret the model.

Gouraud Shading

Gouraud shading smoothes the edges of the polygons, creating the object, by applying different shades of the base color for each pixel of that polygon, which makes it, appear smoothly rounded. A rounded surface in nature reflects a different amount of light from each point. The benefit of Gouroud shading is that it creates a realistic image by eliminating the faceted appearance of the model (at the cost, of course, of performance, since many more calculations must be done).

Another technique used when the hardware does not support many colors is Dithering.

Dithering

In a number of cases the limitation is the hardware. Older monitors and graphics cards can not display more than 256 colors. We can give and impression of more colors in the palette by using dithering. Dithering works by placing different-colored pixels next to each other. Human eye tries for closure and continuity and perceives colors that are not present on the screen. If we place a white pixel next to a black pixel, human eye will see gray.

This technique is also used to show shading on a grayscale display or on a computer printout.

Using Light Sources

Another technique used is derived from the effects of shading and light intensity in physical world. Computer graphics applications use simulations of illumination in the physical world. These simulations are known as lighting models. Computers apply a variety of lighting models to simulate light sources and reveal surface characteristics. Light models are dependent on the type of light source used.

Types of Light Sources

Ambient Light
Ambient light is light is coming from all directions with equal intensity, like being outdoors on an overcast day. All facets of all objects receive equal illumination. Below is an example of a sphere illuminated by ambient light.

Directional Light
Directional light is light is coming from a single direction with a constant intensity, like being outdoors on a sunny day. All rays are parallel, as if the light is at an infinite distance, and light intensity does not diminish with distance. Identical objects with identical orientations are identically illuminated, regardless of their location. An example of the illumination is given below.

Positional Light
Positional light is light is coming from a single location at a finite distance, like being in a room lit by a light bulb. All rays emanate from the light source they are not parallel and light intensity diminishes with distance. Identical objects with identical orientations are differently illuminated, depending on their location with respect to the light source. See example below.

Spotlight
A spotlight is a positional light source, which has a cone of effect, e.g. a desk lamp or a torch.

Lighting Models

When we see objects, we infact see the light being reflected by them. Hence scientists have devoted significant research to the behavior of reflection of light from various surfaces.

Through these empirical data was derived Phong Lighting. Phong lighting is popular computerized lighting model. This model accounts for the ambient, diffuse, and specular reflections of light from a point on a surface.

Reflection

Diffuse Reflection
Diffuse reflection is uniform, as the light scatters equally in all directions. Diffuse reflection looks the same regardless of your viewpoint

Specular Reflection
Specular reflection is what you see when you look at a shiny surface. Highlights are caused by specular reflections, which change depending on your viewpoint. They are the result of light reflecting from the surface directly into your eye, much like a mirror

Combining the models
The easiest method is to compute a single shade color for each face based on its orientation. Of course, the speed is highest, but quality is poor.

Gouraud shading calculates the light intensities accurately only at the corner points of the face. The illumination values at these points are interpolated across the face so that a smooth change in color is achieved. This gives better realism than above, and but is more time consuming.


Gouraud without specular reflection


Gouraud with specular reflection

A rounded surface reflects a different amount of light from each point based on the Phong Lighting model. Phong shading is a technique that utilizes this model. It calculates the orientation of each point on the polygon surface, and accordingly assigns the light intensity for that point. It can also show specular reflections properly.

This creates a realistic image by eliminating the faceted appearance of the model. But this technique is at the cost of performance, since many complex calculations must be done.

Phong shading would be ideal for realistic display, but because it is slow, Gouraud shading is the normally used.

To improve the realism, without compromising the speed, Gouraud shading is used with texture mapping.

Line Quality Enhancement

Another technique widely used is derived from dithering. Because pixels are square and arranged in a rectangular array, drawings of diagonal or curved lines will look jagged, or aliased. These "jaggies" can be disconcerting to the user, and often look downright lousy.

Anti-Aliasing

Anti-aliasing is a technique that helps eliminate the jagged lines on the screen by blurring the edges slightly. By doing this, your eye is tricked into seeing a smooth line. Magnified, an anti-aliased white line on a back background looks similar to the illustration below: shades of gray create "partially lit" pixels in the rotated plus sign.


Anti-aliasing turned ON


Anti-aliasing turned OFF

Hidden Surface Removal

One of the most important techniques used to bring realism to design data is hidden line and surface removal. Opaque objects that are closer to us may partially or completely hide objects that are farther away. To imitate real life, computer graphics must ensure that all opaque surfaces hide surfaces further back. This process is called hidden-surface removal.

Hidden surface removal is one of the most complex operations in computer graphics. It could involve complex algorithms to decide which lines and surfaces should be hidden. Some of the popular ways of achieving this are discussed below.

Z-Buffer

The Z-buffer is a popular method for achieving hidden-surface removal. Think of the screen as having a horizontal direction of X, a vertical direction of Y, and a depth of Z. In reality, of course, the screen has no depth. This is only a model the computer uses.

The computer uses a frame buffer to indicate the color of each pixel on the screen. The Z-buffer is a memory location for Z-axis information, and is used to determine what will be displayed and what will be suppressed when removing hidden surfaces

When you draw a new object, the computer looks at where the object will be placed on the two-dimensional screen. Since an object may be partially obscured by another object, each pixel of the new object you are drawing is compared to the current Z-buffer value for that pixel. If the Z value of the new object is greater than the Z value in the Z-buffer, then the new object is behind previously-drawn objects, ad thus is not drawn. Conversely, if the Z value of the new object is less than the Z value in the Z-buffer, the new object is in front of the old object, and thus the new object is drawn, obscuring previously-drawn objects.

Back-Face Cull

In 3D scenes using hidden-surface removal, there often are polygonal surfaces which face away from the viewer and, because they are completely obscured by other opaque surfaces in front of them, contribute nothing to the final image (for example, the facets on the backside of an opaque sphere). In this situation, you can reduce the time required to draw an image by not rendering these hidden, back-facing surfaces at all, thereby increasing the performance and interactivity of the graphics system. This technique is called back-face cull. By using back-face cull, you can move an object faster when manipulating it on the screen. Back-face cull is so called because it "culls," or removes, all polygonal surfaces facing away from you.

To illustrate back face cull, think of a hexagonal prism. If you view it from the top, as shown at right, the surface normal vectors point straight away from each side.

Now, if you rotate the prism to see the sides, there are surfaces to remove.

In this illustration, the prism in the middle shows the results of hidden-surface removal. The prism to the right shows the result of back-face cull. In practice you would use back-face cull only in situations where you wish to achieve increased performance but not in situations where you would notice that parts of the picture are missing.

Realism

When we light an object in the real world, we get reflections and shadows. Computers use several techniques to represent those effects of light on an object to create a realistic image.

Ray Tracing

Ray tracing is an advanced rendering technique used to calculate not only the direct light sources but also all the reflected, refracted, and transmitted light. Ray tracing approximates the scene by tracing rays from the eye, through each pixel on the image plane, and into the environment. It produces sharp, clear, realistic highlights and reflections. The shadows produced from ray tracing are sharply defined as shown here. Ray tracing is view-dependent, so an interactive walkthrough of a scene is not possible. Animation of a ray-traced scene is accomplished by playing back a series of ray-traced bitmaps.

Radiosity

Radiosity is another method of producing realistic lighting, shading and shadowing. It models the inter-reflections of diffuse light between surfaces of the environment. Radiosity is view-independent, so the user can interact with the image (for example, walk through a scene). The shadows produced from radiosity are softer than those produced from ray tracing, as shown in this example.,


Combined Radiosity and Ray Tracing

Combining the effects of radiosity and ray tracing can create superior photorealistic view-independent images with sharply defined shadowing. Both ray tracing and radiosity are computationally intensive operations that require high-end workstation capabilities. Because of the ray-tracing, the combined radiosity and ray-tracing process is view-dependent it produces a bitmap. Motion can be simulated by playing back a series of these bitmaps. Combining the two effects requires advanced graphics techniques and tools.

Other Techniques

Some of the other techniques often used for creating an illusion of realism are given below. These techniques are increasingly used for complex model visualization.

Transparency

Transparency allows accurate rendering of surfaces like glass and window screens. There are three techniques for producing transparency: screen-door transparency, alpha blending, and ray-tracing. Screen-door transparency actually turns off some pixels which represent the transparent object, so the object behind it can show through just like looking through a screen door. Alpha blending blends the color of the transparent object with those behind it. With this technique, you can vary the amount of transparency across the surface to simulate more realistic transparencies like a bottle that appears more transparent in the center than at the edges. Ray-tracing makes it possible to mimic the optical properties of objects such as varying reflection, refraction, and transmission

Depth Cueing

If you need to create the perception of depth with a 3D wireframe object, you can use a technique called depth cueing. To distinguish the portions of the model that are closer to you from those that are farther away, the computer varies light intensity. The lines closest to the viewer appear brighter than the lines farther away. Alternatively, a color is blended with the existing color based on the object distance. This is also used to produce visual effects such as mist, fog, haze, murky water etc.

Texture Mapping

Texture mapping is a fast, effective technique for laying bitmapped images over rendered surfaces, like wrapping a package with patterned paper. Not only can you get a quick visual response to the shape, you can simulate a wide variety of possible materials for designing decisions. Real world textures like wood grain or leather can be scanned in or generated by an artist directly in the computer.


The image of an Earth model, made from a small texture bitmap and a simple sphere.

Contour Mapping

Contouring is the process of using different colored lines or shaded bands on a surface to represent regions of different value or ranges of values. Contour mapping is used for testing environmental constraints like temperature, density, wind resistance or, as in the image below, altitude (both above and below sea level) of the Gulf of Mexico. Below is an example of showing distance from a plane using contouring.

Clipping

Clipping is the process of removing those portions of a graphic image which do not fit within a specified boundary such as a window. The two illustrations here represent a wireframe house that is bigger than the screen. The one on the left shows what can happen when you do not clip to a screen. The one on the right shows proper clipping. Typically, a graphics software library will enable clipping by default. Some libraries will allow users to disable clipping, which may increase rendering speed.

Now the dominant question in your mind would be how to get these “cool” capabilities into your applications. Though these operations are complex, most of the complexity is hidden form us by the graphics toolkits available in the market today. We will discuss the options available in the next section.

How Can You Incorporate This Functionality Into Your Applications & Graphics Toolkits

In the past, some of the above functionality was available in Third party toolkits. Most of these toolkits were also hardware dependent.

Now there are a set of toolkits that do all the above and much more. They have been accepted as standards in the industry and most hardware supports acceleration for them. We have discussed most prominent toolkits for Microsoft Windows below.

OpenGL From SGI

OpenGL is a very portable software interface for rendering 3-D graphics. It includes approximately 120 commands to draw graphics primitives such as points, lines, and polygons. However, unlike the Windows GDI (graphics device interface), OpenGL primitives are drawn in three dimensions. OpenGL also includes support for shading, texture mapping, anti-aliasing, lighting, and animation. Commands for producing and manipulating higher-level 3-D objects, such as cubes, pyramids, spheres, and the Boeing 777, are not included but can be built from the existing primitives.

OpenGL does not manage windows, read input, or write files. Windows NT, Windows, or some other operating system does the job of managing the windows. An application gives OpenGL a piece of a window or bitmap on which to render

Silicon Graphics Inc. (commonly known as SGI) originally developed GL, a 3-D graphics language, for its 3-D graphics machine, the IRIS. The process of porting it to another system proved extremely difficult, however. So SGI decided to change GL to make it easier to port to different hardware, operating systems, and windowing systems. The result was OpenGL.

While SGI still maintains IRIS GL, all new work and enhancements are being made to OpenGL. The enhancements and changes to OpenGL are decided by the Architecture Review Board (ARB), whose founding members are Digital Equipment Corporation, IBM, Intel, Microsoft, and SGI.

OpenGL Functions

OpenGL provides a wide range of graphics functions: from rendering a simple geometric point, line, or filled polygon, to texture mapping NURBS curved surfaces.

  • Geometric primitives (points, lines, and polygons)
  • Raster primitives (bitmaps and pixel rectangles)
  • RGBA or color index mode
  • Display list or immediate mode
  • Viewing and modeling transformations
  • Hidden Surface Removal(depth buffer)
  • Alpha Blending(transparency)
  • Anti-aliasing
  • Texture Mapping
  • Atmospheric Effects(fog, smoke, and haze)
  • Polynomial Evaluators (to support Non-uniform rational B-splines)
  • Pixel Operations (storing, transforming, mapping, zooming)
  • Accumulation Buffer
  • Stencil Planes
  • Feedback, Selection, and Picking
Benefits For Graphics Workstation Users

OpenGL runs best on high-end 3-D graphics workstations, such as the SGI boxes used for Jurassic Park. Of course, OpenGL running on a Pentium PC with an enhanced VGA card isn't going to come close to the performance of the same application running on an SGI Crimson box. However, the Crimson box will set you back close to $50,000.

So if you don't have $50,000 to drop, the addition of OpenGL to Windows NT provides a number of benefits. For the graphics workstation community, it is low-cost, scalable, and portable. It means that Windows NT can now serve as a low-cost platform for developing and running high-end graphics applications, including CAD/CAM (computer-aided design/computer-aided manufacturing), and thus can replace more expensive graphics workstations. This means a standard Pentium-based PC can become the basis for a graphics workstation.

Windows NT runs on small, portable laptops and large, multiple-processor file servers. You can easily try out 3-D applications or application development on your existing desktop computer and upgrade when you need the extra power. It also runs on the 386, 486, Pentium, MIPS, Alpha AXP, and PowerPC processors.

In addition, Windows NT can easily run standard Windows-based applications. The same system that runs your advanced graphics applications can run word processors, spreadsheets, and other applications for Windows. No need for multiple computers, expensive proprietary applications, or troublesome emulators.

Portability

OpenGL is very portable. If you are thinking of re-engineering an application to Windows platforms this should be the graphics library of choice..

Moving From GDI To OpenGL

Incorporating OpenGL is not as simple as just extending GDI to perform 3-D drawing: GDI users are going to find little that is familiar with OpenGL. For example, drawing a line with OpenGL is completely different from drawing a line with GDI. In fact, OpenGL uses a rendering context and only indirectly uses a device context. Current brushes, colors, fonts, and other objects selected into the device context have no effect on OpenGL rendering. Even the GDI mapping modes have no effect on OpenGL.

OpenGL From SGI

Open Inventor is an object-oriented 3D toolkit offering a comprehensive solution to interactive graphics programming problems. It presents a programming model based on a 3D scene database that dramatically simplifies graphics programming. It includes a rich set of objects such as cubes, polygons, text, materials, cameras, lights, trackballs, handle boxes, 3D viewers, and editors that speed up your programming time and extend your 3D programming capabilities.

Open Inventor
  • is built on top of OpenGL
  • defines a standard file format for 3D data interchange
  • introduces a simple event model for 3D interaction
  • provides animation objects called Engines
  • provides high performance object picking
  • is window system and platform independent
  • is a cross-platform 3D graphics development system
  • supports PostScript printing
  • encourages programmers to create new customized objects
  • is fun to use
DirectX

Microsoft® DirectX® is a group of technologies designed by Microsoft to make Windows-based computers an ideal platform for running and displaying applications rich in multimedia elements such as full-color graphics, video, 3-D animation, and surround sound. Built directly into the Microsoft® Windows® family of operating systems, DirectX is an integral part of Windows 98 and Windows NT® 5.0, as well as Microsoft® Internet Explorer 4.0. DirectX components may also be automatically installed on your system by advanced multimedia games and applications written for Windows 95. (Early releases of Windows 95 may not include DirectX. If you think your Windows 95 operating system does not include DirectX, you can download it from this Web site.)

Microsoft's goal in developing DirectX was to provide developers with a common set of instructions and components that would accomplish two things. First, DirectX would allow developers to be confident that their multimedia applications would run on any Windows-based PC, no matter what the hardware, and at the same time ensure that their products take full advantage of high-performance hardware capabilities to achieve the best possible performance. This was accomplished through the DirectX Foundation layer. Second, DirectX would make life easier for developers by giving them tools that simplify the creation and playback of multimedia content, while at the same time making it easier to integrate a wide range of multimedia elements. DirectX does this with the DirectX Media layer.,

DirectX provides developers with new opportunities for creativity and innovation by allowing them to focus on building unique features for their application without having to worry about which display adapter, sound card, or 3-D accelerator chip is installed in your PC. And because DirectX was designed to support future innovations in software and hardware, developers and consumers can be confident that they will continue to get the best possible performance from their applications as technology advances.

DirectX Foundation

DirectX Foundation gives developers a single set of APIs (application programming interfaces) that provides them with improved access to the advanced features of high-performance hardware such as 3-D graphics acceleration chips and sound cards. These APIs control what are called "low-level functions," including 2-D graphics acceleration; support for input devices such as joy sticks and keyboards, and mice; and control of sound mixing and sound output. The low-level functions are supported by the four components that make up the DirectX Foundation layer: Microsoft® DirectDraw®, Microsoft® Direct3D®, Microsoft® DirectInput®, and Microsoft® DirectSound®.

Before DirectX, developers creating multimedia applications for Windows machines had to customize their products so that they would work well on the wide variety of hardware devices and configurations available on Windows machines. DirectX Foundation provides something called a "hardware abstraction layer" (HAL short for) that uses software drivers to communicate between game software and computer hardware. As a result, developers can write a single version of their product that utilizes DirectX without worrying about the wide range of hardware devices and configurations in existence

Fahrenheit

Fahrenheit is the name of the collaborative project between Silicon Graphics and Microsoft for developing a suite of high-performance visualization technologies for the Windows/DirectX platform.

Fahrenheit will consist of the following APIs:

  • Fahrenheit Large Model Visualization API
  • Fahrenheit Scene Graph API
  • Fahrenheit Low-Level API

Fahrenheit is aimed at supporting applications which rely on interactive graphics, imaging and video. It is expected that these APIs will be leveraged in a variety of markets including games, digital content creation, CAD/CAM, Web, financial, scientific visualization, technical and user interface applications. this ambitious project is slated to produce its first deliverable

Lightworks

LightWorks provides 3D application developers with fast, easy access to high-performance rendering and geometric processing, including photo-realism, adaptive ray-tracing, radiosity and hidden-line rendering.

The LightWorks toolkit is an object-oriented API available for licensing by software developers of a wide range of graphical applications, including CAD/CAM, CAE, graphics and product design

Some of the features of LightWorks are:

  • Flat, Gouraud and Phong shaded rendering
  • Texture mapping
  • Texture spaces for all standard mappings
  • Anti-aliasing to smooth out the ‘jaggies’ in an image
  • Soft shadows
  • Multiple reflectance model shaders, including constant, matte, metallic and plastic
  • Transparent surfaces
  • Wireframe rendering
  • Vectors and polylines, including polyline thickness
  • Polygons and polygon meshes and utilities
  • Procedural primitives, allowing data-sharing with an external geometric database
  • Geometry transformations
  • Interpenetrating geometry (D-zero meshing)
  • Tri-strip geometry output
  • Unlimited number of lights
  • Ambient, distant, eye, point and spot light sources
  • Image file as backgrounds
  • Wrapped filtered image shader for adjusting color contrast and brightness of textures

LightWorks is the most widely used toolkit in Microsoft Windows Mechanical Design applications. There are also three solid modeling kernels available that incorporate above technologies to render images.

  • Parasolids
  • ACIS
  • Designbase