Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions Models/ProjectConfigJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,38 @@ internal class AssetDirectories
public string EnvironmentMapDirectory { get; set; } = "$(workingSpace)/Assets/EnvironmentMaps";
}

internal class SkyDefaults
{
[JsonPropertyName("mode")]
public string Mode { get; set; } = "atmosphere";

[JsonPropertyName("environmentMap")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public Guid? EnvironmentMap { get; set; }

[JsonPropertyName("environmentIntensity")]
public float EnvironmentIntensity { get; set; } = 1.0f;

[JsonPropertyName("environmentTint")]
public float[] EnvironmentTint { get; set; } = new[] { 1.0f, 1.0f, 1.0f, 1.0f };

[JsonPropertyName("environmentYawRadians")]
public float EnvironmentYawRadians { get; set; } = 0.0f;
}

internal class RenderingSettings
{
[JsonPropertyName("environment_lighting_quality")]
public string EnvironmentLightingQuality { get; set; } = "standard";

[JsonPropertyName("environment_lighting_budget_mb")]
public int EnvironmentLightingBudgetMb { get; set; } = 384;

// Preserve other rendering policies when a configuration is round-tripped.
[JsonExtensionData]
public Dictionary<string, JsonElement>? AdditionalProperties { get; set; }
}

internal class ProjectConfigJson
{
[JsonPropertyName("projectName")]
Expand All @@ -60,6 +92,12 @@ internal class ProjectConfigJson
[JsonPropertyName("sceneList")]
public IList<Scene> Scenes { get; set; } = new List<Scene> { new Scene() };

[JsonPropertyName("skyDefaults")]
public SkyDefaults SkyDefaults { get; set; } = new();

[JsonPropertyName("rendering")]
public RenderingSettings Rendering { get; set; } = new();

public string ToJson() => JsonSerializer.Serialize(this, new JsonSerializerOptions { WriteIndented = true });
}
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ See [Contributing.md](Contributing.md) for commit conventions, branch rules, and

For local development with a custom engine build, see [docs/local-engine-path.md](docs/local-engine-path.md).

For generated sky defaults and environment-lighting settings, see [docs/project-configuration.md](docs/project-configuration.md).

---

## License
Expand Down
60 changes: 60 additions & 0 deletions docs/project-configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Project configuration

Panzerfaust writes `projectConfig.json` when creating a project. This is the
project configuration passed to Obelisk; engine documentation and issue reports
may also call this file `project.json`.

New projects include these defaults alongside their asset directories and scenes:

```json
{
"skyDefaults": {
"mode": "atmosphere",
"environmentIntensity": 1,
"environmentTint": [1, 1, 1, 1],
"environmentYawRadians": 0
},
"rendering": {
"environment_lighting_quality": "standard",
"environment_lighting_budget_mb": 384
}
}
```

## Sky defaults

`skyDefaults` supplies authoring defaults for newly created or reset scenes.
Saved scenes retain their own `SkyConfig`. Supported modes are `atmosphere`,
`hdri`, and `skySphere`. The generated atmosphere uses the engine's default
atmosphere settings.

Environment intensity is a nonnegative multiplier. Tint contains four
nonnegative RGBA components; white preserves the original colors. Yaw is a
rotation in radians. The generated values match the engine's validated defaults.

`environmentMap` is optional and omitted by default. When configuring an HDRI,
set it to the imported environment asset's UUID string, rather than a file path.
Generated IBL cache paths, renderer handles, and viewport state do not belong in
this section.

## Environment lighting

`rendering.environment_lighting_quality` controls environment-lighting bake
quality. The accepted tiers are:

| Tier | Intended use |
|---|---|
| `low` | Lower-cost previews or constrained hardware; smaller lighting maps and fewer samples. |
| `standard` | Default balance between lighting quality and bake cost. |
| `high` | Higher-quality lighting with larger maps and more samples. |

`rendering.environment_lighting_budget_mb` is a positive integer number of MiB.
The default is `384`. It caps persistent environment textures, independently of
the quality tier; it is neither a CPU memory budget nor a total GPU memory limit.

Existing projects require no migration. Missing or invalid lighting settings
fall back to `standard` and `384` in the engine. The editor also accepts the
legacy `sky` section. Panzerfaust creates only new project configurations and
does not rewrite existing configurations to add these defaults. Renaming a
project preserves its other configuration properties, including rendering
settings and legacy sky data.
Loading