Search Unity

Vertex channels for spherical harmonic coefficients?

Discussion in 'Shaders' started by willrmiller, Dec 15, 2009.

  1. willrmiller

    willrmiller

    Joined:
    Dec 15, 2009
    Posts:
    9
    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?
     
  2. shawn

    shawn

    Unity Technologies

    Joined:
    Aug 4, 2007
    Posts:
    552
    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. :)
     
  3. willrmiller

    willrmiller

    Joined:
    Dec 15, 2009
    Posts:
    9
    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!