• 沒有找到結果。

User Interface

Material Design Systemrefine

3.4 User Interface

degree

RGB

Figure 3.20: The color selection interface of GIMP.

Figure 3.21: Drawing a 360 rotation via “Draw 360” button. When the button is pressed, a 360 rotation around the center of the selected region will be drawn automatically.

3.4 User Interface

Our user interface is shown in Figure 3.22. From left to right, we can roughly divide the inter-face into three parts: object preview, specular design and parameter control.

3.4 User Interface 29

Figure 3.22: User interface.

3.4.1 Object Preview

In order to allow artists to clearly observe the outcome of their design, we provide an object preview window on which several basic models; Quad, Cube, Sphere, Torus and Teapot can be selected. User can select the model from the menu bar or load the desired model using

“Load model” button (Figure 3.23). Changing lighting and viewing directions are allowed via

Wheel type switch

Reset button Expand window

Object selection

Load model

Point light toggle

Figure 3.23: The menu bar icons.

spin button, scale bar, mouse and keyboard; manually input a specific degree is also supported

3.4 User Interface 30

(Figure 3.24).

Figure 3.24: The control panel of the lighting and viewing directions.

The “Wheel type switch” at the menu bar is used to switch the control between viewing radius and lighting radius when controlled by the mouse wheel. User can use the “Reset but-ton” to reset the viewing and lighting directions to the default values. To cover any viewing and lighting degrees, theta can be set in the range of −180 and 180 degree and phi can be set in the range of 0 and 360 degree. When “auto” check box of a specific parameter is checked, the corresponding degree will automatically increase to the maximum and back to the minimum.

Artists can see the dynamic change of the lighting and viewing direction while editing at the same time. Note that the control of the parameters is synchronized; user can observe the cor-responding degree no matter which control method is used. By default, the type of the light source is set to directional light. However, user can change the light source to point light source via the “Point light toggle” button (Figure 3.25).

Directional Light Point Light

Figure 3.25: Changing the type of light source.

3.4 User Interface 31

The “Expand window” button at the menu bar is designed for users who use small monitors or less efficient graphic cards. When it is clicked, the specular design window will be hidden and the object preview window expanded. User can then resize it to a smaller window (Figure 3.26). Clicked it again will bring back the specualr design window (Figure 3.22).

Figure 3.26: “Expand window” button demonstration.

3.4.2 Specular Design

The part for specular design is mainly used for specular color design. The nine viewports correspond to different lighting and viewing directions over the upper hemisphere (Figure 3.27).

Phi angle is fixed while theta can be set in the range of 0 and 90 degree. When “auto” of a specific parameter is checked, different from the object preview window, the degree will increase to the maximum then decrease to the minimum to avoid the unlighted angle.

The button at the menu bar works the same as the object preview part.

3.4 User Interface 32

The upper right block of the user interface is the map selection block. This block is used for map selection and continuous texture updating. When “Update” of a specific texture is checked, any editing to the texture will directly affect the result. All the maps selected will be memorized. Thus if we accidently close the plugin, there is no need to reselect textures again when we re-execute the plugin. To speed up the map selection process, we filtered the map by its filename such that only those maps containing the key words (e.g., Height) in their filenames are displayed for selection. We only display all the opened maps for selection if none of the maps match the key word.

The “Parallax Occlusion Mapping” block provides the parameters required for parallax oc-clusion mapping, such as height map scale and texture repeat times. Height map scale is the ratio of height to width, which is used to map the height from the range {0.0, 1.0} to a range better represents the physical properties of the surface being simulated. For instance, a brick wall texture might cover a 2 × 2 meter area and the surface of the bricks give the surface a

3.4 User Interface 33

thickness of 0.02 meter. The height map scale for this material would be 0.02/2 = 0.01.

“Tilted Reflection” block provides a button that can be used to set the tilted reflection map to the default values. Artist can design the tilted reflection map via editing the default values (Figure 3.15 and 3.16).

“Rotation Map” block provides a button that can help user to create a 360 rotation around the center of the selected region (Figure 3.21).

“Normal Map Strength” block provides a spin button which is used to set the N ormalStrength for normal map calculation (Subsection 3.3.1). The higher the value is, the stronger the geom-etry features are.

“Specular Position” block will appear when any of the specular color maps is set to be updated continually. This block indicates the specular color positions corresponding to the viewports of the specular design window (Figure 3.9)

C H A P T E R 4

Results

In this chapter, we first describe some details about rendering, then we compare our results to the BTF and show the effects of editing operations. Finally, we show some of the results which are created via our material design system.

4.1 Rendering

We implement the proposed design system by using OpenGL with glsl shading language and put it on top of the GIMP as a plugin. Considering the real-time feedback, which is crucial for an artist friendly design system, we carefully manage the resources. As a result, we share the same texture objects and shader context for the object preview window and specular design window. Also, to reduce texture accesses times, all the specular color maps are combined into a 2D texture array. When changes are applied to a specific specular map, we only update the corresponding layer of the 2D texture array rather than regenerate the whole texture array.

For realism, we apply Parallax occlusion mapping [Tat06] to simulate the self-shadowing effect of the material. This algorithm needs tangent and binormal vectors to transform the light

34

4.1 Rendering 35

and view vectors to the tangent space for ray tracing. Since our focus is on the appearance of static objects, there is no need to calculate them every time for each frame. When a model is loaded, we first calculate the tangent for each vertex and then obtain the binormal via the cross product of the normal and tangent. However, direct calculation of the tangent for each face may not generate appealing results since the tangents for those faces that share the same vertex are not equal. As a result, the seams between surfaces are quite obvious, especially for round objects (e.g., ball). To solve this problem, the smoothness over the tangent is needed. Note that if we directly sum up all the tangents sharing the same vertex, it would also produce incorrect result for objects that have sharp edges (e.g., cube). Thus we only sum the tangents that share the same attributes (normal, texture coordinate and vertex position) for smoothing.

For efficiency, in rendering, we use display list for all the models to avoid re-evaluating and re-transmitting data over and over again for each frame. It is one of the fastest methods to draw static data. On a Intel Core 2 Dual E8400 3.0GHz with Nvidia GTX 260 desktop, a speed of 380 fps can be obtained when we render 10 viewports (a 512 × 512 object preview viewport and nine 170 × 170 specular design viewports) at the same time while a 256 × 256 texture is continuously updated. The main bottleneck resides in the continuous texture data transfer from CPU to GPU for real-time feedback. Also, our program is not fully optimized due to the design purpose. For real-time applications, the normal map can be pre-calculated from the height map and be combined with the height map as a RGBA texture. Also, the specular mask map and Fresnel map can be combined into the G and B channels of the rotation map, since we only use the R channel (Hue) of the rotation map. Further, all the specular color maps can be merged into a 3D texture to reduce the number of textures. In our experiments, three specular color maps along with the index map, specular mask map and rotation map are quite sufficient to represent most materials. However, if the material is enormously complex that requires more specular color maps, another index map is needed for indication. In that case, all the index maps can be combined into a 3D texture to reduce the number of textures. After the optimization mentioned above is done, the rendering speed for a 512 × 512 window can achieve 1450 fps.

相關文件