Is it somehow possible to “force” a Custom Vertex Stream to write to a specific TEXCOORD?
Because i’m working on a custom particle shader with quite a few shader features. Depending on what options are selected in the material i need a different number of components to be set in the Custom Data tab of the particle system.
For example:
Option A,B and C each require an animated value. In the vertex shader i’d have samething like this:
o.customData.xy = v.texcoord0.zw;
o.customData.z = v.texcoord1.x;
If A,B,C are all checked it would work as intended but if only C is selected and there is only one value animated in the Custom Data tab the C value would be written to TEXCOORD0.z and missused in the shader.
Of course i could #ifdef the heck out of these options and cover all possible combinations but thats a bit of an overkill when it comes to shader variants. I’d prefer to handle this in the custom inspector script and tell the particle system where to write its custom data.
Would really appreciate the insight or advice how to tackle this issue =)
I did look at this but as far as i could see it does the “assigning” in the shader, which i’d like to avoid. So its not possible to let a Custom Data variable to write to TEXCOORD1.y for example if TEXCOORD1.x is not written to?
Ah, I misunderstood what you wanted. My understanding is there is not a way to do what you want exactly as described. But if the issue is you want the same data layout for multiple shaders, why not actually use the same data layout? There’s no real harm in having custom data assigned to 0.zw 1.x all of the time.