سؤال

I have implemented GPU skinning for Collada files using Assimp andx my own OpenGL renderer. This is working fine.

Now, My application should allow, 3rd party vertex and fragment shaders to be specified, and should work along with skinning.

An example use case could be that, this foreign shader bends the space about the Y-axis and adds fog to the scene..etc.

Is it possible while using GPU skinning?

هل كانت مفيدة؟

المحلول

Possible? Yes. But not simple.

The least painful way to do this is to take advantage of being able to provide multiple strings to the shader. Make your "skinning shader" a function that returns the camera-space position of the vertex. You might even have multiple variations of this function. One version that returns a position, one that returns a position and normal, and one that returns a position and TBN tangent-space basis matrix.

The user-provided shader would simply call this function to get the camera-space positions/normals. When compiling the shader, simply put your skinning shader string before their shader in the call to glShaderSource.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top