Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: MTV3D65.TV_COLLISIONRESULT & UV  (Read 925 times)
newborn
Customers
Community Member
*****
Posts: 2437


WWW
« on: April 13, 2008, 04:52:37 PM »

It seems that MTV3D65.TV_COLLISIONRESULT sometimes returns negative u/v values
Logged

Zaknafein
Customers
Community Member
*****
Posts: 2674


WWW
« 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

zaknafein.
>> the instruction limit : my blog & samples repository! <<
newborn
Customers
Community Member
*****
Posts: 2437


WWW
« 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
Customers
Community Member
*****
Posts: 367


« Reply #3 on: April 14, 2008, 07:35:53 AM »

If it's like Zak says then it should be 0.3 hmm

Code:
realValue = value - math.floor(value)
Logged

tvsm.co.cc - TVSceneManager
JukkaKevät
Customers
Community Member
*****
Posts: 182


« 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
Administrator
Community Member
*****
Posts: 4479


WWW
« 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

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
newborn
Customers
Community Member
*****
Posts: 2437


WWW
« 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
Customers
Community Member
*****
Posts: 182


« 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
Customers
Community Member
*****
Posts: 367


« 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...

Code:
u = u - math.floor(u)
v = v - math.floor(v)
Logged

tvsm.co.cc - TVSceneManager
SylvainTV
Administrator
Community Member
*****
Posts: 4479


WWW
« Reply #9 on: April 15, 2008, 12:01:21 PM »

Well TV interpolates with what is in the model Wink
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 Smiley
Logged

Regards

Sylvain Dupont
TrueVision3D Developer
sylvain@truevision3d.com

TV3D IRC at http://chat.truevision3d.com or on server irc.truevision3d.com #Truevision3D. Come talk with us !
Zaknafein
Customers
Community Member
*****
Posts: 2674


WWW
« 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

zaknafein.
>> the instruction limit : my blog & samples repository! <<
newborn
Customers
Community Member
*****
Posts: 2437


WWW
« Reply #11 on: April 15, 2008, 07:15:48 PM »

Come on...

Code:
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 Smiley

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
Customers
Community Member
*****
Posts: 2437


WWW
« 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 Tongue
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks