ashwin.sudhir Posted January 23, 2012 Share Posted January 23, 2012 <!-- bindings --> <bind object="mesh_dynamic" to="mesh"/> <bind object="mesh_skinned" to="mesh" defines="MESH_SKINNED"/> Could someone explain the significance of this in the material definition for mesh_indierct_base? Link to comment
ulf.schroeter Posted January 23, 2012 Share Posted January 23, 2012 Actually it means that both ObjectMeshDynamic/Skinned use the same shader source code as ObjectMesh. In case of ObjectMeshSkinned some special code will be activated by define MESH_SKINNED, have a look into vertex/fragment shader source. Link to comment
ashwin.sudhir Posted January 23, 2012 Author Share Posted January 23, 2012 But wouldn't that automatically be taken care of by inheritance? I inherited a material from mesh_base and overrode just the light_world pass. Even without adding any "bindings", the shader seems to work just fine. This is what confuses me. Link to comment
ulf.schroeter Posted January 23, 2012 Share Posted January 23, 2012 But wouldn't that automatically be taken care of by inheritance? I inherited a material from mesh_base and overrode just the light_world pass. Even without adding any "bindings", the shader seems to work just fine. Have you tried to assign your material to a skinned mesh ? Without the binding declaration on your derived material most probably it will work with ObjectMesh, but not e.g. with ObjectMeshSkinned (at least I think I ran into this problem 1,5 years ago with this shader modfication where I had to include the binding too... but I might be wrong as quite some time has passed in the meantime). Link to comment
manguste Posted February 6, 2012 Share Posted February 6, 2012 <!-- bindings --> <bind object="mesh_dynamic" to="mesh"/> <bind object="mesh_skinned" to="mesh" defines="MESH_SKINNED"/> Bindings indicate that another object uses the same states and the same set of shaders as the current material. For example, in order not to write all states and shaders to be used for mesh_dynamic (as they are identical to mesh material), you can simply specify a binding. This way, only one shader will be compiled and used for both mesh_dynamic and mesh. In case of mesh_skinned, the same shaders as for mesh are used except for situations when a custom shader behavior is necessary. If define is specified, two shaders will be compiled: one for mesh (and mesh_dynamic) and one for mesh_skinned. Link to comment
Recommended Posts