Archived

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

edwinnie

One pass shader with different materials

Recommended Posts

hihi, i wonder if this is possible, suppose a group of meshes are cached, with different materials, but they all use the same shader. Is it possible that in a vertex program, we can somehow determine this current vertex under manipulation, is from which mesh in one pass of the vertex program? So somehow there could be a way to determine, which material is supposed to be used during the vertex program... thx! Edwinz

Share this post


Link to post
Share on other sites
A material is passed as constants anyway. You can set a constant before you draw, but it will basically be the same.
Or you can encode the material values into an unused element of each vertex of a mesh, like an extra pair of texture coordinates or vertex color, and use those.

Share this post


Link to post
Share on other sites