Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Send and use a different vector for each vertex

Discussion in 'Shaders' started by nafasso, Jul 28, 2015.

  1. nafasso

    nafasso

    Joined:
    Dec 3, 2013
    Posts:
    22
    Hello everybody,

    first of all please forgive me for my english, I am not a native speaker so my post might contain some mistakes.

    So here is my probleme/question:

    in my project, I want to write a shader that uses datas contained in picture files. Actually, I have 3 picture files, each one representing one of the 3 coordinates (x,y and z). The color of the picture, once converted into float, represents the corresponding coordinate for this vertex of the plane.
    So my job is to get these data from the images (convert all this into floats, which I do through a C# script) and then use these 3 floats to assign them to each corresponding vertex texture coordinates in order to give the texture the shape I want. I am using cubemap texture and I am willing to use it on any shape of screen so the 3 files are from the callibration.
    I just cannot figure out how to pass either a table containing all these floats (which I personnaly think is not a good way to do anyways) or send the corresponding float vector for each vertex ... I assume that there is a way and I was thinking about using the texcoord input but I really don't know how this works.

    If anybody have any idea of how I could make this work, that would be a very good help to me.

    Cheers
     
  2. nafasso

    nafasso

    Joined:
    Dec 3, 2013
    Posts:
    22
    Is modifying the texcoord using the class Mesh and Mesh.uv2 a good solution ?