Arrays are a valid parameter type type these days you know...Quote:>Is there any way to pass "lists" of data (or varying number of
>arguments) to a shader?
1. Encode the values in a very small texture, then point sample.... i.e.,
the values in the texture are not pixels but numbers.
2. Paint it in the first place.
3. For the gas station pavement in Toy Story, I built a few m4 macros within
the shader code so that I could pass structures and lists of structures in a
fairly transparent way. This let me pass any number of skid marks and tire
treads and blotches as textures, each with their own positioning values, and
do so across multiple surfaces that carried the same texture (so a skid
could extend across asphalt/concrete and over the steel gas-filler covers).
4. Alternatively, you could pass a list of named coordinate systems and
position the blotches with THOSE. If the number of splotches is unknown at
the time of shader compilation, or you want to have a variable number, you
could give all the coordinate systems predictable names and just pass the
number of splotches you wanted, and let the simple shader look for some
number of coordinate systems... "splotch%d" etc.
5. You could write a DSO and get the values from a file...
6. You could also use a special light __category, then use light sources to
position the splotches. That way you can have any number of splotches, the
lights can carry all the splotch instance data as output parameters of the
light, and you can have a pretty simple surface shader that doesn't have to
care about geometric types or ST parameters etc. I have used this technique
to animate bulletholes and hence call the technique "bullet lights."
Consider it a Stupid RenderMan Trick.