From: skunkwerk <sku...@gm...> - 2008-07-26 18:13:37
|
hi, i'm looking for an explanation of what negative UV coordinates do when using texture mapping. my initial thought was that negative coordinates are just a continuation in the same U-V plane of the tiled texture, so a value of -1.6 would be equivalent to a positive value of 1.4 however, based on tests i did opening a simple 3d model of a plane with positive, and then negative uv coordinates, it seems like the negative sign is actually flipping the texture around the u/v axis. is this correct? thanks |
From: Jason H. <jas...@di...> - 2008-07-26 18:56:24
|
There's a number of issues involved in mapping a texture to a triangle, and given the nature of your question, I have to assume you may not be aware of some of them, so I'll try to explain the very fundamental components. The UV coordinates of a vertex are just that... a location in a texture mapped from 0..1 in each axis. Graphics hardware typically have different settings to handle what happens when UV values are outside of that range. The most basic are Clamp, Wrap, and Mirror. If you set it to Clamp, any value outside 0..1 becomes either 0 or 1, so you can't exceed the given map on a model. On a typical cube with default UV mapping, that means you'll have one face with a texture on it and all the other faces will have the perimeter color stretched through them. If you set it to Mirror, every odd modulus is frac(U) and every even modulus is 1-frac(U), so 1.1 is remapped to 0.9... thus you can essentially tile a texture across a plane and have it unfold the texture forward and backward forever. With Wrap set, you get the texture repeating as frac(U), so 1.1 is the same as 0.1. Each axis is configured separately. There's also a texture matrix that can be applied to the UVs, which I believe (correct me if I'm wrong) is applied before the wrap/clamp/mirror operation, so you can scale or rotate the UVs on a model without actually modifying the input data. Now, what you were asking about is the direction of a mapping. A geometric triangle has a face normal that can be computed by cross product, or using the right-hand rule from edges 0-1 to 0-2. Let's pretend the texture is in the same plane as the triangle. The three UVs of the triangle vertices form a triangle in the texture plane. Since it's a triangle, it has a facing as well. Computing the sign of the cross product, if it's positive (the right hand rule of edge 0-1 to 0-2 leaves you with your thumb pointing the same direction as the triangle's face normal), the triangle's texture will be mapped as you see it in the texture. However, if you have a negative sign, or your thumb points opposite of the face normal, it will appear to be mirrored/backwards. It's not wrong, just the way it works. One thing is certain, if you are just poking at UV values and trying to figure it out, it will seem complicated. Here's a few things to think about. If you map a triangle, translating the UVs will never cause the direction of the mapping to flip (unless you set Mirror mode). But simply negating them will, because that reverses the face normal. Negating either the positions or UVs will make the texture appear mirrored/backward. So, if you negate both the vertex positions and UVs, you have flipped both triangle normals, and it will appear to be mapped correctly, but facing the opposite direction. :-) I hope that helps. JH skunkwerk wrote: > hi, > i'm looking for an explanation of what negative UV coordinates do > when using texture mapping. my initial thought was that negative > coordinates are just a continuation in the same U-V plane of the tiled > texture, so a value of -1.6 would be equivalent to a positive value of 1.4 > > however, based on tests i did opening a simple 3d model of a plane > with positive, and then negative uv coordinates, it seems like the > negative sign is actually flipping the texture around the u/v axis. > is this correct? > |
From: Tony B. <ton...@kr...> - 2008-07-26 21:14:32
|
In other words, yes. > There's a number of issues involved in mapping a texture to a triangle, > and given the nature of your question, I have to assume you may not be > aware of some of them, so I'll try to explain the very fundamental > components. > > The UV coordinates of a vertex are just that... a location in a texture > mapped from 0..1 in each axis. Graphics hardware typically have > different settings to handle what happens when UV values are outside of > that range. The most basic are Clamp, Wrap, and Mirror. If you set it > to Clamp, any value outside 0..1 becomes either 0 or 1, so you can't > exceed the given map on a model. On a typical cube with default UV > mapping, that means you'll have one face with a texture on it and all > the other faces will have the perimeter color stretched through them. > If you set it to Mirror, every odd modulus is frac(U) and every even > modulus is 1-frac(U), so 1.1 is remapped to 0.9... thus you can > essentially tile a texture across a plane and have it unfold the texture > forward and backward forever. With Wrap set, you get the texture > repeating as frac(U), so 1.1 is the same as 0.1. Each axis is > configured separately. > > There's also a texture matrix that can be applied to the UVs, which I > believe (correct me if I'm wrong) is applied before the > wrap/clamp/mirror operation, so you can scale or rotate the UVs on a > model without actually modifying the input data. > > Now, what you were asking about is the direction of a mapping. A > geometric triangle has a face normal that can be computed by cross > product, or using the right-hand rule from edges 0-1 to 0-2. Let's > pretend the texture is in the same plane as the triangle. The three UVs > of the triangle vertices form a triangle in the texture plane. Since > it's a triangle, it has a facing as well. Computing the sign of the > cross product, if it's positive (the right hand rule of edge 0-1 to 0-2 > leaves you with your thumb pointing the same direction as the triangle's > face normal), the triangle's texture will be mapped as you see it in the > texture. However, if you have a negative sign, or your thumb points > opposite of the face normal, it will appear to be mirrored/backwards. > It's not wrong, just the way it works. > > One thing is certain, if you are just poking at UV values and trying to > figure it out, it will seem complicated. Here's a few things to think > about. If you map a triangle, translating the UVs will never cause the > direction of the mapping to flip (unless you set Mirror mode). But > simply negating them will, because that reverses the face normal. > Negating either the positions or UVs will make the texture appear > mirrored/backward. So, if you negate both the vertex positions and UVs, > you have flipped both triangle normals, and it will appear to be mapped > correctly, but facing the opposite direction. :-) > > I hope that helps. > > JH > > skunkwerk wrote: >> hi, >> i'm looking for an explanation of what negative UV coordinates do >> when using texture mapping. my initial thought was that negative >> coordinates are just a continuation in the same U-V plane of the tiled >> texture, so a value of -1.6 would be equivalent to a positive value of 1.4 >> >> however, based on tests i did opening a simple 3d model of a plane >> with positive, and then negative uv coordinates, it seems like the >> negative sign is actually flipping the texture around the u/v axis. >> is this correct? >> > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list > > This message and its attachments may contain legally privileged or confidential information. This message is intended for the use of the individual or entity to which it is addressed. If you are not the addressee indicated in this message, or the employee or agent responsible for delivering the message to the intended recipient, you may not copy or deliver this message or its attachments to anyone. Rather, you should permanently delete this message and its attachments and kindly notify the sender by reply e-mail. Any content of this message and its attachments, which does not relate to the official business of the sending company must be taken not to have been sent or endorsed by the sending company or any of its related entities. No warranty is made that the e-mail or attachment(s) are free from computer virus or other defect. |
From: Mat N. <mat...@bu...> - 2008-07-26 21:16:10
|
Or no, depending on the render state. MSN -----Original Message----- From: gda...@li... [mailto:gda...@li...] On Behalf Of Tony Ball Sent: Saturday, July 26, 2008 2:15 PM To: Game Development Algorithms Subject: Re: [Algorithms] negative UV coords In other words, yes. > There's a number of issues involved in mapping a texture to a triangle, > and given the nature of your question, I have to assume you may not be > aware of some of them, so I'll try to explain the very fundamental > components. > > The UV coordinates of a vertex are just that... a location in a texture > mapped from 0..1 in each axis. Graphics hardware typically have > different settings to handle what happens when UV values are outside of > that range. The most basic are Clamp, Wrap, and Mirror. If you set it > to Clamp, any value outside 0..1 becomes either 0 or 1, so you can't > exceed the given map on a model. On a typical cube with default UV > mapping, that means you'll have one face with a texture on it and all > the other faces will have the perimeter color stretched through them. > If you set it to Mirror, every odd modulus is frac(U) and every even > modulus is 1-frac(U), so 1.1 is remapped to 0.9... thus you can > essentially tile a texture across a plane and have it unfold the texture > forward and backward forever. With Wrap set, you get the texture > repeating as frac(U), so 1.1 is the same as 0.1. Each axis is > configured separately. > > There's also a texture matrix that can be applied to the UVs, which I > believe (correct me if I'm wrong) is applied before the > wrap/clamp/mirror operation, so you can scale or rotate the UVs on a > model without actually modifying the input data. > > Now, what you were asking about is the direction of a mapping. A > geometric triangle has a face normal that can be computed by cross > product, or using the right-hand rule from edges 0-1 to 0-2. Let's > pretend the texture is in the same plane as the triangle. The three UVs > of the triangle vertices form a triangle in the texture plane. Since > it's a triangle, it has a facing as well. Computing the sign of the > cross product, if it's positive (the right hand rule of edge 0-1 to 0-2 > leaves you with your thumb pointing the same direction as the triangle's > face normal), the triangle's texture will be mapped as you see it in the > texture. However, if you have a negative sign, or your thumb points > opposite of the face normal, it will appear to be mirrored/backwards. > It's not wrong, just the way it works. > > One thing is certain, if you are just poking at UV values and trying to > figure it out, it will seem complicated. Here's a few things to think > about. If you map a triangle, translating the UVs will never cause the > direction of the mapping to flip (unless you set Mirror mode). But > simply negating them will, because that reverses the face normal. > Negating either the positions or UVs will make the texture appear > mirrored/backward. So, if you negate both the vertex positions and UVs, > you have flipped both triangle normals, and it will appear to be mapped > correctly, but facing the opposite direction. :-) > > I hope that helps. > > JH > > skunkwerk wrote: >> hi, >> i'm looking for an explanation of what negative UV coordinates do >> when using texture mapping. my initial thought was that negative >> coordinates are just a continuation in the same U-V plane of the tiled >> texture, so a value of -1.6 would be equivalent to a positive value of 1.4 >> >> however, based on tests i did opening a simple 3d model of a plane >> with positive, and then negative uv coordinates, it seems like the >> negative sign is actually flipping the texture around the u/v axis. >> is this correct? >> > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list > > This message and its attachments may contain legally privileged or confidential information. This message is intended for the use of the individual or entity to which it is addressed. If you are not the addressee indicated in this message, or the employee or agent responsible for delivering the message to the intended recipient, you may not copy or deliver this message or its attachments to anyone. Rather, you should permanently delete this message and its attachments and kindly notify the sender by reply e-mail. Any content of this message and its attachments, which does not relate to the official business of the sending company must be taken not to have been sent or endorsed by the sending company or any of its related entities. No warranty is made that the e-mail or attachment(s) are free from computer virus or other defect. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ GDAlgorithms-list mailing list GDA...@li... https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list Archives: http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list |
From: Tom P. <ga...@fa...> - 2008-07-26 21:41:56
|
> however, based on tests i did opening a simple 3d model of a plane > with positive, and then negative uv coordinates, it seems like the > negative sign is actually flipping the texture around the u/v > axis. is this correct? Based on the variety of answers you're getting, I'd suggest that it depends how it's implemented. Flipping when going negative seems bizarre to me, and I'm trying to remember what happened on the PS2 (which is the last platform where I even thought about it), however it had enough challenges with tiling in the first place that there had to be significant magic in the data conditioner to make the data look like something that the machine could handle at all. -tom! |
From: John P. <jo...@3d...> - 2008-07-26 22:34:21
|
Assuming you don't have texture clamping turned on, negating uv's will cause them to be mirrored along the negated axis. If you think about it, by negating u, you will be walking backwards along the u axis, which means those texels will be encountered in reverse order, which is the order they will be mapped onto the triangle. Tom Plunket wrote: >> however, based on tests i did opening a simple 3d model of a plane >> with positive, and then negative uv coordinates, it seems like the >> negative sign is actually flipping the texture around the u/v >> axis. is this correct? >> > > Based on the variety of answers you're getting, I'd suggest that it > depends how it's implemented. > > Flipping when going negative seems bizarre to me, and I'm trying to > remember what happened on the PS2 (which is the last platform where > I even thought about it), however it had enough challenges with > tiling in the first place that there had to be significant magic in > the data conditioner to make the data look like something that the > machine could handle at all. > > -tom! > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list > > |
From: Mat N. <mat...@bu...> - 2008-07-26 23:15:52
|
To be even more anal, D3D defines 5 separate texture addressing modes. So, again, it depends. MSN -----Original Message----- From: gda...@li... [mailto:gda...@li...] On Behalf Of John Pollard Sent: Saturday, July 26, 2008 3:34 PM To: Game Development Algorithms Subject: Re: [Algorithms] negative UV coords Assuming you don't have texture clamping turned on, negating uv's will cause them to be mirrored along the negated axis. If you think about it, by negating u, you will be walking backwards along the u axis, which means those texels will be encountered in reverse order, which is the order they will be mapped onto the triangle. Tom Plunket wrote: >> however, based on tests i did opening a simple 3d model of a plane >> with positive, and then negative uv coordinates, it seems like the >> negative sign is actually flipping the texture around the u/v >> axis. is this correct? >> > > Based on the variety of answers you're getting, I'd suggest that it > depends how it's implemented. > > Flipping when going negative seems bizarre to me, and I'm trying to > remember what happened on the PS2 (which is the last platform where > I even thought about it), however it had enough challenges with > tiling in the first place that there had to be significant magic in > the data conditioner to make the data look like something that the > machine could handle at all. > > -tom! > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list > > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ GDAlgorithms-list mailing list GDA...@li... https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list Archives: http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list |
From: Tony B. <ton...@kr...> - 2008-07-26 23:20:03
|
Another way of thinking about it that might help some people is to realize that only the fractional part of the UV coordinates are used to look up the texture map. So going stepping from -1 to 0 the fractional component is moving the opposite direction to when stepping from 0 to 1. > Assuming you don't have texture clamping turned on, negating uv's will > cause them to be mirrored along the negated axis. If you think about > it, by negating u, you will be walking backwards along the u axis, which > means those texels will be encountered in reverse order, which is the > order they will be mapped onto the triangle. > > > Tom Plunket wrote: >>> however, based on tests i did opening a simple 3d model of a plane >>> with positive, and then negative uv coordinates, it seems like the >>> negative sign is actually flipping the texture around the u/v >>> axis. is this correct? >>> >> >> Based on the variety of answers you're getting, I'd suggest that it >> depends how it's implemented. >> >> Flipping when going negative seems bizarre to me, and I'm trying to >> remember what happened on the PS2 (which is the last platform where >> I even thought about it), however it had enough challenges with >> tiling in the first place that there had to be significant magic in >> the data conditioner to make the data look like something that the >> machine could handle at all. >> >> -tom! >> >> ------------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge >> Build the coolest Linux based applications with Moblin SDK & win great >> prizes >> Grand prize is a trip for two to an Open Source event anywhere in the world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> _______________________________________________ >> GDAlgorithms-list mailing list >> GDA...@li... >> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list >> Archives: >> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list >> >> > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list > > This message and its attachments may contain legally privileged or confidential information. This message is intended for the use of the individual or entity to which it is addressed. If you are not the addressee indicated in this message, or the employee or agent responsible for delivering the message to the intended recipient, you may not copy or deliver this message or its attachments to anyone. Rather, you should permanently delete this message and its attachments and kindly notify the sender by reply e-mail. Any content of this message and its attachments, which does not relate to the official business of the sending company must be taken not to have been sent or endorsed by the sending company or any of its related entities. No warranty is made that the e-mail or attachment(s) are free from computer virus or other defect. |
From: Jason H. <jas...@di...> - 2008-07-26 23:54:03
|
In this one specific case, where the U or V has been negated (but not both), and the texture addressing mode is set to wrap, yes the texture is mirrored. However, I suggest that it is a poor mental model, thinking about stepping as a property of certain coordinate regions, as if the coordinate system defines directionality of a mapping--it does not. Flow is a function of the geometry triangle, UV triangle, and the texture addressing modes--not the property of any one component in isolation... After fighting to generate really solid tangents (which depends on all these things), I began to appreciate the way it all works together. :-) Thanks, JH Tony Ball wrote: > Another way of thinking about it that might help some people is to realize > that only the fractional part of the UV coordinates are used to look up the > texture map. So going stepping from -1 to 0 the fractional component is moving > the opposite direction to when stepping from 0 to 1. > > > >> Assuming you don't have texture clamping turned on, negating uv's will >> cause them to be mirrored along the negated axis. If you think about >> it, by negating u, you will be walking backwards along the u axis, which >> means those texels will be encountered in reverse order, which is the >> order they will be mapped onto the triangle. >> >> >> Tom Plunket wrote: >> >>>> however, based on tests i did opening a simple 3d model of a plane >>>> with positive, and then negative uv coordinates, it seems like the >>>> negative sign is actually flipping the texture around the u/v >>>> axis. is this correct? >>>> >>>> >>> Based on the variety of answers you're getting, I'd suggest that it >>> depends how it's implemented. >>> >>> Flipping when going negative seems bizarre to me, and I'm trying to >>> remember what happened on the PS2 (which is the last platform where >>> I even thought about it), however it had enough challenges with >>> tiling in the first place that there had to be significant magic in >>> the data conditioner to make the data look like something that the >>> machine could handle at all. >>> >>> -tom! >>> >>> ------------------------------------------------------------------------- >>> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge >>> Build the coolest Linux based applications with Moblin SDK & win great >>> prizes >>> Grand prize is a trip for two to an Open Source event anywhere in the world >>> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >>> _______________________________________________ >>> GDAlgorithms-list mailing list >>> GDA...@li... >>> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list >>> Archives: >>> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list >>> >>> >>> >> ------------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge >> Build the coolest Linux based applications with Moblin SDK & win great prizes >> Grand prize is a trip for two to an Open Source event anywhere in the world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> _______________________________________________ >> GDAlgorithms-list mailing list >> GDA...@li... >> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list >> Archives: >> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list >> >> >> > > > > > > This message and its attachments may contain legally privileged or confidential information. This message is intended for the use of the individual or entity to which it is addressed. If you are not the addressee indicated in this message, or the employee or agent responsible for delivering the message to the intended recipient, you may not copy or deliver this message or its attachments to anyone. Rather, you should permanently delete this message and its attachments and kindly notify the sender by reply e-mail. Any content of this message and its attachments, which does not relate to the official business of the sending company must be taken not to have been sent or endorsed by the sending company or any of its related entities. No warranty is made that the e-mail or attachment(s) are free from computer virus or other defect. > > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list > > |
From: Tony B. <ton...@kr...> - 2008-07-27 01:00:47
|
True, but the original post was a very simple question, so I thought it deserved a simple answer. :) > In this one specific case, where the U or V has been negated (but not > both), and the texture addressing mode is set to wrap, yes the texture > is mirrored. However, I suggest that it is a poor mental model, > thinking about stepping as a property of certain coordinate regions, as > if the coordinate system defines directionality of a mapping--it does not. > > Flow is a function of the geometry triangle, UV triangle, and the > texture addressing modes--not the property of any one component in > isolation... > > After fighting to generate really solid tangents (which depends on all > these things), I began to appreciate the way it all works together. :-) > > Thanks, > JH > > Tony Ball wrote: >> Another way of thinking about it that might help some people is to realize >> that only the fractional part of the UV coordinates are used to look up the >> texture map. So going stepping from -1 to 0 the fractional component is >> moving >> the opposite direction to when stepping from 0 to 1. >> >> >> >>> Assuming you don't have texture clamping turned on, negating uv's will >>> cause them to be mirrored along the negated axis. If you think about >>> it, by negating u, you will be walking backwards along the u axis, which >>> means those texels will be encountered in reverse order, which is the >>> order they will be mapped onto the triangle. >>> >>> >>> Tom Plunket wrote: >>> >>>>> however, based on tests i did opening a simple 3d model of a plane >>>>> with positive, and then negative uv coordinates, it seems like the >>>>> negative sign is actually flipping the texture around the u/v >>>>> axis. is this correct? >>>>> >>>>> >>>> Based on the variety of answers you're getting, I'd suggest that it >>>> depends how it's implemented. >>>> >>>> Flipping when going negative seems bizarre to me, and I'm trying to >>>> remember what happened on the PS2 (which is the last platform where >>>> I even thought about it), however it had enough challenges with >>>> tiling in the first place that there had to be significant magic in >>>> the data conditioner to make the data look like something that the >>>> machine could handle at all. >>>> >>>> -tom! >>>> >>>> ------------------------------------------------------------------------- >>>> This SF.Net email is sponsored by the Moblin Your Move Developer's >>>> challenge >>>> Build the coolest Linux based applications with Moblin SDK & win great >>>> prizes >>>> Grand prize is a trip for two to an Open Source event anywhere in the >>>> world >>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >>>> _______________________________________________ >>>> GDAlgorithms-list mailing list >>>> GDA...@li... >>>> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list >>>> Archives: >>>> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list >>>> >>>> >>>> >>> ------------------------------------------------------------------------- >>> This SF.Net email is sponsored by the Moblin Your Move Developer's >>> challenge >>> Build the coolest Linux based applications with Moblin SDK & win great >>> prizes >>> Grand prize is a trip for two to an Open Source event anywhere in the world >>> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >>> _______________________________________________ >>> GDAlgorithms-list mailing list >>> GDA...@li... >>> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list >>> Archives: >>> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list >>> >>> >>> >> >> >> >> >> >> This message and its attachments may contain legally privileged or >> confidential information. This message is intended for the use of the >> individual or entity to which it is addressed. If you are not the addressee >> indicated in this message, or the employee or agent responsible for >> delivering the message to the intended recipient, you may not copy or >> deliver this message or its attachments to anyone. Rather, you should >> permanently delete this message and its attachments and kindly notify the >> sender by reply e-mail. Any content of this message and its attachments, >> which does not relate to the official business of the sending company must >> be taken not to have been sent or endorsed by the sending company or any of >> its related entities. No warranty is made that the e-mail or attachment(s) >> are free from computer virus or other defect. >> >> >> ------------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge >> Build the coolest Linux based applications with Moblin SDK & win great >> prizes >> Grand prize is a trip for two to an Open Source event anywhere in the world >> http://moblin-contest.org/redirect.php?banner_id=100&url=/ >> _______________________________________________ >> GDAlgorithms-list mailing list >> GDA...@li... >> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list >> Archives: >> http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list >> >> > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list This message and its attachments may contain legally privileged or confidential information. This message is intended for the use of the individual or entity to which it is addressed. If you are not the addressee indicated in this message, or the employee or agent responsible for delivering the message to the intended recipient, you may not copy or deliver this message or its attachments to anyone. Rather, you should permanently delete this message and its attachments and kindly notify the sender by reply e-mail. Any content of this message and its attachments, which does not relate to the official business of the sending company must be taken not to have been sent or endorsed by the sending company or any of its related entities. No warranty is made that the e-mail or attachment(s) are free from computer virus or other defect. |
From: Jon W. <jw...@gm...> - 2008-07-27 19:11:45
|
Jason Hughes wrote: > In this one specific case, where the U or V has been negated (but not > both), and the texture addressing mode is set to wrap, yes the texture > is mirrored. That is only true when you have MIRROR texture addressing mode turned on. This is easy to verify in your modeling tool, which assumes WRAP: the texture is tiled continuously in all directions, including the negative directions. However, the texture MAP may be mirrored on the SCREEN if your texture coordinate gradients don't match your texture memory lay-out and triangle mapping. Most people think that in Direct3D, V goes down-to-up, and in OpenGL, V goes up-to-down. However, that's just an artifact of D3D typically loading BMP textures, and OpenGL typically loading JPG or PNG textures (in the samples that are around). The actual definition is simple: V grows in the direction of the data you pass to the texture. If you pass data with the bottom-most scanline first, V grows upwards. If you pass data with the topmost scanline first, V grows downwards. Sincerely, jw |
From: Tom P. <ga...@fa...> - 2008-07-28 22:45:16
|
> Assuming you don't have texture clamping turned on, negating uv's > will cause them to be mirrored along the negated axis. If you > think about it, by negating u, you will be walking backwards along > the u axis, which means those texels will be encountered in reverse > order, which is the order they will be mapped onto the triangle. Again, it would seem (to me) to depend on the implementation, since it depends how you interpret the fractional portion of the values. E.g. I seem to remember hearing that different hardware implemented modulus differently, so -3.5 % 2.0 could yield 1.5 or .5 (or possibly a negative version of one of those?), depending on your implementation. So then the question is one of whether you interpret -.3 U as .3 or .7. Can one say with certainty that one way is wrong and the other right? I mean, to me if I have the mode "wrap" set, I sure wouldn't expect it'd implicitly mean "flip." For that, I'd choose a "mirror" mode instead. -tom! |
From: Emil P. <hu...@co...> - 2008-07-28 23:13:23
|
With wrap mode it indeed wraps, rather than flip. The fractional part is defined x - floor(x), which is always in [0, 1), so frac(-0.3) = 0.7. I think the confusion in this thread is because some are talking about negating texture coordinates (which flips) and some are talking about what happens when the texture coordinate is interpolated from the positive to negative side of zero (where it's just wrapping, like it does across any other integer coordinate). -Emil -----Original Message----- From: gda...@li... [mailto:gda...@li...] On Behalf Of Tom Plunket Sent: 29 July 2008 00:45 To: Game Development Algorithms Subject: Re: [Algorithms] negative UV coords > Assuming you don't have texture clamping turned on, negating uv's > will cause them to be mirrored along the negated axis. If you > think about it, by negating u, you will be walking backwards along > the u axis, which means those texels will be encountered in reverse > order, which is the order they will be mapped onto the triangle. Again, it would seem (to me) to depend on the implementation, since it depends how you interpret the fractional portion of the values. E.g. I seem to remember hearing that different hardware implemented modulus differently, so -3.5 % 2.0 could yield 1.5 or .5 (or possibly a negative version of one of those?), depending on your implementation. So then the question is one of whether you interpret -.3 U as .3 or .7. Can one say with certainty that one way is wrong and the other right? I mean, to me if I have the mode "wrap" set, I sure wouldn't expect it'd implicitly mean "flip." For that, I'd choose a "mirror" mode instead. -tom! ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ GDAlgorithms-list mailing list GDA...@li... https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list Archives: http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list |