From 116cfa28eb72ac58b2545ad12e639671ae604228 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 20 Nov 2026 14:32:51 +0100 Subject: [PATCH] Look: one studio path, the camera's (lodur:ruling:porcelain-studio-follows-camera) The ruling is camera, so StudioFollowsCamera, the shader's studio_in_view and its world-space branch are deleted: the lights are the camera's children and the glaze reads view-space directions, nothing else. Co-Authored-By: Claude Sonnet 5.5 --- README.md | 2 +- client/Look.cs | 26 ++++++-------------------- client/puppet.gdshader | 1 - client/studio.gdshaderinc | 4 +--- client/tests/Smoke.cs | 2 +- 5 files changed, 9 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 3d49232..3410def 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ Synaptic Induction Chamber, the dummy strapped to a stool with its right hand in input only. Godot's physics engine is set to Dummy; each 120 Hz physics frame the client calls `BodyPainBoxSession.Step()` once and draws Ymir's lanes: one pose-carrying node per stable id, and the body drawn as one skinned SDF mesh (a surface-nets isosurface of the shape lanes, limbs smooth-blended into the body they hang from and -joined by a ball at each joint, built once at startup and rebuilt only when the bodies or joints change; skinned on the CPU every frame by `PuppetSkin`, which derives the facets, creases, vertex normals and altitudes from the skinned surface; flat-shaded, each edge softened by a bevel 2 px wide (`Look.BevelScreen`, at least `Look.BevelMin`, question lodur:question:bds-puppet-bevel-look-width): the fragment shader tilts the facet normal to each edge's bisector and blends corners to the vertex normal). The puppet is glazed porcelain: a bisque lit by a studio (a shadowing key and two rims, `Look.Studio`) that the camera carries (`Look.StudioFollowsCamera`, question lodur:question:bds-porcelain-studio-follows-camera), plus an analytic glaze that reflects the same studio (`client/studio.gdshaderinc`, Fresnel times the studio in the reflected direction, added as emission so it draws the same under gl_compatibility), pooled darker in concave creases. +joined by a ball at each joint, built once at startup and rebuilt only when the bodies or joints change; skinned on the CPU every frame by `PuppetSkin`, which derives the facets, creases, vertex normals and altitudes from the skinned surface; flat-shaded, each edge softened by a bevel 2 px wide (`Look.BevelScreen`, at least `Look.BevelMin`, question lodur:question:bds-puppet-bevel-look-width): the fragment shader tilts the facet normal to each edge's bisector and blends corners to the vertex normal). The puppet is glazed porcelain: a bisque lit by a studio (a shadowing key and two rims, `Look.Studio`) that the camera carries (lodur:ruling:porcelain-studio-follows-camera), plus an analytic glaze that reflects the same studio (`client/studio.gdshaderinc`, Fresnel times the studio in the reflected direction, added as emission so it draws the same under gl_compatibility), pooled darker in concave creases. Needs the .NET 8+ SDK, cmake and a C compiler (MinGW gcc on Windows), the sibling Lodur, Ymir (with joint origin lanes, ABI 8) and CultLib checkouts (`..\Lodur`, `..\Ymir`, `..\CultLib`, or `LODUR_ROOT`, `YMIR_ROOT` and `CULTLIB_ROOT`; CultLib must be a clean checkout of 42dce361, the revision Ymir admits, or the build refuses), and Godot 4.7.2 mono. diff --git a/client/Look.cs b/client/Look.cs index 6451b45..7567579 100644 --- a/client/Look.cs +++ b/client/Look.cs @@ -71,18 +71,14 @@ public static class Look public const float AmbientEnergy = 0.06f; public static readonly Color AmbientColor = new(0.9f, 0.93f, 1f); - /// - /// Whether the studio turns with the camera, as a photographer's lights do (the recommended option of the open question - /// lodur:question:bds-porcelain-studio-follows-camera): form and glints on every side as the player orbits, at the cost of the key's floor - /// shadow swinging with the camera. False fixes the studio in the world: the rig is parented to the camera's parent and the glaze reads - /// the world-space directions; the figure goes flat from the sides the studio does not face. - /// - public const bool StudioFollowsCamera = true; - - /// The scene's environment (a colour background, a colour ambient, linear, no glow) and the studio's lights, carried by . + /// The scene's environment (a colour background, a colour ambient, linear, no glow) and the studio's lights, carried by : a shadowing key and two rims, its children. public static WorldEnvironment Studio(Camera3D camera) { - Rig(camera); + // The studio turns with the camera, as a photographer's lights do (lodur:ruling:porcelain-studio-follows-camera): form and glints on every + // side as the player orbits, at the cost of the key's floor shadow swinging with the camera. + camera.AddChild(Light("StudioKey", KeyDirection, KeyEnergy, true, new Color(1f, 0.98f, 0.95f))); + camera.AddChild(Light("StudioRimA", RimDirectionA, RimEnergyA, false, RimTint)); + camera.AddChild(Light("StudioRimB", RimDirectionB, RimEnergyB, false, RimTint)); return new WorldEnvironment { Environment = new Godot.Environment @@ -97,15 +93,6 @@ public static class Look }; } - /// The key (with the shadow) and the two rims, from the studio's directions, as children of the camera (or of its parent, when the studio is fixed in the world). - public static void Rig(Camera3D camera) - { - Node host = StudioFollowsCamera ? camera : camera.GetParent(); - host.AddChild(Light("StudioKey", KeyDirection, KeyEnergy, true, new Color(1f, 0.98f, 0.95f))); - host.AddChild(Light("StudioRimA", RimDirectionA, RimEnergyA, false, RimTint)); - host.AddChild(Light("StudioRimB", RimDirectionB, RimEnergyB, false, RimTint)); - } - private static DirectionalLight3D Light(string name, Vector3 from, float energy, bool shadow, Color color) => new() { Name = name, @@ -123,7 +110,6 @@ public static class Look material.SetShaderParameter("backlight", Backlight); material.SetShaderParameter("glaze", GlazeStrength); material.SetShaderParameter("glaze_pool", GlazePool); - material.SetShaderParameter("studio_in_view", StudioFollowsCamera); material.SetShaderParameter("studio_room", Room); material.SetShaderParameter("studio_key_dir", KeyDirection); material.SetShaderParameter("studio_key_size", KeySize); diff --git a/client/puppet.gdshader b/client/puppet.gdshader index 5802ebe..029eaab 100644 --- a/client/puppet.gdshader +++ b/client/puppet.gdshader @@ -107,7 +107,6 @@ void fragment() { EMISSION = show_normals ? n * 0.5 + 0.5 : vec3(0.0); if (!show_normals && glaze > 0.0) { vec3 r = reflect(-VIEW, n); - if (!studio_in_view) r = mat3(INV_VIEW_MATRIX) * r; float f = 0.04 + 0.96 * pow(1.0 - clamp(dot(n, VIEW), 0.0, 1.0), 5.0); EMISSION += glaze * f * studio(r); } diff --git a/client/studio.gdshaderinc b/client/studio.gdshaderinc index 0b6b3d9..154d14e 100644 --- a/client/studio.gdshaderinc +++ b/client/studio.gdshaderinc @@ -1,7 +1,6 @@ // The studio the glaze reflects: a dark room, one large soft box (key), two tall strip lights (rims) and a dim floor. Look owns the // numbers and feeds the same ones to the punctual lights, so the lights and the reflections are one studio. The directions are the -// directions the light comes from, in view space when studio_in_view (the studio turns with the camera, as a photographer's lights do), -// else in world space. Radiances are in the render's linear units and are meant to clip where the glaze catches them. +// directions the light comes from, in view space (the studio turns with the camera, as a photographer's lights do). Radiances are in the render's linear units and are meant to clip where the glaze catches them. uniform vec3 studio_room = vec3(0.0); uniform vec3 studio_key_dir = vec3(0.0, 1.0, 0.0); uniform float studio_key_size = 0.0; @@ -12,7 +11,6 @@ uniform vec2 studio_rim_size = vec2(0.0); uniform vec3 studio_rim_tint = vec3(1.0); uniform float studio_rim_radiance = 0.0; uniform float studio_floor = 0.0; -uniform bool studio_in_view = true; // A rectangular emitter seen from the origin along c, w by h on the plane at unit distance, soft at its edge. float studio_box(vec3 d, vec3 c, vec2 half_size) { diff --git a/client/tests/Smoke.cs b/client/tests/Smoke.cs index 4d37760..ca85bb6 100644 --- a/client/tests/Smoke.cs +++ b/client/tests/Smoke.cs @@ -185,7 +185,7 @@ public partial class Smoke : Node foreach (var key in rig.Where(l => l.ShadowEnabled)) { var shinesAlong = camera.GlobalBasis.Inverse() * -key.GlobalBasis.Z; // the key's direction of travel in the camera's space - Check(Look.StudioFollowsCamera == (shinesAlong + Look.KeyDirection).Length() < 1e-3f, $"the key shines along {shinesAlong} in the camera's space after the camera turned {turn} rad; the studio does not follow the camera"); + Check((shinesAlong + Look.KeyDirection).Length() < 1e-3f, $"the key shines along {shinesAlong} in the camera's space after the camera turned {turn} rad; the studio does not follow the camera"); } } camera.GlobalTransform = home;