NewtonCollisionSetCollisionMode behavior change

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: NewtonCollisionSetCollisionMode behavior change

Postby Julio Jerez » Sat Jul 26, 2014 7:12 pm

manny wrote:
so for an user that is not running any of the newton demos, any of the third party libraries with the exception of those two, is part of the build
This is the same for Mac and Linux, and on those tow platform does even use pthread since pthreads is the standards on those plaforms.

Sorry, I was referring only to the sandbox build process!
But still, the regular newton process is kinda fragmented, our local branch merges the following projects into a single output library:
* core
* newton
* physics

there is always going to be difference of opinions, the reason why there are three libraries there is this.
* core is a general computation geometry library that has nothing to do with physics simulation, I use for other projects.
* physyc is the c ++ physic library that is build I=on top of core. It can be use as a C++ library. although this has being so long tat it will be difficult to use like that now
* newton is a C wrapper on physic.

The libraries are actually very small, to me this not a real big problem

On the xcode, I have 4.5 but I see that the latest is 5.1.1 I am getting that now.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionSetCollisionMode behavior change

Postby Julio Jerez » Sun Jul 27, 2014 12:02 am

Ok after updating to xcode 5.1.1 everything compile and runs now.

OS 10.8 seems to be the most horrendous version of the OS yet. It is a resource sink hole, it is taking about 60% of the CPU time and that's with 4 cores.

I know this because the last version when I enable multithreading I got about twice the performance with OS 10.7 and now I get a net lost with OS10.8.
This is because the OS is try to monitor the threads run in the OS, my guess is that OS 10.8 is running ton of demos on the background.

Also the OpenGL performance is atrocious, I get 150 fps in release mode, just drawing one flat polygon and two boxes and every is compiled display list.
If I run some of the other scenes with more objects, I get less that 50 fps. IN the PC I get 1500 fps in the same scene with a mediocre video card.
My Mac has a very powerful video card. I do not know what is wrong with apple but every since the think they are the king of the hill, they go from bad to worse.

The other problem is that for some reason I can not read two mouse click bottom independently, so the kinematic placement demo does not work using two mouse bottoms.
I am not sure if this has always being like that since I'd never tried to click two button on a Mac at the same time, it seems that should works. but if it does not, I will just change the interface to use one button.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionSetCollisionMode behavior change

Postby manny » Sun Jul 27, 2014 8:51 am

Julio Jerez wrote:Ok after updating to xcode 5.1.1 everything compile and runs now.

Interesting, the solution is built for Xcode 4.0+ , I will check this out.

OS 10.8 seems to be the most horrendous version of the OS yet. It is a resource sink hole, it is taking about 60% of the CPU time and that's with 4 cores.

I know this because the last version when I enable multithreading I got about twice the performance with OS 10.7 and now I get a net lost with OS10.8.
This is because the OS is try to monitor the threads run in the OS, my guess is that OS 10.8 is running ton of demos on the background.

I think 10.7 was already incredibly slow compared to 10.6 (snow leopard IIRC). I used to have a first-gen macbook air, and 10.7 was just too slow and the fan was spinning constantly.

Also the OpenGL performance is atrocious, I get 150 fps in release mode, just drawing one flat polygon and two boxes and every is compile display list, if I run some of the other scene with more object I get less that 50.
IN the PC I get 1500 fps in the same scene with a mediocre video card. My Mac has a very powerful video car.

I do not know what is wrong with apple but every thong the think they are the king of the Hill they go from bad to worse.

The other problem is that for some reason I can no ready two mouse click bottom independently, so the kinematic place does no work using two mouse bottoms.
I am not sure if this has always being like that since I'd never try to click tow bottom on a Mac at the same time, it seem that should works. by if it does not I will just change the interface to use one bottom.

Well, to be fair, using displaylists is not really the way to go - they probably have a bug in the driver code. Would be a good idea to switch to either VAs or VBO.
Maybe it would be a good idea to use a third party rendering engine, so the visual part is abstracted away and you don't have to bother with developing a renderer.

Julio Jerez wrote:* core is a general computation geometry library that has nothing to do with physics simulation, I use for other projects.

Ah, I see, you're using the core for other projects - that makes sense then. Don't worry about it, it was just how we're building the library and in any sophisticated integration will have custom build files anyway.
http://www.instaLOD.io - InstaLOD - State of the art 3D optimization
manny
Site Admin
Site Admin
 
Posts: 131
Joined: Tue Feb 11, 2014 6:49 pm

Re: NewtonCollisionSetCollisionMode behavior change

Postby Bird » Mon Jul 28, 2014 3:17 pm

maybe if you just change your test body to Kinematic it will work.


Works perfectly now using a Kinematic body. Thanks very much for taking the time to sort this out for me.

Maybe it would be a good idea to use a third party rendering engine, so the visual part is abstracted away and you don't have to bother with developing a renderer.


I've been looking around for one for awhile and Horde3d looks to be really well done ... but it looks like development is stalled for now.
http://www.horde3d.org/

Also NVIDIA recently released a new version of their Opengl Framework.. It looks to have a basic gui api too but I don't know if there's enough there so that you could pull out wxWidgets from Newton
'https://github.com/NVIDIAGameWorks/OpenGLSamples

-Bird
Bird
 
Posts: 636
Joined: Tue Nov 22, 2011 1:27 am

Re: NewtonCollisionSetCollisionMode behavior change

Postby Julio Jerez » Mon Jul 28, 2014 4:28 pm

Bird wrote:Works perfectly now using a Kinematic body. Thanks very much for taking the time to sort this out for me.-Bird


Ha cool, I was waiting for you to give me feedback, so that I can move to add the part we talked about before the bug happend,
you know the rotation of the phantom so that it find a level set of contacts that make the object placement stable.
I added all the support already I just nee to add that to the demo.

On the OpenGl, I may check the nvidea openGl wrapper, I am reluctant to use any specific this party engine for demoing the physics engine.
I have made that mistake few time already, and people start believing the engine is a wrapper for some other game engine.
If the NVidia framework is lightweight, I made replace the newton demos, But I will always keep WxWidget for my other projects

The model editor, is not complete yet but I have p[lane to make and asset creator tool that can be use to put together physic effects that can be loaded
but some applications, for that you nee a heavy duty GUI like wxWidget or maybe C#.
C# is too much Microsoft, to me wxWighet with all it problems, it the only GUI that is powerful enough, very friendly license,
cross platform with the platform look and feel, free and when you se it is very small size for what it does.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionSetCollisionMode behavior change

Postby AntonSynytsia » Mon Jul 28, 2014 10:41 pm

Juleo, I can see that you remained
NewtonKinematicBodySetCollidable to NewtonBodySetCollidable. This is a good move, however, it doesn't work with dynamic bodies. From my understanding it was meant for kinematic bodies.

Dynamic bodies require NewtonCollisionSetCollisionMode(body_ptr, mode). From my tests the latest revision hasn't been working properly:
Image

According to this post, NewtonCollisionSetCollisionMode has 3 modes now, from which one of them is not finished, but in Newton.cpp the function is still at two modes (mode ? true : false). Looks like it's unfinished.

Is this still being worked on?
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm

Re: NewtonCollisionSetCollisionMode behavior change

Postby Julio Jerez » Tue Jul 29, 2014 8:53 am

AntonSynytsia wrote:According to this post, NewtonCollisionSetCollisionMode has 3 modes now, from which one of them is not finished, but in Newton.cpp the function is still at two modes (mode ? true : false). Looks like it's unfinished.
Is this still being worked on?


no that was no necessary.
I do not understand the video, what it is doing?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionSetCollisionMode behavior change

Postby Bird » Tue Jul 29, 2014 9:43 am

Ha cool, I was waiting for you to give me feedback, so that I can move to add the part we talked about before the bug happend,
you know the rotation of the phantom so that it find a level set of contacts that make the object placement stable.
I added all the support already I just nee to add that to the demo.

Excellent!. That will be a great feature to have. I'm back home now ready to test it out. :)

-Bird
Bird
 
Posts: 636
Joined: Tue Nov 22, 2011 1:27 am

Re: NewtonCollisionSetCollisionMode behavior change

Postby AntonSynytsia » Tue Jul 29, 2014 11:04 am

Julio Jerez wrote:
AntonSynytsia wrote:According to this post, NewtonCollisionSetCollisionMode has 3 modes now, from which one of them is not finished, but in Newton.cpp the function is still at two modes (mode ? true : false). Looks like it's unfinished.
Is this still being worked on?


no that was no necessary.
I do not understand the video, what it is doing?

In the video, the body is set noncollidable (NewtonCollisionSetCollisionMode(body_ptr, 0)), but it doesn't act noncollidable in some ways.
At some points it will even result in a crash, displaying this message:
Image
Edit: This crash error message above displayed because of my own incorrect implementation. It doesn't has to do with anything in collision.
Last edited by AntonSynytsia on Wed Jul 30, 2014 5:02 pm, edited 1 time in total.
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm

Re: NewtonCollisionSetCollisionMode behavior change

Postby Julio Jerez » Tue Jul 29, 2014 12:17 pm

you must have something wrong something in wrong, because dynamic bodies can no be set non collidable, basically the function does nothing
you can set collision shape or sub collision shape of a dynamics body to be non collidable, by no the entire dynamics body

can you set break points?
if you can, set a break point on this function
file: ../coreLibrary_300\source\newton\Newton.cpp
line: 4526
Code: Select all
void NewtonBodySetCollidable (const NewtonBody* const bodyPtr, int collidable)
{
   TRACE_FUNCTION(__FUNCTION__);
   dgBody* const body = (dgBody *)bodyPtr;
   body->SetCollidable(collidable ? true : false);
}


then form there step into function body->SetCollidable(collidable ? true : false);

I should call this function
dgDynamicBody::SetCollidable (bool state) {}
which does nothing
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionSetCollisionMode behavior change

Postby AntonSynytsia » Tue Jul 29, 2014 4:10 pm

It seems the convex box pass through all convex bodies, but not through tree collisions. The floor shape in the video above is a tree collision. When I set it to static convexhull (with mass of zero) the cube passes properly through the floor, but not when I make it a tree collision. There were always some behavior inconsistencies with tree collisions; such as bodies jumping on tree collisions (viewtopic.php?f=12&t=8650); however, I don't yet understand why it behaves that way. Maybe tree collision doesn't check whether its contacting body is collidable. Maybe I'm implementing tree collisions improperly. I'll look into the tutorials again, and see what I implemented improperly. Maybe replacing it with user mesh collision would be probable.

To ensure that collision mesh was properly generated in the first place, I turned collision mode back and the body was colliding fine (not passing at any positions).
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm

Re: NewtonCollisionSetCollisionMode behavior change

Postby Julio Jerez » Tue Jul 29, 2014 4:22 pm

AntonSynytsia wrote:When I set it to static convexhull (with mass of zero) the cube passes properly through the floor, but not when I make it a tree collision.


what do you mean the cube pass properly trough the floor? the cube should never pass trough the floor for dynamic bodies.
In all demo tin the sand box the floors are tree collision. I do not why you say is behave inconsistent,
My guess Is that when you build the tress collision you are passing face with winding inverted.
In Newton the faces of a tree collision are single sided.

to summarized.
is the collision working or falling with box vs Box?
is the collision working or failing with box vs Tree collision?

has you implemented a debug display, you can show the contact points and the collision mesh, that can help to find out the problem.

also if you play the sandbox demos BasicStacking.cpp in that demo the floor is a collision tree. and the box fall on the floor and do not jitter.
If it works there is shoulf also work for you, are you passing the face twice to the collision tree?
Some people do that to fake double face but newton does not supports that
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: NewtonCollisionSetCollisionMode behavior change

Postby Bird » Tue Jul 29, 2014 4:32 pm

There were always some behavior inconsistencies with tree collisions; such as bodies jumping on tree collisions

I have been occasionally experiencing this too in the latest builds ... it's very hard to reproduce though.

-Bird
Bird
 
Posts: 636
Joined: Tue Nov 22, 2011 1:27 am

Re: NewtonCollisionSetCollisionMode behavior change

Postby AntonSynytsia » Tue Jul 29, 2014 4:34 pm

AntonSynytsia wrote:There were always some behavior inconsistencies with tree collisions; such as bodies jumping on tree collisions (viewtopic.php?f=12&t=8650);

When I said this, I based it on the Newton version a few weeks ago, but all the penetration effects no longer occur in the current release. Sorry for confusing you.

Is the collision working or falling with box vs Box?

Working
Is the collision working or failing with box vs Tree collision?

Failing

has you implemented a debug display, you can show the contact points and the collision mesh, that can help to find out the problem.

Yes!

I will post the video shortly
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm

Re: NewtonCollisionSetCollisionMode behavior change

Postby Julio Jerez » Tue Jul 29, 2014 4:34 pm

another thing you can do is to serialize the scene a try loading in the sandbox demo.
after you make the scene, you just call
void NewtonSerializeToFile (const NewtonWorld* const newtonWorld, const char* const filename);

and it will save to a file, you can then load that file in eth sandbox demo and if it load and still fail, you can send it to me and I can see what is wrong.
In the sand box demo you can check for contacts, and see the collision mesh and so on.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests