-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using filament.wasm / NPM module as a Node.js dependency #2647
Comments
Correct, our JavaScript and TypeScript API's are designed for Browsers, not nodejs. I don't know much about nodejs but maybe you could just build a nodejs addon yourself, link against the core Filament library, and use our first-class C++ API. |
Actually I'm curious, what would be the render target in such an environment? I.e. what's the h |
I'm curious too. If you're writing an Electron app, maybe your usage of filament could live in the Renderer process rather than the Main process, in which case you could simply use our JS API, right? |
I was thinking of using node-canvas which uses Cairo. I'm imagining running this on a virtualized Linux box so it'll probably use X window as it's target through Cairo. As an example of something similar, I wrote a small screenshotting tool that spins up an instance of headless chrome, tosses in a element, and produces a render from a browser context but using something like Filament seems more direct without having to load up Chrome. The end goal is to be able to produce 3D renders on a GPU-less docker image hosted somewhere. I could always end up just using the C++ API directly instead of going through this rigmarole of getting it working throw a 'web' context but was curious if it was possible. |
What I'm worried about is whether the whole GL initialization can succeed. Cairo is a 2D renderer and I have no idea if going through it would allow Filament to take over the surface with a 3D context. |
Good point. I took a peek at I still wonder what the possibilities are for using the WASM bundle that can be built for Filament in different contexts. With new WASM runtimes like Lucet one could imagine an intersection of rendering and edge computing. In any case, thanks for the quick responses and insightful conversation on this! |
I think headless-gl is typically what people use when going this direction... I've tested "swapping in" a headless-gl instance with other renderers (http://regl.party/) and it just worked. From the docs, "It is built on top of ANGLE and passes the full Khronos ARB conformance suite, which means it works exactly the same on all supported systems." |
stackgl/headless-gl is a WebGL 1.0 impl, Filament requires 2.0. |
Hm, good point. Following the comment threads a bit further, it doesn't look like they've made much progress on WebGL 2 (stackgl/headless-gl#109). Perhaps https://github.com/google/node-gles then, if/when it becomes stable. |
I've been browsing through the web target for Filament which looks to be for browsers only and was wondering if it was possible to get it running alongside a Node.js application. I figured there's a couple of node/browser polyfills that would be to be involved for
fetch
andcanvas
but not sure if there might be something in the prebuilt WASM files that would cause problems. Out of the box the NPM module doesn't work as the Filament global that is defined doesn't get exposed on window like it does on the browser so there's that to contend with.The text was updated successfully, but these errors were encountered: