|
newborn
|
 |
« on: April 13, 2008, 04:52:37 PM » |
|
It seems that MTV3D65.TV_COLLISIONRESULT sometimes returns negative u/v values
|
|
|
|
|
Logged
|
|
|
|
|
Zaknafein
|
 |
« Reply #1 on: April 13, 2008, 04:58:08 PM » |
|
UV coordinates are [0, 1[, so a -0,25 U coordinate is equal to 0,75. You can bring them back in the right interval pretty easily.
|
|
|
|
|
Logged
|
|
|
|
|
newborn
|
 |
« Reply #2 on: April 13, 2008, 07:06:57 PM » |
|
hum.. okay, I also get U/V > 1 as well, like 1.3
Would that be 0.7 ?
|
|
|
|
|
Logged
|
|
|
|
|
GD
|
 |
« Reply #3 on: April 14, 2008, 07:35:53 AM » |
|
If it's like Zak says then it should be 0.3 hmm realValue = value - math.floor(value)
|
|
|
|
|
Logged
|
|
|
|
|
JukkaKevät
|
 |
« Reply #4 on: April 14, 2008, 01:59:07 PM » |
|
This is no bug, this is how uv's work. U or V more than one or less than zero means the texture is tiled.
|
|
|
|
|
Logged
|
|
|
|
|
SylvainTV
|
 |
« Reply #5 on: April 14, 2008, 04:30:52 PM » |
|
Well do you mean UV or TexUV thats two different things.
If UV ( U V in barycentric coordinates of the triangle ) is negative, there is a problem I think If it's TexUV, no problem, it's normal, it just interpolates the texture coordinates of the mesh.
|
|
|
|
|
Logged
|
|
|
|
|
newborn
|
 |
« Reply #6 on: April 14, 2008, 07:30:39 PM » |
|
I think we have a workaround for this, suggested by Zak:
while(u>1)u-- while(u<0)u++ while(v>1)v-- while(v<0)v++
it's just weird... I understand what you mean JukkaKevät, but when TV3D returns a UV out of bounds, its hard to figure out the texture's pixel where the collision happened if you're trying to create a shadowmap (for instance)
|
|
|
|
|
Logged
|
|
|
|
|
JukkaKevät
|
 |
« Reply #7 on: April 15, 2008, 06:02:10 AM » |
|
You will run into problems if you are trying to bake shadows to an unwrap which is out of 0<->1. If the model which you are trying to shadow map does not have a correct unwrap (each part of the surface should be unique) then you will rewrite parts of the texture in the process.
|
|
|
|
|
Logged
|
|
|
|
|
GD
|
 |
« Reply #8 on: April 15, 2008, 06:49:42 AM » |
|
while(u>1)u-- while(u<0)u++ while(v>1)v-- while(v<0)v++
Come on... u = u - math.floor(u) v = v - math.floor(v)
|
|
|
|
|
Logged
|
|
|
|
|
SylvainTV
|
 |
« Reply #9 on: April 15, 2008, 12:01:21 PM » |
|
Well TV interpolates with what is in the model  There could be some situations when you could need UV < 0 or UV > 1. Think tiling for example. but yea u = u - math.floor(u) v = v - math.floor(v) works fine 
|
|
|
|
|
Logged
|
|
|
|
|
Zaknafein
|
 |
« Reply #10 on: April 15, 2008, 02:13:00 PM » |
|
Come on...
Hahah, mea culpa. I didn't think about this much at all.
|
|
|
|
|
Logged
|
|
|
|
|
newborn
|
 |
« Reply #11 on: April 15, 2008, 07:15:48 PM » |
|
Come on... u = u - math.floor(u) v = v - math.floor(v) Well this clearly shows the difference between a hobbyist who's still learning and someone who knows his stuff... Thanks for the tip  edit: wouldn't this work as well? fU -= Math.Floor(fU) fV -= Math.Floor(fV)
|
|
|
|
« Last Edit: April 15, 2008, 07:19:33 PM by newborn »
|
Logged
|
|
|
|
|
newborn
|
 |
« Reply #12 on: April 15, 2008, 07:17:25 PM » |
|
If the model which you are trying to shadow map does not have a correct unwrap (each part of the surface should be unique) then you will rewrite parts of the texture in the process.
Yup, and my artist is renown to do that 
|
|
|
|
|
Logged
|
|
|
|
|