Giter VIP home page Giter VIP logo

interactivecomputergraphics / positionbaseddynamics Goto Github PK

View Code? Open in Web Editor NEW
1.8K 120.0 347.0 9.02 MB

PositionBasedDynamics is a library for the physically-based simulation of rigid bodies, deformable solids and fluids.

License: MIT License

CMake 2.26% C++ 89.12% GLSL 0.72% Batchfile 0.03% Python 7.66% C 0.21%
simulation position-based-dynamics rigid-bodies rigid-body-dynamics deformable-solids

positionbaseddynamics's People

Contributors

besoft avatar cgmb avatar digitalillusions avatar janbender avatar kugelstadt avatar louen avatar massanoori avatar meshula avatar ruberith avatar stefanmessmer avatar termi3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

positionbaseddynamics's Issues

Compile Error for visual studio 2010

I always meet this error, how to solve this problem ?

positionbaseddynamics-master\extern\eigen\eigen\src\stlsupport\details.h(63): error C2516: 'T' : is not a legal base class
6> main.cpp(146) : see declaration of 'T'
6> main.cpp(146) : see reference to class template instantiation 'Eigen::internal::workaround_msvc_stl_support' being compiled
6> with
6> [
6> T=PBD::TetModel *
6> ]
6>main.cpp(146): error C2819: type 'Eigen::internal::workaround_msvc_stl_support' does not have an overloaded member 'operator ->'
6> with
6> [
6> T=PBD::TetModel *
6> ]
6> did you intend to use '.' instead?
6>main.cpp(146): error C2039: 'updateMeshNormals' : is not a member of 'Eigen::internal::workaround_msvc_stl_support'
6> with
6> [
6> T=PBD::TetModel *
6> ]

build instructions

Apologies if I missed this somewhere but it should be noted in the readme that this library only supports 64 bit builds (at least on MSVC you'll get crashes due to alignment issues on 32 bit builds). Thus on windows you'll need to:

  • Ensure you're building against 64 bit boost
  • Run something like
    cmake -G "Visual Studio 14 2015 Win64"
    (At least on my system cmake really wants to configure for a 32 bit build by default)

How to compute self-collision constraint gradient?

I've some trouble with the constraint gradient. The self collision constraints complicate me a lot, there are two cross product in the formula:

C(q,p1,p2,p3) = (q-p1) * (p2-p1)x(p3-p1) / |(p2-p1)x(p3-p1)| - h

I read it from the PBD paper, point triangle collision constraint.
BUT I don't know how to compute the gradient C. It's too hard for me.
I also notice at the end of PBD paper, Appendix A, give the Gradient of normalized cross product. But it still baffle me.
(I found $$ math format is not supported, sorry for I don't write the latex math formula)

Why does the second Bar not work in BarDemo?

In BarDemo, I create two bar mesh with constraints, the first bar can simulate normally, but the second bar simulate like without constraints solved as the figure shows below.
I debug the position constraints step, all constraints are solved. So I have no idea where goes wrong.

wechat image_20180111223554

Collision handling

According to PBD paper (http://matthias-mueller-fischer.ch/publications/posBasedDyn.pdf) collision constraints are handled in the same way (and solved in the same loop) as spring constraints.
So collision contraints affect postions.

In the PositionBasedDynamics library collision constraints are solved in a separate loop and affect velocities rather than position.

Why is it implemented in such a way?

Performance for games

Hi,
I build the library and the demos and everything works fine. I am trying to evaluate if the library would be fast enough for in-game use. I am mostly intersted in the tetra based solids. I tried all the demos but the most interesting was the SceneLoaderDemo with the DeformableSolidCollisionScene. At the moment it seems that the tetra armadillo is solving quite slow in both FEM and Volume constraints modes. Is there anything that could be optimized for realtime applications? Currently the armadillo has only around 4k tetras compared to tests from Carbon Tetrahedron library where they can achieve sims with 24Hz with 300,000 tets.

building on osx 10.12 with XCode 9

I found that bundled XCode clang didn't include OpenMP support, so one would need to use LLVM. I couldn't use GCC as clang was required to build the ObjectiveC shims for Tweakbar.

This is what I used to build

Install llvm 4

brew install llvm@4

Run Cmake

mkdir build; cd build

export CC=/usr/local/opt/llvm@4/bin/clang
export CXX=/usr/local/opt/llvm@4/bin/clang++
export CFLAGS='-fopenmp -Wno-deprecated-declarations'
export CXXFLAGS='-fopenmp -std=c++11 -Wc++11-extensions -Wno-deprecated-declarations'
export LDFLAGS="-L/usr/local/opt/llvm@4/lib -Wl,-rpath,/usr/local/opt/llvm@4/lib -framework OpenGL -framework GLUT"
cmake ..

The project depends on FreeGLUT, so when using OSX supplied GLUT one would need to comment out

+                       // glutMainLoopEvent();

In Demos/Visualization/MiniGL.cpp

Compilation error C2664 in MiniGL.cpp

I get the following compilation error in MiniGL.cpp on line 421 in VisualStudio2012 on Windows 8.1 64-bit machine
1>..\..\..\Demos\Visualization\MiniGL.cpp(422): error C2664: 'int TwGLUTModifiersFunc(int (__cdecl *)(void))' : cannot convert argument 1 from 'int (__stdcall *)(void)' to 'int (__cdecl *)(void)' 1> None of the functions with this name in scope match the target type

Solution:
Change the line to following
typedef int (TW_GLUT_CALL *GLUTgetmodifiersfun)(void); TwGLUTModifiersFunc((GLUTgetmodifiersfun)glutGetModifiers);

Are these changes correct?

Compile Error

I test the DeformableCollisionDemo,

void OBJLoader::loadObj
{
....
else if(type_str == "vt")
{
.....
texcoords.push_back(tex); // this will cause the following error ! see below !
vt = true;
}
}
template<> EIGEN_STRONG_INLINE void pstore(double* to, const Packet2d& from) { EIGEN_DEBUG_ALIGNED_STORE _mm_store_pd(to, from); }

Exception thrown at 0x013ED11C in DeformableCollisionDemo_d.exe: 0xC0000005: Access violation reading location 0x00000000.

How to fix that? Almost every demo seems to have access violation problem.

Linker error when building demos on Ubuntu 15.10

I'm getting a linker error when building PBD with CMake on Ubuntu 15.10. According to online sources, the problem could be fixed by inserting -lX11 at the right place, but I have no experience with CMake. I spent half an hour grepping and I couldn't figure out where that option would need to go.

This is the error output:

Linking CXX executable /home/lritter/devel/bin/BarDemo
/usr/bin/ld: /home/lritter/devel/lib/libAntTweakBar.a(TwMgr.cpp.o): undefined reference to symbol 'XCreateBitmapFromData'
/usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

How can I make my model work fine?

Dear authors:
Thanks for your repository first!
Now I have some problems when I use the SceneLoaderDemo.
By reading the DeformableSolidCollisionScence.json, I found that only the TetModels are the deformable bodies, not the RigidBodies. Thus, i tried to replace the original armadillo TetModel to my own models.
I found that three files are needed: model.obj , model.ele and model.node. Plus, by opening the .ele file through the notebook, i found that the .ele and .node files are generated by the TetGen program:
# Generated by tetgen -pqa5000.0 Armadillo_UV_low.off

If i use the original armadillo.obj with the Tetgen Program to generate tetrahedral model, the final tetrahedral mesh is too complex to simulate smoothly.
(The number of tetrahedrons and vertices is very high. Also, i translate the obj format to off format firstly by MeshLab because the Tetgen doesn't accept the obj format input).

So i think the original obj model should be simplified firstly before generating the tetrahedral model. I simplified my model by the Simplification Quadric Edge Collapse Decimation funtion provided by MeshLab.
However, I found there are some parameters should be set, such as Target number of faces ,Quality threshold, whether preserve Boundary of the mesh etc.
I don't know what are the appropriate value of these options.

More worse, when i simplified my model to a lower faces number(for example, 1000 faces), some bad properties are appeared in the simplified model such as self-intersection. Tetgen cannot process such situation. Thus, I should fix my model after the simplification. Finally, using the fixed model to generate TetModel with Tetgen.

Now, I have some doubts:

  1. How the Armadillo_UV_low.off is got? Does it adapt a similar processing scheme as me?
  2. Does my way to simplify the model right?
  3. The armadillo_4k.ele is genearted by the command tetgen -pqa5000.0 Armadillo_UV_low.off, why the allowed maximum volume of tetrahedron is set to 5000.0?

Thank you again, look forward to your reply. :)

Continuous Collision Detection and Response

Dear PBD Team,

I have working been working on combining PBD with CCD. I have got the detection part working fine via third party library or sub-stepping but I am experiencing problems with collision response.

For example lets take a case with elastic rod self-collisions where I check for edge-edge (i.e. segment-segment) collisions while tightening the knot. I have got particles initial positions x0 at t=0 at timestep start and predicted positions xp at t=1 after elastic rod constraints solve and some other collisions with static environment. I have got collisions between two edges eA and eB detected at tc .

The question now is how to compute a proper collision response? An intuitive solution would be to simply interpolate between x0 and xp using tc to collision configuration xc, compute the response delta positions dp at this configuration and set predicted positions xp=xc+dp. However, such "overriding" of predicted positions causes that the colliding edges get stuck in the air. I have also tried adding dp computed at tc directly to xp but this causes the edges to often go through each other.

Just to mention that the problem is more general and valid for edge-point or triangle-point (both moving) collisions as well.

Thank you very much for your help

Kay

Some projects (e.g. RigidBodyClothCouplingDemo, ChainDemo) throw exception under VS2015 Release Win32

Hi, everyone:

I built the whole solution under VS2015 Release Win32 configurations. A few demo projects such as RigidBodyClothCouplingDemo and ChainDemo throw exception when running.

A few warnings were thrown when building.

>..\..\..\Demos\CouplingDemos\RigidBodyClothCouplingDemo.cpp(451): warning C4316: 'PBD::RigidBody': object allocated on the heap may not be aligned 16

I debugged these two projects, both threw exceptions at around line 79 of RigidBody.h, where

void initialBody(...)
{
    // ...
    m_x = x; 
    m_x0 = x;
    m_lastX = x;
    m_oldX = x;
    m_v.setZero();
    m_a.setZero();
    m_q = rotation; // throw exception
    m_q0 = rotation;
    m_lastQ = rotation;
    m_oldQ = rotation;
    // ...
}

I changed the default alignment of the project to 16 (not worked for me), then modified RigidBodyClothCouplingDemo.cpp around line 410 from

rb[0] = new RigidBody();
rb[0]->initBody(0.0f,
    Eigen::Vector3f(-5.0, 0.0f, -5.0),
    computeInertiaTensorBox(1.0f, 0.5f, 0.5f, 0.5f),
    Eigen::Quaternionf(1.0f, 0.0f, 0.0f, 0.0f), 
    vd, mesh);

to

RigidBody* p = (RigidBody*) _aligned_malloc(sizeof RigidBody, 16);
rb[0] = new (p) RigidBody();
rb[0]->initBody(0.0f,
    Eigen::Vector3f(-5.0, 0.0f, -5.0),
    computeInertiaTensorBox(1.0f, 0.5f, 0.5f, 0.5f),
    Eigen::Quaternionf(1.0f, 0.0f, 0.0f, 0.0f), 
    vd, mesh);
std::cout << "0 " << rb[0]->getMass() << std::endl;

which made the project run temporarily (It was a bad modification, which I still got exceptions when exit or change some twkBar options).

I am wondering this issue comes from the Win32's alignment. I got stuck here, did I do something wrong in the whole procedure?

Thanks a lot.

Stanley

Cannot find the demo of "Direct Position-Based Solver for Stiff Rods"

I notice this "Crispin Deul added the implementation of his paper Deul, Kugelstadt, Weiler, Bender, "Direct Position-Based Solver for Stiff Rods", Computer Graphics Forum 2018 and a corresponding demo". But There is no corresponding demo that I can find in the project. The actual demo is where?

does the self collision feature cover in this repostory?

Dear authors:
I had gone through the readme, and I got the impression that the repostory is mainly about combine pbd and sdf, and I knew sdf can't handle self collision,so I assum that this repostory doesn't support self collision featured cloth simulation. Am I right? Please let me know, thank you!

Latest Commit.

On the latest commit you added Utils as a dependency on the Demos.

But you forgot to add a CMakeLists.txt file which builds the Utils.lib in the Utils folder .
Thus, Demo's won't build with the following error: LNK1104: Cannot open file Utils.lib .

Stretch/Shear constraint Ks are wrong

Hi there,

Unless I'm missing something, the stretching and shearing Ks in the stretch/shear constraint implementation (for cosserat rods) are being applied by scaling the world space strain, which doesn't make any sense. The strain should be expressed in the rod element's local space, so instead of rotating the director vector then calculate the strain in world space by subtracting it from p1-p0, It should be something along the lines of:

gamma = q0.conjugate() * (p1 - p0) / restLength
gamma[2] -= 1; // strain in local space

// apply stretch/shear ks

// go back to world space before applying delta corrections:
gamma = q0 * gamma;

This results in the expected behavior.

compiling error under ubuntu

Hi,

I ve been trying to compile the new library on ubuntu 16.04. After fixing a couple of errors (adding the required header files for openmp, etc) it gives me this error while linking the executable:

../../lib/libSimulation.a(TimeStepController.cpp.o): In function PBD::TimeStepController::step(PBD::SimulationModel&)': TimeStepController.cpp:(.text+0x3a2): undefined reference toPBD::TimeIntegration::semiImplicitEuler(double, double, Eigen::Matrix<double, 3, 1, 0, 3, 1>&, Eigen::Matrix<double, 3, 1, 0, 3, 1>&, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&)'
TimeStepController.cpp:(.text+0x5a3): undefined reference to PBD::TimeIntegration::semiImplicitEulerRotation(double, double, Eigen::Matrix<double, 3, 3, 0, 3, 3> const&, Eigen::Quaternion<double, 0>&, Eigen::Matrix<double, 3, 1, 0, 3, 1>&, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&)' TimeStepController.cpp:(.text+0x817): undefined reference toPBD::TimeIntegration::semiImplicitEuler(double, double, Eigen::Matrix<double, 3, 1, 0, 3, 1>&, Eigen::Matrix<double, 3, 1, 0, 3, 1>&, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&)'
.....

I checked it with different gcc versions (4.9, 5 and 6).

I d appreciate any help.

Regards,
Babak

how to solve the fluid particles pass through the boundary particles

I want to achieve the blue noise sampling with PBF, my intention is not to do simulation. When I locate the initial fluids particles randomly, the density difference are too much, therefore the particle can pass through the boundary. However, when I use the boundary level set to clamp the particle in the fluids region, the system can not work, just like the vedio they can not converge.

so, in the situation, what should I do to handle the error boundary control?

Performance drop

Hi everyone,

this morning I accidentally compiled a very old version (1.1.0) of the library. Afterwards I compiled the current version. (Both compiled with -DCMAKE_BUILD_TYPE=Release ).

I experience a noticeable performance drop between the two versions. E.g. the cloth demo is no longer performing in real time. I compared the code. The old one is single core (without OpenMP) and the current version is multi core (with OpenMP).

To me it is the same behavior I experienced when I programmed a CPU parallized PBD algorithm long long time ago. My experience was that it is not worth programming a parallized version of the PBD algorithm on the CPU because the overhead of OpenMP and the necessary data structures is too large and therefore the single core outperforms the multi core version. (GPU is a different story)

I'm not sure if my observation is correct or if I miss something. Any opinion on this topic?

Thanks in advance and best wishes from Stuttgart
Daniel

PS: I compiled under Linux Ubuntu 12.10 and g++ 4.8.1

How to handle static friction?

I find that at the end of function 'velocitySolve_RigidBodyContactContaint', 'dynamic friction' is handled. But I can not find where to handle the static friction? Or how to handle static friction in PBD method?

Build error on ubuntu 16.04

Hello,
The code doesn't compile on Ubuntu 16.04, with cmake version 3.5.1, g++ 5.4.0.

Lot of errors like :
SPlisHSPlasH-master/extern/PositionBasedDynamics/src/ExternalProject_PositionBasedDynamics/Common/Common.h:24:8: error: expected nested-name-specifier before ‘Vector2r’
using Vector2r = Eigen::Matrix<Real, 2, 1>;

I solved it by adding
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fopenmp")
in CMakeLists.txt

Same problem in SPlisHSPlasH project

I implemented the cloth simulation by the triangle constraint, but why the vertices of cloth oscillate highly?

I implemented the triangle constraint refer to your code and your paper of ContinuousMaterials, but the vertices of cloth oscillate highly.
the simulation loop is:
void positionBasedDynamics::solve()
{
triangleModel_semiImplicitEuler();
for (int i=0;i<maxItor;i++) //maxItor=5
{
FEMTriangleConstraint_solver();
triangleModel_applyDelta();
}
triangleModel_velocityUpdate();
}
I have directly assigned the one triangle's vertices, area and invRestMat to your project at one simulation step and the calculated delta correction is the same.
Is here any other detail I have missed?
thx!

Using floats instead of doubles.

Happy new year,

If I comment the following line:

define USE_DOUBLE

in Common.h

Proceeds into else condition:
#else typedef float Real; #define REAL_MAX FLT_MAX #define REAL_MIN FLT_MIN #endif

This is supposed to exist for working with floats. But Simulation does not build.
It throws : Error C2338 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY

in Matrix.h

Is this a known issue? Any workarounds?

P.S. For anyone visualizing with OpenGL, according to this question I asked and the answer following, try avoiding double precision numbers which PositionBasedDynamics uses by default.

Linux

Hi, I've made the needed changes to compile it in linux, I can create a pull-request if you're interested. Two questions:

  • it runs very slow on my computer, but that could also be because I have an extremly shitty gfx-card in the laptop and it falls back to software rendering. I guess the simulation should run in realtime, right?
  • density constraints for fluids is currently not included as well as the unified solver (is it correct that for the unified solver it would be needed to fill models with particles and create the needed constraints, otherwise the simulation is available in cpu?)

Why are the demos crashing?

Hi, in order to build the library and demos I've typed the next commands for Debug from root:

mkdir debug
cd debug
cmake -DCMAKE_BUILD_TYPE=Debug
cmake --build .

and for Release:

mkdir release
cd release
cmake -DCMAKE_BUILD_TYPE=Release
cmake --build .

Almost all demos are crashing.

Release demos crashing here
Debug demos crashing here

Could you advice about this?

Also, I've seen in your website some papers presentations including some really cool videos demos, where can i find the source code or executables to give it a shot?

Thanks in advance.

'noexcept' error when build for X86 debug

[solved]
add this section into 'common.h'

#ifndef _MSC_VER
#define NOEXCEPT noexcept
#else
#define NOEXCEPT
#endif

and then

void operator delete(void* block, int const block_use, char const* file_name, int const line_number) NOEXCEPT {

return _aligned_free_dbg(block);
}
void operator delete[](void* block, int const block_use, char const* file_name, int const line_number) NOEXCEPT {
return operator delete(block, block_use, file_name, line_number);
}

examples without boost

This engine seems interesting, but it would be great to be able to try the examples without the huge boost dependency.
This whole dependency stuff just wastes your possible users' time.
As far as I can see it only uses to parse json files, that is doable in hundreds of lines of c code, instead of using a 500MB HUGE library.

Alignment issues on Windows

When I run CosseratRodsDemo on Windows 10 with Visual Studion 2015, it crashed sometimes. I figure out that it has to do with alignment.

Acoording to this page, if one uses STL container with Eigen, she/he should use an aligned allocator.
So the solution is that all of the std::vector<Vector3r> and std::vector<Quaternionr>in ParticleData.h should be replaced by std::vector<Vector3r, Eigen::allocator<Vector3r> and std::vector<Quaternionr, Eigen::allocator<Quaternionr> respectively.

Acoording to this issue, if a class has Eigen members, you should put a EIGEN_MAKE_ALIGNED_OPERATOR_NEW macro in a public part of your class.
Thus, we should put a EIGEN_MAKE_ALIGNED_OPERATOR_NEW macro in class BendTwistConstraint, because it has a Quaternionr m_restDarbouxVector.

Why does the mesh in BarDemo keep vibrating?

I add a static rigidboy as a ground in the BarDemo. The bar are placed on the ground and simulated with FEM based PBD method. But the vertices of the mesh keep vibrating with small amplitude.
When I use Volume Constraints, this bar doesn't vibrate anymore.
So I am not clear about whether the vibrating problem is related to the FEM based PBD method or the Gauss-Seidel solver.

Issues generating project

When trying to generate the project using "PositionBasedDynamics-master" as the source and a new folder as the target build location I get the following message.

CMake Error at C:/Program Files/CMake/share/cmake-3.9/Modules/ExternalProject.cmake:1811 (message):
error: could not find git for clone of ExternalProject_Discregrid
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.9/Modules/ExternalProject.cmake:2565 (_ep_add_download_command)
CMakeLists.txt:28 (ExternalProject_Add)

Do I need to include a path to your project Discregrid?

How to run the project after make

This is not an issue. I am new to CMake. I finally have the targets built after cmake. and make . How do I run the program now? Have googled, but not been of much help.
Thanks

Cloth Continuous Collision Detection

Dear authors:
How to handle continuous collision between cloth models,cloth model self-collision ,collision between cloth model and deformable rigid body ( that you can deform the mesh of the rigid body at each simulation step)? Could you give me some suggestions?

How can I get the FPS of this program? Also about the value set of iterations.

Dear authors:
Thanks for your repository first!
But I have some problems when I use the SceneLoaderDemo. Now I want to calculate the FPS of this program. By reading your code, I found that the render function is this function:
void render(); (in SceneLoaderDemo.cpp)
Plus, the main PBD solve function is this function:
void timestep(): (also in SceneLoaderDemo.cpp)
In this timestep() function, I found that solve is carried by call sim.step(model);
But i don't know why you call the sim.step(model) continuously for 8 times for each call of the timestep() function. The original code as follows: (the other unnecessary codes are omitted)

void timestep()
{ ... 
	//simulation code 
	for (unsigned int i = 0; i < 8; i++)
		sim.step(model); 
...}

I changed this code to(by added the variable turns):

void timestep()
{ ... 
        int turns=8;
	//simulation code 
	for (unsigned int i = 0; i < turns; i++)
		sim.step(model); 
...}

What is more, I also used the C++ chrono for timing. I added these timing code at the beginning of the render() function to calculate FPS (also in the SceneLoaderDemo.cpp) :

void render()
{
_...//unnecessary codes are omitted_
	//calculate FPS
	if (!doPause)
	{
		if (frames_sumt.first == 0)
		{
			frames_sumt.first++;
			fps_tp1 = high_resolution_clock::now();
			fps_tp2 = fps_tp1;
		}
		else
		{
			fps_tp2 = high_resolution_clock::now();
			milliseconds_duration t_a_frame = duration_cast<milliseconds_duration>(fps_tp2 - fps_tp1);
			fps_tp1 = fps_tp2;
			frames_sumt.first++; //frames++
			frames_sumt.second += t_a_frame.count(); //the unit of sumt is ms
		}
	}
...
} // (frames_sumt is a c++ pair<int, double>)

When I set this variable turns in timestep() equals 8, the fps is about 39.6fps , and the running animation seems very smoothly.
But when I set this variable turns to a smaller value , for example ,1, the fps is becoming more higher about 59.8fps, while the running animation seems more slowly in contrast.
(timeStepSize=0.005, maxIter=5, maxIterVel=5)
I don't know why such situation occurs.
Plus, does my way to calculate FPS right?

Thank you again, look forward to your reply.

solve_EdgeEdgeDistanceConstraint error on end points

Edge edge distance constraint computes wrong distance when the intersection is past the end points of both segments. If the intersection is past the end of one segment, it needs to recompute the closest point on the other

Instead of

if (s < 0.0) s = 0.0;
if (s > 1.0) s = 1.0;
if (t < 0.0) t = 0.0;
if (t > 1.0) t = 1.0;

should be something like

if (s < 0.0) {
  s = 0.0;
  t = f / d;
}
else if (s > 1.0) {
  s = 1.0;
  t = (f+b) / d;
}
if (t < 0.0) {
  t = 0.0;
  if (e<0) {
    s = 0.0;
  }
  else if (e>a) {
    s = 1.0;
  }
  else {
    s = e / a;
   }
}

CMake configuration error.

I tried to build the project to Visual Studio 2015 64bit with Boost 1.62.0, during configuration error occurs

"CMake Error at C: / Program Files / CMake / share / cmake-3.6 / Modules / FindBoost.cmake: 1753 (message):
   Unable to find the requested Boost libraries.

   Boost version: 1.62.0

   Boost include path: D: / SAV / PROJECTS / NeuRob / Info and Libs / boost_1_62_0

   Could not find the following static Boost libraries:

           boost_filesystem
           boost_system

   No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the
   directory containing Boost libraries or BOOST_ROOT to the location of
   Boost.
Call Stack (most recent call first):
   Demos / SceneLoaderDemo / CMakeLists.txt: 7 (find_package) "

How to fix it? Thank you.

Visual Studio 13 : error C3646: 'noexcept': Unknown override specifier.

Good evening,

I am trying to build the Demos so i can test your library but i am facing an issue.

I generate Visual Studio 13 .sln files with the use of CMake and i am getting the C3646 error i placed on title. As i far as i am concerned Visual Studio 13 does not support noexcept and that's why i am having this issue.

So i want to know if there's any work-around you have already been over with (because obviously it won't let me compile).
Also since you claim that PBD works on Windows 7 i am guessing you used Visual Studio 15 for implementing/testing ?

Thanks a lot.

Reg. Windows Compilation

Hi,

I have downloaded the source and trying to compile for Windows 10 with VS2012.

Creates a .sln file using CMake application, when I build my application it throws many errors related to "Eigen::aligned_allocator" like this,

Error 238 error C2955: 'Eigen::aligned_allocator' : use of class template requires template argument list (....\PositionBasedDynamics\TimeIntegration.cpp) D:\PRAPTISENSE\New_Physics\PositionBasedDynamics-master\Common\Common.h 36 1 PositionBasedDynamics

Please let me know what would be the issue, Am I missing something here or do I have to download Eigen code base?

I have seen the video, the work is awesome! I believe all the simulation done on GPU level!!

Looking forward to your answer..

Thanks and Regards,
Bala

Licensing and patents

Hello,

I assume if the PBD library is using MIT license I am allowed to use it in my commercial software?

I just wanted to make sure that the use of included algorithms for softbodies, elastic rods and so on (basically the things from references section in this Git repo) is also not restricted in any way (i.e. patented). Is it? For instance, I heard somewhere that PBD itself is patented by Matthias Mueller (currently at NVidia.)

Thanks for clarification

Best regards

Shape Matching - weird behaviour

Dear Jan,

I am experiencing a weird random drift-like behaviour when applying external forces to the rigid bodies driven by your shape matching algorithm. I made a short video depicting this problem:

https://www.youtube.com/watch?v=hkFGghmarqM

I double checked my wrapping code and I am 99% it is fine. I am not sure if its a bug in your code or its just the way the shape-matching works.

Thank you in advance for your help

Regards

korzen303

Cloth keep vibrating when handling collision

Hello everyone:
I'm trying to sim a tight cloth ( two sewing quad cloth surrounding two spheres, see the pic below)
But the cloth keeps vibrating.

1

My collision constraint projection is very simple:

bool projection( Garment& garment )
{
    vec3& p   = garment.P()[ _p ];
    vec3  dir = p - _q;

    float C = dot( dir, _n );
    if ( C >= 0.0)
        return true;

    vec3 dp = _n * ( -C );
    p += dp * 1;

    return false;
}

_q, _n is the collision plane parameters.
The cloth keeps vibrating when I use larger stretch stiffness( or use smaller compliance with XPBD method ).
What should I do to avoid cloth vibrating except changing cloth stiffness?

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.