UV Mapping & Texture coordinates - HELP!

advice

#1

This questions is not necessarily SketchUp related, but I’ve been trying to figure out texture mapping for several days and am not making any progress.

So in SketchUp textures can be assigned to any face an the texture points ‘up’ and is automatically sized and positioned correctly no mater what the plane is.

Consider the following picture where my texture lines run vertically.

When the top is flat the texture runs along the green axis.

However when I give some slope to the roof faces the texture (correctly) follows the vector that points from low to high point.

Two things I’m trying to figure out.

  1. How do I calculate the ‘slope direction’ vector given three points?
  2. How do I calculate the 2D texture coordinates using this vector (or in some other way)?

Also note how the texture on the roof aligns with the texture of the walls?

I’m suspicious the answer involves some trigonometry, which I’m willing to learn if I can figure out how.

I posted a question on stack overflow several days ago, but haven’t gotten an explanation there. I’m hoping some 3D math wiz here can shed some light to my foggy brain.


What formula can I use to calculate the info given by UVHelper?
#2

OK I was able to find the answer. (answer posted on stack overflow)


#3

The thing with UV data in SketchUp is that they are not attached to vertices, but attached to each face. This allows us to have a projected on for instance a triangle. Had the UV data been only on vertices there would not be enough data for three point to define a perspective projection - only a skew.


#4

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.