Archived

This topic is now archived and is closed to further replies.

jonnii

Combining Shaders...

Recommended Posts

Hello, I have a shader that performs skeletal animation on a mesh in a static vbuffer. I also have a shader for extruding shader volumes. The question is, how can i combine these two without writing a new shader and copy/pasting the two together? Is it possible to load two vertex shaders, or combine them somehow? thanks

Share this post


Link to post
Share on other sites
A vertex shader typically transforms the input (vertices, texture coordinates, constants and matrices). Besides some data manipulation/adjusting it transforms them from 3D to screen space using the matrices.
A second shader would then have to work on screen space coordinates while it is now written for model space, it would be difficult. The second one certainly can''t do the matrix transforms again, the output would be wrong.
It would be the best thing to combine those two into a new shader, where you take care that you only do the matrix transforms once.

Share this post


Link to post
Share on other sites