Skip to content
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

3MFLoader: Add support for Volumetric Implicits #29548

Open
zalo opened this issue Oct 4, 2024 · 5 comments
Open

3MFLoader: Add support for Volumetric Implicits #29548

zalo opened this issue Oct 4, 2024 · 5 comments
Labels

Comments

@zalo
Copy link
Contributor

zalo commented Oct 4, 2024

Description

3MF files can now contain volumetric implicits defined as operation execution graphs.

The 3MF consortium has released a 3D Modeller for generating .3mf’s with them, similar to nTopology:
https:/3MFConsortium/gladius

This presents an opportunity to make SDF Implicits a first or second-class feature of 3D on the web!

Solution

My proposal would be to bake the execution graphs out to TSL, where a raymarching shader can evaluate them at runtime.

Alternatives

Eventually, a WebGPU Marching Cubes compute shader can take them the rest of the way into mesh-land. 🧐

Additional context

Perhaps PhysicalSDFMaterial can become a default engine material? I imagine they might ingest a TSL graph describing the SDF value and the PBR Rendering properties (diffuse color, normal, specular etc.) given a point in space; enabling it to benefit from improvements made to the main PBRMaterial! By default, they might just sample from a volumetric texture instead of evaluating the implicit programmatically.

Engine integration provides the interface for standardized cross-system interaction, like possibly with physics engines.

@zalo
Copy link
Contributor Author

zalo commented Oct 4, 2024

I have the roughest beginnings of a node parser implementation here: zalo@e279087
Once the ops are being read out appropriately, it will be time to hook them up to the equivalent TSL functions...

@zalo zalo changed the title 3MFLoader: Add support for Volumetrics 3MFLoader: Add support for Volumetric Implicits Oct 4, 2024
@Mugen87 Mugen87 added the Loaders label Oct 5, 2024
@zalo
Copy link
Contributor Author

zalo commented Oct 8, 2024

It occurs to me that I'm in over my head a bit ( zalo@dcabebf )... perhaps it makes more sense to add just a implicitfunction parser first, and then save the TSL transpilation for a separate PR, once I actually learn about how TSL works...

Does TSL even exist in non-webgpu version of three.js?

@Makio64
Copy link
Contributor

Makio64 commented Oct 8, 2024

@zalo It's confusing but the WebGPURenderer actually have two Backend : WebGL & WebGPU.
It's more like a Threejs v2 with a new core, and new concepts of Nodes & TSL : a system made to work on both technology seemlesssly.

@Mugen87
Copy link
Collaborator

Mugen87 commented Oct 8, 2024

@zalo I recommend to keep TSL generation out of 3FMLoader and return a JSON representation of the volumetric implicits instead (maybe in the userData property of the returned group). In the next step, you can create a separate library that takes the JSON representation and creates node materials from it.

In this way, 3FMLoader can easier be used with both WebGLRenderer and WebGPURenderer. Once WebGLRenderer is deprecated, a deeper integration can be considered.

@zalo
Copy link
Contributor Author

zalo commented Oct 8, 2024

Gotcha; since TSL isn't guaranteed to be present; it doesn't seem to make sense to compile to it in a default lib.

I'll keep the exposed implicitfunction structure simple, but optimized for others (who know more about TSL or some other language 😅 ) to step through and write a node -> node compiler.

I also have it on good authority that the javascript reference implementation for 3mf parsing will include volumetrics support soon, so the third-party ecosystem should have solutions soon regardless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants