[X3D-Public] Problem with X3D

Michalis Kamburelis michalis.kambi at gmail.com
Mon Mar 19 11:05:36 PDT 2012


Iñaki Prieto Furundarena wrote:
> - I put an image texture to the DTM and not all the image is visualized.

By default, if you do not specify your own texture coordinates, X3D
browsers automatically generate texture coordinates to match the size
of the bounding box of your shape. The specification part relevant to
this is http://www.web3d.org/files/specifications/19775-1/V3.2/Part01/components/geometry3D.html#IndexedFaceSet
, look at paragraph "If the texCoord field is NULL, a default texture
coordinate mapping is calculated...". The important thing about this
automatic generation is that the texture is not distorted (stretched
in one dimension more than the other), which the specification
dictates by saying "The T coordinate ranges between 0 and the ratio of
the second greatest dimension of the bounding box to the greatest
dimension."

In other words, the upper part of your image is not visible, because
your shape does not have a square shape (as seen from above). And we
try, by default, to not distort texture images.

This can be overcome in two ways:

1. First of all, you can calculate and specify your own texture
coordinates by using the <TextureCoordinate point="..."> node inside
<IndexedFaceSet>. Then the default texcoord generation doesn't happen,
and you're free to match your texture in any way you like on your
shape.

2. In this case, a simpler method is also possible: use
<TextureTransform scale="..."> to modify the default texture
coordinates, to suit your needs. That is, simply add

<TextureTransform scale="1 1.9"/>

somewhere inside your <Appearance>. This causes the texture to be
stretched in Y dimension, which (as I understand) does exactly what
you want :) Tested in view3dscene.

Hope this helps :)

> - I’m also trying to visualize it in X3DOM and part of the geometry is
> deleted. I think that happens because is a very large <IndexedFaceSet>
> element.
>

I'll leave this for others to answer.

Michalis



More information about the X3D-Public mailing list