[X3D-Public] Problem with X3D
Bederov, Sergey
bederov at cortona3d.com
Wed Mar 21 04:01:06 PDT 2012
It's quite odd that SwView maps the texture differently than the other two browsers. Instant Player and view3dscene leave out the top margin of the texture, while SwView leaves out the bottom margin. Is it a bug or the specification is somewhat vague at this point?
Iñaki, you may consider using ElevationGrid instead of IndexedFaceSet. It is specially designed for terrain modeling, the X3D code will be more compact, and the texture will be mapped the way you expect.
Sergey Bederov
> -----Original Message-----
> From: x3d-public-bounces at web3d.org [mailto:x3d-public-bounces at web3d.org] On
> Behalf Of Michalis Kamburelis
> Sent: Monday, March 19, 2012 10:06 PM
> To: Iñaki Prieto Furundarena
> Cc: x3d-public at web3d.org
> Subject: Re: [X3D-Public] Problem with X3D
>
> 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
>
> _______________________________________________
> X3D-Public mailing list
> X3D-Public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
More information about the X3D-Public
mailing list