dotCooCoo
bb5a3d472b
craft-pbr: metallic-roughness BRDF, environment BRDF and default environment from EffectCraft
...
Adds the direct-light BRDF, the split-sum environment BRDF and the
default studio environment of EffectCraft's adv/shade.rs and
adv/scene.rs to craft-pbr, with EffectCraft's tests on the new API.
- Material::try_new and try_with_weights check base color, metallic,
roughness and the specular and diffuse weights; NaN, infinity and
values out of range give PbrError::BadMaterial. try_direct checks and
normalizes its directions (PbrError::BadDirection).
- The BRDF is the final form of glTF 2.0 section B.3.5 with Schlick's
Fresnel and the GGX distribution of ggx_distribution, evaluated in
f64. The geometry term stays the Smith-Schlick term with
k = (roughness + 1)^2 / 8 for analytic lights; it equals glTF's
separable Smith term at roughness 1.
- Roughness is shaded as at least 0.032 instead of 0.03, above the
alpha floor of ggx_distribution. A view straight opposite the light
gives 0.
- try_environment_brdf keeps scale and bias at least 0 with a sum of at
most 1. The fit gave a scale of -0.044 and a bias of 1.044 at n.v = 0
and roughness 0, and a bias of -0.0024 at n.v = 0 and roughness 1.
- default_environment returns the 8 x 4 studio gradient in this crate's
frame; its pixels match EffectCraft's within 1e-6.
New tests: a white metal reflects at most the light it receives at every
roughness and view angle, the BRDF is reciprocal, roughness is clamped
at MIN_DIRECT_ROUGHNESS, metallic 0 and 1 match glTF's dielectric and
metal BRDFs, the geometry term against glTF's Smith form, invalid
values are refused, and the direct light, environment BRDF and default
environment match a copy of EffectCraft's code.
2026-11-21 08:30:29 -08:00
..
2026-11-16 03:05:05 +01:00
2026-11-11 19:01:12 -05:00
2026-11-16 21:36:17 -05:00
2026-11-16 21:37:13 -05:00
2026-10-23 11:17:51 -04:00
2026-11-19 14:00:33 -05:00
2026-11-11 18:08:00 -05:00
2026-11-16 09:55:13 -05:00
2026-11-19 09:26:19 +01:00
2026-11-19 22:30:27 -05:00
2026-11-14 20:57:04 -05:00
2026-11-19 00:11:54 -05:00
2026-11-20 19:30:33 -05:00
2026-11-12 06:25:55 -05:00
2026-11-16 23:47:58 -05:00
2026-11-17 00:51:58 -05:00
2026-11-20 13:19:20 +07:00
2026-11-11 20:17:35 -05:00
2026-11-16 17:41:25 +01:00
2026-11-19 20:36:43 -05:00
2026-11-20 15:00:40 +01:00
2026-11-15 19:05:00 +00:00
2026-11-12 11:26:10 -05:00
2026-11-01 12:03:49 -05:00
2026-11-18 23:20:42 -05:00
2026-11-13 21:11:56 -05:00
2026-11-19 20:03:14 -05:00
2026-11-15 23:44:31 +01:00
2026-11-17 22:46:28 -05:00
2026-11-19 20:36:43 -05:00
2026-11-18 15:35:02 -05:00
2026-11-18 05:18:38 -05:00
2026-10-28 16:49:37 -04:00
2026-11-07 15:48:07 +01:00
2026-11-19 22:35:42 +01:00
2026-11-14 14:53:16 -05:00
2026-11-17 22:46:28 -05:00
2026-11-20 13:33:59 +07:00
2026-11-16 02:42:09 +01:00
2026-11-20 16:01:18 +01:00
2026-11-16 01:10:44 +01:00
2026-11-19 16:25:57 -05:00
2026-11-03 05:56:54 -08:00
2026-11-16 08:18:20 -05:00
2026-11-14 06:10:27 -05:00
2026-11-11 20:07:35 -05:00
2026-11-17 21:03:40 -05:00
2026-11-17 19:45:22 -05:00
2026-11-11 19:46:19 -05:00
2026-11-18 17:58:04 -05:00
2026-11-16 21:58:20 +01:00
2026-11-14 13:45:31 -05:00
2026-11-13 14:20:19 +00:00
2026-11-11 20:05:20 -05:00
2026-11-19 11:02:50 -08:00
2026-11-19 11:02:50 -08:00
2026-11-12 17:07:23 +01:00
2026-11-20 05:45:58 +01:00
2026-11-16 02:31:10 +01:00
2026-10-27 09:21:01 -04:00
2026-11-12 10:10:35 -05:00
2026-11-20 17:17:41 +00:00
2026-11-16 05:25:45 +01:00
2026-11-16 17:41:25 +01:00
2026-11-11 17:07:37 -05:00
2026-11-11 17:29:14 -05:00
2026-11-18 15:35:02 -05:00
2026-11-14 15:13:21 -05:00
2026-11-18 19:05:00 -06:00
2026-11-18 19:05:00 -06:00
2026-11-18 19:05:00 -06:00
2026-11-18 19:05:00 -06:00
2026-11-16 02:03:41 +01:00
2026-11-15 14:41:14 +00:00
2026-11-17 11:29:30 -05:00
2026-11-16 20:36:13 -05:00
2026-11-16 21:35:56 -05:00
2026-11-20 07:54:59 +01:00
2026-11-19 10:00:32 -05:00
2026-11-14 17:49:47 +01:00
2026-11-11 19:30:23 -05:00
2026-11-19 23:48:59 -05:00
2026-11-20 07:00:55 +01:00
2026-11-13 01:31:26 -05:00
2026-11-16 09:55:22 -05:00
2026-11-19 22:12:41 +01:00
2026-11-17 16:44:09 -05:00
2026-11-11 19:45:03 -05:00
2026-11-18 18:59:59 -05:00
2026-11-17 08:13:52 -05:00
2026-11-16 00:22:34 +01:00
2026-11-19 00:11:50 -05:00
2026-11-16 21:37:09 -05:00
2026-11-11 17:46:14 -05:00
2026-11-14 13:45:31 -05:00
2026-11-20 00:40:38 +00:00
2026-11-16 23:26:35 -05:00
2026-11-16 11:47:05 +01:00
2026-11-16 22:24:56 -05:00
2026-11-15 10:20:02 +00:00
2026-11-20 01:22:46 +00:00
2026-11-18 06:33:33 -05:00
2026-11-15 15:29:27 +00:00
2026-11-19 17:41:52 -05:00
2026-11-21 14:42:45 +07:00
2026-11-16 15:51:32 -05:00
2026-11-17 19:09:17 +00:00
2026-11-03 23:06:04 -05:00
2026-11-21 01:14:47 +07:00
2026-11-16 06:47:48 +01:00
2026-11-16 12:05:10 -08:00
2026-11-20 09:57:10 +07:00
2026-11-15 15:37:41 +00:00
2026-11-20 00:40:38 +00:00
2026-11-16 21:35:45 -05:00
2026-11-11 18:43:46 -05:00
2026-11-16 21:30:17 -05:00
2026-11-13 03:47:36 +00:00
2026-11-14 13:45:31 -05:00
2026-11-16 22:30:28 -05:00
2026-11-21 08:30:29 -08:00
2026-11-17 12:15:24 -05:00
2026-11-14 21:49:09 +08:00
2026-11-15 05:58:40 -05:00
2026-11-20 13:01:27 -05:00
2026-11-12 06:26:30 -05:00
2026-11-16 11:44:25 +01:00
2026-11-16 23:01:56 -05:00
2026-11-19 02:55:14 -05:00
2026-11-13 02:17:30 -05:00
2026-11-12 10:37:13 -05:00
2026-11-16 22:22:29 -05:00
2026-11-19 18:34:11 +07:00
2026-11-20 02:56:26 -05:00
2026-11-19 20:01:09 -05:00
2026-11-16 21:30:13 -05:00
2026-11-17 14:14:36 -05:00
2026-11-16 21:32:22 -05:00
2026-11-17 19:09:17 +00:00
2026-11-20 05:49:52 +01:00
2026-11-15 04:02:49 -05:00
2026-11-20 11:43:22 -05:00
2026-11-21 09:22:30 +07:00
2026-11-16 21:35:49 -05:00
2026-10-25 21:59:22 -04:00
2026-11-18 15:31:45 -05:00
2026-11-20 13:43:32 +07:00
2026-11-16 13:45:33 +01:00
2026-11-20 07:27:17 +01:00
2026-11-19 23:40:51 -05:00
2026-11-16 19:25:08 -05:00
2026-11-16 21:30:28 -05:00
2026-11-16 09:55:13 -05:00
2026-11-11 21:58:16 -05:00
2026-11-18 23:55:20 -05:00
2026-11-16 00:49:25 +01:00
2026-11-11 06:40:49 -05:00
2026-11-11 20:30:38 -05:00
2026-11-15 05:34:46 -05:00
2026-11-16 06:38:32 -05:00
2026-11-17 14:13:02 -05:00
2026-11-20 19:26:17 -05:00
2026-11-16 09:55:17 -05:00
2026-11-13 04:34:44 -05:00
2026-11-13 04:13:55 -05:00
2026-11-21 08:32:16 +07:00
2026-11-17 21:56:16 -06:00
2026-11-20 17:17:41 +00:00
2026-11-11 16:40:42 -05:00
2026-11-17 13:06:31 -05:00
2026-11-15 13:38:46 +00:00
2026-11-18 11:07:00 +07:00
2026-11-16 07:08:34 +01:00
2026-11-18 13:35:40 +07:00
2026-11-16 04:01:03 +01:00
2026-11-16 21:23:24 -05:00
2026-11-13 10:50:15 +00:00
2026-11-16 12:07:35 -05:00
2026-11-17 21:04:35 -05:00
2026-11-19 15:39:12 -08:00
2026-11-19 20:36:34 -05:00
2026-11-11 18:50:38 -05:00
2026-11-15 15:02:41 +00:00
2026-11-17 15:48:26 -05:00
2026-11-19 20:36:39 -05:00
2026-11-17 16:44:09 -05:00
2026-11-12 10:06:13 -05:00
2026-11-12 10:43:32 -05:00
2026-11-15 17:36:53 +00:00
2026-11-12 10:37:27 -05:00
2026-11-20 13:29:45 +07:00
2026-11-12 06:26:24 -05:00
2026-11-18 14:36:07 +07:00
2026-11-19 19:38:35 -05:00
2026-11-16 21:35:57 -05:00
2026-11-16 21:36:11 -05:00
2026-11-20 13:19:14 -05:00
2026-11-16 00:00:18 +01:00
2026-11-16 23:06:56 -05:00
2026-11-11 18:44:44 -05:00
2026-11-20 01:15:20 -05:00