Question about shaders (6 posts)

  • Profile picture of tralala tralala24p said 3 months, 3 weeks ago:

    hello i would like to ask if :
    1) i can pass arrays from my main program to my shader.
    2) i can attach “user data” to a specified vertex in my main program so that the shader can read them.

  • Profile picture of Momoko_Fan Momoko_Fan371p said 3 months, 3 weeks ago:

    @tralala said:
    hello i would like to ask if :
    1) i can pass arrays from my main program to my shader.
    2) i can attach “user data” to a specified vertex in my main program so that the shader can read them.

    1) Yes
    2) Yes, use vertex attributes

  • Profile picture of tralala tralala24p said 3 months, 3 weeks ago:

    1) i searched in material and there is no setArray(“name”, float[]);
    2) where do i find them, they are in Mesh class ?

  • Profile picture of Momoko_Fan Momoko_Fan371p said 3 months, 3 weeks ago:

    @tralala said:
    1) i searched in material and there is no setArray(“name”, float[]);
    2) where do i find them, they are in Mesh class ?

    You probably have to use Material.setParam() to do that, there isn’t a convenience method for the array types yet.
    The attributes are found in the Mesh class, each VertexBuffer is an attribute

  • Profile picture of tralala tralala24p said 3 months, 3 weeks ago:

    thank you, can i create my own “attributes” or do i just “modify” the useless ones like “color”.

  • Profile picture of Momoko_Fan Momoko_Fan371p said 3 months, 3 weeks ago:

    There’s no way to create your own at the moment. Just use one of the existing ones