openframeworks / openFrameworks

openFrameworks is a community-developed cross platform toolkit for creative coding in C++.
http://openframeworks.cc
Other
9.97k stars 2.55k forks source link

ability to build combinations of shaders #3917

Open kylemcdonald opened 9 years ago

kylemcdonald commented 9 years ago

this is important for things like controlling mesh deformation using bones, and calculating this on the GPU. it's faster to calculate the mesh deformation on the GPU, but if you also want to use a shader to render the mesh, right now you would have a problem because only one shader would run.

for the skinning example above, the simplest version of this might just be loading separate vertex and fragment shaders. a more advanced version would allow multiple shaders to be evaluated in a single pass, for the vertex or fragment shaders.

vade commented 9 years ago

2¢ questions:

Has anyone benchmarked CPU skinning and found it to be an issue?

Is the increased complexity for GPU skinning worth the cost on all platforms (RPI, iOS etc)

Is the increased complexity for GPU skinning worth the cost in interoperability with generic GLSL shaders non rockstar devs would be experimenting with?

Does this mean that ofMesh won't be up to date with the animation data? This means you cannot manipulate ofMesh procedurally 'post' animation to augment the baked animation data?

Devils.advocate();

I'm a fan of K.I.S.S.

tgfrerer commented 9 years ago

I feel like siding with the devil on this =)

There's more than one way to skin a mesh, and adding a built-in method could add complexity and support promises which might be difficult to keep up in the core on the long run.

I'm not sure more than a vertex + fragment shader combination is needed to minimally shade & skin a mesh on the GPU; But if done "properly," there's a lot of thought that has gone into using tessellation shaders to deal with rendering bends and joints, and all sorts of other edge cases, like wrinkles.

That said, i think it could be a great idea to have a GPU skinning example.

And there is something to be said about re-useable GLSL functions, which could even become something like an oF shading standard library!

I believe Patrick's suggestion in issue #3886 could help with this.

Also, on a more strategic level, it would be really great, i think, to have something like a roadmap for where we want to go with 3D support, especially now that hardware accelerated 3D platforms appear to fragment more and more, and it's going to be hard to support all platforms we currently support, with their specific take on hardware accelerated graphics.

bilderbuchi commented 9 years ago

Also, on a more strategic level, it would be really great, i think, to have something like a roadmap for where we want to go with 3D support, especially now that hardware accelerated 3D platforms appear to fragment more and more, and it's going to be hard to support all platforms we currently support, with their specific take on hardware accelerated graphics.

this sounds like something that would be great to discuss on the list, or at the next devmeet, or open a separate issue so that this point/thought doesn't get lost.