Jump to content
marcmesafervfx

Remesh using only VEX

Recommended Posts

Hello to everyone! 

I'm creating this topic just to see if someone is able to break down the remesh node in VEX. The point is to achieve a faster result using a wrangler or more as a substitution for the remesh or polyreduce. So here you have some questions:

1. Is it better to use the original mesh (deleting and modifying the mesh) or creating a new one (generating points)?

2. Is the source code used in the remesh node faster than any script that could be written in VEX?

If you find a way or you have an idea about how to do it, don't hesitate to share it with the community!

Share this post


Link to post
Share on other sites

the remesh node is done in C++, doing it yourself in VEX is unlikely to make it faster :P

That said, there are some things that you can optimize on top of the node.
One very easy optimization is to split your mesh by connectivity (create a "class" attribute with the connectivity SOP)
then loop over this attribute with a foreach block, and in turn, use compile block around that.

My suspicion is that because in each iteration of the loop, the remesh node does not have to consider irrelevant (far away)
data, doing a bunch of smaller pieces separately (in a compiled fashion) is faster than processing it as one large chunk.
This can speed it up a loot, depending on the target mesh density etc.

Share this post


Link to post
Share on other sites

You can do almost anything in VEX. I have written some SOPs in VEX that beat their C++ versions in performance (in some cases for some). It mostly depends on the algorithm and carefully designed implementation. But it's also highly dependent on the operation.

For something like remesh, it's mostly a serial operation and pure geometry creation won't be very fast in VEX unless you pre-generate points and primitives, etc. So your best bet is to find a better algorithm first.

I would first get comfortable with topology manipulation in VEX, handling/stitching adjacent polygons properly, interpolating attributes, preserving groups, dealing with edges, etc then you will start to see patterns.

  • Like 1

Share this post


Link to post
Share on other sites

OK yeah, maybe I should have been more clear :P
there are nodes that can done faster in VEX than native, the partition and measure SOPs come to mind.

Its just that Remesh is a much complex beast. If you are a researcher in the field or just want to learn how to do it, then by all means go ahead!
But I think that those things: remesh, poly reduce and also uv layout and uv relax(hopefully at some point xD) are among the most difficult graphical problems you run into on a regular basis

Share this post


Link to post
Share on other sites
50 minutes ago, acey195 said:

OK yeah, maybe I should have been more clear :P
there are nodes that can done faster in VEX than native, the partition and measure SOPs come to mind.

Its just that Remesh is a much complex beast. If you are a researcher in the field or just want to learn how to do it, then by all means go ahead!
But I think that those things: remesh, poly reduce and also uv layout and uv relax(hopefully at some point xD) are among the most difficult graphical problems you run into on a regular basis

Yes definitely, my comment wasn't directed towards you so I agree with you :)

Those nodes, Boolean SOP, etc are quite tricky to get right regardless of language. Back in the day I wrote a UV packer, and it was a difficult problem.

  • Haha 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×