Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

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!