I am working on simple parallax shader and I have problem with sampling height texture for value. My aproach amples texture and give me RGB values of picture:

tex2D(TextureHeightSampler, input.BaseOutput.TexCoordAndViewDistance.xy)

But I am not sure how to convert RGB data to height value. How to solve that?

  • \$\begingroup\$ Well, it depends on what RGB values mean in the original image. Most times you want to use only one channel for height (red, for example) and use other channels for something else (terrain type, collision data, whatever) \$\endgroup\$ Apr 25, 2015 at 17:28
  • \$\begingroup\$ OK you have right :) but now when I can read height I have question about Parallax idea. As I assume from tutorial I need to multiply dot product of view->vertex vector and normal vecotr by height value from height map? And I find offset in that way? \$\endgroup\$ Apr 25, 2015 at 20:32


You must log in to answer this question.

Browse other questions tagged .