diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index af23b7a0..69f76c83 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -21,8 +21,8 @@ licensed and keep their license file next to them. | `docs/images/texturecraft-export.png` | README screenshot: the Export textures dialog | TextureCraft contributors | original screenshot of TextureCraft | MIT OR Apache-2.0 | | `docs/images/texturecraft-rendering.png` | README screenshot: Rendering mode, path traced on the GPU | TextureCraft contributors | original screenshot of TextureCraft | MIT OR Apache-2.0 | | `docs/images/texturecraft-light.png` | README screenshot: the light brightness level with the blue accent | TextureCraft contributors | original screenshot of TextureCraft | MIT OR Apache-2.0 | -| `docs/images/texturecraft-materials.png` | README render: car paint, velvet and brushed steel on the material ball (`texturecraft-cli render --samples 256`, three renders side by side) | TextureCraft contributors | original render | MIT OR Apache-2.0 | -| `docs/images/texturecraft-crate.png` | README render: the built-in crate with chipped paint on wood, rusted iron and tarnished brass smart materials (`texturecraft-cli render --samples 512`, cropped) | TextureCraft contributors | original render by TextureCraft | MIT OR Apache-2.0 | +| `docs/images/texturecraft-lantern.png` | README render: a storm lantern (original procedural mesh of lathes and swept wires, eight texture sets) in chipped red enamel, rust, soot, tarnished brass and glass with an emissive flame (`texturecraft-cli render --camera Hero --samples 2048`, 1200×900) | TextureCraft contributors | original model and render by TextureCraft | MIT OR Apache-2.0 | +| `docs/images/texturecraft-camera.png` | README render: a rangefinder camera (original procedural mesh) in black enamel worn to brass, leatherette, chrome and coated glass; the lens distance scale is an original image drawn in code (`texturecraft-cli render --camera Hero --samples 2048`, 1200×900) | TextureCraft contributors | original model and render by TextureCraft | MIT OR Apache-2.0 | | `docs/brand/artcraft-*.svg`, `docs/brand/artcraft-*.png` | ArtCraft logo and mark | ArtCraft Team | storytold/craftrules `assets/brand/` | ArtCraft brand terms, not open source ([`docs/brand/LICENSE-brand.txt`](docs/brand/LICENSE-brand.txt)) | ## Third-party assets compiled into the binary diff --git a/README.md b/README.md index 2e95eff3..aa0ac09e 100644 --- a/README.md +++ b/README.md @@ -95,18 +95,19 @@ ## Made in TextureCraft -Both pieces below were textured with TextureCraft's procedural materials and smart materials (no -textures or models from anywhere else) and path traced on the GPU by `texturecraft-cli render`. +Two original props, modelled procedurally by contributors, textured layer by layer with TextureCraft's +own materials, masks and mesh-map generators (no textures or models from anywhere else) and path +traced on the GPU by `texturecraft-cli render`.
- A path-traced crate: teal paint chipping off wooden planks, a rusted iron lid and a tarnished brass handle -

Crate: chipped paint on wood, rusted iron and tarnished brass smart materials, one per texture set

+ A path-traced storm lantern on a dark stage: red enamel chipped to bare steel on the edges, rust and grime in the seams, a cream pinstripe, a tarnished brass burner and knob, rusty guard wires and a glowing flame behind the glass globe +

Storm lantern: chipped enamel, rust, soot and a lit flame over eight texture sets

- Three path-traced material balls: glossy red car paint with a clear coat, purple velvet with sheen, and brushed steel with anisotropic highlights -

Shading lobes: car paint (clear coat), velvet (sheen) and brushed steel (anisotropy)

+ A path-traced vintage rangefinder camera: black enamel worn through to brass on the top plate, cognac leatherette, knurled chrome dials, a black lens barrel with an engraved distance scale and a coated front element +

Rangefinder camera: black paint brassing, leatherette, chrome and coated glass

