GithubHelp home page GithubHelp logo

Comments (10)

doyubkim avatar doyubkim commented on June 24, 2024 1

That is great suggestion, @Immocat. Yes, I was also not very proud of the performance of the anisotropic implementation. The SDV is not very efficient, but also using the uniform grid also make things slow. Let me open a separate ticket to cover that issue.

from fluid-engine-dev.

dokipen3d avatar dokipen3d commented on June 24, 2024 1

I've been using eigen's svd for the moment. At one point I had a slow access pattern for the vdb neighbour search and the svd wasn't an issue. Now I've got a faster search, the svd could probably now be looked at. There is a guy here at work who implemented the fast 3x3 svd so I'm going to look at that as well.

The banding does look familiar. It was definely tied to the voxel grid res. It varied with the angle too.

I wish I could share screenshots but here at Weta, we can't really get stuff out without getting it all approved.

from fluid-engine-dev.

doyubkim avatar doyubkim commented on June 24, 2024

Thanks for finding this, @Immocat! Let me take a look at the problem. Iā€™m not sure if the magic number is the real root cause, but still very interesting find.

from fluid-engine-dev.

dokipen3d avatar dokipen3d commented on June 24, 2024

Hi all.

I've been implementing this paper at work using vdb pointDataGrids into a volume grid. I have been a bit confused by that magic number too. I've also encountered banding at the voxel splat stage. I think I'm close to figuring out what the issue is and it's related to the magic scaling.

So here's the problem (I think). I have a particle grid (which stores the particles in 'index' space ie the integer coordinates of the grid which is the way vdb accesses it's coordinates). I calculate the svd/matrix using those coordinates. The svd is fine as I can load the particles back into houdini and instance spheres onto them using the matrix and they are all oriented and squashed correctly.
Then I go to the voxel splat stage which is where I've been having the banding issues. The thing causing the issue is that I am writing to a voxel grid of arbitrary resolution. I do the neighbour search and splat the particles using a kernel (i've tried many) and mult the r vector by the matrix. (one tricky thing to keep in my mind is that I am doing the voxel splat in the particles index space to prevent me having to do a transform into a different 'space').

The thing I think is the problem is that I am using the matrix which is of a certain 'scale' but the voxel splat has a different 'support' radius. So the matrix scaling and the kernel radius are of different scales. So if the anisotropic matrix has eigenvalues of something like (2.0, 0.5, 2.0), and the voxel splat is only 1.0, then the r vectors will be stretched out of the kernel support and messes up the splatted value. I'm going to try and scale down the matrix by a factor that is the difference between the two kernels in the particle and voxel stages.

Also want to try a metaball approach with sdf blending still using the matrices.

I'll follow this thread with interest!

from fluid-engine-dev.

doyubkim avatar doyubkim commented on June 24, 2024

Thank you for chiming in, @dokipen3d! Yes, I also experienced similar issues with the kernel support not being fully captured by the grid points. Probably this is related to that issue based on the first screenshot @Immocat attached (SDF being not smooth which indicates kernel cut-off).

from fluid-engine-dev.

Immocat avatar Immocat commented on June 24, 2024

Thanks for all your replies.
Although using the ks = 1400 solve the "hole" problem, I found a new problem:
compare_band
I'm not sure if it is the banding problem @dokipen3d mentioned. I used the same frame particles to generate these two meshes, while the left one's grid spacing is 0.01 and the right is 0.02.

So for my current project, I choose to use zhu_bridson's method šŸ˜ø. I personally prefer zhu_bridson's result for its sharp and thin surfaces, except it is still suffered from bumpy problem to some extent and the shortcoming described in their paper.

Comparing to zhu_bridson's method, anisotropic method is much slower because of the svd. So I also recommend @doyubkim to adopt the Implicit-shifted Symmetric QR Singular Value Decomposition of 3 Ɨ 3(2x2) Matrices.

Not only this method is widely used and critical in Disney's Material point method simulation(maybe in your future book?šŸ˜ø), but also it is also fast and not that general as the code from "numerical recipe", which is currently used in the code base. QRSVD's result has some convention(mentioned in part 1 in its paper) which perfectly matches the requirement in the anisotropic paper(2x2,3x3 matrices, result is rotation matrix det = 1, sorted eigen values).

I will try to implement material point method and adopt the QRSVD as my future project and do some experiment with this anisotropic kernel but not in the near future.

from fluid-engine-dev.

doyubkim avatar doyubkim commented on June 24, 2024

Just pushed a branch with a potential fix. @Immocat, if you can checkout that branch and see if it fixes your problem, that would be great. It seems to work with most of my test cases including your attached file.

The actual bug was caused by wrong clamping of the singular values after SVD step.

Not related to the bug, but if I make additional comment on my magic parameter, I'm actually implementing the algorithm slightly different from the original paper in order to remove the original magic parameter, 1400. The scaling factor I'm using (pow(relV, 1/3) part) is trying to normalize the kernel volume so that either perfect spherical kernel or elongated kernel have same volume.

Also, about the aliasing, I'm using fixed 2x radius than the kernel size which can be improved I think.

from fluid-engine-dev.

dokipen3d avatar dokipen3d commented on June 24, 2024

Why would absmax fix the holes? Can svd give negative scales?

from fluid-engine-dev.

dokipen3d avatar dokipen3d commented on June 24, 2024

Yeah if we can fix this aliasing, I will be very happy!

from fluid-engine-dev.

doyubkim avatar doyubkim commented on June 24, 2024

@dokipen3d great question. I think my PR and comment were misleading. Apparently, the version of implementation I'm using for SVD does generate negative output, which is totally fine unless I carry the sign all the way to the G matrix. So the fix is cancelling out the sign part and use the abs scale to construct G. But as I type this comment here, I think I can make my code and comment more clear.

from fluid-engine-dev.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.