Skip to content

3D: add SpotLight object with nearest-lights performance guardrails#8349

Open
Carrotstudio0 wants to merge 5 commits into4ian:masterfrom
Carrotstudio0:pr/spotlight-object-guardrails-clean
Open

3D: add SpotLight object with nearest-lights performance guardrails#8349
Carrotstudio0 wants to merge 5 commits into4ian:masterfrom
Carrotstudio0:pr/spotlight-object-guardrails-clean

Conversation

@Carrotstudio0
Copy link

Summary

This PR introduces a dedicated 3D SpotLight object (instead of a layer effect), with built-in performance guardrails that keep only the nearest spot lights active per layer.

What’s included

New object

  • Added Scene3D::SpotLightObject as a real object visible in the scene editor.
  • Object properties include:
    • Light: enabled, color, intensity, distance, cone angle, penumbra, decay
    • Shadows: castShadow, shadowQuality, shadowBias, shadowNormalBias, shadowRadius, shadowNear, shadowFar
    • Performance: per-light guardrailsEnabled

Guardrails system

  • Added scene-level nearest-lights management in runtime:
    • By default, only the nearest 8 spot lights per layer are active.
    • Configurable per layer using:
      • Action: SetMaxActiveSpotLights(layer, max)
      • Expression: MaxActiveSpotLights(layer)
  • Guardrails are evaluated each frame and applied deterministically using distance to camera.

Editor integration

  • Added 2D and 3D scene editor renderers for SpotLightObject.
  • Added default object editor configuration for this object.
  • Added default object naming support (New3DSpotLight).
  • Updated 3D model editor light detection to also consider Scene3D::SpotLightObject.

Files changed

  • Extensions/3D/SpotLightRuntimeObject.ts (new)
  • Extensions/3D/JsExtension.js
  • newIDE/app/src/ObjectEditor/Editors/Model3DEditor.js
  • newIDE/app/src/ObjectsList/index.js

Notes

  • This PR focuses only on Spotlight-as-object architecture + guardrails.
  • It is intentionally scoped to remain reviewable and independent from other 3D/post-processing changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant