I was porting some shaders from RenderMonkey over to Unity and ran into several problems relating to arrays. Here is a test case for one. The values returned from the array are always 0. I tested this in RenderMonkey and changing the values of the colors array changes the rendered output as I would expect. In Unity I only get black.
I was doing the exact same thing as dkoontz, can you suggest a way to define and apply kernels to use them in pixel shaders? Any built in shader that does this that I can refer to? Are there plans to upgrade Unity’s implementation to make arrays work? any other limitations on Unity’s implementation that we should be aware of?
I’m finally getting serious about learning to write my own shaders and it’ll save me a lot of time to know these things beforehand.
Yikes, really? The thing fails silently, no warnings, no errors? (I only found this thread after bonking my head on the desk for several hours…) And you can’t use consts, and arrays won’t work, really? you can’t sample a texture in a vertex shader? Immensely frustrating. Is there any way to get arbitrary data into a vertex shader?
That’s a good idea, meh11, but it’s still not big enough when you consider that in a vertex program you’ll only have access to the structure of the single, current vertex… so storing extra info in the vertex’s uv2, color, or whatever, can’t really encode more data than a shader parameter.
Anyway this would be a great idea for vertex-shader-based keyframe interpolation!