Skip to content

EnvironmentLight.global default is True (spec default is false) and is dropped from serialization #3

Description

@EUPHEMEME

A quick human note: I understand EnvironmentLight is still experimental in 4.1, so this is low-priority — just recording the serialization-default mismatch for whenever the node is finalized.

Summary

X.EnvironmentLight().global_ defaults to True, but the normative X3D 4.0 Lighting component specifies the EnvironmentLight.global default as false. Because x3d.py's internal default is True, an explicit global_=True equals the internal default and is omitted from serialization; a conformant reader then parses the missing attribute as false, so image-based lighting silently fails.

Environment: x3d 4.0.65.4 (pip install x3d), Python 3.12.

Reproduction

from x3d import x3d as X
print(repr(X.EnvironmentLight().global_))   # -> True
e = X.EnvironmentLight(); e.global_ = True
print(e.XML())                              # -> <EnvironmentLight/>   (global omitted)

Spec

The X3D 4.0 Lighting component field table specifies SFBool [in,out] global FALSE for EnvironmentLight — default false. (The x3d-4.0.dtd line global %SFBool; "false" agrees, though it sits in a commented-out block, so the field table is the primary authority.)

This is a spec-divergence rather than a flat contradiction: x3d.py's True matches the convention used by the point/spot light nodes and X_ITE's documented EnvironmentLight behavior, but the normative field table specifies FALSE. The practical problem is that the divergent default is silently dropped from serialization, so output authored against x3d.py renders differently in a spec-default reader.

Expected: default global = False (matching the normative field table); global_=True then serializes as global='true'.

Impact: image-based ambient lighting silently fails; the scene is lit only by remaining direct lights. Confirmed in Castle Model Viewer 5.3; corrected only after global='true' was injected post-serialization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions