简体   繁体   中英

Mapping points onto a 2D texture

Hey this may sound simple but it escapes me,

I have a list of 3D points (including negative positions) that I would like to map onto a 2D Texture.

I'm trying to figure out how to map the points appropriately to the texture and how it differs if it has a specific width/height.

Thanks

The simple way: using ortographic projection.

x_2d = x_3d + z_3d * scale_x

y_2d = y_3d + z_3d * scale_y

Where (scale_x, scale_y) is a vector describing the "direction" of the projection.

If objects with an high position ("far away") should be smaller you should search for perspective projection (eg on Wikipedia: 3D Projection )

In my experience, usually you specify the 2D texture coordinates in your model using glTexCoord2f (one for each 3D point), and let OpenGL take care of the rest.

Maybe I am misunderstanding what you are trying to do here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM