Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

'Forcing' S, T coordinates onto an indexedfaceset

2 views
Skip to first unread message

Obbligato

unread,
Apr 9, 2009, 12:53:45 PM4/9/09
to
If I make a simple rectangle with IndexedFaceSet in the X,Y plane and
texture it with an image texture, it textures OK. However, if I
create the shape in the X,Z or Y, Z plane, the texture shows up as if
the first row of pixels is smeared out across the shape - as if the
texture image is being projected from a plane that is perpendicular to
the shape.

Is there any way to force the texture to be projected onto the
rectangle face-on, regardless of which orientation the rectangle is
created in? I have repeatS and repeatT set to true, and the scale
defined.
I am using the Octaga plugin with firefox.

I am trying to make a complicated object, and the math is easier for
me it I just create the faces in their final orientation as opposed to
creating them all in the same plane and then trying to move and rotate
them all into position.

Joe D Williams

unread,
Apr 10, 2009, 2:45:25 PM4/10/09
to

"Obbligato" <obbli...@yahoo.com> wrote in message
news:7984f993-3a99-4dfa...@k8g2000yqn.googlegroups.com...

> If I make a simple rectangle with IndexedFaceSet in the X,Y plane and
> texture it with an image texture, it textures OK. However, if I
> create the shape in the X,Z or Y, Z plane, the texture shows up as if
> the first row of pixels is smeared out across the shape - as if the
> texture image is being projected from a plane that is perpendicular to
> the shape.
>

Obviously this should not happen as you are describing.
I would ask first to see the code (vertices) you are using for these
different simple rectangles.
If the vertices are correct, this will not happen.
Maybe try another browser?
If it happens in multiple browsers, then I think your coding is off somehow.



psi

unread,
Apr 10, 2009, 7:10:52 PM4/10/09
to
On 9 Apr, 17:53, Obbligato <obbligat...@yahoo.com> wrote:
> If I make a simple rectangle with IndexedFaceSet in the X,Y plane and
> texture it with an image texture, it textures OK.  However, if I
> create the shape in the X,Z or Y, Z plane, the texture shows up as if
> the first row of pixels is smeared out across the shape - as if the
> texture image is being projected from a plane that is perpendicular to
> the shape.

thats how it is meant to be, see the spec., default texture
coordinates are a straight projection in local XY.

> Is there any way to force the texture to be projected onto the
> rectangle face-on, regardless of which orientation the rectangle is
> created in?  I have repeatS and repeatT set to true, and the scale
> defined.
> I am using the Octaga plugin with firefox.
>
> I am trying to make a complicated object, and the math is easier for
> me it I just create the faces in their final orientation as opposed to
> creating them all in the same plane and then trying to move and rotate
> them all into position.

i think you might have to, it isn't that bad, but notice it wont give
you smooth edges, because the faces are all in different objects.

or

you'll have to generate your own texture coordinates, again fairly
easy if you can put up with the texture not wrapping nicely over
edges,

or

add the texture later with a program.

or

actually work out the textute coordinates yourself, which i think
would be a quite a bit harder.

or

use x3d and the TextureCoordinateGenerator node.

Obbligato

unread,
Apr 11, 2009, 6:08:26 PM4/11/09
to
Thanks for your reply. I'll have to look further into this.

> i think you might have to, it isn't that bad, but notice it wont give
> you smooth edges, because the faces are all in different objects.

At this point it shouldn't be a problem. The object I'm trying to
create is a curvy staircase, where the tops and front of each step are
at 90 degrees from each other, and might wind up being textured
differently anyway. The steps are individual objects, but the
staircase as a whole is not.

> or
>
> you'll have to generate your own texture coordinates, again fairly
> easy if you can put up with the texture not wrapping nicely over
> edges,

What's the difference between that and number 3 below, "actually work
out the texture coordinates yourself?" This sort of thing doesn't
scare me too much because I'm using PHP script to generate the
staircase in the first place, it figures out all the positions for
each individual step. Generating texture coordinates shouldn't be too
hard, once I know how to do it.

