Physics Shader - Just a thought

Please don't post Bullet support questions here, use the above forums instead.
Post Reply
codetiger
Posts: 19
Joined: Sat Aug 18, 2012 2:20 am
Location: Chennai, India
Contact:

Physics Shader - Just a thought

Post by codetiger » Mon Feb 18, 2013 8:56 am

When I was first introduced to Shaders (in 2008), I felt, wow, thats how real world lights act. Shaders in Rendering, sounds more close to real world light (At least to me).

With this in mind, I was wondering if a Physics shader should be a good idea in future. Developers have to write separate shaders on how the object has to react in the world. For example, we'll have rubber shader, steel shader, rock shader, and sponge shader. As an output these shaders will give the linear velocity, angular velocity and deformed geometry if the object is soft.

Am not sure if physics on GPU is taking this route and am not a expert in this field, am just a game developer and I had this popping in my mind and thought of sharing it here to see how it sounds to others and physics experts.

Edit: Imagine Bullet Physics and other engines will become fixed pipeline engines while the programable pipeline will give the developers complete freedom of writing simple physics engines based on materials.

SinisterMephisto
Posts: 20
Joined: Tue Sep 01, 2009 4:19 pm

Re: Physics Shader - Just a thought

Post by SinisterMephisto » Tue Feb 19, 2013 2:48 am

Shaders are mostly used as a post processing tool. Unless you plan on using it as stability fix or as something that is contained within its own system without affecting other bodies I don't see how it would work. Probably with animations as a kinematic pose changer but i dont know.

codetiger
Posts: 19
Joined: Sat Aug 18, 2012 2:20 am
Location: Chennai, India
Contact:

Re: Physics Shader - Just a thought

Post by codetiger » Tue Feb 19, 2013 4:24 am

If I didn't put my words correct, am trying to guess the future.

1. GPU will soon be redefined as Game Processing Units. They'll take care of both rendering and physics (and AI if I can add).
2. Like Vertex Shader, Geometry shader and Pixel shader, we'll soon have physics shaders (and AI shaders may be).

I am just sharing my dreaming, not predicting or not trying to prove anything.

Numsgil
Posts: 38
Joined: Wed May 14, 2008 5:58 am

Re: Physics Shader - Just a thought

Post by Numsgil » Mon Feb 25, 2013 9:55 pm

The problem with that is that physics is a global phenomenon, so it doesn't lend itself well to massively parallel execution. By contrast, one triangle/pixel renders pretty much the same as another, regardless of what the other elements are doing. There are a few serial elements to rendering, though, but if you notice those aren't the ones set up for shaders.

I could maybe see custom filtering being set up as shader-like programs. Like, for gameplay reasons you want to tweak the normal of a collision between a car and a wall. If physics is happening in a different address space you don't have access to (GPU, SPU, etc.), and the physics engine is continuous, it becomes a tricky problem, and a "physics shader" would be one reasonable approach.

Dirk Gregorius
Posts: 874
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: Physics Shader - Just a thought

Post by Dirk Gregorius » Mon Feb 25, 2013 10:23 pm

1. GPU will soon be redefined as Game Processing Units. They'll take care of both rendering and physics (and AI if I can add).
2. Like Vertex Shader, Geometry shader and Pixel shader, we'll soon have physics shaders (and AI shaders may be).
Point 1 would mean that the GPU would only use some small percentage of their capacity which could be used by other system, right? In my opinion this is far from true. If I would tell our graphics programmers that I am taking some of their precious shiny pixel time I would get into serious problems :). If you give a graphics programmer more power he will use it. Also graphics and gameplay run often asynchronously.

Saying this, I can imagine that the GPU will be used for more advanced particle effects which are more physics based. I can even imagine basic rigid body effects. Erwin has recently presented some amazing stuff with Bullet here in our office. I could imagine these things to coexist, but I am not seeing one replacing the other.

codetiger
Posts: 19
Joined: Sat Aug 18, 2012 2:20 am
Location: Chennai, India
Contact:

Re: Physics Shader - Just a thought

Post by codetiger » Mon Mar 04, 2013 12:28 pm

Dirk Gregorius wrote: Point 1 would mean that the GPU would only use some small percentage of their capacity which could be used by other system, right? In my opinion this is far from true. If I would tell our graphics programmers that I am taking some of their precious shiny pixel time I would get into serious problems :). If you give a graphics programmer more power he will use it. Also graphics and gameplay run often asynchronously.

Saying this, I can imagine that the GPU will be used for more advanced particle effects which are more physics based. I can even imagine basic rigid body effects. Erwin has recently presented some amazing stuff with Bullet here in our office. I could imagine these things to coexist, but I am not seeing one replacing the other.
Imagine Physics shaders, something similar to Geometric shaders. You can take advantage of these techniques if the game need more power for a specific purpose. Its just a trade off in using the power for where u need.

Dirk Gregorius
Posts: 874
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: Physics Shader - Just a thought

Post by Dirk Gregorius » Wed Mar 06, 2013 4:19 pm

I think that all GPU physics can only be used for visual effects. Imagine you could run all physics in one millisecond (which you cant). It will take three frames until you get the result due to latency. Shared memory might help with this, but you would have to divide the rendering into chunks such that you can interleave physics and graphics. I doubt this will happen. For me all this GPU physics is just a marketing hype by the GPU vendors.

There is really only one important question to answer in this context. Will we get better games with GPU physics? My answer is no. That is why you are not seeing anything in this context.

Post Reply