Now, let’s suppose i want to animate the diffuse parameter but only for material “blue”.
If the output of the animation channel is connected to the diffuse <newparam> sid of phong <effect>, then both materials will be animated which is not what i want.
I am forced to duplicate the <effect> definition, just because Collada specification does not allow a channel’s output to target <material><instance_effect><setparam> node directly.
Is there another solution that would avoid duplicating the <effect> definition ?
Then target with an sid_ref anchored at id “blue”.
Not quite. COLLADA materials are represented as an instantiation of an effect so it describes a connection to an instance of your “phong” effect. COLLADA does not dictate policy for instantiation and your application can do what it needs to do.
A <channel> target is an SID reference so it can target anything in the same document that has an ID and/or SID that you can use to construct a unique path. For example:
You application will bind the param to the effect/shader diffuse using the semantic value such that animating the param will change the diffuse color values in that instance of the effect/shader.
See COLLADA 1.5 spec and Chapter 8: FX Reference, bind_material for more details.
Mark,
If semantic is supposed to reference a parameter, then why isn’t it of the same type as the attribute ref of <setparam> ?
The type for <setparam> ref attribute is xs:token
The type for <param> semantic attribute is xs:NMTOKEN
If the effect parameter is an <array> of values, how do you target an individual value ?
Does it follow the same array-indexing syntax as for <setparam> ?
I have just realized that <param> cannot reference a material parameter directly because <bind_material> may contain several <instance_material> nodes. In the following example, <param> does not know if “diffuse” belongs to mat1 or mat2 :
No, not like that. Don’t think of semantic as “targeting” a value literally in the XML content, so much as making a symbolic binding. The semantic is something the effect run-time understands as a symbol identifying linkage to a parameter (scalar or vector or whatever). The <param> element is there to expose that parameter as an interface in the XML description.
Well <param> refers to things semantically so yes your observation is partly true. The run-time has to understand and resolve the linkage to the semantic reference. It’s not (always) literal in the XML sense.
Yes you can use the two elements to create a more explicit description (scaffolding) of the effect parameters you want to animate without ambiguity.
The <bind target=“here[3]”> is an sidref_type so you can use selection syntax at that point in the description.
The <bind target=“here[3]”> is an sidref_type so you can use selection syntax at that point in the description.[/quote]
Sorry my question was ambiguous. What i was asking is : when an effect parameter is an array, how do we say in <bind> that we only want to animate a single value in the array ?
can u please give me the collada file which contains animating material data.I hope this will help a lot for better understanding for material animation
pls…