@@ -133,42 +133,107 @@ should be used only when standard material is not sufficient.
133
133
134
134
## Textures
135
135
136
- You can add textures to your material, to be used as inputs to material's parameters.
137
- To do so, right-click on the material and select 'Add Texture'.
138
- The new texture appears under the material:
136
+ ### A few words about textures
137
+ First, let's remind of what a texture is, in Physically Based Rendering
138
+ context: in PBR, ** a texture is a set of images that serve as inputs to a
139
+ material.**
140
+
141
+ The use of textures therefore presupposes the use of a material. _ There is no
142
+ texture without material._
143
+ Each image is intended to feed one of the material's parameters: color,
144
+ roughness, normals, bumpiness, etc. The image is also called a map: color map,
145
+ roughness map, normal map, bump map...
146
+
147
+
148
+ ### How it works in Render
149
+ In Render, you can use textures in your materials via a four steps process:
150
+
151
+ #### Step 1: Prepare
152
+ The first thing to do is to obtain the texture. Textures for rendering can be
153
+ downloaded from various sites, including [ AmbientCG] ( www.ambientcg.com ) ,
154
+ [ MaterialX] ( matlib.gpuopen.com ) etc.
155
+
156
+ Since it's usually shipped as a compressed file, you first have to unzip it
157
+ into a temporary directory. At this stage, you usually get a set of image files
158
+ plus a few other files containing metadata you may ignore (.usdc, .mtlx etc.).
159
+
160
+
161
+ <img src=./fileset_texture.png alt="Texture File Set">
162
+
163
+ As we have seen, texture is necessarily applied via a material. If you've
164
+ already got a material to be textured, you can jump to next step. If not, it is
165
+ recommended to use a Disney material, which is the most versatile solution.
166
+
167
+ #### Step 2: Upload
168
+ Then you have to store the texture into the material in FreeCAD.
169
+ To do so, right-click on your material and select 'Add Texture'.
170
+ A new texture object appears under the material:
139
171
140
172
<img src=./material_texture.png alt="MaterialTexture">
141
173
174
+ It contains:
175
+ - an Image field
176
+ - and mapping informations: rotation, scale, translation (in 2D)
142
177
143
- For the new texture to be usable, you must upload at least one image: set the
144
- 'Image' parameter.
145
- You can then add as many other images as you want. Textures can indeed be
146
- composed of different images for different purposes (color, bump map, normal
147
- map...). Use 'Add image entry' in texture's right-click menu.
178
+ You then have to upload your image files to this Render texture object:
179
+ - click on the Image field, and select your first image file in the file
180
+ picker. The image file is being uploaded into the texture.
181
+ - If there are remaining image files, right-click on the texture and select
182
+ 'Add image entry' in the context menu. Click on the new Image field and
183
+ select your file. Repeat till there is no more remaining image file.
148
184
185
+ You should obtain something like that:
149
186
150
187
<img src=./manyimages_texture.png alt="ManyimagesTexture">
151
188
152
- Optionally, you can set the mapping parameters (rotation, scale, translation).
189
+ Hints:
190
+ 1 . Some image files found in downloadable textures are useless for our
191
+ purposes. For instance:
192
+ - Ambient Occlusion: this input is not handled by our renderers.
193
+ - Normal DX: see note #2 below.
194
+ - Preview (usually a .png file...): although it is an image file, this file
195
+ is not intended to be an input for the material, but a way of assessing
196
+ the texture result.
197
+
198
+ You may ignore those files when uploading.
199
+
200
+ 2 . Some image names may be reinterpreted to connect to their target parameters:
201
+ - Albedo should be connected to Color / Base Color
202
+ - Displacement may rather be connected to Bump than to Displacement.
203
+
204
+ 3 . Due to FreeCAD's peculiarities, once you've uploaded a file to an Image
205
+ field, it's no longer possible to modify this link. If you still want to
206
+ make a modification, you need to delete the field, invoking 'Remove Image Entry' in
207
+ texture context menu, and recreate it (please don't blame Render for this,
208
+ this is FreeCAD related...).
153
209
210
+
211
+
212
+ #### Step 3: Connect
154
213
Once you have a workable texture, you can use it in rendering parameters:
155
- right-click on your material, select 'Edit Render Settings' to open your
156
- material's settings; set the parameter to 'Use texture' and select the texture
157
- you want in the combo box. You should get something like that:
214
+ 1 . Right-click on your material, select 'Edit Render Settings' to open your
215
+ material's settings
216
+ 2 . For each parameter affected by an image file, set the parameter to 'Use
217
+ texture' and select the image file you want in the combo box. You should get
218
+ something like that:
158
219
159
220
<img src=./textures.png alt="TextureSettings">
160
221
161
- Caveats:
162
- - Textures cannot be used standalone: they are necessarily linked to a
163
- material.
164
- - A material can only access its own textures (not the textures of another
165
- material).
166
- - The image files will be stored inside the .fcstd file. Large use of
222
+ #### Step 4: Tweak
223
+ Optionally, you may set:
224
+ - the mapping parameters.
225
+ - the UV mapping: see next chapter.
226
+
227
+ #### Additional Notes
228
+ - Normal DX / Normal GL: Normal maps exist in two formats : DX (DirectX)
229
+ and GL (OpenGL). Both formats strictly contain the same information, but in
230
+ two distinct encodings.
231
+ _ In Render, normal maps are expected to follow OpenGL encoding (not DirectX)._
232
+ Hence NormalDX files are useless for us.
233
+ - The image files will be stored inside the .FCStd file. Large use of
167
234
textures may affect file size!
168
- - Normal maps are expected to follow OpenGL convention (not DirectX)
169
235
170
-
171
- ## UV mapping
236
+ ### UV mapping
172
237
To correctly position the texture on the object, Render WB generates a UV
173
238
mapping. Three modes are available:
174
239
- Cubic
@@ -179,6 +244,8 @@ Those modes are accessible in the View of the object, in the parameter
179
244
180
245
<img src=./UVProjection.png alt="UV Projection">
181
246
247
+ By default, the cubic is mode is selected, which is suitable for most situations.
248
+
182
249
183
250
## Writing Material card for rendering <a name =" parameters " ></a >
184
251
In [ Step #1 ] ( #step-1-create-a-material-in-your-document ) above, you have imported a
0 commit comments