diff --git a/Models/ProjectConfigJson.cs b/Models/ProjectConfigJson.cs index 9cb93d7..3b61e3a 100644 --- a/Models/ProjectConfigJson.cs +++ b/Models/ProjectConfigJson.cs @@ -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? AdditionalProperties { get; set; } + } + internal class ProjectConfigJson { [JsonPropertyName("projectName")] @@ -60,6 +92,12 @@ internal class ProjectConfigJson [JsonPropertyName("sceneList")] public IList Scenes { get; set; } = new List { 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 }); } } diff --git a/README.md b/README.md index f130542..f00ff1e 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docs/project-configuration.md b/docs/project-configuration.md new file mode 100644 index 0000000..3c97251 --- /dev/null +++ b/docs/project-configuration.md @@ -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.