Salome HOME
Update documentation for 7.2.0
[modules/geom.git] / doc / salome / gui / GEOM / input / material.doc
1 /*!
2
3 \page material_page Material properties
4
5 \tableofcontents
6
7 \section material_general_description General description
8
9 \note The functionality related to the material properties is
10 \b experimental, so it might work not as expected. The behaviour might
11 be changed in the future versions of SALOME Geometry module.
12
13 \n You can change the material properties of the selected shape(s) in
14 the dedicated dialog box. This dialog box can be invoked from the
15 context popup menu. 
16
17 \n Appearance of popup menu can be customizable via 
18 "Show predefined materials in popup menu" option from preferences.
19 If this option is switched off, only "Material properties" item will 
20 be shown in popup menu. If this option is on (by default), "Material 
21 properties" item in popup menu will open submenu listing predefined 
22 materials and additionally "Custom..." item.
23
24 \n "Show predefined materials in popup menu" option is switched off:
25 \image html hide_predef_material.PNG
26 \n "Show predefined materials in popup menu" option is switched on  
27 \image html show_predef_material.PNG
28
29 \n"Custom..." or "Material properties" item will open dialog box:
30
31 \image html material.png
32
33 In this dialog box you can:
34 - modify the properties of the material model currenly assigned to the
35 shape presentation;
36 - assign one of predefined global materials to the shape;
37 - create a custom material model and apply it to the shape.
38
39 \n You also can work with custom materials in the "Materials library" dialog box. 
40 This dialog box can be invoked from the "Tools" main menu using 
41 "Materials library" item:
42
43 \image html materials_library.png
44
45 \note This functionality is available in both OCC and VTK 3D
46 viewers. However, note that due to the differencies between underlying API
47 of OCC and VTK libraries the behaviour of the functionality related to
48 the materials is different:
49 - presentation of the shape in OCC and VTK viewers is not fully identical;
50 - some material attributes can affect presentation in a different way.
51
52 \section material_opengl_model OpenGL ligthing model
53
54 The material is specifed by several attributes of the lighting
55 model. More details can be found in the documentation related to the
56 OpenGL programming, for example here: http://www.glprogramming.com/red/chapter05.html.
57
58 In the OpenGL lighting model, the light in a scene comes from several
59 light sources; the light sources have an effect only when there are
60 surfaces that absorb and reflect light. Each surface is assumed to be
61 composed of a material with various properties. A material might emit
62 its own light (like headlights on an automobile), it might scatter
63 some incoming light in all directions, and it might reflect a
64 portion of the incoming light in a preferential direction like a
65 mirror or other shiny surface.
66
67 The OpenGL lighting model considers the lighting to be divided into
68 four independent components: emissive, ambient, diffuse, and
69 specular. All four components are computed independently and then
70 added together. 
71
72 Ambient illumination is the light that has been scattered so much by the
73 environment that its direction is impossible to determine - it seems
74 to come from all directions. Backlighting in a room has a large
75 ambient component, since most of the light that reaches your eye has
76 first bounced off many surfaces. A spotlight outdoors has a tiny
77 ambient component; most of the light travels in the same direction,
78 and since you're outdoors, very little of the light reaches your eye
79 after bouncing off other objects. When ambient light strikes a
80 surface, it is scattered equally in all directions.
81
82 The diffuse component is the light that comes from one direction, so
83 it is brighter if it comes squarely down on a surface than if it barely
84 glances off the surface. Once it hits a surface, however, it's
85 scattered equally in all directions, so it appears equally bright, no
86 matter where the eye is located. Any light coming from a particular
87 position or direction probably has a diffuse component.
88
89 Finally, the specular light comes from a particular direction, and it
90 tends to bounce off the surface in a preferred direction. A
91 well-collimated laser beam bouncing off a high-quality mirror produces
92 specular reflection by almost 100 percent. Shiny metal or plastic has a
93 high specular component, and chalk or carpet has almost none. You can
94 think of specularity as shininess.
95
96 Although a light source delivers a single distribution of frequencies,
97 the ambient, diffuse, and specular components might be different. For
98 example, if you have a white light in a room with red walls, the
99 scattered light tends to be red, although the light directly striking
100 objects is white. OpenGL allows you to set the red, green, and blue
101 values for each component of light independently.  
102
103 \section material_lib Materials library dialog box
104 The dialog box consists of two parts:
105 - The list box at the left shows all available material models, both
106 predefined by the application and custom one specified by the user.
107 - The widgets in the right part of the dialog box allows modifyng of
108 different properties of the material model.
109
110 The following properties of the material model can be specified:
111 - \b Ambient color and coefficient (floating point value between 0 and 1)
112 - \b Diffuse color and coefficient (floating point value between 0 and 1)
113 - \b Specular color and coefficient (floating point value between 0 and 1)
114 - \b Emissive color and coefficient (floating point value between 0
115 and 1). Note: this attribute is applicable only for the OCC viewer;
116 it simulates light originating from an object.
117 - \b Shininess
118 - \b Type of material model: \em physical or \em artificial.
119
120 All available predefined material models are shown in the list box of
121 the <b>Materials dialog</b> dialog:
122 - <b>[Current]</b> item in the list corresponds to the material model
123   currently assigned to the selected shape(s). This model can be
124   freely modified by the user.
125 - <b>Global</b> material models are shown in blue color in the list;
126   these are the models predefined by the SALOME Geometry module. The user
127   is not allowed to modify the global models.
128 - <b>User</b> materials are shown in black color in the list. These
129   models are specified by the user and can be modified at any moment.
130
131 The buttons "Add material" and "Remove material" in the lower part of
132 the dialog box can be used to create or remove custom material
133 models. The same commands are also available via the popup menu that
134 is shown if the user presses right mouse button in the materials list
135 box. An additional "Rename material" command, available in popup menu,
136 can be used to change the name of material model.
137
138 \section material Material properties dialog box
139
140 The dialog box looks like "Materials library" dialog box but has 
141 some additions in the form of selection objects mechanizm and "Color"
142 property.
143
144 If the material model is specified as a \em physical one (like \em Gold,
145 for instance), this means that the color of the shape (more precisely
146 its \em ambient color) can not be modified. If you assign a physical
147 material model to the shape, the "Color" menu item will not be
148 available in the popup menu.
149
150 If the model is non-physical (\em artificial), the color can be changed
151 to any appopriate one, only other attributes will be constant. In the
152 dialog box you will be able to modify the color of the shape via the
153 "Color" button. "Ambient color" button becomes disabled to signalize
154 that this attribute of the model is ignored. Also, it will be possible
155 to modify the color of the shape via the
156 \ref color_page "corresponding popup menu command".
157
158 <b>Examples:</b>
159
160 \image html material_OCC.png
161 <em>Different materials in OCC viewer</em>
162
163 \image html material_VTK.png
164 <em>Different materials in VTK viewer</em>
165
166 The default material model is specified via the preferences of Geometry
167 module.
168
169 */
170