Sign in to follow this  
akuda

Matrix-pallete Skinning and Materials

Recommended Posts

akuda    122
Hi, It's a shader-newbie (or wannabe) question. I have following skinned mesh structure: struct SkinVertex { vector3f Position; vector3f Normal; vector3f TexCoord; int JointIndices[numBones]; float JointWeights[numBones]; }; Vertices are arranged in an array, and an array of triples of indices of vertices is provided to form triangles. I'm planning to use shader to do the hardware skinning, but that in future. Now, I'm thinking, where to put material information in (texture and light info). So far I used fixed-pipeline functions only, so I sorted triangles in groups of materials, then - in loop - applied a material and then draw the triangles in that group. Using shaders, would it be any different? For examlpe: is it possible to post a collections of materials to some hardware buffer, and then (in a skinning shader) apply a proper material per-triange, or is it impossible, or simply worse solution? The reason is that right now I'm just writing some kind of proof-of-concept in a Uni project, and I'm not required to use shaders yet. These I will implement in few months, once I learn the GLSL. Right now I would like to plan a class hierarchy to minimize changes in the future. Sorry for my English :) akuda

Share this post


Link to post
Share on other sites
V-man    813
It is the same idea. Something like this

BindTexture();
BindShader();
SetupUniforms();
DrawObject();

instead of the old

BindTexture();
SetupglTexEnv();
SetupglLight();
DrawObject();

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this