>
> or
>
> add the texture later with a program.
>
> or
>
> actually work out the textute coordinates yourself, which i think
> would be a quite a bit harder.
>
> or
>
> use x3d and the TextureCoordinateGenerator node.

This one sounds useful, I'll have to look into it.


Joe D Williams

unread,
Apr 11, 2009, 4:42:24 PM4/11/09
to
I'm going to throw this old box out there again, which is one example for
placing a different texture on each surface of the box. THis is necessary
since the shape for hte cube node won't let you do this. THis relates to the
OP question because it will also show that you don't need anything special
except the correct texture mapping, which may work automagically like this
does and exerything just seems to get laid on there just right.

# Box
DEF boxfront Shape {
appearance Appearance {
material Material { }
texture ImageTexture {
url [ "textures/boxfront.jpg" ]
}
}
geometry IndexedFaceSet {
coordIndex [ 0 1 2 3 -1 ]
coord Coordinate {
point [ -1 -1 1, 1 -1 1, 1 1 1, -1 1 1 ]
}
texCoordIndex [ 0 1 2 3 -1 ]
texCoord TextureCoordinate {
point [ 0 0 1 0 1 1 0 1 ]
}
}
}
DEF boxright Shape {
appearance Appearance {
material Material { }
texture ImageTexture {
url [ "textures/boxright.jpg" ]
}
}
geometry IndexedFaceSet {
coordIndex [ 0 1 2 3 -1 ]
coord Coordinate {
point [ 1 -1 1, 1 -1 -1, 1 1 -1, 1 1 1 ]
}
texCoordIndex [ 0 1 2 3 -1 ]
texCoord TextureCoordinate {
point [ 0 0 1 0 1 1 0 1 ]
}
}
}
DEF boxrear Shape {
appearance Appearance {
material Material { }
texture ImageTexture {
url [ "textures/boxrear.jpg" ]
}
}
geometry IndexedFaceSet {
coordIndex [ 0 1 2 3 -1 ]
coord Coordinate {
point [ 1 -1 -1, -1 -1 -1, -1 1 -1, 1 1 -1 ]
}
texCoordIndex [ 0 1 2 3 -1 ]
texCoord TextureCoordinate {
point [ 0 0 1 0 1 1 0 1 ]
}
}
}
DEF boxleft Shape {
appearance Appearance {
material Material { }
texture ImageTexture {
url [ "textures/boxleft.jpg" ]
}
}
geometry IndexedFaceSet {
coordIndex [ 0 1 2 3 -1 ]
coord Coordinate {
point [ -1 -1 1, -1 1 1, -1 1 -1, -1 -1 -1 ]
}
texCoordIndex [ 1 2 3 0 -1 ]
texCoord TextureCoordinate {
point [ 0 0 1 0 1 1 0 1 ]
}
}
}
DEF boxtop Shape {
appearance Appearance {
material Material { }
texture ImageTexture {
url [ "textures/boxtop.jpg" ]
}
}
geometry IndexedFaceSet {
coordIndex [ 0 1 2 3 -1 ]
coord Coordinate {
point [ -1 1 1, 1 1 1, 1 1 -1, -1 1 -1 ]
}
texCoordIndex [ 0 1 2 3 -1 ]
texCoord TextureCoordinate {
point [ 0 0 1 0 1 1 0 1 ]
}
}
}
DEF boxbottom Shape {
appearance Appearance {
material Material { }
texture ImageTexture {
url [ "textures/boxbottom.jpg" ]
}
}
geometry IndexedFaceSet {
coordIndex [ 0 1 2 3 -1 ]
coord Coordinate {
point [ -1 -1 -1, 1 -1 -1, 1 -1 1, -1 -1 1 ]
}
texCoordIndex [ 0 1 2 3 -1 ]
texCoord TextureCoordinate {
point [ 0 0 1 0 1 1 0 1 ]
}
}
}

At least it can be seen that the texture mapping is consistent on the
various individual surfaces without regard to their original orientation if
the vertices are consistent. .

Good Luck and Best Regards,
Joe

box from:
http://www.hypermultimedia.com/acontents.htm
. Viewpoint Example with ProximitySensor, reference box and backgrounds
.x3dv


Joerg Scheurich aka MUFTI

unread,
Apr 14, 2009, 3:50:08 AM4/14/09
to
> > If I make a simple rectangle with IndexedFaceSet in the X,Y plane and
> > texture it with an image texture, it textures OK.  However, if I
> > create the shape in the X,Z or Y, Z plane, the texture shows up as if
> > the first row of pixels is smeared out across the shape - as if the
> > texture image is being projected from a plane that is perpendicular to
> > the shape.

> thats how it is meant to be, see the spec., default texture
> coordinates are a straight projection in local XY.

Did you misunderstood

http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-VRML97/Images/IFStexture.gif

?
See also

http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-VRML97/part1/nodesRef.html#ImageTexture
http://www.web3d.org/x3d/specifications/vrml/ISO-IEC-14772-VRML97/part1/nodesRef.html#IndexedFaceSet

| Texture maps are defined in a 2D coordinate system (s, t) that ranges from
| [0.0, 1.0] in both directions. The bottom edge of the image corresponds
| to the S-axis of the texture map, and left edge of the image corresponds
| to the T-axis of the texture map.

| If the texCoord field is NULL, a default texture coordinate mapping is
| calculated using the local coordinate system bounding box of the shape.
| The longest dimension of the bounding box defines the S coordinates, and
| the next longest defines the T coordinates.

So texturing in VRML is not projection in local XY (similar to e.g. povray),
instead texturing depends on the 2 biggest dimensions of the bounding box.

> > I am using the Octaga plugin with firefox.

Unbelievable, that the Octaga player would make it different. Are you
sure, that you do not have something like strange textureCoordinates ?

so long
MUFTI
--
Der groesste Teil des Auges, Eigenschaft des UEBERFALLS 0 fangend,
ist, dass es keine Paritaetsgeneration hier gibt.
Aus einer Webseite ueber RAID-Systeme

psi

unread,
Apr 16, 2009, 10:58:43 AM4/16/09
to
On Apr 14, 3:50 am, Joerg Scheurich aka MUFTI

<rusmu...@helpdesk.bera.rus.uni-stuttgart.de> wrote:
> > > If I make a simple rectangle with IndexedFaceSet in the X,Y plane and
> > > texture it with an image texture, it textures OK.  However, if I
> > > create the shape in the X,Z or Y, Z plane, the texture shows up as if
> > > the first row of pixels is smeared out across the shape - as if the
> > > texture image is being projected from a plane that is perpendicular to
> > > the shape.
> > thats how it is meant to be, see the spec., default texture
> > coordinates are a straight projection in local XY.
>
> Did you misunderstood
>


yes, i thought he was talking about a cuboid, not just a single flat
face, which means this is the wrong behaviour.

psi

unread,
Apr 18, 2009, 5:17:50 PM4/18/09
to

had another thought, what is the bounding box of an IFS?

what if there are unused vertexes, that if included in the box change
its orientation for textures?

and

what if there is a user provided bounding box, is that used?


Joerg Scheurich aka MUFTI

unread,
Apr 21, 2009, 4:59:30 AM4/21/09
to
> had another thought, what is the bounding box of an IFS?

This is not exactly specified in the VRML97 standard 8-(

> what if there are unused vertexes, that if included in the box change
> its orientation for textures?

I think, (allmost) all implemented the bonding box via all vertices of a
IndexedFaceSet, not onlz used vertices.

> what if there is a user provided bounding box, is that used?

Unlike Group/Transform etc. the IndexedFaceSet node do not have bboxCenter
or bboxSize fields.

The standard talks about the "using the local coordinate system bounding
box of the shape" not about the "system bounding box of a group".

so long
MUFTI
--
'MFVec3d' is used as a type, but has not been defined as a type.
Perhaps you meant 'MFVec3d' as in class MFVec3d.
Errormessage HPUX aCC

0 new messages