jupyter-widgets / pythreejs

A Jupyter - Three.js bridge
https://pythreejs.readthedocs.io
Other
942 stars 188 forks source link

Light models copy only color and intensity from python to JS(three.js) #330

Closed crazyquark closed 4 years ago

crazyquark commented 4 years ago

I found this while working on ipyvolume: if you instantiate a light in python code then attempt to use the corresponding object from inside ipyvolume's typescript(javascript) via constructThreeObject() method this will only give you a minimalist THREE object which is the correct type but contains only color and intensity, position and everything else is not set. This can be seen for example in js/src/lights/DirectionalLight.autogen.js which only syncs color and intensity making the directional light pretty useless from JS code.

Now, probably this is not how pythree was meant to be used but ipyvolume is trying to add lights and shadows and needs this. I manually copied the properties I needed from the "obj" property to work around.

crazyquark commented 4 years ago

I realized that I can just use .obj to get what I need.