Why don't my textures map correctly? 
Author Message
 Why don't my textures map correctly?

I'm using CosmoPlayer 2 on Win98 and my textures tend to map as a
right-left mirror image!  A good example is
http://www.*-*-*.com/ ;Can't seem to figure it out
;-(  Any help would be greatly appreciated.  Please email

Thanks,
Aaryn



Sun, 03 Feb 2002 03:00:00 GMT  
 Why don't my textures map correctly?


Quote:
> I'm using CosmoPlayer 2 on Win98 and my textures tend to map as a
> right-left mirror image!  A good example is
> http://ag.arizona.edu/agnet/vrml/plane.wrl.  Can't seem to figure it
out
> ;-(  Any help would be greatly appreciated.  Please email

> Thanks,
> Aaryn

The problem is just your light direction. If you turn
the headlight on in your "NavigationInfo". It will be
fine now...

Yan

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.



Sun, 03 Feb 2002 03:00:00 GMT  
 Why don't my textures map correctly?
I wish that was what is wrong.  I turned on the headlight, but I detect no
difference in the model.  The image is simply mapped as a right-left
mirror!  It doesn't make any sense to me whatsoever...

I can fix this problem on an IndexedFaceSet by setting texCoordIndex as [
3 2 1 0 -1 ] and making CoordIndex the reverse: [ 0 1 2 3 -1 ], but this
seems more like an undocumented "feature" than a solution.  I setup the
plane.wrl as an easy example, but my real problem is mapping a texture
onto an ElevationGrid.  The same thing happens!

Here's a better example:
http://ag.arizona.edu/agnet/vrml/elevationgrid.wrl - The image contains a
watermark at the bottom that should be readable.  Here is the code:

Transform {
  children Shape {
    appearance Appearance {
      material Material {
      }

      texture ImageTexture {
 repeatS TRUE
 repeatT TRUE
 url "http://ag.arizona.edu/agnet/livecam/forbes_vr.jpg"
      }

    }

    geometry DEF _0 ElevationGrid {
      xDimension 4
      zDimension 4
      xSpacing 10
      zSpacing 10
      height [ 0, 1, 0, 2,
         1, 2, 1, 1,
         2, 1, 1.5, 2,
         4, 2, 2, 1.8 ]
      solid FALSE
      creaseAngle 2
    }

  }

  translation -15 0 -15

Quote:
}



> > I'm using CosmoPlayer 2 on Win98 and my textures tend to map as a
> > right-left mirror image!  A good example is
> > http://ag.arizona.edu/agnet/vrml/plane.wrl.  Can't seem to figure it
> out
> > ;-(  Any help would be greatly appreciated.  Please email

> > Thanks,
> > Aaryn

> The problem is just your light direction. If you turn
> the headlight on in your "NavigationInfo". It will be
> fine now...

> Yan

> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.



Sun, 03 Feb 2002 03:00:00 GMT  
 Why don't my textures map correctly?
Hi, Aaryn

I just downloaded your Script, and as I edited it I changed the value of
solid from FALSE to TRUE. that solved the part of the problem with the mirror.
At least on my computer.
Why don't you give it a try and let the geometry node look just like this ...

    geometry DEF _0 ElevationGrid {
      xDimension 4
      zDimension 4
      xSpacing 10
      zSpacing 10
      height [ 0, 1, 0, 2,
         1, 2, 1, 1,
         2, 1, 1.5, 2,
         4, 2, 2, 1.8 ]
      solid TRUE
      creaseAngle 2
    }

That should help you to get on ...
If the texture is on the wrong side now, just rotate the whole grid ...

CU

Aaryn Olsson schrieb:

Quote:
> I wish that was what is wrong.  I turned on the headlight, but I detect no
> difference in the model.  The image is simply mapped as a right-left
> mirror!  It doesn't make any sense to me whatsoever...

> I can fix this problem on an IndexedFaceSet by setting texCoordIndex as [
> 3 2 1 0 -1 ] and making CoordIndex the reverse: [ 0 1 2 3 -1 ], but this
> seems more like an undocumented "feature" than a solution.  I setup the
> plane.wrl as an easy example, but my real problem is mapping a texture
> onto an ElevationGrid.  The same thing happens!

> Here's a better example:
> http://ag.arizona.edu/agnet/vrml/elevationgrid.wrl - The image contains a
> watermark at the bottom that should be readable.  Here is the code:

> Transform {
>   children Shape {
>     appearance Appearance {
>       material Material {
>       }

>       texture ImageTexture {
>  repeatS TRUE
>  repeatT TRUE
>  url "http://ag.arizona.edu/agnet/livecam/forbes_vr.jpg"
>       }

>     }

>     geometry DEF _0 ElevationGrid {
>       xDimension 4
>       zDimension 4
>       xSpacing 10
>       zSpacing 10
>       height [ 0, 1, 0, 2,
>          1, 2, 1, 1,
>          2, 1, 1.5, 2,
>          4, 2, 2, 1.8 ]
>       solid FALSE
>       creaseAngle 2
>     }

>   }

>   translation -15 0 -15
> }




> > > I'm using CosmoPlayer 2 on Win98 and my textures tend to map as a
> > > right-left mirror image!  A good example is
> > > http://ag.arizona.edu/agnet/vrml/plane.wrl.  Can't seem to figure it
> > out
> > > ;-(  Any help would be greatly appreciated.  Please email

> > > Thanks,
> > > Aaryn

> > The problem is just your light direction. If you turn
> > the headlight on in your "NavigationInfo". It will be
> > fine now...

> > Yan

> > Sent via Deja.com http://www.deja.com/
> > Share what you know. Learn what you don't.



Mon, 04 Feb 2002 03:00:00 GMT  
 Why don't my textures map correctly?
Thanks for the quick replies, folks.  I do appreciate it, but I have still not
solved the problem within VRML...

Changing solid to FALSE does indeed allow me to see the image straight on one side
and mirrored on the other, but it still shows up mirrored on the top side, which
is not acceptable on account of the nature of the application.  I am using digital
elevation data to populate the grid with heights, so turning it upside down is not
an option because then I would have mountains as holes in the ground and valleys
would be the highest things around...

I understand that I can simply flip the image in Photoshop, but it seems absurd
that textures would not be mapped on like they should!

Somewhat confused,
Aaryn

Quote:

> Hi, Aaryn

> I just downloaded your Script, and as I edited it I changed the value of
> solid from FALSE to TRUE. that solved the part of the problem with the mirror.
> At least on my computer.
> Why don't you give it a try and let the geometry node look just like this ...

>     geometry DEF _0 ElevationGrid {
>       xDimension 4
>       zDimension 4
>       xSpacing 10
>       zSpacing 10
>       height [ 0, 1, 0, 2,
>          1, 2, 1, 1,
>          2, 1, 1.5, 2,
>          4, 2, 2, 1.8 ]
>       solid TRUE
>       creaseAngle 2
>     }

> That should help you to get on ...
> If the texture is on the wrong side now, just rotate the whole grid ...

> CU

> Aaryn Olsson schrieb:

> > I wish that was what is wrong.  I turned on the headlight, but I detect no
> > difference in the model.  The image is simply mapped as a right-left
> > mirror!  It doesn't make any sense to me whatsoever...

> > I can fix this problem on an IndexedFaceSet by setting texCoordIndex as [
> > 3 2 1 0 -1 ] and making CoordIndex the reverse: [ 0 1 2 3 -1 ], but this
> > seems more like an undocumented "feature" than a solution.  I setup the
> > plane.wrl as an easy example, but my real problem is mapping a texture
> > onto an ElevationGrid.  The same thing happens!

> > Here's a better example:
> > http://ag.arizona.edu/agnet/vrml/elevationgrid.wrl - The image contains a
> > watermark at the bottom that should be readable.  Here is the code:

> > Transform {
> >   children Shape {
> >     appearance Appearance {
> >       material Material {
> >       }

> >       texture ImageTexture {
> >  repeatS TRUE
> >  repeatT TRUE
> >  url "http://ag.arizona.edu/agnet/livecam/forbes_vr.jpg"
> >       }

> >     }

> >     geometry DEF _0 ElevationGrid {
> >       xDimension 4
> >       zDimension 4
> >       xSpacing 10
> >       zSpacing 10
> >       height [ 0, 1, 0, 2,
> >          1, 2, 1, 1,
> >          2, 1, 1.5, 2,
> >          4, 2, 2, 1.8 ]
> >       solid FALSE
> >       creaseAngle 2
> >     }

> >   }

> >   translation -15 0 -15
> > }




> > > > I'm using CosmoPlayer 2 on Win98 and my textures tend to map as a
> > > > right-left mirror image!  A good example is
> > > > http://ag.arizona.edu/agnet/vrml/plane.wrl.  Can't seem to figure it
> > > out
> > > > ;-(  Any help would be greatly appreciated.  Please email

> > > > Thanks,
> > > > Aaryn

> > > The problem is just your light direction. If you turn
> > > the headlight on in your "NavigationInfo". It will be
> > > fine now...

> > > Yan

> > > Sent via Deja.com http://www.deja.com/
> > > Share what you know. Learn what you don't.



Mon, 04 Feb 2002 03:00:00 GMT  
 Why don't my textures map correctly?
Well, I noticed that your coordinate ordering was a little
strange (clockwise so it faces -z). When I flipped the ordering
(coordIndex  [ 3, 2, 1, 0, -1 ] ) the poly had to be viewd from
the other side (+z), but the texture was correct. I'm not
positive what's going on, but I expect that since you haven't
given any texture coordinates that the browser is assuming a
counter-clockwise vertex order and is giving you default
coordinates that match it. You could check the spec and see if
this is correct behaviour or a bug, but that's what seems to be
happening.

If you add the following texture coordinates to your scene, it
should display correctly...
      texCoord     TextureCoordinate {
        point   [ 1 0,
                  1 1,
                  0 1,
                  0 0 ]
      }
      texCoordIndex     [0, 1, 2, 3, -1 ]

If you don't want to use texture coordinates, then you will have
to make the poly counter clockwise and view it from the other
side.

Since it looks like you are using CosmoWorlds, I would suggest
using the PEP texture editor the place the texture coordinates
where you want.

I hope this helps.

Cindy

Quote:

> Thanks for the quick replies, folks.  I do appreciate it, but I have still not
> solved the problem within VRML...

> Changing solid to FALSE does indeed allow me to see the image straight on one side
> and mirrored on the other, but it still shows up mirrored on the top side, which
> is not acceptable on account of the nature of the application.  I am using digital
> elevation data to populate the grid with heights, so turning it upside down is not
> an option because then I would have mountains as holes in the ground and valleys
> would be the highest things around...

> I understand that I can simply flip the image in Photoshop, but it seems absurd
> that textures would not be mapped on like they should!

> Somewhat confused,
> Aaryn



Mon, 04 Feb 2002 03:00:00 GMT  
 Why don't my textures map correctly?


Quote:
> If you add the following texture coordinates to your scene, it
> should display correctly...
>       texCoord     TextureCoordinate {
>         point   [ 1 0,
>                   1 1,
>                   0 1,
>                   0 0 ]
>       }
>       texCoordIndex     [0, 1, 2, 3, -1 ]
> I hope this helps.

It helped me, meanwhile. Thanks Cindy!
Do you know a source to understand how texCoord works. I'm having ofter
the same problem, regardless of the direction of the faces in the
IndexedFaceSet, when I use in inside of a PROTO, and fan a texture from
outside. I tried to reverse the direction of the face, both changing the
order of the points and/or their index. But nothing. Now I'm trying the
methot you suggested which works, but has the drawback to add some code
that could be avoided if I could be figure out out to do it without.

Thanks a lot!

Cris

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.



Sat, 09 Feb 2002 03:00:00 GMT  
 Why don't my textures map correctly?
Cris,

I'm glad that helped you!

I think that part of the problem is that you want to use
"default" texture coordinates on an IndexedFaceSet and that, as
you're finding out, can be tricky. In the example you've been
working with you can get the texture to map correctly if you flip
the vertex ordering. Basicly you have a reversed ploygon that you
are viewing from the -z direction. Flipping the vertex ordering
and changing the view will work *FOR THIS EXAMPLE*. If you want
to do more complex geometry, then you will have to set texture
coordinates. The best way to do this is with an authoring tool of
some sort.

Several years ago I wrote a tutorial on texture mapping that you
might find useful. It can be found at
http://www.ballreich.net/vrml/texture/
Take a look at the "Understanding How Textures Work" section.

I wish you the best of luck, but I don't think you are going to
be able to achieve your goals without using TextureCoordinates.

Cindy

Quote:



> > If you add the following texture coordinates to your scene, it
> > should display correctly...
> >       texCoord     TextureCoordinate {
> >         point   [ 1 0,
> >                   1 1,
> >                   0 1,
> >                   0 0 ]
> >       }
> >       texCoordIndex     [0, 1, 2, 3, -1 ]
> > I hope this helps.

> It helped me, meanwhile. Thanks Cindy!
> Do you know a source to understand how texCoord works. I'm having ofter
> the same problem, regardless of the direction of the faces in the
> IndexedFaceSet, when I use in inside of a PROTO, and fan a texture from
> outside. I tried to reverse the direction of the face, both changing the
> order of the points and/or their index. But nothing. Now I'm trying the
> methot you suggested which works, but has the drawback to add some code
> that could be avoided if I could be figure out out to do it without.

> Thanks a lot!

> Cris

> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.



Sat, 09 Feb 2002 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. AutoScale don't work correctly with the FP closed

2. Numeric don't compare arrays correctly

3. Angles don't map nicely to two's complement turns

4. Why doesn't this work correctly

5. Why patterns don't suck

6. why awk don't display the results?

7. Why I don't Like HTML Help...

8. Animated Gifs Some work some don't why

9. Why don't Memo Entry Fields wrap?????

10. I don't understand why my haskell program works

11. Why I don't use Dylan

 

 
Powered by phpBB® Forum Software