diff --git a/apps/texturecraft-cli/src/main.rs b/apps/texturecraft-cli/src/main.rs index 21b7235b..bd9845d8 100644 --- a/apps/texturecraft-cli/src/main.rs +++ b/apps/texturecraft-cli/src/main.rs @@ -29,11 +29,11 @@ USAGE: Bake mesh maps for every texture set (a project is saved in place without -o). texturecraft-cli export [--preset ] [--format ] [--padding ] [--size ] Export textures (default preset: Document channels + Normal + AO). - texturecraft-cli render [--size x] [--view 3d|2d] [--yaw ] [--pitch ] - [--samples ] [--bounces ] [--cpu] - Render the viewport to PNG (needs a GPU or software adapter); --samples path traces it - instead (Rendering mode), on the GPU when it has compute shaders, else (or with --cpu) on - the CPU. + texturecraft-cli render [--size x] [--view 3d|2d] [--camera ] [--yaw ] + [--pitch ] [--samples ] [--bounces ] [--cpu] + Render the viewport to PNG (needs a GPU or software adapter); --camera looks through a + camera saved in the project (camera.add); --samples path traces it instead (Rendering + mode), on the GPU when it has compute shaders, else (or with --cpu) on the CPU. texturecraft-cli new > [--resolution ] [--sample] New project; --sample bakes and applies a smart material to every texture set. texturecraft-cli mcp [--bridge ] [--token ] [--read-root ] [--write-root ] @@ -55,7 +55,7 @@ const SUBCOMMANDS: &[(&str, &[&str], &[&str])] = &[ ("batch", &[], &[]), ("bake", &["-o", "--resolution", "--maps"], &[]), ("export", &["--preset", "--format", "--padding", "--size"], &[]), - ("render", &["--size", "--view", "--yaw", "--pitch", "--samples", "--bounces"], &["--cpu"]), + ("render", &["--size", "--view", "--camera", "--yaw", "--pitch", "--samples", "--bounces"], &["--cpu"]), ("new", &["--resolution"], &["--sample"]), ("mcp", &["--bridge", "--token", "--read-root", "--write-root"], &[]), ("serve", &["--port", "--read-root", "--write-root"], &[]), @@ -336,6 +336,9 @@ fn render(a: &Args) -> R { cpu: a.has("--cpu"), }; let mut h = open(input, None)?; + if let Some(name) = a.get("--camera") { + h.command_run("camera.select", json!({ "name": name })).map_err(s)?; + } let t0 = std::time::Instant::now(); let r = h.render_png(&o).map_err(s)?; let secs = t0.elapsed().as_secs_f64(); diff --git a/apps/texturecraft-cli/tests/cli.rs b/apps/texturecraft-cli/tests/cli.rs index 2a0b3dce..254eabb4 100644 --- a/apps/texturecraft-cli/tests/cli.rs +++ b/apps/texturecraft-cli/tests/cli.rs @@ -128,6 +128,12 @@ fn path_traced_render_needs_no_gpu() { let lum = |x, y| img.get_pixel(x, y).0.iter().map(|v| *v as u32).sum::(); assert!(lum(48, 28) > lum(1, 1) + 60); } + // --camera looks through a camera saved in the project; an unknown name is an error. + let proj = d.join("cams.tcraft"); + ok(&["run", "builtin:cube", "camera.set", r#"{"yaw": 80, "distance": 9}"#, "-o", p(&proj)]); + ok(&["run", p(&proj), "camera.add", r#"{"name": "Side"}"#, "-o", p(&proj)]); + ok(&["render", p(&proj), p(&out), "--size", "48x32", "--camera", "Side", "--samples", "2", "--cpu"]); + assert_eq!(cli(&["render", p(&proj), p(&out), "--camera", "Nope", "--samples", "2", "--cpu"]).status.code(), Some(1)); assert_eq!(cli(&["render", "builtin:cube", p(&out), "--samples", "0"]).status.code(), Some(1)); assert_eq!(cli(&["render", "builtin:cube", p(&out), "--samples", "4", "--view", "2d"]).status.code(), Some(1)); let _ = std::fs::remove_dir_all(&d); diff --git a/docs/control-protocol.md b/docs/control-protocol.md index 56b2155b..9a6e0c19 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -217,6 +217,7 @@ texturecraft-cli batch script.json texturecraft-cli bake model.tcraft --resolution 2048 --maps ambientOcclusion,curvature,thickness texturecraft-cli export model.tcraft out/ --preset "Unreal Engine (Packed)" --format png --size 2048 texturecraft-cli render ball.tcraft ball.png --size 1280x800 --view 3d --yaw 30 --pitch 15 +texturecraft-cli render scene.tcraft hero.png --size 1200x900 --camera Hero --samples 2048 # a saved camera (camera.add), path traced ``` `` is a `.tcraft` project, a mesh file or `builtin:`. A batch script is a list of diff --git a/docs/images/texturecraft-camera.png b/docs/images/texturecraft-camera.png new file mode 100644 index 00000000..4420ee1c Binary files /dev/null and b/docs/images/texturecraft-camera.png differ diff --git a/docs/images/texturecraft-crate.png b/docs/images/texturecraft-crate.png deleted file mode 100644 index 0e7f4c5c..00000000 Binary files a/docs/images/texturecraft-crate.png and /dev/null differ diff --git a/docs/images/texturecraft-lantern.png b/docs/images/texturecraft-lantern.png new file mode 100644 index 00000000..aba26219 Binary files /dev/null and b/docs/images/texturecraft-lantern.png differ diff --git a/docs/images/texturecraft-materials.png b/docs/images/texturecraft-materials.png deleted file mode 100644 index 10c075e1..00000000 Binary files a/docs/images/texturecraft-materials.png and /dev/null differ