FaceAttribute and NewtonCollisionCollide

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: FaceAttribute and NewtonCollisionCollide

Postby Stucuk » Wed Apr 18, 2012 11:52 am

@Julio Jerez: If a world is saved with serializeCallback's being used, does that mean that you have to have the same serializeCallback's in the loading? As in if Yezide for example posted a Serialized Physics File for you to debug could you then load it in your test app even if it had custom body data in it(Without you knowing what the custom data is)? If you can't id recommend that you modify the format so that you can skip the custom data(Would make debugging easier if you can load other peoples Serialised Physics).
User avatar
Stucuk
 
Posts: 801
Joined: Sat Mar 12, 2005 3:54 pm
Location: Scotland

Re: FaceAttribute and NewtonCollisionCollide

Postby Julio Jerez » Wed Apr 18, 2012 12:25 pm

Stucuk wrote:@Julio Jerez: If a world is saved with serializeCallback's being used, does that mean that you have to have the same serializeCallback's in the loading?


no you do not, there serializtion take a callback as agrument.
for each body you get that call and teh application can save information for what object typoe is being serialized.

for exmaple you have a body that is a grabity body,
inther call back you get teh user data, and read what typy it is, you cna wriet a streing that say "gravity object"

say you have a hiovercraf with a special furce an toruq call back, you can save "hover craft"
you do the same for visuall mesh, for exampelk you can save teh path to were teh best is or a code that look up fo the mesh from an mesh cache.

the engine serialization has a tag, so it knwo hwo to skip data that does no undertand.

for exampel I I rad that model in anoeth app, I do not knwo wha thso estrem mean, by I can assign a gravity function. as a place holler
it is up to the client to pass teh ampund of infrmnation about teh object that he wan to pass.

for exampel you cna make a sysme when you save teh name of a script that when excecute it can find the function inself as a compiel shader, (for that we have to wait until Core 300 in in beta and I go back to teh Netwon sript system)
but nothong stop anyone form actually using a scripl language an envede the call back as a Just in tiem compiler, and and intepreted script .
remenbe contrary to what we are let to beleieve by teh self appoinetd experts, call back are sheap and spdul be use, ther si no reason whe a call back can be implented as a script.
it is all upto waht a client app wants to do and share.


Stucuk wrote:...for example posted a Serialized Physics File for you to debug could you then load it in your test app even if it had custom body data in it(Without you knowing what the custom data is)? If you can't id recommend that you modify the format so that you can skip the custom data(Would make debugging easier if you can load other peoples Serialised Physics).

yes the reason for tags in the file is so that the visual debuger and the SDK demos app can load the file placing placeholder callbacks, and proxy viusal meshes, by skeeping the user specific data in the file.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: FaceAttribute and NewtonCollisionCollide

Postby Julio Jerez » Wed Apr 18, 2012 12:32 pm

Yezide wrote:cool, still possible to serialize individual bodies/shapes/etc I take it?

yes you will be able to serialize on demand.

a collision, a body, a joint, and my favory, a feature (a constraction of bodies, joints and shapes)
but teh tool will not parce that, only full serialzation. the tood and teh debuger if for simplyfing support to the end users. no need to deal with such detail.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: FaceAttribute and NewtonCollisionCollide

Postby Julio Jerez » Sun Apr 22, 2012 10:37 am

I modified the serialize interface. now it take an array of bodies, that way the client application can serialize selection rather that complete worlds,
the interface is like this now
Code: Select all
void NewtonSerializeBodyArray (const NewtonWorld* const newtonWorld, NewtonBody** const bodyArray, int bodyCount, NewtonOnBodySerializationCallback serializeBody, NewtonSerializeCallback serializeFunction, void* const serializeHandle);
void NewtonDeserializeBodyArray (const NewtonWorld* const newtonWorld, NewtonOnBodyDeserializationCallback deserializeBody, NewtonDeserializeCallback serializeFunction, void* const serializeHandle);


I also added the Scene collision, for what you described you have a world with lot of static objects, at mix of terrain polygonal meshes, and rigid solid.
the scene collision is a static compound collision, so it can take convex, and poligonal mesh.

for world with my static terrain paches with terrain LOD, polygonal meshes, and solid convexes (collsion scene does not allow to take other collision scene as child shape) .
This offer a big level performance optimization and memory saving.
say for example you have a work with 1000 static mesh, and 100 dynamiocs bodies.
if each piece is added to the broad phase as a body.
the broad phase time complexity is k * n log2(n) whil is k * 1100 * log2 (1100)
this is because the does not know that a static body does no move, and even if it did to add that information to a single brad phase,
you end of with a series of states represent by dirty flags in the broad phase and each body.
The reason for this is that the only way to extract that information is by haven a full graph, and the broad phase if a top down tree. therefore graph connectivity has to be added with dirty flags.
this was the approach used in core 100 and 200

for core 300, and by the end of core 200 I realize that the person who knows better how to optimize the collision is the client application.
The client will know when a body is static, if it has more statics than dynamics, or vise verse.

this can be accomplished by assign some sort of grouping to the collision system. But the engine had that already, it was the compound collision.
So I realize that with little modification to the compound collision, basically adding the ability to add, and remove children and modifier the transform matrix of a child shape. this is what the collision engine needed.

so I did that and now scene collision is a powerful system that let the end application to add unlimited number of static shape at chapel cost. Say for example you want to add a tree forest.

normally people do that by making a series for trees, and placing instances of the at random.
with the new collision system the cost of adding a new copy is simple a new node in the collision scene.
while the all system add a complete body.

let us now calculate the time complexity for the above example.

we know that 1000 entities are static, but they do not collide with each other.
the worse time complexity for this object is if every other object is in intersecting its AABB.
the time complexity of colliding one object with the scene collision is log (n)

so when all bodies intersect the aadd of the collision scene we have 100 * log (1000)
all the dynamics bodies can collide with each other so they time complexity is 100 * log (100)

so the total time complexity is now

k * 100 * (log2 (1000) + log2 (100))

if we neglect the log2(100) over

you can see how the performance a least 10 time that of the general tree. In general is much better.

what this mean is that a client application can literally add 10's of thousand of object to a world in cost effect way.
Meaning objects will only be consider for calculation when a dynamic object is nearby and not other time.

Scene collision is the Newton solution for Next generation games like you see in crisis, and battle field 4.
while still being general phys engine.
those technologies are so tight that they cannot afford to use a their part engine, they actually have to write custom solutions.
While those game are very impressive graphically, when you analyze the closely the physics is of very poor quality. Bad collision, bad physics resolution.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Previous

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron