# How to Configure Camera and Viewport Settings in ArmorPaint: Complete Technical Guide

> Master ArmorPaint camera and viewport settings. Learn to adjust FOV, camera type, and navigation speeds by editing the global g_config object and config.json. Optimize your 3D painting workflow.

- Repository: [Armory 3D/armorpaint](https://github.com/armory3d/armorpaint)
- Tags: how-to-guide
- Published: 2026-09-11

---

**ArmorPaint stores all viewport and camera parameters in the global `g_config` object, loading them from [`config.json`](https://github.com/armory3d/armorpaint/blob/main/config.json) at startup and applying them through functions in [`viewport.c`](https://github.com/armory3d/armorpaint/blob/main/viewport.c) where UI controls, shortcuts, and scripts can modify values like FOV, camera type, and navigation speeds in real time.**

ArmorPaint provides deep configurability for its 3D viewport and camera behavior through a centralized configuration system. Whether you need to adjust projection modes for precise texture painting or modify navigation speeds for ergonomic workflows, understanding how to configure camera and viewport settings in ArmorPaint allows you to customize the application at both the user interface and source code levels.

## Understanding the Configuration Architecture

The configuration system relies on a global state object that bridges persistent storage and runtime application.

### The Global Config Object (`g_config`)

All camera and viewport parameters reside in the global **`g_config`** structure defined in [`paint/sources/config.c`](https://github.com/armory3d/armorpaint/blob/main/paint/sources/config.c). This object acts as the single source of truth for settings including `camera_fov`, `camera_pan_speed`, `camera_zoom_speed`, `camera_rotation_speed`, and `camera_upside_down`. When the application initializes, `config_load()` parses [`config.json`](https://github.com/armory3d/armorpaint/blob/main/config.json) and populates this structure with user-defined values or sensible defaults.

### Persistence Layer ([`config.json`](https://github.com/armory3d/armorpaint/blob/main/config.json))

Settings survive between sessions through JSON serialization. The `config_save()` function (located in [`paint/sources/config.c`](https://github.com/armory3d/armorpaint/blob/main/paint/sources/config.c) at lines 89-93) writes the current state of `g_config` back to disk, encoding floats via `json_encode_f32()` for parameters like `"camera_fov"`. This ensures that custom viewport configurations remain intact across application restarts.

## Camera Type and Projection Settings

ArmorPaint supports both perspective and orthographic projections, with distinct configuration paths for each.

### Switching Between Perspective and Orthographic

The active camera type is stored in `g_context->camera_type`, which accepts either `CAMERA_TYPE_PERSPECTIVE` or `CAMERA_TYPE_ORTHOGRAPHIC`. When users trigger the view toggle shortcut (handled in [`paint/sources/util/util_shortcut.c`](https://github.com/armory3d/armorpaint/blob/main/paint/sources/util/util_shortcut.c) at lines 303-305), the system calls `viewport_update_camera_type()` in [`paint/sources/viewport.c`](https://github.com/armory3d/armorpaint/blob/main/paint/sources/viewport.c). This function swaps the projection matrix and immediately updates the viewport UI to reflect the change.

You can also toggle programmatically using MiniC scripts:

```c
// Toggle camera type via embedded scripting
g_context->camera_type = (g_context->camera_type == CAMERA_TYPE_PERSPECTIVE) ?
                         CAMERA_TYPE_ORTHOGRAPHIC : CAMERA_TYPE_PERSPECTIVE;
viewport_update_camera_type(g_context->camera_type);

```

### Field of View (FOV) Configuration

The default field of view persists in `g_config->camera_fov` and clamps between 0.3 and 1.4 radians. During viewport initialization (lines 24-33 of [`paint/sources/viewport.c`](https://github.com/armory3d/armorpaint/blob/main/paint/sources/viewport.c)), the system applies this value:

```c
// From viewport.c - applying configuration to active camera
cam->data->fov = g_config->camera_fov;
camera_object_build_proj();

```

The Preferences panel exposes this through a slider defined in [`paint/sources/ui/box_preferences.c`](https://github.com/armory3d/armorpaint/blob/main/paint/sources/ui/box_preferences.c) (lines 456-457), allowing real-time adjustments without restarting the application.

## Navigation and Viewport Controls

Beyond projection matrices, ArmorPaint allows granular control over how users navigate the 3D space.

### Pan, Zoom, and Rotation Speed

Three distinct speed modifiers control viewport navigation sensitivity:
- **`g_config->camera_pan_speed`** – Multiplies mouse deltas during middle-click dragging
- **`g_config->camera_zoom_speed`** – Scales scroll wheel or gesture inputs
- **`g_config->camera_rotation_speed`** – Adjusts orbit sensitivity around the model

These values are consumed by camera control functions in [`paint/sources/viewport.c`](https://github.com/armory3d/armorpaint/blob/main/paint/sources/viewport.c) such as `camera_zoom()` and `camera_rotate()`. Modify them programmatically to suit specific hardware or user preferences:

```c
// Increase pan speed for tablet users
g_config->camera_pan_speed = 2.0f;
// Changes take effect immediately on next mouse interaction

```

### Inverted Controls and Zoom Direction

For users requiring inverted navigation, **`g_config->camera_upside_down`** inverts the Y-axis interpretation during mouse movement calculations in [`viewport.c`](https://github.com/armory3d/armorpaint/blob/main/viewport.c). Similarly, **`g_config->zoom_direction`** multiplies the zoom delta, allowing reversal of the standard scroll wheel behavior. Both settings serialize to [`config.json`](https://github.com/armory3d/armorpaint/blob/main/config.json) via the standard save mechanism.

## Runtime Modification Methods

ArmorPaint exposes camera and viewport configuration through three distinct interfaces, each targeting different workflow requirements.

### UI Controls and Preferences Panel

The primary method for adjusting settings involves the Preferences viewport panel implemented in [`paint/sources/ui/box_preferences.c`](https://github.com/armory3d/armorpaint/blob/main/paint/sources/ui/box_preferences.c). This interface provides sliders for FOV and navigation speeds that write directly to `g_config`:

```c
// UI slider binding from box_preferences.c
ui_slider(&g_config->camera_fov, tr("Default Camera FoV"),
          0.3f, 1.4f, true, 100.0f, true, UI_ALIGN_RIGHT, true);

```

Changes propagate immediately because [`viewport.c`](https://github.com/armory3d/armorpaint/blob/main/viewport.c) reads from `g_config` during each frame's camera update cycle.

### Keyboard Shortcuts

Direct shortcuts handle common toggles without menu navigation. The camera type toggle resides in [`paint/sources/util/util_shortcut.c`](https://github.com/armory3d/armorpaint/blob/main/paint/sources/util/util_shortcut.c), mapping keyboard inputs to context switches. These shortcuts bypass the UI layer and modify `g_context->camera_type` directly before invoking viewport updates.

### Scripting with MiniC

For automated workflows or custom tools, ArmorPaint's embedded MiniC scripting API exposes the same configuration fields that the UI manipulates. Scripts can override settings temporarily for render captures or batch operations:

```c
// Script-based FOV adjustment for render preview
g_config->camera_fov = 0.5f;  // Narrow FOV for detail work
// Perform operations...
config_save();  // Persist if desired

```

This approach mirrors the internal logic found in [`util_shortcut.c`](https://github.com/armory3d/armorpaint/blob/main/util_shortcut.c) while allowing programmatic batching of configuration changes.

## Persisting Custom Configurations

To ensure configuration changes survive application restarts, explicitly invoke the save mechanism after modifications:

```c
// Save current g_config state to config.json
config_save();

```

This function (located in [`paint/sources/config.c`](https://github.com/armory3d/armorpaint/blob/main/paint/sources/config.c)) encodes all camera and viewport parameters into JSON format. The system typically calls this automatically on graceful exit, but manual invocation guarantees persistence during long sessions or after scripting changes.

## Summary

- **ArmorPaint** centralizes camera and viewport settings in the global `g_config` object, distinct from the runtime `g_context` state that tracks active camera type.
- **Configuration persistence** relies on [`config.json`](https://github.com/armory3d/armorpaint/blob/main/config.json), parsed by `config_load()` and written by `config_save()` in [`paint/sources/config.c`](https://github.com/armory3d/armorpaint/blob/main/paint/sources/config.c).
- **Projection settings** including FOV and camera type apply through [`viewport.c`](https://github.com/armory3d/armorpaint/blob/main/viewport.c), specifically via `viewport_update_camera_type()` and direct camera object manipulation.
- **Navigation behavior**—pan, zoom, and rotation speeds—scales according to `g_config` values consumed by input handlers in the viewport system.
- **Three interfaces** control these settings: the Preferences UI ([`box_preferences.c`](https://github.com/armory3d/armorpaint/blob/main/box_preferences.c)), keyboard shortcuts ([`util_shortcut.c`](https://github.com/armory3d/armorpaint/blob/main/util_shortcut.c)), and MiniC scripting exposing the same underlying C structures.

## Frequently Asked Questions

### How do I reset the camera to default settings in ArmorPaint?

ArmorPaint applies default values when [`config.json`](https://github.com/armory3d/armorpaint/blob/main/config.json) cannot be found or parsed. To force a reset, close the application, delete the [`config.json`](https://github.com/armory3d/armorpaint/blob/main/config.json) file from your ArmorPaint directory, and restart. The `config_load()` function in [`paint/sources/config.c`](https://github.com/armory3d/armorpaint/blob/main/paint/sources/config.c) will regenerate the file with factory defaults for all camera and viewport parameters.

### Can I switch to orthographic view for precise pixel alignment?

Yes, toggle between perspective and orthographic projection using the camera type shortcut defined in [`paint/sources/util/util_shortcut.c`](https://github.com/armory3d/armorpaint/blob/main/paint/sources/util/util_shortcut.c), or set `g_context->camera_type = CAMERA_TYPE_ORTHOGRAPHIC` via MiniC script. The `viewport_update_camera_type()` function in [`paint/sources/viewport.c`](https://github.com/armory3d/armorpaint/blob/main/paint/sources/viewport.c) handles the matrix recalculation and UI updates automatically.

### Where does ArmorPaint store my custom FOV and speed settings?

All custom values persist in the [`config.json`](https://github.com/armory3d/armorpaint/blob/main/config.json) file in your application directory. The `config_save()` function writes fields like `camera_fov`, `camera_pan_speed`, and `zoom_direction` using `json_encode_f32()` and related serialization functions found in [`paint/sources/config.c`](https://github.com/armory3d/armorpaint/blob/main/paint/sources/config.c).

### Is it possible to script camera movements for automated rendering?

The embedded MiniC scripting environment exposes the complete `g_config` and `g_context` structures, allowing scripts to modify `camera_fov`, camera type, and navigation speeds before triggering renders. After adjustments, call `config_save()` to persist the configuration or allow the values to reset on next launch depending on your workflow requirements.