passing lists to shaders

passing lists to shaders

Post by Kevin Bjork » Mon, 18 Oct 1999 04:00:00

Quote:>Is there any way to pass "lists" of data (or varying number of
>arguments) to a shader?

Arrays are a valid parameter type type these days you know...

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.



1. passing lists to shaders

You could try a texture file, which you
then explicitly access colors from.
The color data represents the information
you want to pass to the shader, since
it's all numbers anyway. Each scanline
of the texture could represent the
data for one of your splotches, e.g.
Generating the texture, of course,
requires writing a generator that
converts your splotch params into
color values and lays them out properly.


2. Video Blaster driver

3. passing external values to shaders

4. unable to load pagemaker

5. Shadow pass, surface and displacement shader

6. FS: Data General AViiON AV 5500 Unix Server. OFFER!

7. Shader parameters passing through arrays - Help

8. New animation site!

9. single pass / multi pass

10. ANN: new shader article, Using Vertex Shaders, Part III: Optimizing the Tweening Vertex Shader, is live

11. Toon shaders or shader ideas

12. Accessing light shader parameters from a surface shader

13. Converting Maya Shader to a Renderman Shader