I have written several shaders which make heavy use of spherical harmonic approximation that I’m trying to get working with Unity. I can compute the per-vertex data I need, and generate the spherical harmonic coefficients (9 floats or 3 vectors), but am at a loss for a way to get the data into a shader, seeing as Unity seems to only support 2 UV channels in its Mesh class, and the other exposed per-vertex data channels are rather important (for you know, lighting). Any ideas?
Pack that data into textures and then pass the uv coordinate of the data to the shader. Sample the texture and do what you will with the data. ![]()
Thought about that. Using the second UV channel and a texture would work, but might preclude the use of light maps in some situations. For what I’m doing, that would probably be ok though. Thanks! I’ll give it a try!