Re: [osg-users] Advice sought for rendering coins in OSG. Lots of coins.

2009-06-21 Thread Robert Osfield
Hi Christian,

To profile the peformance bottleneck it would be best to press 's' a
couple more times to get the full frame rate stats so you can see
exactly which parts of rendering are the bottleneck - the frame rate
only tells that you frame rate is reducing it doesn't give any clues
to why.

In terms of optimizing performance I'd be inclined towards trying out
using draw instanced support.  Not all cards support this, but it
would help with draw lots of identical geometry with the only
different being it's position in space.

Robert.

On Sun, Jun 21, 2009 at 1:25 AM, Christian
Buchnerchristian.buch...@gmail.com wrote:
 A little youtube video clip showing the progress on my coin pusher
 arcade prototype with very simple graphics:
 http://www.youtube.com/watch?v=ubpZUTuO1ecfmt=22

 The bottleneck here is definitely physics. Frame rates take a dip when
 lots of coins are interacting. I am hoping for some public CUDA
 support in the Bullet physics library in the near future.

 This demo is based mainly on the osgbullet source code found on the
 OSG Wiki. I replaced the golf ball in the demo with coins and I am
 tossing in a new coin every second. I also added a box-shaped pusher
 and a (yet invisible) rear wall that makes sure the coins fall off the
 pusher eventually.

 Christian
 ___
 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


Re: [osg-users] Advice sought for rendering coins in OSG. Lots of coins.

2009-06-21 Thread Paul Martz

Christian Buchner wrote:

The bottleneck here is definitely physics. Frame rates take a dip when
lots of coins are interacting. I am hoping for some public CUDA
support in the Bullet physics library in the near future.
  
My source inside Bullet development indicates that fully functional 
public Cuda solver is still some time off, perhaps 6 months or so.


I assume you're using cylinder collisions shapes? I have not played with 
them very much. I get excellent performance from bullet with several 
dozen boxes interacting, but performance slows to a crawl as soon as I 
add a single convex hull into the mix. I'm looking at running the 
physics sim in a separate thread so that the app maintains framerate and 
interactivity, but unless I do something to simplify the simulation, the 
visual results will still appear sluggish in spite of the high frame rate.

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


Re: [osg-users] Advice sought for rendering coins in OSG. Lots of coins.

2009-06-21 Thread Christian Buchner
 To profile the peformance bottleneck it would be best to press 's' a
 couple more times to get the full frame rate stats so you can see
 exactly which parts of rendering are the bottleneck - the frame rate
 only tells that you frame rate is reducing it doesn't give any clues
 to why.

I am pretty sure I am limited by the physics. Right now I have to
reduce the physics time step dynamically to stay within my tolerated
frame rate window. A final video (I promise!) is posted here and it
shows an almost complete pusher machine and up to 400 coins in the
game.

http://www.youtube.com/watch?v=0bLAq7btZbUfmt=22

I have since made the pusher operate faster so the player won't fall
asleep. I still have to add the game mechanics (player's coin balance,
player controlled coin insertion etc).

My coins are currently rendered several OSG
PositionAttitudeTransforms, all from the same model instance. I may
switch to an approach that uses vertex shaders soon.

A future enhancement could put the physics on a separate thread from
OSG. We will see how that goes.

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


Re: [osg-users] Advice sought for rendering coins in OSG. Lots of coins.

2009-06-20 Thread Christian Buchner
A little youtube video clip showing the progress on my coin pusher
arcade prototype with very simple graphics:
http://www.youtube.com/watch?v=ubpZUTuO1ecfmt=22

The bottleneck here is definitely physics. Frame rates take a dip when
lots of coins are interacting. I am hoping for some public CUDA
support in the Bullet physics library in the near future.

This demo is based mainly on the osgbullet source code found on the
OSG Wiki. I replaced the golf ball in the demo with coins and I am
tossing in a new coin every second. I also added a box-shaped pusher
and a (yet invisible) rear wall that makes sure the coins fall off the
pusher eventually.

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


Re: [osg-users] Advice sought for rendering coins in OSG. Lots of coins.

2009-05-22 Thread Kim C Bale
Hi Christian,

Out of interest are you simulating a penny push machine? 

I had the same idea for a hobby project a while back. It's a great idea,
although it might be tricky to get the physics working nicely.

Unfortunately my ponderings stop there as I never found the time to get
on it.

However, with regards to glsl effects you wanted, try these two pages

http://www.typhoonlabs.com/tutorials/glsl/Chapter_4.pdf
http://www.ozone3d.net/tutorials/index_glsl.php

They give good explanations and glsl implementations. Getting the
shaders to work with the OSG will be trivial.

Personally I wouldn't set the Intel GMA chipset as your minimum spec.
You'll be making life difficult for yourself just to accommodate
hardware that makes a half arsed attempt to offer hardware accelerated
3D. ( Just my 2p ;) )

Hope that helps a little.


Kim.


-Original Message-
From: osg-users-boun...@lists.openscenegraph.org
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of
Christian Buchner
Sent: 22 May 2009 11:57
To: OpenSceneGraph Users
Subject: [osg-users] Advice sought for rendering coins in OSG. Lots of
coins.

Hi,

I was going to start a hobby (i.e. noncommercial) project to simulate
an electromechanical coin arcade game. This would include rendering
potentially hundres of coins that physically interact (think
500...1000 coins). For the physics simulation I am going for the free
bullet physics package. For rendering I intend to use OSG.

