-
Notifications
You must be signed in to change notification settings - Fork 341
[SofaImplicitField] Add FieldToSurfaceMesh component #5565
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
[SofaImplicitField] Add FieldToSurfaceMesh component #5565
Conversation
b769e33 to
8144c9e
Compare
applications/plugins/SofaImplicitField/initSofaImplicitField.cpp
Outdated
Show resolved
Hide resolved
applications/plugins/SofaImplicitField/components/engine/FieldToSurfaceMesh.h
Outdated
Show resolved
Hide resolved
|
About wether it is an engine, a normal component, a topological mapping or mechanical mapping, here is my understanding.
Data Engine are not operating that way, they process data in inputs...and stores the results in output field. Users of the component are free to link the output datas to any other component's compatible data field. It can be a component saving to file, or to visualize the geometry in opengl, storing it in a MeshTopologyContainer. I see much more flexibility in data engine design. So
About the case of ImplicitSurfaceMapping. So I will just factor the duplicated marching cube code. |
|
@bakpaul, do you have any idea what MarchingCubeUtility is for ? I'm not sure I understand why it takes a char* data as inputs. |
|
Some news @bakpaul Moving the marching cube from FIeldToSurfaceMesh in a separated file was pretty easy and thus the introduced component is now independent of the marching cube algorithm and the algorithm is now available to other component. But using it, to refactor ImplicitSurfaceMapping is complex. Because ImplicitSurfaceMapping is in fact hard coding a ScalarField. And that the hard coded incremental version of the MarchingCube seems to sweeps along one axis with an acceleration mechanism to evaluate efficiently the field generated by spherical kernels (the ScalarFIeld). Untangle ImplicitSurfaceMapping, while maintaining more or less the same level of performance need serious refactoring and/or algorithmic work. So I would suggest to let the refactoring of ImplicitSurfaceMapping to use the MarchingCube that is in MarchingCube.h and use a real ScalarField (kind of GaussianKernel) for the one that want it. In addition, I'm not interested to work on the ImplicitSurfaceMapping part right now, because performance oriented ScalarField are in my TODO list: #5673 and I expect that the refactoring would profit of that. Before giving up, I will see if I can do something with a lambda function on MarchingCube::generateSurfaceMesh() |
|
Hello @bakpaul, I spend the day to refactoring the ImplicitSurfaceMapping to separate the field approximation using wyvill's function from the MarchingCube algorithm itself. As expected, there is no free lunch, this come with a performance drop from 500 fps to 300fps on the default scene. |
|
Hi @damienmarchal, great to see the work you did to try to factorize the code. |
|
Hi @bakpaul Thanks for the feedback, to me the ImplicitSurfaceMapping component was developped to render SPH fluides simulations, as it was very common circa 2006-2010, and the implementation is elegant to maximize efficiency. Nowaydays other rendering approach are possible to implement high performances rendering of fluids. So investing time on these is probably wiser. So with this in mind and if having a 1.5 time slower version of ImplicitSurfaceMapping is ok, then I will clean the code (as it is still very drafty). I will keep you informed when it is ready for review. |
84dd899 to
a0c0044
Compare
This reverts commit 70dfe40.
a0c0044 to
e390490
Compare
|
@hugtalbot I integrated the fix |
|
Teh scene you introduce triggers an error, could you fix it ? |
|
SUre , thank for the feedback |
…implicit-field-example.py This example file was added by mistake
|
[ci-build][with-all-tests] |
|
So much "update" |
|
Hi @damienmarchal |
|
Error might come from my wrong-merge, so restart the CI and see what happens |
|
@hugtalbot do you know if the error from the CI or the PR ? |
|
sry can't merge: "This branch is out-of-date with the base branch" |


There is currently no component to generate a 3D surface as the "implicit" surface of a scalar field.
I searched into the code base and the closest I found was ImplicitSurfaceMapping... but:
So... I made this PR, which introduce a FieldToSurfaceMesh component. Meshing any ScalarField.
This produce this kind of view:


Or by changing the step:
After this PR:
By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).
Reviewers will merge this pull-request only if