PDA

View Full Version : Texturing Quads



MButchers
08-19-2001, 05:33 AM
hi there,

i have a strange problem while using
quads, if i have a quad with 2
vertices very close to each other then
the texture is applied as if it were a
triangle rather than the texture being
progressivly narrower as it gets towards the
apex.

hope you can understand this

cheers

Mark.

DFrey
08-19-2001, 05:53 AM
This sounds like normal behavior to me. See, if you stretch (or squeeze) the texture along one edge but not the other, the hardware will interpolate the texture of each triangle of the quad differently. To compensate for that difference you need to use the q coordinate of the texture coordinate so that each triangle's texture will be interpolated in a consistent manner.
There is a link to a site somewhere that descibes this in good detail and shows how to calculate q in this instance. I'll post that link if I find it.


[This message has been edited by DFrey (edited 08-19-2001).]

DFrey
08-19-2001, 06:00 AM
http://www.r3.nu/~cass/qcoord/

MButchers
08-19-2001, 11:23 PM
Cheers DFrey

looks like its what i want.

Hofi
08-20-2001, 10:07 AM
Hi,
Is'nt this another example of prefering triangles above other polygons?
greetings,
Hofi

DFrey
08-20-2001, 10:20 AM
No it is not an example of why triangles should be preferred, the exact same problem would appear with individual triangles. After all, the quad is triangulated automatically into either a triangle fan or strip.

Frumpy
08-20-2001, 01:04 PM
Holy crap this q thing actually works ... for the most part.

All is fine while the top two verticies are apart. However when the verticies close to the point where my quad becomes a triangle I see just a zoomed bit of the lower left of my texture covering the entire triange and not a squeezed texture. What should I set q to now?

DFrey
08-20-2001, 02:30 PM
You can't squeeze it too much because eventually the floating point errors start to become significant. I'm not sure what you can do at that point.

Mezz
08-21-2001, 07:51 AM
cry?

MButchers
08-22-2001, 11:17 PM
hi there,

ive found a work around, all my quads are
subdivided (in order to apply dicplacement
maps and greater lighting quality from
patched lights (both of these are to do
this week)) and if you do this to a level
of one or more the problem is drastically reduced.

Mark

MofuX
08-23-2001, 07:53 AM
hi, it could be a graphics failure of the inner angle of the cam!
if objects are far away of your cam this effect will be if your inner angle of cam is to slow!
so you have to make it bigger (like 1.0f)
in gluLookAt() function!
this is the variable in front of the view-distance! (the outer angle of cam)