Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Physics calculations on CPU vs on GPU

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2015
    Posts
    27

    Physics calculations on CPU vs on GPU

    Hi everyone,

    Apart from rendering engine, physics calculations are what I am interested to learn. Been foraying on google on this topic. There are several sub topics in this like rigid body dynamics, soft body dynamics, fluid dynamics and collision detection etc. I am not sure whether to perform these calculations on GPU ( if so how) or CPU ( using C++). Btw, I find it difficult to believe that such complex calculations are bieng done on CPU and yet those AAA games achieve 40-60 fps.

  2. #2
    Intern Contributor
    Join Date
    Mar 2014
    Posts
    58
    Maybe GPU is better... NVidia PhysX by exemple...

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2015
    Posts
    27
    NVidia PhysX calculations, in their entirety, are not done on GPU. Besides I have AMD card.

    Even supposing that some part of library is executed on GPU, do they use compute shaders and geometry shaders? In Opengl SuperBible, authors use vertex and geometry shaders to perform some calculations on vertices and bring them back to entry stage by streaming the data out for simulating a cloth. Which brings me back to my question. What portions of physics simulations can be done on today's GPUs and what portions are, by necessity, to be done on CPU?

  4. #4
    Intern Contributor
    Join Date
    Feb 2016
    Posts
    64
    Quote Originally Posted by ajith.mk View Post
    In Opengl SuperBible, authors use vertex and geometry shaders to perform some calculations on vertices and bring them back to entry stage by streaming the data out for simulating a cloth.
    I can't find the sample code for this, but i'd make a wild guess that they use Transform Feedback instead of compute shaders, as they only have to change some attributes on the same set of vertices. Compute shaders lets you input and output any data you want, with the exact number of work groups you want.

    Quote Originally Posted by ajith.mk View Post
    What portions of physics simulations can be done on today's GPUs and what portions are, by necessity, to be done on CPU?
    Anything that can be parallelized will have a huge performance boost when done on the GPU, like physics calculations, Z sorting for transparency/optimal early depth testing, or LOD calculations. Anything that can't will have to run on the CPU since its single core performance is always better.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •