3D Scene - adjust lighting parameters #3917
andreear-23
started this conversation in
Ideas / Feature Requests
Replies: 1 comment 1 reply
-
Hi @andreear-23, Currently the light is hard-coded: nicegui/nicegui/elements/scene.js Lines 101 to 104 in 3b9293d You can add spot lights like this: with ui.scene() as scene:
scene.sphere()
scene.spot_light().move(0, 0, 3).rotate(0, math.pi / 2, 0) Removing the two existing lights is a bit tricky, but possible: with ui.scene() as scene:
scene.sphere()
scene.on('init', lambda: ui.run_javascript(
f'getElement("{scene.id}").scene.children.slice(0, 2).forEach(child => child.removeFromParent())'
))
scene.spot_light().move(0, 0, 3).rotate(0, math.pi / 2, 0) Let's turn this question into a feature request to improve the API for configuring existing lighting and adding more light objects like ambient or directional light. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Question
Hi everyone,
Is it possible to adjust the renderer parameters for the
ui.scene
element? I am interesting in changing things like lighting and renderer for my scene. I am loading a GLB mesh with texture but it looks really dark in the scene.For example, this is how a GLB looks like loaded with
ui.scene
and this is how it looks when I load it in another web based gLTF Viewer (which is also using threejs as a backbone)
In these screenshots the difference is not as bad, but for the GLB models I am using it's really obvious.
Thanks for your help!
Beta Was this translation helpful? Give feedback.
All reactions