Skip to content

Commit

Permalink
Doc: Update for all devs
Browse files Browse the repository at this point in the history
  • Loading branch information
mwestphal committed Sep 2, 2024
1 parent 5f3e43d commit 0555a6e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 26 deletions.
3 changes: 2 additions & 1 deletion doc/libf3d/OPTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ model.material.roughness|double<br>0.3<br>render|Set the *roughness coefficient*
model.material.texture|string<br>-<br>render|Path to a texture file that sets the Occlusion, Roughness and Metallic values of the object. Multiplied with the `model.material.roughness` and `model.material.metallic`, set both of them to 1.0 to get a true result.|\-\-texture-material
model.normal.scale|double<br>1.0<br>render|Normal scale affects the strength of the normal deviation from the normal texture.|\-\-normal-scale
model.normal.texture|string<br>-<br>render|Path to a texture file that sets the normal map of the object.|\-\-texture-normal
model.scivis.enable|bool<br>false<br>render|*Color by an array* present in on the data. If `model.scivis.array_name` is set to <empty>, the first available array will be used.|\-\-scalar-coloring
model.scivis.cells|bool<br>false<br>render|Color the data with value found *on the cells* instead of points|\-\-cells
model.scivis.colormap|vector\<double\><br>\<inferno\><br>render|Set a *custom colormap for the coloring*.<br>This is a list of colors in the format `val1,red1,green1,blue1,...,valN,redN,greenN,blueN`<br>where all values are in the range (0,1).|\-\-colormap
model.scivis.component|int<br>-1<br>render|Specify the component to color with. -1 means *magnitude*. -2 means *direct values*.|\-\-comp
model.scivis.array_name|string<br>\<reserved\><br>render|*Color by a specific data array* present in on the data. Set to <empty> to let libf3d find the first available array.|\-\-scalars
model.scivis.array_name|string<br>-<br>render|Select the name of the array to color with.|\-\-coloring-array
model.scivis.range|vector\<double\><br>-<br>render|Set a *custom range for the coloring*.|\-\-range
model.point_sprites.enable|bool<br>false<br>render|Show sphere *points sprites* instead of the geometry.|\-\-point-sprites
model.point_sprites.type|string<br>sphere<br>render|Set the sprites type when showing point sprites (can be `sphere` or `gaussian`).|\-\-point-type
Expand Down
33 changes: 15 additions & 18 deletions doc/user/CONFIGURATION_FILE.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
# Configuration File

Almost all the command-line options can be controlled using configuration files.
Almost all the command-line [options](OPTIONS.md) can be controlled using configuration files.
Configuration files uses the "long" version of the command-line options in a JSON
formatted file to provide values for these options.
formatted file to provide values for these options. It is also possible to use
the [libf3d options](../libf3d/OPTIONS.md) syntax.

These options can be organized by block using a regular expression for each block
in order to provide different default values for the different filetypes.

A special block, named `global`, will apply to all files.
Using a command-line option will override the corresponding value in the config file.
Using a command-line option will override similar option set in any config files.

The `global` block and command-line options are only taken into account on the first load
and not on subsequent loads, when switching between files.
The regular expression blocks are always taken into account, even when loading further files.
Please note the regular expressions are not case-sensitive.
Some options are only taken into account on the first load and not on subsequent loads,
when switching between files.

A typical config file may look like this:

```javascript
{
"global": {
".*": {
"bg-color": "0.7,0.7,0.7",
"color": "0.5,0.1,0.1",
"anti-aliasing": true,
Expand All @@ -29,7 +27,7 @@ A typical config file may look like this:
"bar": true,
"roughness": 0.2,
"grid": true,
"scalars": true
"scalar-coloring": true
},
".*vt.": {
"edges": true
Expand All @@ -44,23 +42,23 @@ A typical config file may look like this:
}
}
```
Here, the first block defines a basic global configuration with many desired options for all files.
Here, the first block defines a basic configuration with many desired options for all files.
The second block specifies that all files ending with vt., eg: vtk, vtp, vtu, ... will be shown with edges visibility turned on.
The third block specifies raytracing usage for .gltf and .glb files.
The last block specifies that volume rendering should be used with .mhd files.

Single .json file for configuration is supported, as well a config directory containing multiple .json config files.
In the case of config directory, .json file are read in alphabetical order and an option in a block can be overridden
by the same option being set in the same block in another .json file read after.
by the same option being set in another block in another .json file read after.

F3D provides a default config directory for generic usage (`config.d`) and a thumbnail specific config directory (`thumbnail.d`).
You can edit the file contained in these directory or copy then into specific locations (see below) in order to customize F3D behavior.
You can edit the file contained in these directory or add your own in specific directories (see below).

The following command-line options <b> cannot </b> be set via config file:
`help`, `version`, `readers-list`, `config`, `dry-run`.
`help`, `version`, `readers-list`, `config`, `dry-run` and `input`.

The following command-line options <b>can only</b> be set in the global block of the config file:
`no-render`, `inputs`, `output`, `verbose`, `resolution`, `position` and all testing options.
The following command-line options <b>are only taken on the first load</b>:
`no-render`, `output`, and all testing options.

Boolean options that have been turned on in the configuration file can be turned
off on the command line if needed, eg: `--point-sprites=false`.
Expand All @@ -80,5 +78,4 @@ On Linux, they will be installed in `[install_dir]/share/f3d/configs/`, on Windo
Please note there is a command line option to control the configuration file to read. Using it, one can specify an absolute/relative path for the configuration path, but also
only the filename or filestem (`.json` and `.d` will be added) to look for in the locations listed above, , eg: `f3d --config=custom_config` will look
for `custom_config.json` and `custom_config.d` in locations listed above.

Please note <b>only one</b> config file or directory will be found and parsed.
When specifying an absolute/relative path for the configuration file, a single file is read. If not, all files from locations listed above, with the overriding logic specified above.
4 changes: 1 addition & 3 deletions doc/user/INTERACTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ Other hotkeys are available:
* <kbd>F12</kbd>: take a screenshot, ie. render the current view to an image file.
* <kbd>F11</kbd>: take a "minimal" screenshot, ie. render the current view with no grid and no overlays to an image file with a transparent background.

When loading another file or reloading, options that have been changed interactively are kept but can be overridden
if a dedicated regular expression block in the configuration file is present, see the [configuration file](CONFIGURATION_FILE.md)
documentation for more info.
When loading another file or reloading, options that have been changed interactively are kept as is.

## Cycling Coloring

Expand Down
8 changes: 4 additions & 4 deletions doc/user/OPTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ F3D behavior can be fully controlled from the command line using the following o

Options|Default|Description
------|------|------
\-\-input=\<input file\>||The input file or files to read, can also be provided as a positional argument.
\-\-output=\<png file\>||Instead of showing a render view and render into it, *render directly into a png file*. When used with \-\-ref option, only outputs on failure. If `-` is specified instead of a filename, the PNG file is streamed to the stdout. Can use [template variables](#filename-templating).
\-\-no-background||Use with \-\-output to output a png file with a transparent background.
-h, \-\-help||Print *help* and exit. Ignore `--verbose`.
Expand Down Expand Up @@ -85,7 +86,8 @@ Options|Default|Description

Options|Default|Description
------|------|------
-s, \-\-scalars=\<array_name\>||Specify an array to *Color* with if present in the file. If no array_name is provided, the first in alphabetical order will be picked if any are available. <br>Requires a default scene.<br>Use \-\-verbose to recover the usable array names.
-s, \-\-scalar-coloring||Enable scalar coloring if present in the file. If no `--coloring-array` is provided, the first in alphabetical order will be picked if any are available. <br>Requires a default scene.
\-\-coloring-array=\<array_name\>||The coloring array name to use when coloring.<br>Use \-\-verbose to recover the usable array names.
-y, \-\-comp=\<comp_index\>|-1|Specify the *component from the scalar* array to color with.<br>Use with the scalar option. -1 means *magnitude*. -2 or the short option, -y, means *direct values*.<br>When using *direct values*, components are used as L, LA, RGB, RGBA values depending on the number of components.
-c, \-\-cells||Specify that the scalar array is to be found *on the cells* instead of on the points.<br>Use with the scalar option.
\-\-range=\<min,max\>||Set a *custom range for the coloring* by the array.<br>Use with the scalar option.
Expand Down Expand Up @@ -146,8 +148,7 @@ Some rendering options are not compatible between them, here is the precedence o

## Options syntax

The `--options=value` syntax is used everywhere in this documentation, however, the syntax `--options value` can also be used, with the exception of options that have implicit values,
`--verbose`, `--comp` and `--scalars`.
As documented, only the `--options=value` syntax is supported. The syntax `--options value` is not supported.

## Filename templating

Expand All @@ -167,4 +168,3 @@ The destination filename used by `--output` or to save screenshots can use the f

For example the screenshot filename is configured as `{app}/{model}_{n}.png` by default, meaning that, assuming the model `hello.glb` is being viewed,
consecutive screenshots are going to be saved as `F3D/hello_1.png`, `F3D/hello_2.png`, `F3D/hello_3.png`, ...

0 comments on commit 0555a6e

Please sign in to comment.