Newton 2.0x Archemedia Open Beta

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Newton 2.0x Archemedia Open Beta

Postby Julio Jerez » Tue Aug 18, 2009 9:59 am

waht do you mean single sided poligon?
The simulation should never ever explode unde eany circunstace, can you make a video to see what you mean?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0x Archemedia Open Beta

Postby rvangaal » Thu Aug 20, 2009 9:27 am

With single-sided I mean a not-culled polygon. Normally your collisions may require convex shapes, but a fence is often a single polygon. Depending on the normal of the polygon, the convex hull will hit the polygon or not.
See http://www.racer.nl/temp/evo6_movie.wmv for a (1.2Mb) small movie with a car driving through a fence in one direction, and bumping against it when trying to go through in reverse. Our 3D modeler could put 2 polygons on the spot, but it's easier to have an option to let the triangle be hit from both sides (not culled to one side only).

For the explode effect, see http://www.racer.nl/temp/evo6_explode.wmv (600Kb). The guardrail (I've checked) is 2 polygons at exactly the same spot; the normals are pointed to either side (which is why Newton becomes confused as it hits both at the same time). I don't think this is really nicely fixable, although I did try once to converse momentum - after a collision the momentum should not exceed the summed momentum of both objects colliding (in this case, the static world has momentum 0).
rvangaal
 
Posts: 61
Joined: Mon Jun 08, 2009 1:11 pm

Re: Newton 2.0x Archemedia Open Beta

Postby Julio Jerez » Thu Aug 20, 2009 9:40 am

In the secund image is the car in comming into the fence from the back side of the poligon?

give me some more information. Is this using Newton 2.0x?
Are you using the Raycast car? or are you making your own car model.
Is the level one single collision trees?

can you identifiy the fence and the place that are made by single polygons, and therefore do no have volume?
all those problems can be fixed.
Netwon Collision tress do not handle double side faces however Newton comes with Many option that can solve that problem quite eassily.

It all depend hwo much ainformation yo ucn aextact from you mesh,
For most people running simple demos teh jsu tak eteh mesh a turn it a Collsion tree, but for more elvrated project liek teh one you seem to be working
there are options that can be used bu requred more work tah just adding the face to a collision trees.

can you for example get information from the mesh and determine if for example a face in part of a Fence or a bill board, maybe by teh Material of by object name of something else?



Btw that looks very nice. Is this something you are working on in a team or by yourself?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0x Archemedia Open Beta

Postby JernejL » Thu Aug 20, 2009 11:07 am

Newton's trimesh is always one-sided, from what i read this is designed this way, and is a optimization part of the engine. The fence should have more thickness and geometry which prevents it from going into it like that.

In video #2 You hit the fence at a side which has nothing blocking you to go into it and contacts are ofcourse messed up afterwards as the body slides into the body and penetration gets bigger and sideways contacts get generated.

You can create either a two-sided trimesh by using double faces, but i would suggest you have the designers "fix" the geometry models, alternatively newton supports a custom static geometry mesh, which you can implement on your own using a double-sided algorythm, you can use something existing, such as OPCODE inside newton with this functionality.

Just another note regarding why you should have the designers fix this - no modern game ever uses two-sided polygon rendering, it's simply a waste of gpu to do so, last professional game which had this was gta3, and look at how bad the performance was when it came out, the cause of it was that they could render two-sided on a PS2 because of different architecture and so they messed that up the pc port.

Just thinking.. level designers save triangles by using a 1-polygon thin fence, and then waste the benefits by forcing it to be rendered without face culling.. :)
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Newton 2.0x Archemedia Open Beta

Postby Julio Jerez » Thu Aug 20, 2009 11:33 am

Some time it is too tough askin a desigend to chaneg teh geomnety so dramatically, for what I see ther is a lot of work put into that.
Ther are oethe solution.

On teh usin Opcode of oether polygion sopu queries, I have to say that there is a good compelling reason for using the collision tree,
Collision trees are not just a naive collection of faces and indices, they contain edge information.
for example they can tell the engine if an edge is concave, flat, or convex, They also can optimize coplanar faces array, they are very, very fast, and they privide information for high quality contact generation to the solver.
(believe me this one of eth thing that separate Newton from other solutions)

But the performance and functionality comes at the price that they cannot be double sided,

It they allow double sided faces then if more than two faces converging at one edge, it will be impossible to determine if they can be combine into a larger face, or if the edge must be preserved because is flat of convex.

The solution is to filter the entire singe side faces, the either create a SceneCollision, or a more than one collision tree. The two collision tree solution is two pass solutions.

The first pass creates a collision tree and adds all the faces to the collision tree,
The second pass check only for the single sided faces and add then to a second collision trees with the winding inverted. then you add two static bodies.

The first solution is like the first it make the two trees, but it add then to a SceneCollision
This is better because you can add lot of many static bodies than can be represented by a close form shapes, for example trees in the level you can make the canopy a convex hull, and leave the stem as part of the collision tree. The possibilities are almost unlimited

The only requirement is the you have to be able to identify those special face by some means.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0x Archemedia Open Beta

Postby Julio Jerez » Thu Aug 20, 2009 12:57 pm

rvangaal wrote:For the explode effect, see http://www.racer.nl/temp/evo6_explode.wmv (600Kb). The guardrail (I've checked) is 2 polygons at exactly the same spot; the normals are pointed to either side (which is why Newton becomes confused as it hits both at the same time). I don't think this is really nicely fixable, although I did try once to converse momentum - after a collision the momentum should not exceed the summed momentum of both objects colliding (in this case, the static world has momentum 0).


On the explode My guess is that that is there is a big penetration because contacts normal were generated in the wrong direction.
Then what happen is that there fance goes under the car body, and the car take off like if it was going over a steep ramp.
Because teh solver was trying to recover from penetration fololwing the shortest path to a penetration free poistion.

It is wrong behavoiur and it does not look like that graphically but from the phsyics point of view were the solver only sees contacts and constraints, that's how it looks like
and it is the correct respond for that set up.
This is all solvable once the collision mesh is well behave meaning there will be a contact that can represent the fence edge correctly instead of only the fence face.

On the momentum, Let us not talk about consevation of mementum until those problems are solved. I can asure you, you do no need to worry about that.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0x Archemedia Open Beta

Postby Julio Jerez » Sat Aug 22, 2009 1:36 pm

next beta is ready 30% performance gane across the board in all 32 bit versions (only with VS 2008 because supports the option fast float, 2003 vertin do not get this performance gain)
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0x Archemedia Open Beta

Postby winstrol » Sat Aug 22, 2009 4:04 pm

in iPhoneTutorials is a bug, when I want to roll the weel on the NewtonBox, that wheel jumping

hear is the movie:
http://www.insurgents.net/~winstrol/wheel.mov
User avatar
winstrol
 
Posts: 30
Joined: Fri Jul 24, 2009 9:57 pm

Re: Newton 2.0x Archemedia Open Beta

Postby Julio Jerez » Sat Aug 22, 2009 5:34 pm

I can not see the movie
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0x Archemedia Open Beta

Postby melven » Sat Aug 22, 2009 5:36 pm

Hi, I'm trying to implement a player-controller in OgreNewt (based on the CustomPlayerController-joint).

First of all, the player controller seems to work nice ;-).

At the moment I just "copied" the code from the CustomPlayerController-class ( with modifications, so it uses Ogre's vectors etc).
It seems to work now, but I still have a few questions:
- If you move the player in the middle of two "illegal" ramps ( like a 'V' ), it gets stuck ( I did test this only with my version of the player-controller ). This happened when moving on some small boxes... If you have an idea how to solve this, I would be happy...

- In the following code from the CustomPlayerController::PlayerOnLand function, the hitParam can be 1.02, when the convex-cast in the for-loop doesn't hit anything, is this the intented behavior? (the hitParam is used to set the position later on... it seems to work though)
Code: Select all
      if (hitParam > 1.0e-3f) {
         int isFuturePosiInRamp;

         dVector   floorNormal (info[0].m_normalOnHitPoint[0], info[0].m_normalOnHitPoint[1], info[0].m_normalOnHitPoint[2], 0.0f);
         isFuturePosiInRamp = (floorNormal % upDir) < m_maxSlope;
         if (isFuturePosiInRamp) {
            // apply free fall gravity force to the body along the ramp
            dFloat hitParam1;
            NewtonWorldConvexCastReturnInfo info1;
            bodyMatrix.m_posit = posit + upDir.Scale (m_stairHeight - m_kinematicCushion);
            target = bodyMatrix.m_posit - upDir.Scale(m_stairHeight * 2.0f);
            NewtonWorldConvexCast (m_world, &bodyMatrix[0][0], &target[0], m_bodyFloorSensorShape, &hitParam1, &castFilterData, ConvexAllBodyCastPrefilter, &info1, 1, threadIndex);

            if (hitParam < hitParam1) {
               int iterations;
               int contactCount = 1;
               // the player hit the edge of a forbidden ramp
               dVector savedVeloc (velocity);
               for (iterations = 0; contactCount && (iterations < MAX_COLLISIONS_ITERATION); iterations ++) {
                  dFloat projectVel;
                  floorNormal -= upDir.Scale (floorNormal % upDir);
                  _ASSERTE ((floorNormal % floorNormal) > 1.0e-3f);
                  floorNormal = floorNormal.Scale (1.0f / dSqrt (floorNormal % floorNormal));

                  projectVel = velocity % floorNormal;
                  velocity -= floorNormal.Scale (projectVel);

                  step = velocity.Scale (timestep);
                  bodyMatrix.m_posit = posit + step + upDir.Scale (m_stairHeight - m_kinematicCushion);
                  target = bodyMatrix.m_posit - upDir.Scale(m_stairHeight * 2.0f);

                  castFilterData.m_count = 1;
                  contactCount = NewtonWorldConvexCast (m_world, &bodyMatrix[0][0], &target[0], m_bodyFloorSensorShape, &hitParam, &castFilterData, ConvexAllBodyCastPrefilter, info, 1, threadIndex);
//
//
//
// here the hitParam can be 1.02 or so, if contactCount is 0
//
//
//
                  if (contactCount) {
                     floorNormal = dVector (info[0].m_normalOnHitPoint[0], info[0].m_normalOnHitPoint[1], info[0].m_normalOnHitPoint[2], 0.0f);
                     //floorNormal = dVector (info[0].m_normal[0], info[0].m_normal[1], info[0].m_normal[2], 0.0f);
                     contactCount = (floorNormal % upDir) < m_maxSlope;
                  }
               }

               if (iterations >= MAX_COLLISIONS_ITERATION) {
                  dVector veloc1 (CalculateVelocity (savedVeloc, timestep, upDir, 0.0f, threadIndex));
                  dVector err (veloc1 - velocity);
                  if ((err % err) < 1.0e-6f) {
                     m_playerState = m_onIlligalRamp;
                  } else {
                     velocity = veloc1;
                     hitParam = 0.0f;
                     step = dVector (0.0f, 0.0f, 0.0f, 0.0f);
                     bodyMatrix.m_posit = posit - upDir.Scale (m_kinematicCushion);
                  }
               }

            } else {
               m_playerState = m_onIlligalRamp;
            }
         }
//
//
//
// then if iterations was < MAX_COLLISION_ITERATION it is used here to set the position
//
//
//
         bodyMatrix.m_posit = bodyMatrix.m_posit + (target - bodyMatrix.m_posit).Scale (hitParam) + upDir.Scale (m_kinematicCushion);
         bodyMatrix.m_posit -= step;
         NewtonBodySetMatrix (m_body0, &bodyMatrix[0][0]);
      }
melven
 
Posts: 14
Joined: Wed Jun 25, 2008 7:21 am

Re: Newton 2.0x Archemedia Open Beta

Postby winstrol » Sat Aug 22, 2009 6:54 pm

I deleted the movie, here is the test project:
http://www.insurgents.net/~winstrol/iPh ... rials2.zip

set active target to tutorial102 and move the wheel by pressing up and down arrows on the screen
under tutorial101 is the very simple car, you can also see the problem there, because car is jumping
User avatar
winstrol
 
Posts: 30
Joined: Fri Jul 24, 2009 9:57 pm

Re: Newton 2.0x Archemedia Open Beta

Postby Julio Jerez » Sat Aug 22, 2009 7:33 pm

melven wrote:Hi, I'm trying to implement a player-controller in OgreNewt (based on the CustomPlayerController-joint).

First of all, the player controller seems to work nice ;-).

At the moment I just "copied" the code from the CustomPlayerController-class ( with modifications, so it uses Ogre's vectors etc).
It seems to work now, but I still have a few questions:
- If you move the player in the middle of two "illegal" ramps ( like a 'V' ), it gets stuck ( I did test this only with my version of the player-controller ). This happened when moving on some small boxes... If you have an idea how to solve this, I would be happy...

- In the following code from the CustomPlayerController::PlayerOnLand function, the hitParam can be 1.02, when the convex-cast in the for-loop doesn't hit anything, is this the intented behavior? (the hitParam is used to set the position later on... it seems to work though)

There are still some more refitnmenet I nee to add to the player controller,
It is good you are testing it, because the more case the more case can be added to the state machine

It is posible for me to see a test of a movie?
I still have soem areas whe it jitter when it hot a wall in a precarisu way. I will try to fix that.
Are you re implementiong the joint? or are you deriving from it?
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0x Archemedia Open Beta

Postby Julio Jerez » Sat Aug 22, 2009 7:36 pm

winstrol wrote:I deleted the movie, here is the test project:
http://www.insurgents.net/~winstrol/iPh ... rials2.zip

set active target to tutorial102 and move the wheel by pressing up and down arrows on the screen
under tutorial101 is the very simple car, you can also see the problem there, because car is jumping


Oh Cool, you are making the car for the iphone, I will chek it out tomorrrow morning, maybe I will add it as next tutorial.
Also had you getten the laste SDK, there are soem optimization an dsome change sonc eteh last Mac version
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Newton 2.0x Archemedia Open Beta

Postby winstrol » Sun Aug 23, 2009 6:37 pm

Oh Cool, you are making the car for the iphone, I will chek it out tomorrrow morning, maybe I will add it as next tutorial.

In tutorial102 code I've almost done the "tutorial203-raycastcar" but I have problems with implementing:
Code: Select all
struct dQuaternion InitFromMatrix (struct dMatrix* matrix)
to finish this, maybe you will try to do this (commented part of code in dQuaternion.m)

Also had you getten the laste SDK, there are soem optimization an dsome change sonc eteh last Mac version

yes, I have new SDK, thank you
User avatar
winstrol
 
Posts: 30
Joined: Fri Jul 24, 2009 9:57 pm

Re: Newton 2.0x Archemedia Open Beta

Postby deadvirus » Sun Aug 23, 2009 6:46 pm

I use a cylinder collision for my Airplane shots, but since I've updated to Newton 2.08, the collision orientation of my shots goes wrong.
Before, the collision was aligned with the mesh independent of the shoot direction. But now it is not aligned anymore! And the collision orientation relative to the mesh orientation changes if I change shot direction (airplane orientation)...
By the way, the node's (and mesh) position/orientation is managed by the OgreNewt body, so if the mesh is right oriented, so should the collision be... I think melven didn't change that part of the code...
deadvirus
 
Posts: 5
Joined: Thu Aug 06, 2009 6:57 pm

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron