0
\$\begingroup\$

I'm working on a shader in Unity that uses a Binary Tree to store some precomputed values, this binary tree should be available to the shaders and would ideally also be constructed on the graphics card (each node in this tree is based on 1 pixel) is there a good way of doing this?

\$\endgroup\$
4
  • \$\begingroup\$ The best way of passing such data to the GPU via shaders would be with a texture. Knowing that, your own question answers it: a texture with one pixel for each node of the tree. \$\endgroup\$
    – glampert
    Mar 10, 2015 at 18:10
  • \$\begingroup\$ Well, I don't really have enough knowledge about Unity shaders to develop this into an answer. Perhaps now that you have a pointer to start from, you can edit this into a more specific question and someone with good knowledge of Unity can help you further. \$\endgroup\$
    – glampert
    Mar 10, 2015 at 20:44
  • \$\begingroup\$ @glampert I think he was suggesting that you post your comment as an answer so he could mark it as the answer he was looking for :) \$\endgroup\$
    – Vaillancourt
    Mar 10, 2015 at 21:00
  • \$\begingroup\$ @AlexandreVaillancourt Okay. \$\endgroup\$
    – glampert
    Mar 10, 2015 at 21:09

1 Answer 1

2
\$\begingroup\$

The best way of passing such data to the GPU, using the shaders pipeline, would probably be with a texture. Knowing that, your own question answers it: A texture with one pixel for each node of the tree.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .