Page 1 of 1

Physics Shader - Just a thought

Posted: Mon Feb 18, 2013 8:56 am
by codetiger
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.

Re: Physics Shader - Just a thought

Posted: Tue Feb 19, 2013 2:48 am
by SinisterMephisto
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.

Re: Physics Shader - Just a thought

Posted: Tue Feb 19, 2013 4:24 am
by codetiger
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.

Re: Physics Shader - Just a thought

Posted: Mon Feb 25, 2013 9:55 pm
by Numsgil
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.

Re: Physics Shader - Just a thought

Posted: Mon Feb 25, 2013 10:23 pm
by Dirk Gregorius
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.

Re: Physics Shader - Just a thought

Posted: Mon Mar 04, 2013 12:28 pm
by codetiger
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.

Re: Physics Shader - Just a thought

Posted: Wed Mar 06, 2013 4:19 pm
by Dirk Gregorius
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.