Rotate mesh to nornal

by dotminic   Last Updated July 11, 2019 20:13 PM - source

I have some instanced geometry (basic tube meshes) laid out in a grid, and I have a noise texture (normal map) that I want to use to rotate my instances with. So head pixel in my texture is a normal and I want to rotate each instance with the corresponding normal in a shader. How can I achieve that in a shader only? Unless I am mistaking, there should only be a rotation around the x and z axes.

Thanks.



Related Questions


Is there an HLSL equivalent to GLSL's "map" function?

Updated September 01, 2017 16:13 PM

Full screen shader causes performance hit

Updated September 02, 2019 22:13 PM

Shader - Get maximum value of a vector

Updated April 23, 2015 22:05 PM

Encoding Float to RG/RGBA and Blending

Updated April 05, 2015 16:05 PM

Shader - Convert vector into scalar

Updated April 23, 2015 22:05 PM