Skip to content

Commit 1309ff6

Browse files
committed
Texture: rewrite documentation
1 parent 6a94457 commit 1309ff6

File tree

3 files changed

+96
-22
lines changed

3 files changed

+96
-22
lines changed

README.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ Raytracing:
2222
facilitate the addition of new engines. The Render Workbench already supports several more
2323
renderers than Raytracing Workbench, like Appleseed, LuxCoreRender and Cycles.
2424
* The Render Workbench provides enhanced features, compared to Raytracing:
25-
scene lighting, camera enhanced control, material support etc.
25+
- various scene lighting features (point lights, area lights, sunsky etc.)
26+
and preconfigured lightings as templates
27+
- camera enhanced control
28+
- material support
29+
- texture support
30+
- renderers' advanced features handling: denoising, batch mode
31+
etc.
2632

2733
## Supported rendering engines
2834

@@ -94,6 +100,7 @@ Optionally, you may tweak some particulars of your scene:
94100
* Add [lights](./docs/Lights.md) to your scene
95101
* Add extra [cameras](./docs/Cameras.md)
96102
* Add [materials](./docs/Materials.md) to your objects
103+
* Add [textures](./docs/Materials.md##textures) to your materials
97104

98105
These adjustments should take place between steps 2 and 3.
99106

docs/Materials.md

+88-21
Original file line numberDiff line numberDiff line change
@@ -133,42 +133,107 @@ should be used only when standard material is not sufficient.
133133

134134
## Textures
135135

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:
139171

140172
<img src=./material_texture.png alt="MaterialTexture">
141173

174+
It contains:
175+
- an Image field
176+
- and mapping informations: rotation, scale, translation (in 2D)
142177

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.
148184

185+
You should obtain something like that:
149186

150187
<img src=./manyimages_texture.png alt="ManyimagesTexture">
151188

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...).
153209

210+
211+
212+
#### Step 3: Connect
154213
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:
158219

159220
<img src=./textures.png alt="TextureSettings">
160221

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
167234
textures may affect file size!
168-
- Normal maps are expected to follow OpenGL convention (not DirectX)
169235

170-
171-
## UV mapping
236+
### UV mapping
172237
To correctly position the texture on the object, Render WB generates a UV
173238
mapping. Three modes are available:
174239
- Cubic
@@ -179,6 +244,8 @@ Those modes are accessible in the View of the object, in the parameter
179244

180245
<img src=./UVProjection.png alt="UV Projection">
181246

247+
By default, the cubic is mode is selected, which is suitable for most situations.
248+
182249

183250
## Writing Material card for rendering <a name="parameters"></a>
184251
In [Step #1](#step-1-create-a-material-in-your-document) above, you have imported a

docs/fileset_texture.png

15 KB
Loading

0 commit comments

Comments
 (0)