Change the time of day
We can call the set_time_of_day method on the viewer to change the time between dawn (0) to noon (60)
[1]:
import numpy as np
from ipywidgets import widgets, interact, interactive
import ipyanimlab as lab
viewer = lab.Viewer(shadow_quality=lab.ShadowQuality.HIGH, move_speed=5, width=800, height=600)
Load the USD Asset
As static asset the ShaderBall is accessible directly from internal resources
[3]:
asset = viewer.import_usd_asset('ShaderBall')
Interact with the time of day
[7]:
def render(time_of_day):
#the time between dawn (0) to noon (60)
viewer.set_time_of_day(time_of_day)
# start the rendering of the shadow
viewer.begin_shadow()
# render the asset at default position in the shadow
viewer.draw(asset)
# end the shadow
viewer.end_shadow()
# start the rendering of the scene
viewer.begin_display()
# render the default ground
viewer.draw_ground()
# render the asset at default position
viewer.draw(asset)
# display the image
viewer.end_display()
# send all the command to webgl
viewer.execute_commands()
interact(
render,
time_of_day=widgets.IntSlider(min=0, max=60, value=10)
)
# show the viewer
viewer
[7]: