mirror of
https://github.com/storytold/texturecraft.git
synced 2026-11-28 17:19:24 +01:00
Export: Redshift Standard Material (separate maps) template, one map per Standard Material input the texture set has, normals in OpenGL as Redshift expects
Spec: https://help.maxon.net/r3d/maya/en-us/Content/html/Standard_Material.html and https://help.maxon.net/r3d/maya/en-us/Content/html/Bump+Map.html
This commit is contained in:
1 parent
0d1df0580e
commit
498394a11d
4 files changed
+46
-1
No files matched your search
@@ -139,6 +139,7 @@ Built-in presets (each one lists the public specification its packing follows in
|
||||
| USD Preview Surface (separate maps) | one map per UsdPreviewSurface input the set has, named like it: `diffuseColor`, `emissiveColor`, `metallic`, `roughness`, `normal` (OpenGL), `occlusion`, `opacity`, `clearcoat`, `clearcoatRoughness` |
|
||||
| Unreal Engine Subsurface Profile (Packed) | `BaseColor` (no alpha), `OcclusionRoughnessMetallic`, `Normal` (DirectX), `SubsurfaceMask` (scatter weight, for the Opacity input) |
|
||||
| glTF Specular Glossiness (archived extension) | `Diffuse` (A = opacity), `SpecularGlossiness` (RGB specular, A glossiness, from the set's own channels), `Normal` (OpenGL), `Occlusion`, `Emissive` |
|
||||
| Redshift Standard Material (separate maps) | one map per Standard Material input the set has: `BaseColor`, `Metalness`, `ReflectionRoughness`, `Normal` (OpenGL), `EmissionColor`, `Opacity`, `SubsurfaceWeight`, `CoatWeight`, `CoatRoughness`, `SheenWeight`, `SheenColor`, `SheenRoughness` |
|
||||
| Separate maps | one file per channel, gray where scalar, height 16-bit |
|
||||
| Mesh maps | every baked map (`$channel` = map id), 16-bit |
|
||||
|
||||
|
||||
@@ -1806,3 +1806,27 @@ fn the_gltf_specular_glossiness_template_packs_a_specular_glossiness_sets_own_ch
|
||||
let green = pixel(find(&files, "_Normal.png"))[1];
|
||||
assert!((green - open_gl_green).abs() <= 1, "OpenGL normal: green {green}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_redshift_template_writes_one_map_per_input_the_set_has() {
|
||||
let mut channels = default_channels();
|
||||
channels.extend([Channel::ScatterWeight, Channel::CoatWeight]);
|
||||
let mut fx = Fx::new(&channels);
|
||||
fx.set_all(Channel::Roughness, |_, _| [0.4; 3]);
|
||||
fx.set_all(Channel::Metallic, |_, _| [0.8; 3]);
|
||||
fx.set_all(Channel::ScatterWeight, |_, _| [0.7; 3]);
|
||||
fx.set_all(Channel::CoatWeight, |_, _| [0.2; 3]);
|
||||
let open_gl_green = tilt_normals(&mut fx);
|
||||
|
||||
let files = fx.render_preset("Redshift Standard Material (separate maps)");
|
||||
|
||||
let names: Vec<&str> = files.iter().map(|f| f.name.as_str()).collect();
|
||||
for (input, expected) in [("Metalness", 0.8), ("ReflectionRoughness", 0.4), ("SubsurfaceWeight", 0.7), ("CoatWeight", 0.2)] {
|
||||
let file = find(&files, &format!("_{input}.png"));
|
||||
assert_eq!(decode(file).color(), image::ColorType::L8, "{input} is one 8-bit channel: {names:?}");
|
||||
assert_close(pixel(file), [byte(expected), byte(expected), byte(expected), 255], input);
|
||||
}
|
||||
let green = pixel(find(&files, "_Normal.png"))[1];
|
||||
assert!((green - open_gl_green).abs() <= 1, "OpenGL normal: green {green}");
|
||||
assert!(!names.iter().any(|name| name.contains("Sheen") || name.contains("CoatRoughness")), "inputs the set lacks write no maps: {names:?}");
|
||||
}
|
||||
@@ -244,6 +244,26 @@ pub fn builtin_presets() -> Vec<ExportPreset> {
|
||||
map("Emissive", 8, rgb(|k| ch(Channel::Emissive, k))),
|
||||
],
|
||||
),
|
||||
// Spec: https://help.maxon.net/r3d/maya/en-us/Content/html/Standard_Material.html (the Standard Material inputs)
|
||||
// Spec: https://help.maxon.net/r3d/maya/en-us/Content/html/Bump+Map.html (normal maps in OpenGL format)
|
||||
preset("Redshift Standard Material (separate maps)", {
|
||||
let gray8 = |name: &str, c: Channel| map(name, 8, gray(ch(c, 0)));
|
||||
let rgb8 = |name: &str, c: Channel| map(name, 8, rgb(|k| ch(c, k)));
|
||||
vec![
|
||||
rgb8("BaseColor", Channel::BaseColor),
|
||||
gray8("Metalness", Channel::Metallic),
|
||||
gray8("ReflectionRoughness", Channel::Roughness),
|
||||
map("Normal", 8, normal(VirtualMap::NormalOpenGl)),
|
||||
rgb8("EmissionColor", Channel::Emissive),
|
||||
gray8("Opacity", Channel::Opacity),
|
||||
gray8("SubsurfaceWeight", Channel::ScatterWeight),
|
||||
gray8("CoatWeight", Channel::CoatWeight),
|
||||
gray8("CoatRoughness", Channel::CoatRoughness),
|
||||
gray8("SheenWeight", Channel::SheenWeight),
|
||||
rgb8("SheenColor", Channel::SheenColor),
|
||||
gray8("SheenRoughness", Channel::SheenRoughness),
|
||||
]
|
||||
}),
|
||||
preset("Separate maps", Channel::ALL.into_iter().map(channel_map).collect()),
|
||||
preset(
|
||||
"Mesh maps",
|
||||
|
||||
+1
-1
@@ -163,7 +163,7 @@ Everything TextureCraft does today, by area. What's still missing is in [`ROADMA
|
||||
finished; the bake bar follows the newest map, pins a finished one or shows the material.
|
||||
- **Export presets** for glTF PBR Metal Roughness, Unreal Engine (packed), Unity HDRP (mask map),
|
||||
Unity Standard, Unity URP Lit, USD Preview Surface, Blender (Principled BSDF), Godot 4 (ORM), OpenPBR (with the coat, fuzz,
|
||||
anisotropy, transmission and subsurface maps), Unreal Engine (subsurface profile), glTF specular/glossiness (archived extension), separate maps, mesh maps and document channels, in
|
||||
anisotropy, transmission and subsurface maps), Unreal Engine (subsurface profile), glTF specular/glossiness (archived extension), Redshift Standard Material, separate maps, mesh maps and document channels, in
|
||||
PNG, JPEG, JPEG 2000, JNG, PGM, TGA, TIFF, BMP, WEBP, PSD, EXR or HDR at 8 bits (optionally dithered), 16
|
||||
bits or 32-bit float (TIFF, EXR, HDR; 16-bit half float for EXR), with UV padding (dilation,
|
||||
infinite, or dilation + diffusion), size override and OpenGL or DirectX normals.
|
||||
|
||||
Reference in new issue
Block a user