From 7fd2061f5c3ae0ee6a71fc1102c0ce0bf9a95481 Mon Sep 17 00:00:00 2001 From: Yuval Tassa Date: Thu, 6 Aug 2026 04:27:35 -0700 Subject: [PATCH] Change default light softness from 0 to 0.2. PiperOrigin-RevId: 960218397 Change-Id: I58f211f5a275f8f19254424facd02c14eaa8c668 --- doc/XMLreference.rst | 2 +- doc/changelog.rst | 2 +- src/user/user_init.c | 1 + src/xml/generated/dmcontrol_schema.xml | 8 ++++---- src/xml/generated/mjcf.xsd | 4 ++-- src/xml/generated/mjcf_default_table.inc | 2 +- src/xml/mjcf.schema | 2 +- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/doc/XMLreference.rst b/doc/XMLreference.rst index 87992af4..a610a960 100644 --- a/doc/XMLreference.rst +++ b/doc/XMLreference.rst @@ -3323,7 +3323,7 @@ Attributes may be applied or ignored depending on the lighting model being used. .. _body-light-softness: -:at:`softness`: :at-val:`real, "0"` +:at:`softness`: :at-val:`real, "0.2"` Edge softness for spotlights, as a fraction of the :ref:`cutoff` angle in [0, 1], used by physically-based lighting models. The light delivers its full :ref:`intensity` inside the cone, falling to zero over the outer softness fraction of the cone angle; the default corresponds to a sharp-edged diff --git a/doc/changelog.rst b/doc/changelog.rst index b9bc24b3..62dc26cf 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -75,7 +75,7 @@ Rendering :class: attention - Added :ref:`light/softness`: edge softness for spotlights under physically-based lighting - models, given as the fraction of the cone over which intensity falls to zero. The default of 0 is a sharp-edged + models, given as the fraction of the cone over which intensity falls to zero. The default of 0.2 is a semi-soft cone which delivers the full :ref:`intensity` everywhere inside it, so that illuminance follows :math:`E = I/d^2` independent of the :ref:`cutoff` angle. Previously the filament renderer treated the entire cone as penumbra, dimming spotlights well below their rated intensity, increasingly diff --git a/src/user/user_init.c b/src/user/user_init.c index a1685191..fccb3aa2 100644 --- a/src/user/user_init.c +++ b/src/user/user_init.c @@ -204,6 +204,7 @@ void mjs_defaultLight(mjsLight* light) { light->active = 1; light->attenuation[0] = 1; light->cutoff = 45; + light->softness = 0.2; light->exponent = 10; light->diffuse[0] = light->diffuse[1] = light->diffuse[2] = 0.7; light->specular[0] = light->specular[1] = light->specular[2] = 0.3; diff --git a/src/xml/generated/dmcontrol_schema.xml b/src/xml/generated/dmcontrol_schema.xml index 408feab2..cf376fa8 100644 --- a/src/xml/generated/dmcontrol_schema.xml +++ b/src/xml/generated/dmcontrol_schema.xml @@ -397,7 +397,7 @@ - + @@ -793,7 +793,7 @@ - + @@ -1378,7 +1378,7 @@ - + @@ -1700,7 +1700,7 @@ - + diff --git a/src/xml/generated/mjcf.xsd b/src/xml/generated/mjcf.xsd index fc094bff..fcdcfe3a 100644 --- a/src/xml/generated/mjcf.xsd +++ b/src/xml/generated/mjcf.xsd @@ -1495,7 +1495,7 @@ - + @@ -2274,7 +2274,7 @@ - + diff --git a/src/xml/generated/mjcf_default_table.inc b/src/xml/generated/mjcf_default_table.inc index 592cdb36..5e129e05 100644 --- a/src/xml/generated/mjcf_default_table.inc +++ b/src/xml/generated/mjcf_default_table.inc @@ -394,7 +394,7 @@ static const mjXDefaultEntry kDefaults_mjsLight[] = { {"range", (int)offsetof(mjsLight, range), 1, 1, 1, 0, {10.0}}, {"attenuation", (int)offsetof(mjsLight, attenuation), 1, 3, 3, 0, {1.0, 0.0, 0.0}}, {"cutoff", (int)offsetof(mjsLight, cutoff), 1, 1, 1, 0, {45.0}}, - {"softness", (int)offsetof(mjsLight, softness), 1, 1, 1, 0, {0.0}}, + {"softness", (int)offsetof(mjsLight, softness), 1, 1, 1, 0, {0.2}}, {"exponent", (int)offsetof(mjsLight, exponent), 1, 1, 1, 0, {10.0}}, {"ambient", (int)offsetof(mjsLight, ambient), 1, 3, 0, 0, {0}}, {"diffuse", (int)offsetof(mjsLight, diffuse), 1, 3, 3, 0, {0.7, 0.7, 0.7}}, diff --git a/src/xml/mjcf.schema b/src/xml/mjcf.schema index 0454625b..a5572d17 100644 --- a/src/xml/mjcf.schema +++ b/src/xml/mjcf.schema @@ -1117,7 +1117,7 @@ element light : mjsLight { range : float = 10 attenuation : float[3] = {1, 0, 0} cutoff : float = 45 - softness : float = 0 + softness : float = 0.2 exponent : float = 10 ambient : float[3] diffuse : float[3] = {0.7, 0.7, 0.7}