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