How we can change Light

vikram_s

Hello William Thompson,

I want to change the light using API on the client-side.


Can you please suggest to me how we can achieve it?

Thanks

Comments

8 comments

  • Comment author
    Ian Drews

    Hi Vikram, You can set a rule on the scene that your stage corresponds to which will change the lighting. In this example the rotation of the light is being set based on a number attribute but you should be able to accomplish anything you'd like with this method.

    After you've done that you can get access to the stage configurator on the frontend like this 

    let s = await window.threekit.player.getStageConfigurator()

    and from there the stage configurator will function essentially the same as the regular player configurator. Call setConfiguration on the stageConfigurator to change the value of the attribute(s) that you have assigned the lighting changes to.

    Hope this is helpful, 
    Ian

    0
  • Comment author
    vikram_s
    • Edited

    Can you provide me example CODE?

    0
  • Comment author
    Ian Drews
    • Edited

    You will need to modify the stage to add in a configuration attribute, there is no way to achieve this purely with frontend code as far as I am aware. When you've added the attribute to the Stage the code will be:

    let s = await window.threekit.player.getStageConfigurator()
    s.setConfiguration({yourLightingAttribute: newValue})

     

    0
  • Comment author
    vikram_s

    I am getting this response after calling below method :

    let s = await window.threekit.player.getStageConfigurator()

    0
  • Comment author
    vikram_s

    How we can get the stage option?

    0
  • Comment author
    Ian Drews
    • Edited

    Hi Vikram,
    You cannot change the active stage without unloading the player and re-initializing with the new stage ID. If you would like to change the lighting in real-time, I would set up attributes & rules to change the active light setup with the stage configurator, either by changing the setup directly or by creating a proxy scene and swapping the active scene based on a rule.
    Ian

    0
  • Comment author
    vikram_s
    • Edited

    Hi,

    Can we move temperature option under item? If yes, Please give us the assistance on it?

    0
  • Comment author
    Ian Drews

    Hi Vikram,

    I'm sorry it's not possible, you'll have to use the stage configurator

    Ian

    0

Please sign in to leave a comment.