🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

A shot in the dark question. (can anybody help?)

Started by
0 comments, last by Luxury 22 years, 5 months ago
Ok...i know that this is a little more advanced for many people on this board (myself included), but a friend of mine (programmer) asked if it was possible to take a regular square texture, and distort it into a triangular perspective while losing as little as detail as possible. This would then be strecthed back out into a square in the final game engine when applied to the final object. What I would then do is stitch many of these triangles together to form a larger overall texture, etc... Has anybody ever heard of this method? Any ideas on how I would even start? If you do know, or have some ideas, please let me know. I appreciate it. -Luxury
Advertisement
first off your programmer friend should learn more about his api and texture coordinates. this is not really a visual arts question and more of texture coordinate manipulation. ALL artwork you do will be square or rectangular in the very least when dealing with most 3d apis. simply being that its easier to store rectangular textures (and more efficent) then storing triangles of textures. this texture data can be applied in almost any fashion to a traingle. stretching and squishing in the areas that need it depending on the points you choose on the texture for the vertices.

now let me see if i understand what you want to be done. breaking it up, so you can see where you are making this question look a bit silly if your friend knew his api better (considering you are calling this an advanced question when its not)

you want to take a square texture, makes sense. you have to use some rectangular shape.

distort to triangle persepctive while losing the least quality. the texture does not distort at all. you dont need this step. later on you will see more clearly why.

then hgo back to a square via strecthing which os not possible. a 3 sided object CANNOT be stretched in anyway to form a 4 sided object. no matter how hard you try unless you break it, heh (which by the way is what you do).

stitch the triangles together to form the final look. again makes some sense. well here we go, explaining how texturing works.

2d texture (since you wont be using volume textures) coordinates are normally shown as U and V. with U being the x horizontal axis and V being the vertical axis. they are reletive to the orientation of the texture as you would see it in your paint program. for maost apis they range from 0.0-1.0 and are in floating point format (for the most part, i wont go into texture repeating and other fun tricks with the coordinates). 0.0 is the furthest left (or top) and 1.0 is furthest right (or bottom). they are percentages which determine which part of the texture gets mapped to the triangle. they are not affectd by screen size, polygon size, nor polygon orientation.

most squares are formed using two triangles:

a.b....d
c....f.e

hopefully that comes out looking nice. if not imagine it.

now the uv coordinates that would map the entire texture to that quad.

a.u = 0.0
a.v = 0.0

b.u = 1.0
b.v = 0.0

c.u = 0.0
c.v = 1.0

d.u = 1.0
d.v = 0.0

e.u = 1.0
e.v = 1.0

f.u = 0.0
f.v = 1.0

as you see some of the coorinates are overlapping. those are the points in which the veritices would have the same positiona dn overlap as well.

if you wish to spread the texture over other areas, such as curved spheres and such. you would use different mapping techniques which i wont go into since ussually you set the texture coordinates on the model for the most part by hand and draw the texture to color in the polys in that fashion. take a look at some of the quake models in a model viewer. you can set up the textire coordinates however you like, just make sure that overlapping vertices have the same coordinate to ensure a seemless look.

you shoudl do a search on google for information on different mapping techniques and play around with some modeling software. you should also look into just playing around with texture coordinates in yoru own simple engine (basically the engine loads a texture, and draws some polygons where you set all the vertices and texture coordinates by hand at compile time). this will give you a better idea and feeling for how you should create your textures.

btw, this is assumign i read your question correctly (which i feel i have) this is VERY common method of doing texturing. nearly ALL games and other 3d apps do this. it just seems more magically when they do it because the artist spent all the time getting the right texture coordinates.

This topic is closed to new replies.

Advertisement