• Advertisement
Sign in to follow this  

How to find uv coordinates for a 3D triangle?

This topic is 1473 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am using the uv coordinate as a seed for a 2D simplex noise to create surface effects. If the triangle has the normal pointing at z, then xy can be used as uv coordinates.

 

However, the triangles have more or less random orientations. I suppose I need a rotation so as to have the normal aligned with e.g. z, then I can again use xy as uv. I have difficulties to find out how to do this rotation.

 

It may be that the problem can have more than one solution, but I only need one. Is there an efficient algorithm for this?

 

Share this post


Link to post
Share on other sites
Advertisement

There is an implementation of 3d Simplex noise at github/ashima/webgl-noise. I was mainly worried about higher performance costs as the 3D noise is more complex than the 2D noise. But it turned out this added a negligible time to the shader.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement