-
-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Support for Custom Renderers #272
Comments
I've been having a look at this. Depending on the level of support we want, this might be tricky. WebGPURenderer might be fine, but Tres seems to assume that the output element will be a canvas, which in the case of SVGRenderer, CSS2DRenderer, stuff like that, the output element is not a canvas. Looks like to truly support any renderer, we'd have to take the returned Maybe it would be best to support only canvas-based renderers? (R3F also only support canvas-based renderers) Here's the interface for SVGRenderer: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/three/examples/jsm/renderers/SVGRenderer.d.ts |
Another complication - to use a canvas-based renderer, Tres needs to instantiate the renderer (because it has the canvas), but for an example like this, we need access to the renderer itself in the vue component. I'm giving up for now - if anyone wants to pick it up in the future, here's what I tried so far :) callumacrae@a475a3f |
the output doesn't really matter because for various reasons you don't want to output a canvas anyway as the outmost element but a div (or a view on native). the reason for this is you have eco system overlays that rely on being in the same nesting as the canvas element, for instance the addons html or view components. here's an example of a svg renderer in react https://codesandbox.io/s/zcuqh?file=/src/App.js |
Description
As of now, https://github.com/Tresjs/tres/blob/main/src/composables/useRenderer/index.ts#L209 supports the default WebGL 2 renderer.
The idea would be to adapt
useRenderer
so a custom renderer like https://github.com/mrdoob/three.js/blob/dev/examples/jsm/renderers/webgpu/WebGPURenderer.js can be used.Suggested solution
Check out R3F and NGT support
https://github.com/pmndrs/react-three-fiber/blob/master/packages/fiber/src/core/index.tsx#L108
Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: