Re: [osg-users] Questions about physic engines.

2010-02-10 Thread Mathias
On Monday 08 February 2010 09:38:53 pm Paul Martz wrote:
 Ricardo Ruiz wrote:
  Thanks.
 
  Just one question, OSG renders at the maximun amount of FPS it can, but
  ODE requires a fixed time step. How do you solve this problem? Thanks a
  lot.
 
 Is there a reason you're not synced to vertical swap? If you were to
 enable that, then OSG would render at the refresh rate of the monitor
 (unless you have a huge rendering load). Assuming you use the monitor
 refresh rate as the ODE simulation interval, then the two sample rates
 would match. End of problem.
 
 I'm not sure my Bullet work will help here, as Bullet doesn't require a
 fixed time interval. You just pass an arbitrary elapsed time interval to
 stepSimulation and Bullet produces sim results accordingly.
 
 osgBullet (at http://osgbullet.googlecode.com) includes a mechanism to
 share transform data between separate rendering and physics threads,
 allowing both to run at whichever rate they choose (not to mention take
 advantage of multicore systems). So if you can't find any way for ODE
 and OSG to use the same sample rate, then a mechanism like this might help.
 
 I seem to recall someone making some changes to osgViewer a while back
 to control the frame rate. I didn't really follow that change or
 discussion. Maybe just looking at the source code would be revealing.
 -Paul
 
 
 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
Hi,

I'm working on a project (work in progress, still growing) which combines 
bullet and osg. Currently there are only rigid bodies and I'm not using 
osgBullet or osgPhysics. 
What I've done so far:
- separate threads for bullet and osg
- usage of btDiscreteDynamicsWorld
- a loader which loads 3d objects and calculates simplified collision bodies

Any loaded 3d object is attached to the OSG-graph and its collision body is 
attached to the DynamicsWorld. 
The physics thread runs at a high frequency while the gfx-thread is synced to 
the vertical swap. Even if vsync is off you can implement a frame limiter by 
measuring the time a single frame needs to be calculated. You can then put the 
gfx thread to sleep (OpenThreads::Thread::microSleep()).
You can calculate the frame-time in the same way for the physics-thread. Use 
this value as simulation step. The high update rate of the physics thread 
prevents punch-through effects for fast moving objects. 
The transform data of the collision bdoy is read from the gfx-thread in an OSG 
update callback. You may have to sync both threads here. 

Greetings
Mathias Buhr
-- 
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Questions about physic engines.

2010-02-10 Thread Jan Ciger
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 2010-02-08 20:23, Ricardo Ruiz wrote:
 Thanks.
 
 Just one question, OSG renders at the maximun amount of FPS it can,
 but ODE requires a fixed time step. How do you solve this problem?
 Thanks a lot.

Easy, you measure the elapsed time between the frames and execute as
many fixed steps as needed to fit inbetween the two frames. I believe
that ODE even provides a convenience method for it. Of course, that
assumes that the fixed step is small - which is what you want anyway for
stability and accuracy.

Regards,

Jan
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFLcq92n11XseNj94gRAvX6AKC0Mut5cgm61FkXd4hd+wTVi/EjjACfepn+
UXGzcJiBRzsKdCQ7VyPra30=
=tdzi
-END PGP SIGNATURE-
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Questions about physic engines.

2010-02-08 Thread Ricardo Ruiz
Thanks.

Just one question, OSG renders at the maximun amount of FPS it can, but ODE 
requires a fixed time step. How do you solve this problem? Thanks a lot.

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=23813#23813





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Questions about physic engines.

2010-02-08 Thread Cedric Pinson
Hi,
I know Paul did some work to use bullet physic engine with osg.
A search of osgBullet should point to his work.

Cheers,
Cedric

-- 
Provide OpenGL services around OpenSceneGraph and more
+33 659 598 614 Cedric Pinson mailto:cedric.pin...@plopbyte.net
http://www.plopbyte.net


On Mon, 2010-02-08 at 19:23 +, Ricardo Ruiz wrote:
 Thanks.
 
 Just one question, OSG renders at the maximun amount of FPS it can, but ODE 
 requires a fixed time step. How do you solve this problem? Thanks a lot.
 
 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=23813#23813
 
 
 
 
 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 


signature.asc
Description: This is a digitally signed message part
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Questions about physic engines.

2010-02-08 Thread Paul Martz

Ricardo Ruiz wrote:

Thanks.

Just one question, OSG renders at the maximun amount of FPS it can, but ODE 
requires a fixed time step. How do you solve this problem? Thanks a lot.


Is there a reason you're not synced to vertical swap? If you were to 
enable that, then OSG would render at the refresh rate of the monitor 
(unless you have a huge rendering load). Assuming you use the monitor 
refresh rate as the ODE simulation interval, then the two sample rates 
would match. End of problem.


I'm not sure my Bullet work will help here, as Bullet doesn't require a 
fixed time interval. You just pass an arbitrary elapsed time interval to 
stepSimulation and Bullet produces sim results accordingly.


osgBullet (at http://osgbullet.googlecode.com) includes a mechanism to 
share transform data between separate rendering and physics threads, 
allowing both to run at whichever rate they choose (not to mention take 
advantage of multicore systems). So if you can't find any way for ODE 
and OSG to use the same sample rate, then a mechanism like this might help.


I seem to recall someone making some changes to osgViewer a while back 
to control the frame rate. I didn't really follow that change or 
discussion. Maybe just looking at the source code would be revealing.

   -Paul



___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Questions about physic engines.

2010-02-07 Thread PCJohn

Hi Ricardo,
sorry to not go into the details - so just few hints from my friend that 
is going his project on ODE+OSG.

He done the integration like this:
- he loads the scene by OSG
- he converts the scene geometry to ODE geometry and sends it to ODE by 
ODE functions

- he setups the ODE world
- he starts the ODE simulation
- each frame, he reads all required transformations from ODE and updates 
OSG transformations

 (ODE simulation is applied to OSG scene)

Concerning your questions:
- sorry, I have no knowledge about osgPhysics
- friction, mass, etc. - it is always a little bit tricky to put 
additional information to the file (3ds, collada) if the format is not 
designed to carry this information. However, number of formats supports 
additional text info connected to a scene graph node. Maybe, this will 
be the way. My friend is setting this information inside his code after 
loading each particular scene object. It is easy solution for the 
starting...
- simulation steps: yes, you need to do the simulation steps and then 
render. It sometimes happens that you are doing number of simulation 
steps per one rendering step. That is not a problem. But sorry, I did 
not know implementation details. You will need to take a look to doc and 
tutorials.


Sorry, no more knowledge on my side, but hopefully, it helps a little bit,
John


Ricardo Ruiz wrote:

Hi mates.


I have several questions regarding about physics engines in OSG. BTW, I'm a OSG 
beginner.

If I want to use ODE, must I add osgPhysics plugin to my OSG?

How can I load a scene with physics values? Let's say I'm creating a scene in 
3Ds MAX, and I export it to COLLADA (or any other format). Does OSG or 
osgPhysics read these values (mass, friction...)? And the most important, how 
can I tell 3Ds MAX that objets have different physic properties?

And the last one. Usually physics engines requere a fixed (or almost) time 
step, ODE is one of them. How should I manage that inside OSG, I mean, after 
integrating ODE with ODE?

Thank you very much for your time and help.

Cheers,
Ricardo

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=23771#23771





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
  

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Questions about physic engines.

2010-02-06 Thread Ricardo Ruiz
Hi mates.


I have several questions regarding about physics engines in OSG. BTW, I'm a OSG 
beginner.

If I want to use ODE, must I add osgPhysics plugin to my OSG?

How can I load a scene with physics values? Let's say I'm creating a scene in 
3Ds MAX, and I export it to COLLADA (or any other format). Does OSG or 
osgPhysics read these values (mass, friction...)? And the most important, how 
can I tell 3Ds MAX that objets have different physic properties?

And the last one. Usually physics engines requere a fixed (or almost) time 
step, ODE is one of them. How should I manage that inside OSG, I mean, after 
integrating ODE with ODE?

Thank you very much for your time and help.

Cheers,
Ricardo

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=23771#23771





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org