One problem with GPUs is that round shapes map badly to triangle
meshes. One needs a lot of triangles to make the coins appear
sufficiently round. Lots of vertices may conflict with the idea of
rendering many coins simultaneously. I could go down the route of
using a mesh based 3D model combined with LOD techniques. However this
may incur some performance issues on architectures like Intel GMA that
have pixel shaders in hardware but do all their vertex processing on
the CPU.

Also I would really like to include a 3D relief for the coin
imprinting (embossment), either by using simple bump mapping or more
advanced pixel shader based techniques like parallax mapping or relief
mapping. To get simulated (fake) reflections I need to apply some kind
of environment mapping.

Considering that I will have to use pixels shaders anyway, I was
thinking that this can a pixel shader could just as well be used to
also render a geometric primitive like for example a cylinder. The
pixel shader would have to do some calculatios like does the view ray
intersect with the primitive?  and what is the surface normal?...
very much like in raytracing. The only vertex based geometry needed
would be a billboard that fully covers the visible extents of the
geometric primitive (or alternatively a box that wraps around the
visible extents of the primitive)

To get started with this I could use a few pointers and suggestions.

1) Does anyone here know some open sourced OSG based code that renders
primitives like spheres, cylinders, cones or the like within a GLSL
pixel shader? I know there have been projects in academia that did
just this, but is there anything open sourced?

2) Would anyone know a nicely done (in terms of documentation,
clarity) parallax mapping or relief mapping implementation in GLSL and
OSG? I've found a lot of conference papers on this (Siggraph etc) but
almost no source code.

It's often 10 times harder to start something from scratch than to
modify someone's existing code. So thanks a lot for any pointers and
help,

 Christian
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g*
To view the terms under which this email is distributed, please go to 
http://www.hull.ac.uk/legal/email_disclaimer.html
*___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Advice sought for rendering coins in OSG. Lots of coins.

2009-05-22 Thread Christian Buchner
 Out of interest are you simulating a penny push machine?

Yes. These sucked the life out of my wallet on my last trip to
Shanghai and Hangzhou. Playing with virtual currency would be cheaper.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Advice sought for rendering coins in OSG. Lots of coins.

2009-05-22 Thread Paul Martz
You could take a look at the draw instanced support in OSG, good for drawing
lots of things.

BRDFs could be used to render a high fidelity coin on just a couple
triangles without the flat, wallpaper-like effect of a regular texture map.
The first edition orange book included a section on implementing BRDFs in
shaders. I haven't seen much discussion on BRDFs lately, perhaps because
generating them is so complex.

Paul Martz
Skew Matrix Software LLC
http://www.skew-matrix.com
+1 303 859 9466

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


Re: [osg-users] Advice sought for rendering coins in OSG. Lots of coins.

2009-05-22 Thread Christian Buchner
 You could take a look at the draw instanced support in OSG, good for drawing
 lots of things.

I believe this instancing capability might require Geforce 8 class hardware.

I was thinking along the lines of how the osgforest sample replicates
thousands of trees from
the same billboard drawable. However I would also need to add per
instance rotation, not jus
a simple displacement.

 BRDFs could be used to render a high fidelity coin on just a couple

I think BRDFs are a little over my head. I think they would not add a
true relief, just different
reflectivity at different locations on the coin surface.

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


Re: [osg-users] Advice sought for rendering coins in OSG. Lots of coins.

2009-05-22 Thread scormier

Hi,

I would use osgparticle.
You can induce rotations  displacement.

HTH

Sylvain

Christian Buchner wrote:

You could take a look at the draw instanced support in OSG, good for drawing
lots of things.



I believe this instancing capability might require Geforce 8 class hardware.

I was thinking along the lines of how the osgforest sample replicates
thousands of trees from
the same billboard drawable. However I would also need to add per
instance rotation, not jus
a simple displacement.

  

BRDFs could be used to render a high fidelity coin on just a couple



I think BRDFs are a little over my head. I think they would not add a
true relief, just different
reflectivity at different locations on the coin surface.

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

  



--
Sylvain Cormier
Technologist/Test Manager
Société des arts technologiques
Propulse[art]
514 804 8434
1197 boulevard Saint-Laurent
C.P. 1083 Succursale Desjardins
Montréal (Québec) H5B 1C2 Canada 


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


Re: [osg-users] Advice sought for rendering coins in OSG. Lots of coins.

2009-05-22 Thread Christian Buchner
 Out of interest are you simulating a penny push machine?

Here is a first youtube video of my progress so far.

http://www.youtube.com/watch?v=74C61A-wzaA

This is based on the osgBullet sample code found on the OpenSceneGraph
Wiki on Support/Tutorials.
A few things to note:

- No shiny coins with imprint yet, just a simple cylindrical model
exported from Blender.

- things get slow with more than 70 coins on this (slightly outdated)
machine. The bottleneck is definitely physics, not rendering. May have
to experiment with CUDA acceleration to achieve 500 coins and more.

- The coins slide apart when stacked on top, as if the whole setup
was on a vibrating ground plate. I need to get in touch with the guys
on the bullet physics forums to see if this can be solved.

I will be back when I've got the shiny coins done... and hundreds of them!

Thanks for all your suggestions so far.

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