Hi, I want to export UV and UVQ (homogenous) coordinates simultaneously and I am wondering what’s the best way of doing this. I am thinking of using a <source> with a <float_array> and an accessor with 5 <param>'s like: (I intentionally left off the unimportant parts)
Which one is better? Are there better ways of doing this? Will this be transparent for other applications who don’t know about “xxx_u”, “xxx_v”, “xxx_q” in the first case and how should those param’s be named properly in both cases?
You can export the values in one or more <float_array> as you like. Remember that source data does not have semantics yet. The values don’t “become” texture coordinates until they are referenced by an <input semantic=“TEXCOORD”> element.
Also note that inputs are scalable according to the source’s accessor, so that a TEXCOORD can sample 1D, 2D, 3D, or more texture coordinates. The common profile defines parameters for up to 4D (using S,T,P,Q as names). For example:
But real 3D texture coordinates are different from homogenous 2D texture coordinates using three values. Isn’t STP used for real 3D texture coordinates or can it also be used for homogenous 2D texture coordinates with three values. But how can an application then decide if it is 3D or homogenous 2D?
If i separate the 2D texture coordinates and the homogenous 2D texture coordinates like in your example and having two <input semantic> then I have to bind the texture name in a e.g. <diffuse> to two different <input semantic> elements simultanously which I can’t. I’d like one application to choose the 2D texture coordinates and the other the homogenous 2D texture coordinates with one bind to one <input semantic>.
You write that the values don’t “become” texture coordinates until they are referenced properly. I agree, but if I name the first param “2” and the second param “1” and not “S”, “T” or “T”, “S” how does an importer know that the first param “2” is in fact the v coordinate and the second param “1” is in fact the u coordinate. I know this is probably a very basic COLLADA question but I saw exporters writing out S and T and other exporters writing out U and V for texture coordinates so I would like to know how this should be handled properly.
… I’ve add the set attribute to the example (in green) showing that you can cleaning bind multiple inputs to from your geometry to your material. I’ve also added an <extra> that says the 2nd set is homogeneous. This is just a suggestion on for you to consider.
The names of the <param> don’t matter in fact. The order of values is defined by the semantic. In this case TEXCOORD means S, then T, then P, then Q, in that order if all are present. No gaps are allowed.
Since your 2nd set of textures are not in keeping with that semantic, I suggest that you use the generic UV semantic instead, for proper U, V, W values. E.g.: