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