jupyter-widgets / pythreejs

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

Updating three.js to be able to use InstancedMesh(and shadow maps with instanced geometry) #319

Open crazyquark opened 4 years ago

crazyquark commented 4 years ago

Hello,

Our project needs to use InstancedMesh, introduced here: https://github.com/mrdoob/three.js/pull/17505 (I think in r109)

Would it be possible to update pythree to at least three.js 109?

We want to implement shadow mapping in ipyvolume, unfortunately we need a feature that was introduced in three.js 109 for shadow maps to work properly with instanced geometry, I am referring to this issue: https://github.com/mrdoob/three.js/issues/13995

This is was addressed with the PR mentioned above: https://github.com/mrdoob/three.js/pull/17505

vidartf commented 4 years ago

Would it be possible to update pythree to at least three.js 109?

Yes, that should be possible (we would probably update to latest release then), I just need to find some spare time. If you want to help out push this along, please let me know and I can outline the steps needed to upgrade, and you can get started :)

crazyquark commented 4 years ago

@vidartf Hi, yes, indeed, can you outline the process? Maybe I can help(I am comfortable with both python and JS)

vidartf commented 4 years ago

The main workload is probably to go through all the changelogs and identify any changes to the properties and/or constructor signatures of existing objects. Additionally, any newly added objects should be added to the spec.

The spec to update is here: https://github.com/jupyter-widgets/pythreejs/blob/master/js/scripts/three-class-config.js

Once a first attempt has been made on the spec, get the JS dev env set up (clone + npm install in js folder), and run npm run autogen:enum[s] and npm run autogen to look for any obvious complaints.

If you get this far, that would be very helpful :)

Note that since the API docs of threejs has become much more reliable, it might be possible to streamline this process by using a script to extract (parts of) the config from the API docs. I'll leave it up to you to decide which seems faster / more fun?

crazyquark commented 4 years ago

@vidartf Hi. So I've been trying to update three.js(got to version r103) but now I am having trouble testing it against ipyvolume, I made a virtualenv w/ python3 where I installed the dev pythree but when I run jupyter-notebook it still picks up three.js 97(as far as I can tell). Could you maybe give me a short testing scenario for pythree and ipyvolume? My current work is here: https://github.com/crazyquark/pythreejs/tree/feature/updateThree

crazyquark commented 4 years ago

I had to manually run: jupyter nbextension uninstall jupyter-threejs for it to pickup the updated pythree ... no sure why?

vidartf commented 4 years ago

I've not worked much with ipyvolume, so I won't be able to help you with that, sorry. Maybe @maartenbreddels has some input?

vidartf commented 4 years ago

jupyter nbextension uninstall jupyter-threejs for it to pickup the updated pythree

You either need to symlink it (jupyter nbextension --symlink ...) or you will need to uninstall/reinstall every time it changes.

arkanoid87 commented 3 years ago

I would like to use this feature too. This would unlock large scenes, moreover I've been spending some time trying to workaround current limitations using current api, failing hard on every possible way.